diff options
author | Vanessa Dannenberg <vanessa.e.dannenberg@gmail.com> | 2018-12-01 09:06:00 -0500 |
---|---|---|
committer | Vanessa Dannenberg <vanessa.e.dannenberg@gmail.com> | 2018-12-01 09:06:00 -0500 |
commit | 856b86858ebfa4af2c352b022188f82dcff7ed92 (patch) | |
tree | 867b0323f38e6b582b3fa3e4e1e896607493d5b1 /technic/machines/register | |
parent | 2d8ff9f889450fb5c36016276997544aae98a350 (diff) | |
download | dreambuilder_modpack-856b86858ebfa4af2c352b022188f82dcff7ed92.tar dreambuilder_modpack-856b86858ebfa4af2c352b022188f82dcff7ed92.tar.gz dreambuilder_modpack-856b86858ebfa4af2c352b022188f82dcff7ed92.tar.bz2 dreambuilder_modpack-856b86858ebfa4af2c352b022188f82dcff7ed92.tar.xz dreambuilder_modpack-856b86858ebfa4af2c352b022188f82dcff7ed92.zip |
update basic_materials, biome_lib, technic, digilines, digistuff,
gloopblocks, homedecor, moreblocks, pipeworks, prefab_redo
Diffstat (limited to 'technic/machines/register')
-rw-r--r-- | technic/machines/register/cables.lua | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/technic/machines/register/cables.lua b/technic/machines/register/cables.lua index 1e8cee9..924128e 100644 --- a/technic/machines/register/cables.lua +++ b/technic/machines/register/cables.lua @@ -117,6 +117,19 @@ local function clear_networks(pos) end end +local function item_place_override_node(itemstack, placer, pointed, node) + -- Call the default on_place function with a fake itemstack + local temp_itemstack = ItemStack(itemstack) + temp_itemstack:set_name(node.name) + local original_count = temp_itemstack:get_count() + temp_itemstack = + minetest.item_place(temp_itemstack, placer, pointed, node.param2) or + temp_itemstack + -- Remove the same number of items from the real itemstack + itemstack:take_item(original_count - temp_itemstack:get_count()) + return itemstack +end + function technic.register_cable(tier, size) local ltier = string.lower(tier) cable_tier["technic:"..ltier.."_cable"] = tier @@ -228,11 +241,10 @@ function technic.register_cable(tier, size) num = xyz[((fine_pointed[bigger] < 0 and "-") or "") .. bigger] end end - minetest.set_node(pointed_thing.above, {name = "technic:"..ltier.."_cable_plate_"..num}) - if not (creative and creative.is_enabled_for(placer)) then - itemstack:take_item() - end - return itemstack + return item_place_override_node( + itemstack, placer, pointed_thing, + {name = "technic:"..ltier.."_cable_plate_"..num} + ) end else def.groups.not_in_creative_inventory = 1 |