diff options
author | cheapie <no-email-for-you@example.com> | 2021-03-27 19:51:23 -0500 |
---|---|---|
committer | cheapie <no-email-for-you@example.com> | 2021-03-27 19:51:23 -0500 |
commit | 7ad991ce409d40afa00a31dfadbc30462420de81 (patch) | |
tree | 72fae116d9486934e9d522292a4b85425d2f7973 /item_transport.lua | |
parent | d2954c52773faa86e3a414250b8a9f5acd04c787 (diff) | |
download | pipeworks-7ad991ce409d40afa00a31dfadbc30462420de81.tar pipeworks-7ad991ce409d40afa00a31dfadbc30462420de81.tar.gz pipeworks-7ad991ce409d40afa00a31dfadbc30462420de81.tar.bz2 pipeworks-7ad991ce409d40afa00a31dfadbc30462420de81.tar.xz pipeworks-7ad991ce409d40afa00a31dfadbc30462420de81.zip |
* Tubes can now be intentionally broken using a hammer
* Log messages have been improved slightly for tube repair
* Punching a broken tube now causes damage due to the sharp edges
Diffstat (limited to 'item_transport.lua')
-rw-r--r-- | item_transport.lua | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/item_transport.lua b/item_transport.lua index f302bca..e1ee192 100644 --- a/item_transport.lua +++ b/item_transport.lua @@ -55,15 +55,22 @@ end) -- tube overload mechanism: -- when the tube's item count (tracked in the above tube_item_count table) -- exceeds the limit configured per tube, replace it with a broken one. + +function pipeworks.break_tube(pos) + local node = minetest.get_node(pos) + local meta = minetest.get_meta(pos) + meta:set_string("the_tube_was", minetest.serialize(node)) + minetest.swap_node(pos, {name = "pipeworks:broken_tube_1"}) + pipeworks.scan_for_tube_objects(pos) +end + local crunch_tube = function(pos, cnode, cmeta) if enable_max_limit then local h = minetest.hash_node_position(pos) local itemcount = tube_item_count[h] or 0 if itemcount > max_tube_limit then - cmeta:set_string("the_tube_was", minetest.serialize(cnode)) pipeworks.logger("Warning - a tube at "..minetest.pos_to_string(pos).." broke due to too many items ("..itemcount..")") - minetest.swap_node(pos, {name = "pipeworks:broken_tube_1"}) - pipeworks.scan_for_tube_objects(pos) + pipeworks.break_tube(pos) end end end |