generated from your-land/yl_template
Fixing item
This commit is contained in:
parent
0b564fc78a
commit
d4b17755c6
11
chatcommand_movie_reload.lua
Normal file
11
chatcommand_movie_reload.lua
Normal 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)
|
@ -1,2 +1,3 @@
|
||||
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")
|
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
17
internal.lua
17
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 [<movie_id>]"
|
||||
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
|
||||
|
BIN
textures/yl_cinema_icon_movie_empty_inv.png
Normal file
BIN
textures/yl_cinema_icon_movie_empty_inv.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.4 KiB |
BIN
textures/yl_cinema_icon_movie_inv.old.png
Normal file
BIN
textures/yl_cinema_icon_movie_inv.old.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.5 KiB |
Loading…
Reference in New Issue
Block a user