Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions UsefulCombinators_0.4.0/control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -366,23 +366,35 @@ classes["max-combinator"] = {
local signals = get_signals(control)
local signal = {type = "virtual"}
local count = -math.huge
for k,v in pairs(signals) do
count = math.max(count, v.count)
if count == v.count then
signal = v.signal
if signals then
for k,v in pairs(signals) do
if v.signal.name ~= "output-signal" then
count = math.max(count, v.count)
if count == v.count then
signal = v.signal
end
end
end
end
count = 1
local ncount = 1
if count == -math.huge then
ncount = 0
count = 0
end
local f1 = false
for _,i in pairs(params) do
if i.signal.name then
f1 = true
if signal.name == i.signal.name then
table.insert(slots, {signal = signal, count = count, index = 1})
table.insert(slots, {signal = signal, count = ncount, index = 1})
table.insert(slots, {signal = {type="virtual", name="output-signal"}, count = count, index = 2})
end
end
end
if not f1 then
table.insert(slots, {signal = signal, count = ncount, index = 1})
table.insert(slots, {signal = {type="virtual", name="output-signal"}, count = count, index = 2})
end
control.parameters = {
parameters = slots
}
Expand Down Expand Up @@ -2187,4 +2199,4 @@ script.on_event(defines.events.on_tick, tick)
script.on_event(defines.events.on_gui_click, on_click_ok)
--script.on_event(defines.events.on_entity_settings_pasted, on_paste)
script.on_event("uc-edit", on_key)
script.on_configuration_changed(configuration_changed)
script.on_configuration_changed(configuration_changed)
4 changes: 2 additions & 2 deletions UsefulCombinators_0.4.0/prototypes/entity/entities.lua
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ data:extend({
collision_box = {{-0.35, -0.35}, {0.35, 0.35}},
selection_box = {{-0.5, -0.5}, {0.5, 0.5}},

item_slot_count = 1,
item_slot_count = 2,

sprites =
{
Expand Down Expand Up @@ -3587,4 +3587,4 @@ data:extend({
},
circuit_wire_max_distance = 7.5
}
})
})