your-land/bugtracker#4668 13 Movie doesn't start twice

This commit is contained in:
AliasAlreadyTaken 2023-07-30 10:06:55 +02:00
parent 4b927e6119
commit b8ab4665e1

View File

@ -1,7 +1,10 @@
if not (yl_cinema.settings.enable_bigscreen and (yl_cinema.settings.enable_bigscreen == true)) then
if not (yl_cinema.settings.enable_screens and (yl_cinema.settings.enable_screens == true)) then
return
end
local warn = yl_cinema.warn
local action = yl_cinema.action
local bigscreen_entity_name = "yl_cinema:movie_bigscreen"
local screen_width = 12
local screen_height = 6.75
@ -75,8 +78,31 @@ end
-- Changepage
local function showpage(ent_obj, movie_id, pagenum)
if not movie_id or not pagenum then
warn("Movie_id or pagenum not found, movie_id=" .. dump(movie_id)..", pagenum="..dump(pagenum))
return ""
end
local movie = yl_cinema.get_movie(movie_id)
local pages = movie.pages
if not movie or pagenum then
warn("Movie_id or pagenum not found, movie_id=" .. dump(movie_id)..", pagenum="..dump(pagenum))
return ""
end
local pages = movie.pages or {}
if not ent_obj then
warn("Cinema Screen Object not found, movie_id=" .. dump(movie_id))
return ""
end
local ent_properties = ent_obj:get_properties()
if ent_properties._playing == true then
warn("Tried to play movie on running projector, movie_id=" .. dump(movie_id))
return ""
end
if pagenum <= #pages then
@ -94,7 +120,8 @@ local function showpage(ent_obj, movie_id, pagenum)
local properties = {
textures = {movie.title_texture},
infotext = movie.name,
nametag = movie.description
nametag = movie.decription,
_playing = true
}
ent_obj:set_properties(properties)
else
@ -106,13 +133,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