mirror of
https://github.com/pandorabox-io/banners.git
synced 2025-01-08 00:50:32 +01:00
cleanup old banners when their entities are generated
This commit is contained in:
parent
e3c216eba7
commit
88d628d73f
14
init.lua
14
init.lua
@ -284,7 +284,9 @@ end
|
|||||||
-- (pos, player, itemstack, pointed_thing)
|
-- (pos, player, itemstack, pointed_thing)
|
||||||
function banners.banner_after_place(pos, _, itemstack, pointed_thing)
|
function banners.banner_after_place(pos, _, itemstack, pointed_thing)
|
||||||
core.get_node(pos).param2 = banners.determine_flag_direction(pos, pointed_thing)
|
core.get_node(pos).param2 = banners.determine_flag_direction(pos, pointed_thing)
|
||||||
core.get_meta(pos):set_string("banner", itemstack:get_meta():get_string(""))
|
local meta = core.get_meta(pos)
|
||||||
|
meta:set_string("banner", itemstack:get_meta():get_string(""))
|
||||||
|
meta:set_float("version", banners.version)
|
||||||
core.add_entity(pos, "banners:banner_ent")
|
core.add_entity(pos, "banners:banner_ent")
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -292,7 +294,15 @@ end
|
|||||||
|
|
||||||
function banners:banner_on_activate()
|
function banners:banner_on_activate()
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
local banner = core.get_meta(pos):get_string("banner")
|
local meta = core.get_meta(pos)
|
||||||
|
local banner = meta:get_string("banner")
|
||||||
|
-- cleanup meta of old banners
|
||||||
|
if meta:get_float("version") < 20241122 then
|
||||||
|
meta:set_float("version", banners.version)
|
||||||
|
banner = banners.transform_table_to_string(
|
||||||
|
banners.transform_string_to_table(banner))
|
||||||
|
meta:set_string("banner", banner)
|
||||||
|
end
|
||||||
local banner_face = core.get_node(pos).param2
|
local banner_face = core.get_node(pos).param2
|
||||||
local yaw = 0.
|
local yaw = 0.
|
||||||
if banner_face == 2 then
|
if banner_face == 2 then
|
||||||
|
Loading…
Reference in New Issue
Block a user