diff options
author | FaceDeer <derksenmobile@gmail.com> | 2017-01-02 18:50:03 -0700 |
---|---|---|
committer | FaceDeer <derksenmobile@gmail.com> | 2017-01-02 18:50:03 -0700 |
commit | 2b5dc41d50965a2190ae7c16cc18129061fa74ab (patch) | |
tree | 50ccc92fb37e0779d63b46880216ed3a5e1ab66d /entities.lua | |
parent | ec1ee19893c3e645b34607e9df069f164be7f31c (diff) |
Adding item display entities to the builder heads
Diffstat (limited to 'entities.lua')
-rw-r--r-- | entities.lua | 37 |
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, +}) |