mirror of
https://github.com/PHIDIAS0303/factorio-mod-PHI.git
synced 2025-12-27 11:05:22 +09:00
.
This commit is contained in:
@@ -459,22 +459,28 @@ end
|
|||||||
|
|
||||||
local function handle_spoil_value(entity, combinator)
|
local function handle_spoil_value(entity, combinator)
|
||||||
-- combinator.set_slot(1, {value = {type = 'virtual', name = 'signal-OA', quality = 'normal'}, min = 0})
|
-- combinator.set_slot(1, {value = {type = 'virtual', name = 'signal-OA', quality = 'normal'}, min = 0})
|
||||||
|
local c = entity.surface.find_entities_filtered{type='chest', position=entity.position, radius=1, limit=1}
|
||||||
|
|
||||||
local v = entity.surface.find_entities_filtered{type='valve', position=entity.position, radius=1}
|
if not (c or #c == 0) then
|
||||||
|
|
||||||
if not (v or #v == 0) then
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, valve in pairs(v) do
|
local chest_storage = c[1].get_inventory(defines.inventory.chest)
|
||||||
if valve.valve_threshold_override then
|
|
||||||
if combinator_slot_value == 0 then
|
|
||||||
valve.valve_threshold_override = nil
|
|
||||||
|
|
||||||
else
|
if chest_storage then
|
||||||
valve.valve_threshold_override = combinator_slot_value / 100
|
local n = 31
|
||||||
|
|
||||||
|
for _, item in pairs(chest_storage) do
|
||||||
|
if item.spoil_percent and item.spoil_percent > 0 and n < 35 then
|
||||||
|
combinator.set_slot(n, {value = {type = 'virtual', name = item, quality = 'normal'}, min = math.floor(item.spoil_percent * 100)})
|
||||||
|
|
||||||
|
n = n + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
for i = n, 35 do
|
||||||
|
combinator.clear_slot(i)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user