aboutsummaryrefslogtreecommitdiff
path: root/display_api
diff options
context:
space:
mode:
authorfluxionary <25628292+fluxionary@users.noreply.github.com>2023-10-03 00:16:09 -0700
committerGitHub <noreply@github.com>2023-10-03 09:16:09 +0200
commit2c1efede4d9d9f3a0e6e644e9e781a1ba2938156 (patch)
tree6faab11b7c15246aa184b51e7ac3aad2b11faf47 /display_api
parente25588cf914e787ea84b7f62bacb9228fc05018a (diff)
downloaddisplay_modpack_no_craft-2c1efede4d9d9f3a0e6e644e9e781a1ba2938156.tar.gz
display_modpack_no_craft-2c1efede4d9d9f3a0e6e644e9e781a1ba2938156.zip
handle interactions w/ explosions (#3)
* don't let explosions destroy sign entities * destroy sign entities if sign node is exploded * remove redundant destructor call * make sure other things don't try to interact w/ the signs entity * name will be "" for non-players or unknown players. * remove default value from initial values --------- Co-authored-by: Niklp <89982526+Niklp09@users.noreply.github.com>
Diffstat (limited to 'display_api')
-rw-r--r--display_api/display.lua16
1 files changed, 15 insertions, 1 deletions
diff --git a/display_api/display.lua b/display_api/display.lua
index 113a738..c329dd7 100644
--- a/display_api/display.lua
+++ b/display_api/display.lua
@@ -251,6 +251,15 @@ function display_api.on_destruct(pos)
end
end
+function display_api.on_blast(pos, intensity)
+ if not minetest.is_protected(pos, "") then
+ local node = minetest.get_node(pos)
+ local drops = minetest.get_node_drops(node, "tnt:blast")
+ minetest.remove_node(pos)
+ return drops
+ end
+end
+
-- On_rotate (screwdriver) callback for display_api items. Prevents invalid
-- rotations and reorients entities.
function display_api.on_rotate(pos, node, user, _, new_param2)
@@ -272,12 +281,17 @@ function display_api.register_display_entity(entity_name)
initial_properties = {
collisionbox = {0, 0, 0, 0, 0, 0},
visual = "upright_sprite",
- textures = {}
+ textures = {},
+ collide_with_objects = false,
+ pointable = false
},
on_activate = display_api.on_activate,
get_staticdata = function(self)
return minetest.serialize({ nodepos = self.nodepos })
end,
+ on_blast = function(self, damage)
+ return false, false, {}
+ end,
})
end
end