1
0
mirror of https://github.com/pyrollo/display_modpack.git synced 2024-11-10 12:10:37 +01:00

destroy sign entities if sign node is exploded

This commit is contained in:
flux 2022-10-26 10:32:25 -07:00
parent 4d483563f6
commit 41f2eaaabb
No known key found for this signature in database
GPG Key ID: 9333B27816848A15
4 changed files with 18 additions and 0 deletions

View File

@ -289,6 +289,16 @@ function display_api.on_destruct(pos)
end end
end end
function display_api.on_blast(pos, intensity)
if not minetest.is_protected(pos, "tnt:blast") then
local node = minetest.get_node(pos)
local drops = minetest.get_node_drops(node, "tnt:blast")
minetest.remove_node(pos)
display_api.on_destruct(pos)
return drops
end
end
-- On_rotate (screwdriver) callback for display_api items. Prevents invalid -- On_rotate (screwdriver) callback for display_api items. Prevents invalid
-- rotations and reorients entities. -- rotations and reorients entities.
function display_api.on_rotate(pos, node, user, _, new_param2) function display_api.on_rotate(pos, node, user, _, new_param2)

View File

@ -48,6 +48,7 @@ minetest.register_node("ontime_clocks:green_digital", {
on_place = display_api.on_place, on_place = display_api.on_place,
on_construct = display_api.on_construct, on_construct = display_api.on_construct,
on_destruct = display_api.on_destruct, on_destruct = display_api.on_destruct,
on_blast = display_api.on_blast,
on_rotate = display_api.on_rotate, on_rotate = display_api.on_rotate,
}) })
@ -86,6 +87,7 @@ minetest.register_node("ontime_clocks:red_digital", {
on_place = display_api.on_place, on_place = display_api.on_place,
on_construct = display_api.on_construct, on_construct = display_api.on_construct,
on_destruct = display_api.on_destruct, on_destruct = display_api.on_destruct,
on_blast = display_api.on_blast,
on_rotate = display_api.on_rotate, on_rotate = display_api.on_rotate,
}) })
@ -124,6 +126,7 @@ minetest.register_node("ontime_clocks:white", {
on_place = display_api.on_place, on_place = display_api.on_place,
on_construct = display_api.on_construct, on_construct = display_api.on_construct,
on_destruct = display_api.on_destruct, on_destruct = display_api.on_destruct,
on_blast = display_api.on_blast,
on_rotate = display_api.on_rotate, on_rotate = display_api.on_rotate,
}) })
@ -161,6 +164,7 @@ minetest.register_node("ontime_clocks:frameless_black", {
on_place = display_api.on_place, on_place = display_api.on_place,
on_construct = display_api.on_construct, on_construct = display_api.on_construct,
on_destruct = display_api.on_destruct, on_destruct = display_api.on_destruct,
on_blast = display_api.on_blast,
on_rotate = display_api.on_rotate, on_rotate = display_api.on_rotate,
}) })
@ -198,6 +202,7 @@ minetest.register_node("ontime_clocks:frameless_gold", {
on_place = display_api.on_place, on_place = display_api.on_place,
on_construct = display_api.on_construct, on_construct = display_api.on_construct,
on_destruct = display_api.on_destruct, on_destruct = display_api.on_destruct,
on_blast = display_api.on_blast,
on_rotate = display_api.on_rotate, on_rotate = display_api.on_rotate,
}) })
@ -235,6 +240,7 @@ minetest.register_node("ontime_clocks:frameless_white", {
on_place = display_api.on_place, on_place = display_api.on_place,
on_construct = display_api.on_construct, on_construct = display_api.on_construct,
on_destruct = display_api.on_destruct, on_destruct = display_api.on_destruct,
on_blast = display_api.on_blast,
on_rotate = display_api.on_rotate, on_rotate = display_api.on_rotate,
}) })

View File

@ -218,6 +218,7 @@ function signs_api.register_sign(mod, name, model)
display_api.on_construct(pos) display_api.on_construct(pos)
end, end,
on_destruct = display_api.on_destruct, on_destruct = display_api.on_destruct,
on_blast = display_api.on_blast,
on_rotate = signs_api.on_rotate, on_rotate = signs_api.on_rotate,
on_receive_fields = signs_api.on_receive_fields, on_receive_fields = signs_api.on_receive_fields,
on_punch = function(pos, node, player, pointed_thing) on_punch = function(pos, node, player, pointed_thing)

View File

@ -74,6 +74,7 @@ for i, material in ipairs(steles.materials) do
display_api.on_construct(pos) display_api.on_construct(pos)
end, end,
on_destruct = display_api.on_destruct, on_destruct = display_api.on_destruct,
on_blast = display_api.on_blast,
on_rotate = display_api.on_rotate, on_rotate = display_api.on_rotate,
on_receive_fields = function(pos, formname, fields, player) on_receive_fields = function(pos, formname, fields, player)
if not minetest.is_protected(pos, player:get_player_name()) then if not minetest.is_protected(pos, player:get_player_name()) then