diff options
author | rubenwardy <rubenwardy@gmail.com> | 2017-09-20 17:05:04 +0100 |
---|---|---|
committer | orwell96 <mono96.mml@gmail.com> | 2017-09-20 18:05:04 +0200 |
commit | d65c4916ceaeed6eec5fe3f344d4e71b3c96a80b (patch) | |
tree | ae2a4a1ca5bdbcb0a2a867287d4556f92478405a /advtrains/digtron.lua | |
parent | b75c83ea43bb9f6e3bee2b4db955e2a9e7be885e (diff) | |
download | advtrains-d65c4916ceaeed6eec5fe3f344d4e71b3c96a80b.tar.gz advtrains-d65c4916ceaeed6eec5fe3f344d4e71b3c96a80b.tar.bz2 advtrains-d65c4916ceaeed6eec5fe3f344d4e71b3c96a80b.zip |
Remove zip release files, move mod to root, exclude assets from Makefile (#92)
Diffstat (limited to 'advtrains/digtron.lua')
-rw-r--r-- | advtrains/digtron.lua | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/advtrains/digtron.lua b/advtrains/digtron.lua new file mode 100644 index 0000000..7105a54 --- /dev/null +++ b/advtrains/digtron.lua @@ -0,0 +1,25 @@ +--digtron.lua +--make tracks placeable by digtrons by overriding the place function. + +local old_item_place = digtron.item_place_node + +digtron.item_place_node = function(itemstack, placer, place_to, param2) + if minetest.get_item_group(itemstack:get_name(), "advtrains_trackplacer")>0 then + return advtrains.pcall(function() + local def = minetest.registered_items[itemstack:get_name()] + if not def then return itemstack, false end + + local pointed_thing = {} + pointed_thing.type = "node" + pointed_thing.above = {x=place_to.x, y=place_to.y, z=place_to.z} + pointed_thing.under = {x=place_to.x, y=place_to.y - 1, z=place_to.z} + + --call the on_rightclick callback + local success + itemstack, success = def.on_place(itemstack, placer, pointed_thing) + return itemstack, success + end) + else + return old_item_place(itemstack, placer, place_to, param2) + end +end |