mirror of
https://github.com/joe7575/techpack.git
synced 2024-09-12 07:58:39 +02:00
new mod 'techpack_warehouse' added
tubelib_stairway renamed to techpack_stairway code maintenance
This commit is contained in:
parent
ffdcdc5d8c
commit
5fb6462231
@ -190,11 +190,11 @@ function techpack_warehouse.allow_metadata_inventory_put(self, pos, listname, in
|
|||||||
local item_name = inv:get_stack("filter", index):get_name()
|
local item_name = inv:get_stack("filter", index):get_name()
|
||||||
if listname == "input" and item_name == stack:get_name() then
|
if listname == "input" and item_name == stack:get_name() then
|
||||||
return math.min(stack:get_count(), self.inv_size - main_stack:get_count())
|
return math.min(stack:get_count(), self.inv_size - main_stack:get_count())
|
||||||
elseif listname == "filter" then
|
elseif listname == "filter" and item_name == main_stack:get_name() then
|
||||||
local number = M(pos):get_string("number")
|
local number = M(pos):get_string("number")
|
||||||
Cache[number] = nil
|
Cache[number] = nil
|
||||||
return 1
|
return 1
|
||||||
elseif listname == "shift" and item_name == main_stack:get_name() then
|
elseif listname == "shift" then
|
||||||
return stack:get_count()
|
return stack:get_count()
|
||||||
end
|
end
|
||||||
return 0
|
return 0
|
||||||
@ -202,6 +202,8 @@ end
|
|||||||
|
|
||||||
function techpack_warehouse.on_metadata_inventory_put(pos, listname, index, stack, player)
|
function techpack_warehouse.on_metadata_inventory_put(pos, listname, index, stack, player)
|
||||||
if listname == "input" then
|
if listname == "input" then
|
||||||
|
local number = M(pos):get_string("number")
|
||||||
|
Cache[number] = nil
|
||||||
minetest.after(0.5, move_to_main, pos, index)
|
minetest.after(0.5, move_to_main, pos, index)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -226,6 +228,8 @@ function techpack_warehouse.allow_metadata_inventory_take(pos, listname, index,
|
|||||||
Cache[number] = nil
|
Cache[number] = nil
|
||||||
return 1
|
return 1
|
||||||
elseif listname == "shift" then
|
elseif listname == "shift" then
|
||||||
|
local number = M(pos):get_string("number")
|
||||||
|
Cache[number] = nil
|
||||||
return stack:get_count()
|
return stack:get_count()
|
||||||
end
|
end
|
||||||
return 0
|
return 0
|
||||||
@ -239,6 +243,8 @@ function techpack_warehouse.on_receive_fields(self, pos, formname, fields, playe
|
|||||||
if minetest.is_protected(pos, player:get_player_name()) then
|
if minetest.is_protected(pos, player:get_player_name()) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
local number = M(pos):get_string("number")
|
||||||
|
Cache[number] = nil
|
||||||
self.State:state_button_event(pos, fields)
|
self.State:state_button_event(pos, fields)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -261,7 +267,8 @@ function techpack_warehouse.on_timer(self, pos, elapsed)
|
|||||||
local number = meta:get_string("number")
|
local number = meta:get_string("number")
|
||||||
local player_name = meta:get_string("player_name")
|
local player_name = meta:get_string("player_name")
|
||||||
local offs = meta:get_int("offs")
|
local offs = meta:get_int("offs")
|
||||||
local push_dir = meta:get_string("push_dir") or "R"
|
local push_dir = meta:get_string("push_dir")
|
||||||
|
if push_dir == "" then push_dir = "L" end
|
||||||
meta:set_int("offs", offs + 1)
|
meta:set_int("offs", offs + 1)
|
||||||
for i = 0,7 do
|
for i = 0,7 do
|
||||||
local idx = ((i + offs) % 8) + 1
|
local idx = ((i + offs) % 8) + 1
|
||||||
|
Loading…
Reference in New Issue
Block a user