mirror of
https://github.com/PHIDIAS0303/factorio-mod-PHI.git
synced 2025-12-27 11:05:22 +09:00
.
This commit is contained in:
@@ -219,6 +219,8 @@ local function storage_init()
|
||||
if not storage.phi_cl.combinator then
|
||||
storage.phi_cl.combinator = {
|
||||
research_set_combinator_count = 0,
|
||||
combinator_list = {},
|
||||
combinator_list_len = 0,
|
||||
research_queue = {},
|
||||
research_queue_set = {},
|
||||
research_progress = 0
|
||||
@@ -322,8 +324,8 @@ end
|
||||
script.on_nth_tick(1800, function(_)
|
||||
if storage.phi_cl.loop.combinator then
|
||||
storage.phi_cl.combinator.research_progress = math.floor(game.forces['player'].research_progress * 100)
|
||||
|
||||
do
|
||||
storage.phi_cl.combinator.combinator_list = {}
|
||||
storage.phi_cl.combinator.combinator_list_len = 0
|
||||
storage.phi_cl.combinator.research_queue = {}
|
||||
storage.phi_cl.combinator.research_queue_set = {
|
||||
[1] = nil,
|
||||
@@ -346,7 +348,6 @@ script.on_nth_tick(1800, function(_)
|
||||
|
||||
n = n + 1
|
||||
end
|
||||
end
|
||||
|
||||
for _, s in pairs(game.surfaces) do
|
||||
local c = s.find_entities_filtered{type='constant-combinator', name='super-combinator'}
|
||||
@@ -355,8 +356,26 @@ script.on_nth_tick(1800, function(_)
|
||||
return
|
||||
end
|
||||
|
||||
for _, sc in pairs(c) do
|
||||
local circuit_oc = sc.get_or_create_control_behavior()
|
||||
storage.phi_cl.combinator.combinator_list = c
|
||||
storage.phi_cl.combinator.combinator_list_len = math.ceil(#c / 175)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
script.on_nth_tick(10, function(event)
|
||||
local head = #storage.phi_cl.combinator.combinator_list
|
||||
local max_remove = math.floor(head / 100) + 1
|
||||
local remove_count = math.random(0, max_remove)
|
||||
|
||||
while remove_count > 0 and head > 0 do
|
||||
local remove_index = math.random(1, head)
|
||||
local entity = storage.phi_cl.combinator.combinator_list[remove_index]
|
||||
storage.phi_cl.combinator.combinator_list[remove_index] = storage.phi_cl.combinator.combinator_list[head]
|
||||
head = head - 1
|
||||
|
||||
if entity and entity.valid then
|
||||
remove_count = remove_count - 1
|
||||
local circuit_oc = entity.get_or_create_control_behavior()
|
||||
|
||||
if circuit_oc and circuit_oc.sections_count and circuit_oc.sections_count == 0 then
|
||||
circuit_oc.add_section()
|
||||
@@ -415,7 +434,6 @@ script.on_nth_tick(1800, function(_)
|
||||
end
|
||||
end
|
||||
]]
|
||||
end
|
||||
|
||||
-- game.forces['player'].research_queue = storage.phi_cl.combinator.research_queue_set
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user