summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Snelling <jordach.snelling@gmail.com>2013-06-21 09:40:26 -0700
committerJordan Snelling <jordach.snelling@gmail.com>2013-06-21 09:40:26 -0700
commit251e8ed7b538ecc0a74b13231bce961de74447b7 (patch)
tree3c566e9e07a974c2243d630e2f01d1a76529b154
parente718c73b36fcf44c564c84d8bdfa45373c12f2a5 (diff)
parent0039f38b9497e9c8be830c05b5dd59a7e1633b83 (diff)
Merge pull request #33 from kaeza/place_craftitems
Deployers and constructors now able to "place" craftitems.
-rw-r--r--technic/constructor.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/technic/constructor.lua b/technic/constructor.lua
index 58d2dad..2b031e5 100644
--- a/technic/constructor.lua
+++ b/technic/constructor.lua
@@ -283,6 +283,22 @@ deploy_node =function (inv, slot_name, pos1, node1, node)
stack1[1]:take_item()
inv:set_stack(slot_name, 1, stack1[1])
elseif def.type == "craft" then
+ if def.on_place then
+ -- print("deploy_node: item has on_place. trying...")
+ local ok, stk = pcall(def.on_place, stack1[1], nil, {
+ -- Fake pointed_thing
+ type = "node",
+ above = pos1,
+ under = { x=pos1.x, y=pos1.y-1, z=pos1.z },
+ })
+ if ok then
+ -- print("deploy_node: on_place succeeded!")
+ inv:set_stack(slot_name, 1, stk or stack1[1])
+ return
+ -- else
+ -- print("deploy_node: WARNING: error while running on_place: "..tostring(stk))
+ end
+ end
minetest.item_place_object(stack1[1], nil, {
-- Fake pointed_thing
type = "node",