Merge pull request #8 from gpcf/master

Compatibility with signs_lib and advtrains, new large banner signs.
This commit is contained in:
pyrollo 2017-12-10 10:46:48 +01:00 committed by GitHub
commit d07e0c5c13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 44 additions and 15 deletions

@ -149,9 +149,10 @@ end
--- On_activate callback for display_lib entities. Calls on_display_update callbacks --- On_activate callback for display_lib entities. Calls on_display_update callbacks
--- of corresponding node for each entity. --- of corresponding node for each entity.
function display_lib.on_activate(entity, staticdata) function display_lib.on_activate(entity, staticdata)
if entity then if entity then
call_node_on_display_update(entity.object:getpos(), entity.object) entity.object:set_armor_groups({immortal=1})
end call_node_on_display_update(entity.object:getpos(), entity.object)
end
end end
--- On_place callback for display_lib items. Does nothing more than preventing item --- On_place callback for display_lib items. Does nothing more than preventing item

@ -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 } wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
}, },
tiles = {"ontime_clocks_digital.png"}, tiles = {"ontime_clocks_digital.png"},
groups = {oddly_breakable_by_hand=1}, groups = {oddly_breakable_by_hand=1,not_blocking_trains=1},
display_entities = { display_entities = {
["ontime_clocks:display"] = { ["ontime_clocks:display"] = {
depth = 13/32 - 0.01, 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 } wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
}, },
tiles = {"ontime_clocks_digital.png"}, tiles = {"ontime_clocks_digital.png"},
groups = {oddly_breakable_by_hand=1}, groups = {oddly_breakable_by_hand=1,not_blocking_trains=1},
display_entities = { display_entities = {
["ontime_clocks:display"] = { ["ontime_clocks:display"] = {
depth = 13/32 - 0.01, 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}, wall_top = { -7/16, 0.5, -7/16, 7/16, 7/16, 7/16},
}, },
tiles = {"ontime_clocks_white.png"}, tiles = {"ontime_clocks_white.png"},
groups = {choppy=1,oddly_breakable_by_hand=1}, groups = {choppy=1,oddly_breakable_by_hand=1,not_blocking_trains=1},
display_entities = { display_entities = {
["ontime_clocks:display"] = { ["ontime_clocks:display"] = {
depth = 6/16 - 0.01, 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 } wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
}, },
tiles = {"ontime_clocks_frameless.png"}, tiles = {"ontime_clocks_frameless.png"},
groups = {choppy=1,oddly_breakable_by_hand=1}, groups = {choppy=1,oddly_breakable_by_hand=1,not_blocking_trains=1},
display_entities = { display_entities = {
["ontime_clocks:display"] = { ["ontime_clocks:display"] = {
depth = 7/16, 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 } wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
}, },
tiles = {"ontime_clocks_frameless.png^[colorize:#FF0"}, tiles = {"ontime_clocks_frameless.png^[colorize:#FF0"},
groups = {choppy=1,oddly_breakable_by_hand=1}, groups = {choppy=1,oddly_breakable_by_hand=1,not_blocking_trains=1},
display_entities = { display_entities = {
["ontime_clocks:display"] = { ["ontime_clocks:display"] = {
depth = 7/16, 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 } wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
}, },
tiles = {"ontime_clocks_frameless.png^[colorize:#FFF"}, tiles = {"ontime_clocks_frameless.png^[colorize:#FFF"},
groups = {choppy=1,oddly_breakable_by_hand=1}, groups = {choppy=1,oddly_breakable_by_hand=1,not_blocking_trains=1},
display_entities = { display_entities = {
["ontime_clocks:display"] = { ["ontime_clocks:display"] = {
depth = 7/16, depth = 7/16,

@ -24,8 +24,8 @@ local F = function(...) return minetest.formspec_escape(S(...)) end
function signs.set_formspec(pos) function signs.set_formspec(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local ndef = minetest.registered_nodes[minetest.get_node(pos).name] local ndef = minetest.registered_nodes[minetest.get_node(pos).name]
if ndef and ndef.display_entities and ndef.display_entities["signs:text"] then if ndef and ndef.display_entities and ndef.display_entities["signs:display_text"] then
local maxlines = ndef.display_entities["signs:text"].maxlines local maxlines = ndef.display_entities["signs:display_text"].maxlines
local formspec local formspec
if maxlines == 1 then if maxlines == 1 then
@ -149,10 +149,10 @@ function signs.register_sign(mod, name, model)
fixed = {-model.width/2, -model.height/2, 0.5, fixed = {-model.width/2, -model.height/2, 0.5,
model.width/2, model.height/2, 0.5 - model.depth}, model.width/2, model.height/2, 0.5 - model.depth},
}, },
groups = {choppy=2, dig_immediate=2}, groups = {choppy=2, dig_immediate=2, not_blocking_trains = 1},
sounds = default.node_sound_defaults(), sounds = default.node_sound_defaults(),
display_entities = { display_entities = {
["signs:text"] = { ["signs:display_text"] = {
on_display_update = font_lib.on_display_update, on_display_update = font_lib.on_display_update,
depth = 0.499 - model.depth, depth = 0.499 - model.depth,
size = { x = model.width, y = model.height }, size = { x = model.width, y = model.height },
@ -187,7 +187,7 @@ function signs.register_sign(mod, name, model)
-- Entity fields override -- Entity fields override
for key, value in pairs(model.entity_fields) do for key, value in pairs(model.entity_fields) do
fields.display_entities["signs:text"][key] = value fields.display_entities["signs:display_text"][key] = value
end end
minetest.register_node(mod..":"..name, fields) minetest.register_node(mod..":"..name, fields)

@ -66,7 +66,7 @@ local function on_receive_fields_poster(pos, formname, fields, player)
end end
-- Text entity for all signs -- Text entity for all signs
display_lib.register_display_entity("signs:text") display_lib.register_display_entity("signs:display_text")
-- Sign models and registration -- Sign models and registration
local models = { local models = {

@ -46,6 +46,15 @@ minetest.register_craft({
} }
}) })
minetest.register_craft({
type = "shapeless",
output = 'signs_road:large_street_sign',
recipe = {'signs_road:white_street_sign','signs_road:white_street_sign','signs_road:white_street_sign','signs_road:white_street_sign'}
})
minetest.register_craft({ minetest.register_craft({
output = 'signs_road:green_street_sign 2', output = 'signs_road:green_street_sign 2',
recipe = { recipe = {

@ -39,6 +39,25 @@ local models = {
inventory_image = "signs_road_blue.png", inventory_image = "signs_road_blue.png",
}, },
}, },
large_street_sign = {
depth = 1/16,
width = 64/16,
height = 12/16,
entity_fields = {
resolution = { x = 30, y = 20 },
maxlines = 1,
color = "#000",
},
node_fields = {
visual_scale = 1,
description = S("Large banner"),
tiles = { "signs_road_sides.png", "signs_road_sides.png",
"signs_road_sides.png", "signs_road_sides.png",
"signs_road_sides.png", "station_sign.png" },
inventory_image = "signs_road_white.png",
},
},
red_street_sign = { red_street_sign = {
depth = 1/16, depth = 1/16,
width = 1, width = 1,

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B