Merge pull request #9 from Thomas--S/lbm_update

Update the entities as soon as mapblock is loaded
This commit is contained in:
Pierre-Yves Rollo 2018-01-28 15:09:49 +01:00 committed by GitHub
commit c7d13fca9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 9 deletions

@ -80,4 +80,6 @@ This is a helper to register entities used for display.
})
**Note:** Nodes in the `display_lib_node` group will have their entities updated as soon as the mapblock is loaded (Useful after /clearobjects).

@ -230,5 +230,11 @@ function display_lib.register_display_entity(entity_name)
end
end
minetest.register_lbm({
label = "Update display_lib entities",
name = "display_lib:update_entities",
run_at_every_load = true,
nodenames = {"group:display_lib_node"},
action = function(pos, node) display_lib.update_entities(pos) end,
})

@ -35,7 +35,7 @@ minetest.register_node("ontime_clocks:green_digital", {
wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
},
tiles = {"ontime_clocks_digital.png"},
groups = {oddly_breakable_by_hand=1,not_blocking_trains=1},
groups = {oddly_breakable_by_hand = 1, not_blocking_trains = 1, display_lib_node = 1},
display_entities = {
["ontime_clocks:display"] = {
depth = 13/32 - 0.01,
@ -73,7 +73,7 @@ minetest.register_node("ontime_clocks:red_digital", {
wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
},
tiles = {"ontime_clocks_digital.png"},
groups = {oddly_breakable_by_hand=1,not_blocking_trains=1},
groups = {oddly_breakable_by_hand = 1, not_blocking_trains = 1, display_lib_node = 1},
display_entities = {
["ontime_clocks:display"] = {
depth = 13/32 - 0.01,
@ -111,7 +111,7 @@ minetest.register_node("ontime_clocks:white", {
wall_top = { -7/16, 0.5, -7/16, 7/16, 7/16, 7/16},
},
tiles = {"ontime_clocks_white.png"},
groups = {choppy=1,oddly_breakable_by_hand=1,not_blocking_trains=1},
groups = {choppy = 1, oddly_breakable_by_hand = 1, not_blocking_trains = 1, display_lib_node = 1},
display_entities = {
["ontime_clocks:display"] = {
depth = 6/16 - 0.01,
@ -148,7 +148,7 @@ minetest.register_node("ontime_clocks:frameless_black", {
wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
},
tiles = {"ontime_clocks_frameless.png"},
groups = {choppy=1,oddly_breakable_by_hand=1,not_blocking_trains=1},
groups = {choppy = 1, oddly_breakable_by_hand = 1, not_blocking_trains = 1, display_lib_node = 1},
display_entities = {
["ontime_clocks:display"] = {
depth = 7/16,
@ -185,7 +185,7 @@ minetest.register_node("ontime_clocks:frameless_gold", {
wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
},
tiles = {"ontime_clocks_frameless.png^[colorize:#FF0"},
groups = {choppy=1,oddly_breakable_by_hand=1,not_blocking_trains=1},
groups = {choppy = 1, oddly_breakable_by_hand = 1, not_blocking_trains = 1, display_lib_node = 1},
display_entities = {
["ontime_clocks:display"] = {
depth = 7/16,
@ -222,7 +222,7 @@ minetest.register_node("ontime_clocks:frameless_white", {
wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
},
tiles = {"ontime_clocks_frameless.png^[colorize:#FFF"},
groups = {choppy=1,oddly_breakable_by_hand=1,not_blocking_trains=1},
groups = {choppy = 1, oddly_breakable_by_hand = 1, not_blocking_trains = 1, display_lib_node = 1},
display_entities = {
["ontime_clocks:display"] = {
depth = 7/16,

@ -153,7 +153,7 @@ function signs.register_sign(mod, name, model)
fixed = {-model.width/2, -model.height/2, 0.5,
model.width/2, model.height/2, 0.5 - model.depth},
},
groups = {choppy=2, dig_immediate=2, not_blocking_trains = 1},
groups = {choppy=2, dig_immediate=2, not_blocking_trains = 1, display_lib_node = 1},
sounds = default.node_sound_defaults(),
display_entities = {
["signs:display_text"] = {

@ -26,6 +26,8 @@ display_lib.register_display_entity("steles:text")
for i, material in ipairs(steles.materials) do
local ndef = minetest.registered_nodes[material]
local groups = table.copy(ndef.groups)
groups.display_lib_node = 1
if ndef then
local parts = material:split(":")
@ -44,7 +46,7 @@ for i, material in ipairs(steles.materials) do
{-7/16, -0.5, -4/16, 7/16, -4/16, 4/16}
}
},
groups = ndef.groups,
groups = groups,
display_entities = {
["steles:text"] = {
on_display_update = font_lib.on_display_update,