node number bugfixes
This commit is contained in:
parent
729214ca6a
commit
a45bf2249c
@ -42,7 +42,7 @@ local function can_dig(pos, player)
|
||||
end
|
||||
|
||||
local function after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||
techage.remove_node(pos)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
end
|
||||
|
||||
local function formspec2()
|
||||
|
@ -197,7 +197,7 @@ function techage.register_consumer(base_name, inv_name, tiles, tNode, validState
|
||||
if crd.power_netw then
|
||||
crd.power_netw:after_dig_node(pos)
|
||||
end
|
||||
techage.remove_node(pos)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
techage.del_mem(pos)
|
||||
end
|
||||
|
||||
|
@ -436,7 +436,7 @@ local function on_rotate(pos, node, user, mode, new_param2)
|
||||
end
|
||||
|
||||
local function after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||
techage.remove_node(pos)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
convert_to_chest_again(pos, oldnode, digger)
|
||||
end
|
||||
|
||||
|
@ -18,6 +18,7 @@ local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||
--local M = minetest.get_meta
|
||||
|
||||
local NodeInfoCache = {}
|
||||
local NumbersToBeRecycled = {}
|
||||
local MP = minetest.get_modpath("techage")
|
||||
local techage_use_sqlite = minetest.settings:get_bool('techage_use_sqlite', false)
|
||||
|
||||
@ -210,17 +211,19 @@ function techage.add_node(pos, name)
|
||||
if item_handling_node(name) then
|
||||
Tube:after_place_node(pos)
|
||||
end
|
||||
-- store position
|
||||
return get_number(pos, true)
|
||||
local key = minetest.hash_node_position(pos)
|
||||
return NumbersToBeRecycled[key] or get_number(pos, true)
|
||||
end
|
||||
|
||||
-- Function removes the node from the techage lists.
|
||||
function techage.remove_node(pos)
|
||||
local number = get_number(pos)
|
||||
function techage.remove_node(pos, oldnode, oldmetadata)
|
||||
local number = oldmetadata and oldmetadata.fields and oldmetadata.fields.node_number
|
||||
number = number or get_number(pos)
|
||||
if number then
|
||||
local key = minetest.hash_node_position(pos)
|
||||
NumbersToBeRecycled[key] = number
|
||||
local ninfo = NodeInfoCache[number] or update_nodeinfo(number)
|
||||
if ninfo then
|
||||
backend.del_nodepos(number)
|
||||
NodeInfoCache[number] = nil
|
||||
if item_handling_node(ninfo.name) then
|
||||
Tube:after_dig_node(pos)
|
||||
|
@ -17,6 +17,10 @@ local M = minetest.get_meta
|
||||
local S = techage.S
|
||||
local P2S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||
local S2P = minetest.string_to_pos
|
||||
local MP = minetest.get_modpath("minecart")
|
||||
local cart = dofile(MP.."/cart_lib1.lua")
|
||||
|
||||
cart:init(true)
|
||||
|
||||
local function formspec()
|
||||
return "size[8,6]"..
|
||||
@ -31,7 +35,8 @@ end
|
||||
|
||||
local function can_dig(pos, player)
|
||||
local owner = M(pos):get_string("owner")
|
||||
if owner ~= "" and owner ~= player:get_player_name() then
|
||||
if owner ~= "" and (owner ~= player:get_player_name() or
|
||||
not minetest.check_player_privs(player:get_player_name(), "minecart")) then
|
||||
return false
|
||||
end
|
||||
local inv = minetest.get_meta(pos):get_inventory()
|
||||
@ -91,12 +96,11 @@ minetest.register_node("techage:chest_cart", {
|
||||
end,
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return minecart.node_on_place(itemstack, placer, pointed_thing,
|
||||
"techage:chest_cart")
|
||||
return cart.add_cart(itemstack, placer, pointed_thing, "techage:chest_cart")
|
||||
end,
|
||||
|
||||
on_punch = function(pos, node, puncher, pointed_thing)
|
||||
minecart.node_on_punch(pos, node, puncher, pointed_thing, "techage:chest_cart_entity")
|
||||
cart.node_on_punch(pos, node, puncher, pointed_thing, "techage:chest_cart_entity")
|
||||
end,
|
||||
|
||||
set_cargo = function(pos, data)
|
||||
@ -133,9 +137,9 @@ minecart.register_cart_entity("techage:chest_cart_entity", "techage:chest_cart",
|
||||
visual_size = {x=0.66, y=0.66, z=0.66},
|
||||
static_save = false,
|
||||
},
|
||||
on_activate = minecart.on_activate,
|
||||
on_punch = minecart.on_punch,
|
||||
on_step = minecart.on_step,
|
||||
on_activate = cart.on_activate,
|
||||
on_punch = cart.on_punch,
|
||||
on_step = cart.on_step,
|
||||
})
|
||||
|
||||
techage.register_node({"techage:chest_cart"}, {
|
||||
|
@ -19,6 +19,10 @@ local P2S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||
local S2P = minetest.string_to_pos
|
||||
local Pipe = techage.LiquidPipe
|
||||
local liquid = techage.liquid
|
||||
local MP = minetest.get_modpath("minecart")
|
||||
local cart = dofile(MP.."/cart_lib1.lua")
|
||||
|
||||
cart:init(true)
|
||||
|
||||
local CAPACITY = 100
|
||||
|
||||
@ -110,8 +114,7 @@ minetest.register_node("techage:tank_cart", {
|
||||
end,
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return minecart.node_on_place(itemstack, placer, pointed_thing,
|
||||
"techage:tank_cart")
|
||||
return cart.add_cart(itemstack, placer, pointed_thing, "techage:tank_cart")
|
||||
end,
|
||||
|
||||
on_punch = function(pos, node, puncher, pointed_thing)
|
||||
@ -121,7 +124,7 @@ minetest.register_node("techage:tank_cart", {
|
||||
if techage.liquid.is_container_empty(wielded_item) then
|
||||
liquid.on_punch(pos, node, puncher, pointed_thing)
|
||||
else
|
||||
minecart.node_on_punch(pos, node, puncher, pointed_thing, "techage:tank_cart_entity")
|
||||
cart.node_on_punch(pos, node, puncher, pointed_thing, "techage:tank_cart_entity")
|
||||
end
|
||||
end,
|
||||
|
||||
@ -170,9 +173,9 @@ minecart.register_cart_entity("techage:tank_cart_entity", "techage:tank_cart", {
|
||||
visual_size = {x=0.66, y=0.66, z=0.66},
|
||||
static_save = false,
|
||||
},
|
||||
on_activate = minecart.on_activate,
|
||||
on_punch = minecart.on_punch,
|
||||
on_step = minecart.on_step,
|
||||
on_activate = cart.on_activate,
|
||||
on_punch = cart.on_punch,
|
||||
on_step = cart.on_step,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
|
@ -267,7 +267,7 @@ minetest.register_node("techage:ta4_doser", {
|
||||
del_liquids(pos)
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
techage.remove_node(pos)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
Pipe:after_dig_node(pos)
|
||||
techage.del_mem(pos)
|
||||
end,
|
||||
|
@ -688,4 +688,3 @@ techage.icta_register_action("set_filter", {
|
||||
return send_single_string(environ, data.number, "filter", payload)
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -451,8 +451,8 @@ minetest.register_node("techage:ta4_icta_controller", {
|
||||
return
|
||||
end
|
||||
|
||||
minetest.node_dig(pos, node, puncher, pointed_thing)
|
||||
techage.remove_node(pos)
|
||||
minetest.node_dig(pos, node, puncher, pointed_thing)
|
||||
end,
|
||||
|
||||
on_timer = on_timer,
|
||||
|
@ -110,8 +110,8 @@ minetest.register_node("techage:ta4_display", {
|
||||
minetest.get_node_timer(pos):start(1)
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos)
|
||||
techage.remove_node(pos)
|
||||
after_dig_node = function(pos, oldnode, oldmetadata)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
end,
|
||||
|
||||
on_timer = on_timer,
|
||||
@ -157,8 +157,8 @@ minetest.register_node("techage:ta4_displayXL", {
|
||||
minetest.get_node_timer(pos):start(2)
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos)
|
||||
techage.remove_node(pos)
|
||||
after_dig_node = function(pos, oldnode, oldmetadata)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
end,
|
||||
|
||||
on_timer = on_timer,
|
||||
|
@ -56,8 +56,8 @@ minetest.register_node("techage:ta4_signaltower", {
|
||||
end
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos)
|
||||
techage.remove_node(pos)
|
||||
after_dig_node = function(pos, oldnode, oldmetadata)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
end,
|
||||
|
||||
paramtype = "light",
|
||||
|
@ -161,7 +161,7 @@ minetest.register_node("techage:ta3_silo", {
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
Pipe:after_dig_node(pos)
|
||||
techage.remove_node(pos)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
end,
|
||||
liquid = tLiquid,
|
||||
networks = tNetworks,
|
||||
@ -206,7 +206,7 @@ minetest.register_node("techage:ta4_silo", {
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
Pipe:after_dig_node(pos)
|
||||
techage.remove_node(pos)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
end,
|
||||
liquid = tLiquid,
|
||||
networks = tNetworks,
|
||||
|
@ -103,7 +103,7 @@ minetest.register_node("techage:ta3_tank", {
|
||||
on_punch = liquid.on_punch,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
Pipe:after_dig_node(pos)
|
||||
techage.remove_node(pos)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
end,
|
||||
liquid = {
|
||||
capa = CAPACITY,
|
||||
@ -161,7 +161,7 @@ minetest.register_node("techage:oiltank", {
|
||||
on_punch = liquid.on_punch,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
Pipe:after_dig_node(pos)
|
||||
techage.remove_node(pos)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
end,
|
||||
liquid = {
|
||||
capa = CAPACITY * 4,
|
||||
@ -209,7 +209,7 @@ minetest.register_node("techage:ta4_tank", {
|
||||
on_punch = liquid.on_punch,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
Pipe:after_dig_node(pos)
|
||||
techage.remove_node(pos)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
end,
|
||||
liquid = {
|
||||
capa = CAPACITY * 2,
|
||||
|
@ -140,7 +140,7 @@ local function techage_set_numbers(pos, numbers, player_name)
|
||||
end
|
||||
|
||||
local function after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||
techage.remove_node(pos)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
end
|
||||
|
||||
minetest.register_node("techage:ta3_button_off", {
|
||||
|
@ -73,7 +73,7 @@ local function techage_set_numbers(pos, numbers, player_name)
|
||||
end
|
||||
|
||||
local function after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||
techage.remove_node(pos)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
end
|
||||
|
||||
minetest.register_node("techage:ta3_cartdetector_off", {
|
||||
|
@ -177,8 +177,8 @@ minetest.register_node("techage:ta4_collector", {
|
||||
|
||||
on_timer = on_timer,
|
||||
|
||||
after_dig_node = function(pos)
|
||||
techage.remove_node(pos)
|
||||
after_dig_node = function(pos, oldnode, oldmetadata)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
end,
|
||||
|
||||
paramtype = "light",
|
||||
|
@ -76,7 +76,7 @@ local function techage_set_numbers(pos, numbers, player_name)
|
||||
end
|
||||
|
||||
local function after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||
techage.remove_node(pos)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
techage.del_mem(pos)
|
||||
end
|
||||
|
||||
|
@ -78,8 +78,8 @@ for idx,pgn in ipairs(tPgns) do
|
||||
end
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos)
|
||||
techage.remove_node(pos)
|
||||
after_dig_node = function(pos, oldnode, oldmetadata)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
end,
|
||||
|
||||
paramtype = "light",
|
||||
|
@ -105,9 +105,9 @@ minetest.register_node("techage:ta3_doorcontroller", {
|
||||
return res
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos)
|
||||
after_dig_node = function(pos, oldnode, oldmetadata)
|
||||
swap_door_nodes(pos, false)
|
||||
techage.remove_node(pos)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
techage.del_mem(pos)
|
||||
end,
|
||||
|
||||
|
@ -64,8 +64,8 @@ for idx,pgn in ipairs(tPgns) do
|
||||
end
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos)
|
||||
techage.remove_node(pos)
|
||||
after_dig_node = function(pos, oldnode, oldmetadata)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
end,
|
||||
|
||||
paramtype = "light",
|
||||
|
@ -207,8 +207,8 @@ minetest.register_node("techage:ta3_logic", {
|
||||
return res
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos)
|
||||
techage.remove_node(pos)
|
||||
after_dig_node = function(pos, oldnode, oldmetadata)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
techage.del_mem(pos)
|
||||
end,
|
||||
|
||||
|
@ -135,7 +135,7 @@ minetest.register_node("techage:ta3_nodedetector_off", {
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
techage.remove_node(pos)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
techage.del_mem(pos)
|
||||
end,
|
||||
|
||||
@ -165,7 +165,7 @@ minetest.register_node("techage:ta3_nodedetector_on", {
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
techage.remove_node(pos)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
techage.del_mem(pos)
|
||||
end,
|
||||
|
||||
|
@ -133,7 +133,7 @@ minetest.register_node("techage:ta3_playerdetector_off", {
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
techage.remove_node(pos)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
techage.del_mem(pos)
|
||||
end,
|
||||
|
||||
@ -168,7 +168,7 @@ minetest.register_node("techage:ta3_playerdetector_on", {
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
techage.remove_node(pos)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
techage.del_mem(pos)
|
||||
end,
|
||||
|
||||
@ -224,7 +224,7 @@ minetest.register_node("techage:ta4_playerdetector_off", {
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
techage.remove_node(pos)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
techage.del_mem(pos)
|
||||
end,
|
||||
|
||||
@ -273,7 +273,7 @@ minetest.register_node("techage:ta4_playerdetector_on", {
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
techage.remove_node(pos)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
techage.del_mem(pos)
|
||||
end,
|
||||
|
||||
|
@ -72,8 +72,8 @@ minetest.register_node("techage:ta3_repeater", {
|
||||
return res
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos)
|
||||
techage.remove_node(pos)
|
||||
after_dig_node = function(pos, oldnode, oldmetadata)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
techage.del_mem(pos)
|
||||
end,
|
||||
|
||||
|
@ -228,8 +228,8 @@ minetest.register_node("techage:ta3_sequencer", {
|
||||
end
|
||||
local nvm = techage.get_nvm(pos)
|
||||
if not nvm.running then
|
||||
minetest.node_dig(pos, node, puncher, pointed_thing)
|
||||
techage.remove_node(pos)
|
||||
minetest.node_dig(pos, node, puncher, pointed_thing)
|
||||
techage.del_mem(pos)
|
||||
end
|
||||
end,
|
||||
|
@ -54,7 +54,7 @@ minetest.register_node("techage:signal_lamp_off", {
|
||||
on_rightclick = switch_on,
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
techage.remove_node(pos)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
if COLORED then
|
||||
unifieddyes.after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||
end
|
||||
@ -97,7 +97,7 @@ minetest.register_node("techage:signal_lamp_on", {
|
||||
after_place_node = COLORED and unifieddyes.recolor_on_place or nil,
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
techage.remove_node(pos)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
if COLORED then
|
||||
unifieddyes.after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||
end
|
||||
|
@ -226,8 +226,8 @@ local function register_terminal(num, tiles, node_box, selection_box)
|
||||
end
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos)
|
||||
techage.remove_node(pos)
|
||||
after_dig_node = function(pos, oldnode, oldmetadata)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
end,
|
||||
|
||||
paramtype = "light",
|
||||
|
@ -175,8 +175,8 @@ minetest.register_node("techage:ta3_timer", {
|
||||
|
||||
on_timer = check_rules,
|
||||
|
||||
after_dig_node = function(pos)
|
||||
techage.remove_node(pos)
|
||||
after_dig_node = function(pos, oldnode, oldmetadata)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
techage.del_mem(pos)
|
||||
end,
|
||||
|
||||
|
@ -533,8 +533,8 @@ minetest.register_node("techage:ta4_lua_controller", {
|
||||
return
|
||||
end
|
||||
|
||||
minetest.node_dig(pos, node, puncher, pointed_thing)
|
||||
techage.remove_node(pos)
|
||||
minetest.node_dig(pos, node, puncher, pointed_thing)
|
||||
end,
|
||||
|
||||
on_timer = on_timer,
|
||||
|
@ -89,7 +89,7 @@ local function can_dig(pos, player)
|
||||
end
|
||||
|
||||
local function after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||
techage.remove_node(pos)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
end
|
||||
|
||||
local function formspec1()
|
||||
|
@ -86,8 +86,8 @@ minetest.register_node("techage:ta4_server", {
|
||||
return
|
||||
end
|
||||
techage.del_mem(pos)
|
||||
minetest.node_dig(pos, node, puncher, pointed_thing)
|
||||
techage.remove_node(pos)
|
||||
minetest.node_dig(pos, node, puncher, pointed_thing)
|
||||
end,
|
||||
|
||||
on_timer = function(pos, elasped)
|
||||
|
@ -173,8 +173,8 @@ minetest.register_node("techage:ta4_terminal", {
|
||||
end
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos)
|
||||
techage.remove_node(pos)
|
||||
after_dig_node = function(pos, oldnode, oldmetadata)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
end,
|
||||
|
||||
paramtype = "light",
|
||||
|
Binary file not shown.
@ -72,9 +72,9 @@ local function after_place_node(pos)
|
||||
Cable:after_place_node(pos)
|
||||
end
|
||||
|
||||
local function after_dig_node(pos, oldnode)
|
||||
local function after_dig_node(pos, oldnode, oldmetadata)
|
||||
Cable:after_dig_node(pos)
|
||||
techage.remove_node(pos)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
techage.del_mem(pos)
|
||||
end
|
||||
|
||||
|
@ -171,14 +171,14 @@ local function after_place_node(pos, placer)
|
||||
Cable:after_place_node(pos)
|
||||
end
|
||||
|
||||
local function after_dig_node(pos, oldnode)
|
||||
local function after_dig_node(pos, oldnode, oldmetadata)
|
||||
local hash = minetest.hash_node_position(pos)
|
||||
if Rotors[hash] and Rotors[hash]:get_luaentity() then
|
||||
Rotors[hash]:remove()
|
||||
end
|
||||
Rotors[hash] = nil
|
||||
Cable:after_dig_node(pos)
|
||||
techage.remove_node(pos)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
techage.del_mem(pos)
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user