From 58408a6f073b388fe93262a4b2a6fad5f8301c71 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Rollo Date: Sun, 10 Dec 2017 11:03:23 +0100 Subject: Added LBM to automatically update entities from signs:text to signs:display_text --- signs_road/compatibility.lua | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'signs_road') diff --git a/signs_road/compatibility.lua b/signs_road/compatibility.lua index 4ef25ba..fa5f94b 100644 --- a/signs_road/compatibility.lua +++ b/signs_road/compatibility.lua @@ -19,6 +19,8 @@ --]] -- Wallmounted to facedir conversion +------------------------------------ + local wallmounted_to_facedir = { [0]=1, -- Should not happend with signs [1]=1, -- Should not happend with signs @@ -55,4 +57,29 @@ minetest.register_lbm({ name = "signs_road:conpatibility_1", action = compatibility_check, }) +-- Text entity name change because of signs_lib using signs prefix +------------------------------------------------------------------ + +local function compatibility_check_2(pos, node) + -- Remove old entity + for _, objref in ipairs(minetest.get_objects_inside_radius(pos, 0.5)) do + local entity = objref:get_luaentity() + if entity and entity.name == "signs:text" then + objref:remove() + end + end + -- Create new entity + display_lib.update_entities(pos) +end + +minetest.register_lbm({ name = "signs_road:conpatibility_2", + nodenames = { + "signs_road:blue_street_sign", "signs_road:red_street_sign", "signs_road:white_street_sign", + "signs_road:green_street_sign", "signs_road:yellow_street_sign", "signs_road:black_right_sign", + "signs_road:black_left_sign", "signs_road:green_right_sign", "signs_road:green_left_sign", + "signs_road:yellow_right_sign", "signs_road:yellow_left_sign", "signs_road:white_right_sign", + "signs_road:white_left_sign"}, + action = compatibility_check_2, +}) + -- cgit v1.2.3