summaryrefslogtreecommitdiff
path: root/entities.lua
diff options
context:
space:
mode:
authorFaceDeer <derksenmobile@gmail.com>2017-01-03 23:03:41 -0700
committerFaceDeer <derksenmobile@gmail.com>2017-01-03 23:03:41 -0700
commitcfd6071ee669ac6bffeffbdba8e0e05dfaa77b52 (patch)
tree6f90599862086e51d6eb2aaf87ad57003f3c83fc /entities.lua
parent3600a745be423d60cea19bd8ac887a5f069a15bf (diff)
Added the auto-controller.
Diffstat (limited to 'entities.lua')
-rw-r--r--entities.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/entities.lua b/entities.lua
index 8ad4dcf..ae997af 100644
--- a/entities.lua
+++ b/entities.lua
@@ -66,6 +66,13 @@ minetest.register_entity("digtron:builder_item", {
on_activate = function(self, staticdata)
local props = self.object:get_properties()
if staticdata ~= nil and staticdata ~= "" then
+ local pos = self.object:getpos()
+ local node = minetest.get_node(pos)
+ if minetest.get_node_group(node.name, "digtron") ~= 4 then
+ -- We were reactivated without a builder node on our location, self-destruct
+ self.object:remove()
+ return
+ end
props.textures = {staticdata}
self.object:set_properties(props)
elseif digtron.create_builder_item ~= nil then