summaryrefslogtreecommitdiff
path: root/entities.lua
diff options
context:
space:
mode:
Diffstat (limited to 'entities.lua')
-rw-r--r--entities.lua37
1 files changed, 37 insertions, 0 deletions
diff --git a/entities.lua b/entities.lua
index b3d12cb..deb1ec6 100644
--- a/entities.lua
+++ b/entities.lua
@@ -49,3 +49,40 @@ minetest.register_entity("digtron:marker_vertical", {
self.object:remove()
end,
})
+
+minetest.register_entity("digtron:builder_item", {
+
+ initial_properties = {
+ hp_max = 1,
+ is_visible = true,
+ visual = "wielditem",
+ visual_size = {x=0.25, y=0.25},
+ collisionbox = {0,0,0,0,0,0},
+ physical = false,
+ textures = {""},
+ automatic_rotate = math.pi * 0.25,
+ },
+
+ on_activate = function(self, staticdata)
+ local props = self.object:get_properties()
+ if staticdata ~= nil and staticdata ~= "" then
+ props.textures = {staticdata}
+ self.object:set_properties(props)
+ elseif digtron.create_builder_item ~= nil then
+ minetest.debug("creating builder item", digtron.create_builder_item)
+ props.textures = {digtron.create_builder_item}
+ self.object:set_properties(props)
+ digtron.create_builder_item = nil
+ else
+ self.object:remove()
+ end
+ end,
+
+ get_staticdata = function(self)
+ local props = self.object:get_properties()
+ if props ~= nil and props.textures ~= nil and props.textures[1] ~= nil then
+ return props.textures[1]
+ end
+ return ""
+ end,
+})