Skip to content

Commit

Permalink
Is ground content (#12)
Browse files Browse the repository at this point in the history
* clocks aren't ground content

* signs aren't ground content

and some whitespace indentation fixes

* steles aren't ground content

and some whitespace indentation fixes
  • Loading branch information
SwissalpS authored Mar 1, 2024
1 parent fce192d commit 394166c
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 29 deletions.
6 changes: 6 additions & 0 deletions ontime_clocks/nodes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ minetest.register_node("ontime_clocks:green_digital", {
},
tiles = {"ontime_clocks_digital.png"},
groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1},
is_ground_content = false,
display_entities = {
["ontime_clocks:display"] = {
depth = 13/32 - 0.01,
Expand Down Expand Up @@ -81,6 +82,7 @@ minetest.register_node("ontime_clocks:red_digital", {
},
tiles = {"ontime_clocks_digital.png"},
groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1},
is_ground_content = false,
display_entities = {
["ontime_clocks:display"] = {
depth = 13/32 - 0.01,
Expand Down Expand Up @@ -114,6 +116,7 @@ minetest.register_node("ontime_clocks:white", {
},
tiles = {"ontime_clocks_white.png"},
groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1},
is_ground_content = false,
display_entities = {
["ontime_clocks:display"] = {
depth = 6/16 - 0.01,
Expand Down Expand Up @@ -148,6 +151,7 @@ minetest.register_node("ontime_clocks:frameless_black", {
},
tiles = {"ontime_clocks_frameless.png"},
groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1},
is_ground_content = false,
display_entities = {
["ontime_clocks:display"] = {
depth = 7/16,
Expand Down Expand Up @@ -182,6 +186,7 @@ minetest.register_node("ontime_clocks:frameless_gold", {
},
tiles = {"ontime_clocks_frameless.png^[colorize:#FF0"},
groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1},
is_ground_content = false,
display_entities = {
["ontime_clocks:display"] = {
depth = 7/16,
Expand Down Expand Up @@ -216,6 +221,7 @@ minetest.register_node("ontime_clocks:frameless_white", {
},
tiles = {"ontime_clocks_frameless.png^[colorize:#FFF"},
groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1},
is_ground_content = false,
display_entities = {
["ontime_clocks:display"] = {
depth = 7/16,
Expand Down
21 changes: 11 additions & 10 deletions signs_api/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ function signs_api.register_sign(mod, name, model)
model.width/2, model.height/2, 0.5 - model.depth},
},
groups = {choppy=2, dig_immediate=2, not_blocking_trains=1, display_api=1,signs_api_formspec_lbm=1},
is_ground_content = false,
sounds = default.node_sound_defaults(),
display_entities = {
["signs:display_text"] = {
Expand All @@ -183,21 +184,21 @@ function signs_api.register_sign(mod, name, model)
},
on_place = display_api.on_place,
on_construct = function(pos)
local ndef = minetest.registered_nodes[minetest.get_node(pos).name]
local meta = minetest.get_meta(pos)
meta:set_string("font", ndef and ndef.display_entities.font_name or
font_api.get_default_font_name())
signs_api.set_formspec(pos)
display_api.on_construct(pos)
end,
local ndef = minetest.registered_nodes[minetest.get_node(pos).name]
local meta = minetest.get_meta(pos)
meta:set_string("font", ndef and ndef.display_entities.font_name or
font_api.get_default_font_name())
signs_api.set_formspec(pos)
display_api.on_construct(pos)
end,
on_destruct = display_api.on_destruct,
on_blast = display_api.on_blast,
on_rotate = signs_api.on_rotate,
on_receive_fields = signs_api.on_receive_fields,
on_punch = function(pos, node, player, pointed_thing)
signs_api.set_formspec(pos)
display_api.update_entities(pos)
end,
signs_api.set_formspec(pos)
display_api.update_entities(pos)
end,
}

-- Node fields override
Expand Down
39 changes: 20 additions & 19 deletions steles/nodes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ for i, material in ipairs(steles.materials) do
},
},
groups = groups,
is_ground_content = false,
display_entities = {
["steles:text"] = {
on_display_update = font_api.on_display_update,
Expand All @@ -72,32 +73,32 @@ for i, material in ipairs(steles.materials) do
},
},
on_place = function(itemstack, placer, pointed_thing)
minetest.rotate_node(itemstack, placer, pointed_thing)
return display_api.on_place(itemstack, placer, pointed_thing)
end,
minetest.rotate_node(itemstack, placer, pointed_thing)
return display_api.on_place(itemstack, placer, pointed_thing)
end,
on_construct = function(pos)
set_formspec(pos)
display_api.on_construct(pos)
end,
set_formspec(pos)
display_api.on_construct(pos)
end,
on_rightclick = function(pos)
set_formspec(pos)
end,
set_formspec(pos)
end,
on_destruct = display_api.on_destruct,
on_blast = display_api.on_blast,
on_rotate = display_api.on_rotate,
on_receive_fields = function(pos, formname, fields, player)
if not minetest.is_protected(pos, player:get_player_name()) then
local meta = minetest.get_meta(pos)
if fields.ok or fields.font then
meta:set_string("display_text", fields.display_text)
meta:set_string("infotext", "\""..fields.display_text.."\"")
display_api.update_entities(pos)
end
if fields.font then
font_api.show_font_list(player, pos)
end
if not minetest.is_protected(pos, player:get_player_name()) then
local meta = minetest.get_meta(pos)
if fields.ok or fields.font then
meta:set_string("display_text", fields.display_text)
meta:set_string("infotext", "\""..fields.display_text.."\"")
display_api.update_entities(pos)
end
end,
if fields.font then
font_api.show_font_list(player, pos)
end
end
end,
on_punch = display_api.update_entities,
})
end
Expand Down

0 comments on commit 394166c

Please sign in to comment.