Rework chatcommands

This commit is contained in:
AliasAlreadyTaken 2023-07-30 10:07:25 +02:00
parent b8ab4665e1
commit 4eabbf63e1
3 changed files with 15 additions and 12 deletions

View File

@ -0,0 +1,11 @@
local chatcommand_cmd = "movie_reload"
local chatcommand_definition = {
params = "[<movie_id>]", -- Short parameter description
description = "Reload specific <movie_id> or all movies, but does not create movie reel items.",
privs = {
[yl_cinema.settings.admin_priv] = true
},
func = yl_cinema.cmd_movie_reload
}
minetest.register_chatcommand(chatcommand_cmd, chatcommand_definition)

View File

@ -1,2 +1,4 @@
dofile(yl_cinema.modpath .. "chatcommand_movie_show.lua")
dofile(yl_cinema.modpath .. "chatcommand_movie_list.lua")
dofile(yl_cinema.modpath .. "chatcommand_movie_list.lua")
dofile(yl_cinema.modpath .. "chatcommand_movie_reload.lua")
--dofile(yl_cinema.modpath .. "chatcommand_movie_imprint.lua")

View File

@ -1,13 +1,3 @@
local function load_movies()
local movie_save_path = yl_cinema.worldpath .. yl_cinema.settings.save_path
local movies, loaded_count, total_count = yl_cinema.load_movies(movie_save_path)
if loaded_count ~= total_count then
yl_cinema.warn(loaded_count .. "/" .. total_count .. " movies loaded.")
else
yl_cinema.action(loaded_count .. "/" .. total_count .. " movies loaded.")
end
return movies
end
local function load_images(movies)
for movie_id, _ in pairs(movies) do
@ -21,7 +11,7 @@ local function load_images(movies)
end
local function run_each_serverstart()
local movies = load_movies()
local movies = yl_cinema.load_movies()
minetest.after(0, load_images, movies)
yl_cinema.movies = movies
end