diff --git a/chatcommand_movie_reload.lua b/chatcommand_movie_reload.lua new file mode 100644 index 0000000..c018df6 --- /dev/null +++ b/chatcommand_movie_reload.lua @@ -0,0 +1,11 @@ +local chatcommand_cmd = "movie_reload" +local chatcommand_definition = { + params = "[]", -- Short parameter description + description = "Reload specific 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) diff --git a/chatcommands.lua b/chatcommands.lua index 20e4a4f..d08b3e1 100644 --- a/chatcommands.lua +++ b/chatcommands.lua @@ -1,2 +1,3 @@ dofile(yl_cinema.modpath .. "chatcommand_movie_show.lua") -dofile(yl_cinema.modpath .. "chatcommand_movie_list.lua") \ No newline at end of file +dofile(yl_cinema.modpath .. "chatcommand_movie_list.lua") +dofile(yl_cinema.modpath .. "chatcommand_movie_reload.lua") \ No newline at end of file diff --git a/feature_bigscreen_entity.lua b/feature_bigscreen_entity.lua index 97c74d1..07fc56a 100644 --- a/feature_bigscreen_entity.lua +++ b/feature_bigscreen_entity.lua @@ -78,6 +78,11 @@ local function showpage(ent_obj, movie_id, pagenum) local movie = yl_cinema.get_movie(movie_id) local pages = movie.pages + if not ent_obj then + warn("Cinema Screen Object not found, movie_id=" .. dump(movie_id)) + return "" + end + if pagenum <= #pages then table.sort(pages, yl_cinema.orderpages) @@ -94,7 +99,8 @@ local function showpage(ent_obj, movie_id, pagenum) local properties = { textures = {movie.title_texture}, infotext = movie.name, - nametag = movie.description + nametag = movie.description, + _playing = true } ent_obj:set_properties(properties) else @@ -106,13 +112,21 @@ local function showpage(ent_obj, movie_id, pagenum) local properties = { textures = {page.texture}, infotext = movie.name, - nametag = page.caption + nametag = page.caption, + _playing = true } ent_obj:set_properties(properties) end - + else -- Fin + local properties = { + textures = {"yl_cinema_block_bigscreen.png^yl_cinema_icon_movie_inv.png"}, + infotext = "Fin", + nametag = "Fin", + _playing = false + } + ent_obj:set_properties(properties) end end diff --git a/feature_bigscreen_items.lua b/feature_bigscreen_items.lua index da0e474..aa89ebe 100644 --- a/feature_bigscreen_items.lua +++ b/feature_bigscreen_items.lua @@ -1,24 +1,30 @@ if yl_cinema.settings.enable_movieitems ~= true then return end +-- + +local movie_item_name_empty = yl_cinema.settings.movie_item_name_empty +local movie_item_definition_empty = { + groups = {movie = 1, not_in_creative_inventory = 1, media = 1}, + inventory_image = "yl_cinema_icon_movie_inv.png", + wield_image = "yl_cinema_icon_movie_inv.png", + stack_max = 1, + range = 4, + liquids_pointable = false, + _yl_cinema_movie_id = "" +} + +minetest.register_craftitem(movie_item_name_empty, movie_item_definition_empty) + +local movie_item_string = yl_cinema.settings.movie_item_name_written local movie_item_definition = { groups = {movie = 1, not_in_creative_inventory = 1, media = 1}, inventory_image = "yl_cinema_icon_movie_inv.png", wield_image = "yl_cinema_icon_movie_inv.png", stack_max = 1, range = 4, - liquids_pointable = false + liquids_pointable = false, + _yl_cinema_movie_id = "" } -for movie_id, movie in pairs(yl_cinema.movies) do - if movie.item and (movie.item == true) then - local item_definition = movie_item_definition - item_definition._yl_cinema_movie_id = movie_id - core.log("action", "item_definition._yl_cinema_movie_id=" .. - item_definition._yl_cinema_movie_id) - item_definition.short_description = minetest.formspec_escape(movie.name) - item_definition.description = - minetest.formspec_escape(movie.description) - local item_string = yl_cinema.get_itemstring(movie_id) - minetest.register_craftitem(item_string, item_definition) - end -end +minetest.register_craftitem(movie_item_string, movie_item_definition) + diff --git a/internal.lua b/internal.lua index fdb66f5..25447a0 100644 --- a/internal.lua +++ b/internal.lua @@ -192,7 +192,7 @@ local function search_movies(movies, search_term) string.match(movie.description, search_term) then local item_string = "" if movie.item == true then - item_string = get_itemstring(movie_id) + item_string = "yes" end table.insert(results, {movie_id, movie.name, item_string or ""}) end @@ -355,6 +355,21 @@ function yl_cinema.cmd_show_movie(name, param) end end +function yl_cinema.cmd_movie_reload(name, param) + local args = string.split(param, " ") + + if (#args >= 2) then + return false, "Usage: /movie_reload []" + end + + local movie_id = args[1] or "" + + minetest.log("action", "[yl_cinema] Player " .. name .. " reloads movie " .. movie_id) + + +end + + function yl_cinema.listmovies(searchterm) return search_movies(yl_cinema.movies, searchterm) end diff --git a/textures/yl_cinema_icon_movie_empty_inv.png b/textures/yl_cinema_icon_movie_empty_inv.png new file mode 100644 index 0000000..d77b08a Binary files /dev/null and b/textures/yl_cinema_icon_movie_empty_inv.png differ diff --git a/textures/yl_cinema_icon_movie_inv.old.png b/textures/yl_cinema_icon_movie_inv.old.png new file mode 100644 index 0000000..52d6934 Binary files /dev/null and b/textures/yl_cinema_icon_movie_inv.old.png differ diff --git a/textures/yl_cinema_icon_movie_inv.png b/textures/yl_cinema_icon_movie_inv.png index 52d6934..2e3ab28 100644 Binary files a/textures/yl_cinema_icon_movie_inv.png and b/textures/yl_cinema_icon_movie_inv.png differ