diff --git a/UsefulCombinators_0.5.1/changelog.txt b/UsefulCombinators_0.5.1/changelog.txt new file mode 100644 index 0000000..724fe62 --- /dev/null +++ b/UsefulCombinators_0.5.1/changelog.txt @@ -0,0 +1,35 @@ +--------------------------------------------------------------------------------------------------- +Version: 0.5.1 +Date: 2023.11.05 + Info: + - Fix random-combinator error +--------------------------------------------------------------------------------------------------- +Version: 0.5.0 +Date: 2021.03.13 + Info: + - Add support Schall Circuit Group recipe categories +--------------------------------------------------------------------------------------------------- +Version: 0.4.9 +Date: 2021.03.13 + Info: + - Updated internal names to prevent incompatabilities with other mods +--------------------------------------------------------------------------------------------------- +Version: 0.4.8 +Date: 2021.03.07 + Info: + - Fixed and updated for latest factorio version +--------------------------------------------------------------------------------------------------- +Version: 0.4.7 +Date: 2020.06.23 + Info: + - Enhanced thumbnail +--------------------------------------------------------------------------------------------------- +Version: 0.4.6 +Date: 2020.06.22 + Info: + - Updated tyo Factoio v0.18 +--------------------------------------------------------------------------------------------------- +Version: 0.4.5 +Date: 2020.06.22 + Info: + - Updated tyo Factoio v0.17 \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/combinators/list.lua b/UsefulCombinators_0.5.1/combinators/list.lua new file mode 100644 index 0000000..f92630b --- /dev/null +++ b/UsefulCombinators_0.5.1/combinators/list.lua @@ -0,0 +1,25 @@ +return { + "uc-and-gate-combinator", + "uc-color-combinator", + "uc-converter-combinator", + "uc-counting-combinator", + "uc-daytime-combinator", + "uc-detector-combinator", + "uc-emitter-combinator", + "uc-max-combinator", + "uc-min-combinator", + "uc-nand-gate-combinator", + "uc-nor-gate-combinator", + "uc-not-gate-combinator", + "uc-or-gate-combinator", + "uc-pollution-combinator", + "uc-power-combinator", + "uc-railway-combinator", + "uc-random-combinator", + "uc-receiver-combinator", + "uc-sensor-combinator", + "uc-statistic-combinator", + "uc-timer-combinator", + "uc-xnor-gate-combinator", + "uc-xor-gate-combinator" +} \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/combinators/uc-and-gate-combinator.lua b/UsefulCombinators_0.5.1/combinators/uc-and-gate-combinator.lua new file mode 100644 index 0000000..41ab03d --- /dev/null +++ b/UsefulCombinators_0.5.1/combinators/uc-and-gate-combinator.lua @@ -0,0 +1,99 @@ +return { + on_click = function(player, object) + local gui = player.gui.center.uc["uc-and-gate-combinator"] + local params = object.meta.params + if gui["signal_a"].elem_value and gui["signal_a"].elem_value.name then + params[1] = {signal = gui["signal_a"].elem_value} + else + params[1] = {signal = {type = "virtual"}} + end + if gui["signal_b"].elem_value and gui["signal_b"].elem_value.name then + params[2] = {signal = gui["signal_b"].elem_value} + else + params[2] = {signal = {type = "virtual"}} + end + if gui["signal_c"].elem_value and gui["signal_c"].elem_value.name then + params[3] = {signal = gui["signal_c"].elem_value} + else + params[3] = {signal = {type = "virtual"}} + end + end, + on_key = function(player, object) + if not (player.gui.center["uc"]) then + local params = object.meta.params + local gui = player.gui.center + local uc = gui.add{type = "frame", name = "uc", caption = "AND Gate Combinator"} + local layout = uc.add{type = "table", name = "uc-and-gate-combinator", column_count = 5} + if params[1].signal and params[1].signal.name then + layout.add{type = "choose-elem-button", name = "signal_a", elem_type = "signal", signal = params[1].signal} + else + layout.add{type = "choose-elem-button", name = "signal_a", elem_type = "signal"} + end + layout.add{type = "label", caption = "AND"} + if params[2].signal and params[2].signal.name then + layout.add{type = "choose-elem-button", name = "signal_b", elem_type = "signal", signal = params[2].signal} + else + layout.add{type = "choose-elem-button", name = "signal_b", elem_type = "signal"} + end + layout.add{type = "label", caption = " = "} + if params[3].signal and params[3].signal.name then + layout.add{type = "choose-elem-button", name = "signal_c", elem_type = "signal", signal = params[3].signal} + else + layout.add{type = "choose-elem-button", name = "signal_c", elem_type = "signal"} + end + layout.add{type = "button", name = "uc-exit", caption = "Ok"} + end + end, + on_place = function(entity, item) + if item ~= nil and item.get_tag("uc_meta") ~= nil then + local tag = item.get_tag("uc_meta") + tag.meta.entity = entity + return { meta = tag.meta } + end + return { + meta = { + entity = entity, + params = { + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}}, + {signal = {type = "virtual", name = "uc-output-signal"}} + } + } + } + end, + on_destroy = function(meta, item) + item.set_tag("uc_meta", meta) + end, + on_tick = function(object) + local control = object.meta.entity.get_or_create_control_behavior() + if control then + local params = object.meta.params + if params[3].signal then + if control.enabled then + local slots = {} + local c1,c2 = 0,0 + if params[1].signal.name then + c1 = get_count(control, params[1].signal) + end + if params[2].signal.name then + c2 = get_count(control, params[2].signal) + end + if params[3].signal.name then + if (c1 > 0) and (c2 > 0) and (c1 == c2) then + table.insert(slots, {signal = params[3].signal, count = 1, index = 1}) + else + table.insert(slots, {signal = params[3].signal, count = 0, index = 1}) + end + end + control.parameters = slots + end + else + control.parameters = { + { + {signal = {type = "virtual", name = "uc-output-signal"}, count = 0, index = 1} + } + } + end + end + end +} \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/combinators/uc-color-combinator.lua b/UsefulCombinators_0.5.1/combinators/uc-color-combinator.lua new file mode 100644 index 0000000..09f1c0f --- /dev/null +++ b/UsefulCombinators_0.5.1/combinators/uc-color-combinator.lua @@ -0,0 +1,150 @@ +return { + on_click = function(player, object) + local gui = player.gui.center + for i = 1,6 do + if gui["uc"]["uc-color-combinator"]["signal"..i].elem_value and gui["uc"]["uc-color-combinator"]["signal"..i].elem_value.name then + object.meta.params[i] = {signal = gui["uc"]["uc-color-combinator"]["signal"..i].elem_value, count = tonumber(gui["uc"]["uc-color-combinator"]["count"..i].text) or object.meta.params[i].count} + else + object.meta.params[i] = {signal = {type = "virtual"}, count = 0} + end + end + end, + on_key = function(player, object) + if not (player.gui.center["uc"]) then + local gui = player.gui.center + local params = object.meta.params + local uc = gui.add{type = "frame", name = "uc", caption = "Color Combinator"} + local layout = uc.add{type = "table", name = "uc-color-combinator", column_count = 4} + for i = 1,6 do + if i == 1 then + layout.add{type = "label", caption = "Red: (?)", tooltip = {"uc-color-combinator.red"}} + if params[i].signal and params[i].signal.name then + layout.add{type = "choose-elem-button", name = "signal"..i, elem_type = "signal", signal = params[i].signal} + else + layout.add{type = "choose-elem-button", name = "signal"..i, elem_type = "signal"} + end + layout.add{type = "label", caption = " = "} + layout.add{type = "textfield", name = "count"..i, style = "uc_text", text = params[i].count or 0} + elseif i == 2 then + layout.add{type = "label", caption = "Green: (?)", tooltip = {"uc-color-combinator.green"}} + if params[i].signal and params[i].signal.name then + layout.add{type = "choose-elem-button", name = "signal"..i, elem_type = "signal", signal = params[i].signal} + else + layout.add{type = "choose-elem-button", name = "signal"..i, elem_type = "signal"} + end + layout.add{type = "label", caption = " = "} + layout.add{type = "textfield", name = "count"..i, style = "uc_text", text = params[i].count or i} + elseif i == 3 then + layout.add{type = "label", caption = "Blue: (?)", tooltip = {"uc-color-combinator.blue"}} + if params[i].signal and params[i].signal.name then + layout.add{type = "choose-elem-button", name = "signal"..i, elem_type = "signal", signal = params[i].signal} + else + layout.add{type = "choose-elem-button", name = "signal"..i, elem_type = "signal"} + end + layout.add{type = "label", caption = " = "} + layout.add{type = "textfield", name = "count"..i, style = "uc_text", text = params[i].count or i} + elseif i == 4 then + layout.add{type = "label", caption = "Yellow: (?)", tooltip = {"uc-color-combinator.yellow"}} + if params[i].signal and params[i].signal.name then + layout.add{type = "choose-elem-button", name = "signal"..i, elem_type = "signal", signal = params[i].signal} + else + layout.add{type = "choose-elem-button", name = "signal"..i, elem_type = "signal"} + end + layout.add{type = "label", caption = " = "} + layout.add{type = "textfield", name = "count"..i, style = "uc_text", text = params[i].count or i} + elseif i == 5 then + layout.add{type = "label", caption = "Magenta: (?)", tooltip = {"uc-color-combinator.magenta"}} + if params[i].signal and params[i].signal.name then + layout.add{type = "choose-elem-button", name = "signal"..i, elem_type = "signal", signal = params[i].signal} + else + layout.add{type = "choose-elem-button", name = "signal"..i, elem_type = "signal"} + end + layout.add{type = "label", caption = " = "} + layout.add{type = "textfield", name = "count"..i, style = "uc_text", text = params[i].count or i} + elseif i == 6 then + layout.add{type = "label", caption = "Cyan: (?)", tooltip = {"uc-color-combinator.cyan"}} + if params[i].signal and params[i].signal.name then + layout.add{type = "choose-elem-button", name = "signal"..i, elem_type = "signal", signal = params[i].signal} + else + layout.add{type = "choose-elem-button", name = "signal"..i, elem_type = "signal"} + end + layout.add{type = "label", caption = " = "} + layout.add{type = "textfield", name = "count"..i, style = "uc_text", text = params[i].count or i} + end + end + layout.add{type = "button", name = "uc-exit", caption = "Ok"} + end + end, + on_place = function(entity, item) + if item ~= nil and item.get_tag("uc_meta") ~= nil then + local tag = item.get_tag("uc_meta") + tag.meta.entity = entity + return { meta = tag.meta } + end + return { + meta = { + entity = entity, + params = { + {signal = {type = "virtual", name = "uc-red-signal"}, count = 1}, + {signal = {type = "virtual", name = "uc-green-signal"}, count = 2}, + {signal = {type = "virtual", name = "uc-blue-signal"}, count = 3}, + {signal = {type = "virtual", name = "uc-yellow-signal"}, count = 4}, + {signal = {type = "virtual", name = "uc-magenta-signal"}, count = 5}, + {signal = {type = "virtual", name = "uc-cyan-signal"}, count = 6} + } + } + } + end, + on_destroy = function(meta, item) + item.set_tag("uc_meta", meta) + end, + on_tick = function(object) + local control = object.meta.entity.get_or_create_control_behavior() + if control then + local params = object.meta.params + if control.enabled then + local slots = { + {signal = {type = "virtual", name = "signal-red"}, count = 0, index = 1}, + {signal = {type = "virtual", name = "signal-green"}, count = 0, index = 2}, + {signal = {type = "virtual", name = "signal-blue"}, count = 0, index = 3}, + {signal = {type = "virtual", name = "signal-yellow"}, count = 0, index = 4}, + {signal = {type = "virtual", name = "signal-pink"}, count = 0, index = 5}, + {signal = {type = "virtual", name = "signal-cyan"}, count = 0, index = 6} + } + for i = 1,6 do + if params[i].signal and params[i].signal.name then + local color = "" + if i == 1 then + color = "signal-red" + elseif i == 2 then + color = "signal-green" + elseif i == 3 then + color = "signal-blue" + elseif i == 4 then + color = "signal-yellow" + elseif i == 5 then + color = "signal-pink" + elseif i == 6 then + color = "signal-cyan" + end + if get_count(control, params[i].signal) == params[i].count then + table.insert(slots, {signal = {type = "virtual", name = color}, count = 1, index = i}) + else + table.insert(slots, {signal = {type = "virtual", name = color}, count = 0, index = i}) + end + end + end + control.parameters = slots + else + control.parameters = { + {signal = {type = "virtual", name = "signal-red"}, count = 0, index = 1}, + {signal = {type = "virtual", name = "signal-green"}, count = 0, index = 2}, + {signal = {type = "virtual", name = "signal-blue"}, count = 0, index = 3}, + {signal = {type = "virtual", name = "signal-yellow"}, count = 0, index = 4}, + {signal = {type = "virtual", name = "signal-pink"}, count = 0, index = 5}, + {signal = {type = "virtual", name = "signal-cyan"}, count = 0, index = 6} + } + end + end + end +} \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/combinators/uc-converter-combinator.lua b/UsefulCombinators_0.5.1/combinators/uc-converter-combinator.lua new file mode 100644 index 0000000..6ad542a --- /dev/null +++ b/UsefulCombinators_0.5.1/combinators/uc-converter-combinator.lua @@ -0,0 +1,107 @@ +return { + on_click = function(player, object) + local gui = player.gui.center + for i = 1,5 do + if gui["uc"]["uc-converter-combinator"]["from"..i].elem_value and gui["uc"]["uc-converter-combinator"]["from"..i].elem_value.name then + object.meta.params["from"][i] = {signal = gui["uc"]["uc-converter-combinator"]["from"..i].elem_value} + else + object.meta.params["from"][i] = {type = "virtual"} + end + if gui["uc"]["uc-converter-combinator"]["to"..i].elem_value and gui["uc"]["uc-converter-combinator"]["to"..i].elem_value.name then + object.meta.params["to"][i] = {signal = gui["uc"]["uc-converter-combinator"]["to"..i].elem_value} + else + object.meta.params["to"][i] = {type = "virtual"} + end + end + end, + on_key = function(player, object) + if not (player.gui.center["uc"]) then + local params = object.meta.params + local gui = player.gui.center + local uc = gui.add{type = "frame", name = "uc", caption = "Converter Combinator"} + local layout = uc.add{type = "table", name = "uc-converter-combinator", column_count = 2} + layout.add{type = "label", caption = "From: (?)", tooltip = {"uc-converter-combinator.from"}} + layout.add{type = "label", caption = "To: (?)", tooltip = {"uc-converter-combinator.to"}} + for i = 1,5 do + if params["from"][i].signal and params["from"][i].signal.name then + layout.add{type = "choose-elem-button", name = "from"..i, elem_type = "signal", signal = params["from"][i].signal} + else + layout.add{type = "choose-elem-button", name = "from"..i, elem_type = "signal"} + end + if params["to"][i].signal and params["to"][i].signal.name then + layout.add{type = "choose-elem-button", name = "to"..i, elem_type = "signal", signal = params["to"][i].signal} + else + layout.add{type = "choose-elem-button", name = "to"..i, elem_type = "signal"} + end + end + layout.add{type = "button", name = "uc-exit", caption = "Ok"} + end + end, + on_place = function(entity, item) + if item ~= nil and item.get_tag("uc_meta") ~= nil then + local tag = item.get_tag("uc_meta") + tag.meta.entity = entity + return { meta = tag.meta } + end + return { + meta = { + entity = entity, + params = { + from = { + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}} + }, + to = { + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}} + } + } + } + } + end, + on_destroy = function(meta, item) + item.set_tag("uc_meta", meta) + end, + on_tick = function(object) + local control = object.meta.entity.get_or_create_control_behavior() + if control then + if control.enabled then + local slots = {} + local params = object.meta.params + if not params["from"] and not params["to"] then + object.meta.params = { + from = { + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}} + }, + to = { + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}} + } + } + params = object.meta.params + end + for i = 1,5 do + if params["to"][i].signal and params["to"][i].signal.name then + table.insert(slots, {signal = params["to"][i].signal, count = get_count(control, params["from"][i].signal), index = i}) + end + end + control.parameters = slots + else + control.parameters = nil + end + end + end +} \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/combinators/uc-counting-combinator.lua b/UsefulCombinators_0.5.1/combinators/uc-counting-combinator.lua new file mode 100644 index 0000000..70dc80c --- /dev/null +++ b/UsefulCombinators_0.5.1/combinators/uc-counting-combinator.lua @@ -0,0 +1,59 @@ +return { + on_click = function(player, object) + local gui = player.gui.center.uc["uc-counting-combinator"] + object.meta.reset = tonumber(gui["reset"].text) or object.meta.reset + end, + on_key = function(player, object) + if not (player.gui.center["uc"]) then + local params = object.meta.params + local gui = player.gui.center + local uc = gui.add{type = "frame", name = "uc", caption = "Counting Combinator"} + local layout = uc.add{type = "table", name = "uc-counting-combinator", column_count = 2} + layout.add{type = "label", caption = "Reset: (?)", tooltip = {"uc-counting-combinator.reset"}} + layout.add{type = "textfield", name = "reset", style = "uc_text", text = object.meta.reset} + layout.add{type = "button", name = "uc-exit", caption = "Ok"} + layout.add{type = "label", caption = "(extra info)", tooltip = {"uc-counting-combinator.extra"}} + end + end, + on_place = function(entity, item) + if item ~= nil and item.get_tag("uc_meta") ~= nil then + local tag = item.get_tag("uc_meta") + tag.meta.entity = entity + return { meta = tag.meta } + end + return { + meta = { + entity = entity, + count = 0, + reset = -1 + } + } + end, + on_destroy = function(meta, item) + item.set_tag("uc_meta", meta) + end, + on_tick = function(object) + local control = object.meta.entity.get_or_create_control_behavior() + if control then + if control.enabled then + if (object.meta.reset < -1) then object.meta.reset = -1 end + if (object.meta.count < 0) then object.meta.count = 0 end + if object.meta.reset > -1 and object.meta.count > object.meta.reset then + object.meta.count = 0 + end + object.meta.count = object.meta.count - get_count(control, {type = "virtual", name = "uc-minus-one-signal"}) + object.meta.count = object.meta.count + get_count(control, {type = "virtual", name = "uc-plus-one-signal"}) + if object.meta.reset > -1 and object.meta.count == -1 then + object.meta.count = object.meta.reset + end + control.parameters = { + {signal = {type = "virtual", name = "uc-counting-signal"}, count = object.meta.count, index = 1} + } + end + else + control.parameters = { + {signal = {type = "virtual", name = "uc-counting-signal"}, count = 0, index = 1} + } + end + end +} \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/combinators/uc-daytime-combinator.lua b/UsefulCombinators_0.5.1/combinators/uc-daytime-combinator.lua new file mode 100644 index 0000000..dfcb903 --- /dev/null +++ b/UsefulCombinators_0.5.1/combinators/uc-daytime-combinator.lua @@ -0,0 +1,75 @@ +return { + on_click = function(player, object) + local gui = player.gui.center + if gui["uc"]["uc-daytime-combinator"]["minutes"].elem_value and gui["uc"]["uc-daytime-combinator"]["minutes"].elem_value.name then + object.meta.minutes = gui["uc"]["uc-daytime-combinator"]["minutes"].elem_value + else + object.meta.minutes = {type = "virtual", name = "signal-M"} + end + if gui["uc"]["uc-daytime-combinator"]["hours"].elem_value and gui["uc"]["uc-daytime-combinator"]["hours"].elem_value.name then + object.meta.hours = gui["uc"]["uc-daytime-combinator"]["hours"].elem_value + else + object.meta.hours = {type = "virtual", name = "signal-H"} + end + end, + on_key = function(player, object) + if not (player.gui.center["uc"]) then + local meta = object.meta + local gui = player.gui.center + local uc = gui.add{type = "frame", name = "uc", caption = "Daytime Combinator"} + local layout = uc.add{type = "table", name = "uc-daytime-combinator", column_count = 2} + layout.add{type = "label", caption = "Minutes: (?)", tooltip = {"uc-daytime-combinator.minutes"}} + if meta.minutes and meta.minutes.name then + layout.add{type = "choose-elem-button", name = "minutes", elem_type = "signal", signal = meta.minutes} + else + layout.add{type = "choose-elem-button", name = "minutes", elem_type = "signal"} + end + layout.add{type = "label", caption = "Hours: (?)", tooltip = {"uc-daytime-combinator.hours"}} + if meta.hours and meta.hours.name then + layout.add{type = "choose-elem-button", name = "hours", elem_type = "signal", signal = meta.hours} + else + layout.add{type = "choose-elem-button", name = "hours", elem_type = "signal"} + end + layout.add{type = "button", name = "uc-exit", caption = "Ok"} + end + end, + on_place = function(entity, item) + if item ~= nil and item.get_tag("uc_meta") ~= nil then + local tag = item.get_tag("uc_meta") + tag.meta.entity = entity + return { meta = tag.meta } + end + return { + meta = { + entity = entity, + minutes = {type = "virtual", name = "signal-M"}, + hours = {type = "virtual", name = "signal-H"} + } + } + end, + on_destroy = function(meta, item) + item.set_tag("uc_meta", meta) + end, + on_tick = function(object) + local control = object.meta.entity.get_or_create_control_behavior() + if control then + if control.enabled then + local slots = {} + local meta = object.meta + local daytime = (meta.entity.surface.daytime * 24 + 12) % 24 + if meta.minutes and meta.minutes.name then + table.insert(slots, {signal = meta.minutes, count = math.floor((daytime - math.floor(daytime)) * 60), index = 1}) + end + if meta.hours and meta.hours.name then + table.insert(slots, {signal = meta.hours, count = math.floor(daytime), index = 2}) + end + control.parameters = slots + end + else + control.parameters = { + {signal = {type = "virtual", name = "signal-M"}, count = 0, index = 1}, + {signal = {type = "virtual", name = "signal-H"}, count = 0, index = 2} + } + end + end +} \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/combinators/uc-detector-combinator.lua b/UsefulCombinators_0.5.1/combinators/uc-detector-combinator.lua new file mode 100644 index 0000000..04deed2 --- /dev/null +++ b/UsefulCombinators_0.5.1/combinators/uc-detector-combinator.lua @@ -0,0 +1,75 @@ +return { + on_click = function(player, object) + local gui = player.gui.center + if gui["uc"]["uc-detector-combinator"]["signal"].elem_value and gui["uc"]["uc-detector-combinator"]["signal"].elem_value.name then + object.meta.signal = gui["uc"]["uc-detector-combinator"]["signal"].elem_value + else + object.meta.signal = {type = "virtual"} + end + object.meta.radius = tonumber(gui["uc"]["uc-detector-combinator"]["radius"].text) or object.meta.radius + end, + on_key = function(player, object) + if not (player.gui.center["uc"]) then + local meta = object.meta + local gui = player.gui.center + local uc = gui.add{type = "frame", name = "uc", caption = "Detector Combinator"} + local layout = uc.add{type = "table", name = "uc-detector-combinator", column_count = 4} + layout.add{type = "label", caption = "Radius: (?)", tooltip = {"uc-detector-combinator.radius"}} + layout.add{type = "textfield", name = "radius", style = "uc_text", text = meta.radius} + layout.add{type = "label", caption = "Signal: (?)", tooltip = {"uc-detector-combinator.signal"}} + if meta.signal and meta.signal.name then + layout.add{type = "choose-elem-button", name = "signal", elem_type = "signal", signal = meta.signal} + else + layout.add{type = "choose-elem-button", name = "signal", elem_type = "signal"} + end + layout.add{type = "button", name = "uc-exit", caption = "Ok"} + end + end, + on_place = function(entity, item) + if item ~= nil and item.get_tag("uc_meta") ~= nil then + local tag = item.get_tag("uc_meta") + tag.meta.entity = entity + return { meta = tag.meta } + end + return { + meta = { + entity = entity, + radius = 24, + signal = {type = "virtual", name = "uc-output-signal"} + } + } + end, + on_destroy = function(meta, item) + item.set_tag("uc_meta", meta) + end, + on_tick = function(object) + local control = object.meta.entity.get_or_create_control_behavior() + if control then + local signal = object.meta.signal + if signal then + if control.enabled then + local r = object.meta.radius + if r > 24 then + r = 24 + object.meta.radius = 24 + end + if r < 1 then + r = 1 + object.meta.radius = 1 + end + local slots = {} + local pos = object.meta.entity.position + local units = object.meta.entity.surface.count_entities_filtered({position = pos, radius = r + 0.5, force = "enemy"}) + if signal.name then + table.insert(slots, {signal = signal, count = units, index = 1}) + end + control.parameters = slots + end + else + control.parameters = { + {signal = {type = "virtual", name = "uc-output-signal"}, count = 0, index = 1} + } + end + end + end +} \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/combinators/uc-emitter-combinator.lua b/UsefulCombinators_0.5.1/combinators/uc-emitter-combinator.lua new file mode 100644 index 0000000..ff7aebb --- /dev/null +++ b/UsefulCombinators_0.5.1/combinators/uc-emitter-combinator.lua @@ -0,0 +1,66 @@ +return { + on_click = function(player, object) + local gui = player.gui.center + local params = {} + for i = 1,6 do + if gui["uc"]["uc-emitter-combinator"]["signal"..i].elem_value then + params[i] = {signal = gui["uc"]["uc-emitter-combinator"]["signal"..i].elem_value} + else + params[i] = {signal = {type = "virtual"}} + end + end + object.meta.params = params + end, + on_key = function(player, object) + if not (player.gui.center["uc"]) then + local gui = player.gui.center + local params = object.meta.params + local uc = gui.add{type = "frame", name = "uc", caption = "Emitter Combinator"} + local layout = uc.add{type = "table", name = "uc-emitter-combinator", column_count = 8} + layout.add{type = "label", caption = "Signal: (?)", tooltip = {"uc-emitter-combinator.signal"}} + if params[1] and params[1].signal then + layout.add{type = "choose-elem-button", name = "signal1", elem_type = "signal", signal = params[1].signal} + else + layout.add{type = "choose-elem-button", name = "signal1", elem_type = "signal"} + end + layout.add{type = "label", caption = "Filter: (?)", tooltip = {"uc-emitter-combinator.filter"}} + for i= 2,6 do + if params[i] and params[i].signal then + layout.add{type = "choose-elem-button", name = "signal" .. i, elem_type = "signal", signal = params[i].signal} + else + layout.add{type = "choose-elem-button", name = "signal" .. i, elem_type = "signal"} + end + end + layout.add{type = "button", name = "uc-exit", caption = "Ok"} + end + end, + on_place = function(entity, item) + if item ~= nil and item.get_tag("uc_meta") ~= nil then + local tag = item.get_tag("uc_meta") + tag.meta.entity = entity + return { meta = tag.meta } + end + return { + meta = { + entity = entity, + params = {} + } + } + end, + on_destroy = function(meta, item) + item.set_tag("uc_meta", meta) + end, + on_tick = function(object) + local control = object.meta.entity.get_or_create_control_behavior() + if control then + local params = object.meta.params + if control.enabled then + for i = 2,6 do + if params[i] and params[i].signal and params[i].signal.name then + object.meta.params[i].count = get_count(control, params[i].signal) + end + end + end + end + end +} \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/combinators/uc-max-combinator.lua b/UsefulCombinators_0.5.1/combinators/uc-max-combinator.lua new file mode 100644 index 0000000..1bed504 --- /dev/null +++ b/UsefulCombinators_0.5.1/combinators/uc-max-combinator.lua @@ -0,0 +1,85 @@ +return { + on_click = function(player, object) + local params = object.meta.params + local gui = player.gui.center.uc["uc-max-combinator"] + for i = 1,5 do + if gui["signal"..i].elem_value and gui["signal"..i].elem_value.name then + object.meta.params[i] = {signal = gui["signal"..i].elem_value} + else + object.meta.params[i] = {signal = {type = "virtual"}} + end + end + end, + on_key = function(player, object) + if not (player.gui.center["uc"]) then + local params = object.meta.params + local gui = player.gui.center + local uc = gui.add{type = "frame", name = "uc", caption = "Max Combinator"} + local layout = uc.add{type = "table", name = "uc-max-combinator", column_count = 6} + layout.add{type = "label", caption = "Filter: (?)", tooltip = {"uc-max-combinator.filter"}} + for i = 1,5 do + if params[i].signal and params[i].signal.name then + layout.add{type = "choose-elem-button", name = "signal"..i, elem_type = "signal", signal = params[i].signal} + else + layout.add{type = "choose-elem-button", name = "signal"..i, elem_type = "signal"} + end + end + layout.add{type = "button", name = "uc-exit", caption = "Ok"} + end + end, + on_place = function(entity, item) + if item ~= nil and item.get_tag("uc_meta") ~= nil then + local tag = item.get_tag("uc_meta") + tag.meta.entity = entity + return { meta = tag.meta } + end + return { + meta = { + entity = entity, + params = { + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}} + }, + + } + } + end, + on_destroy = function(meta, item) + item.set_tag("uc_meta", meta) + end, + on_tick = function(object) + local control = object.meta.entity.get_or_create_control_behavior() + if control then + local params = object.meta.params + if control.enabled then + local slots = {} + 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 + end + end + count = 1 + if count == -math.huge then + count = 0 + end + for _,i in pairs(params) do + if i.signal.name then + if signal.name == i.signal.name then + table.insert(slots, {signal = signal, count = count, index = 1}) + end + end + end + control.parameters = slots + else + control.parameters = nil + end + end + end +} \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/combinators/uc-min-combinator.lua b/UsefulCombinators_0.5.1/combinators/uc-min-combinator.lua new file mode 100644 index 0000000..79ae645 --- /dev/null +++ b/UsefulCombinators_0.5.1/combinators/uc-min-combinator.lua @@ -0,0 +1,85 @@ +return { + on_click = function(player, object) + local params = object.meta.params + local gui = player.gui.center.uc["uc-min-combinator"] + for i = 1,5 do + if gui["signal"..i].elem_value and gui["signal"..i].elem_value.name then + object.meta.params[i] = {signal = gui["signal"..i].elem_value} + else + object.meta.params[i] = {signal = {type = "virtual"}} + end + end + end, + on_key = function(player, object) + if not (player.gui.center["uc"]) then + local params = object.meta.params + local gui = player.gui.center + local uc = gui.add{type = "frame", name = "uc", caption = "Min Combinator"} + local layout = uc.add{type = "table", name = "uc-min-combinator", column_count = 6} + layout.add{type = "label", caption = "Filter: (?)", tooltip = {"uc-min-combinator.filter"}} + for i = 1,5 do + if params[i].signal and params[i].signal.name then + layout.add{type = "choose-elem-button", name = "signal"..i, elem_type = "signal", signal = params[i].signal} + else + layout.add{type = "choose-elem-button", name = "signal"..i, elem_type = "signal"} + end + end + layout.add{type = "button", name = "uc-exit", caption = "Ok"} + end + end, + on_place = function(entity, item) + if item ~= nil and item.get_tag("uc_meta") ~= nil then + local tag = item.get_tag("uc_meta") + tag.meta.entity = entity + return { meta = tag.meta } + end + return { + meta = { + entity = entity, + params = { + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}} + } + } + } + end, + on_destroy = function(meta, item) + item.set_tag("uc_meta", meta) + end, + on_tick = function(object) + local control = object.meta.entity.get_or_create_control_behavior() + if control then + local params = object.meta.params + if control.enabled then + local slots = {} + local signals = get_signals(control) + local signal = {type = "virtual"} + local count = math.huge + for k,v in pairs(signals) do + count = math.min(count, v.count) + if count == v.count then + signal = v.signal + end + end + count = 1 + if count == math.huge then + count = 0 + end + for i = 1,5 do + if params[i].signal and params[i].signal.name then + if signal.name == params[i].signal.name then + table.insert(slots, {signal = signal, count = count, index = 1}) + break + end + end + end + control.parameters = slots + else + control.parameters = nil + end + end + end +} \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/combinators/uc-nand-gate-combinator.lua b/UsefulCombinators_0.5.1/combinators/uc-nand-gate-combinator.lua new file mode 100644 index 0000000..666a3f4 --- /dev/null +++ b/UsefulCombinators_0.5.1/combinators/uc-nand-gate-combinator.lua @@ -0,0 +1,97 @@ +return { + on_click = function(player, object) + local gui = player.gui.center.uc["uc-nand-gate-combinator"] + local params = object.meta.params + if gui["signal_a"].elem_value and gui["signal_a"].elem_value.name then + params[1] = {signal = gui["signal_a"].elem_value} + else + params[1] = {signal = {type = "virtual"}} + end + if gui["signal_b"].elem_value and gui["signal_b"].elem_value.name then + params[2] = {signal = gui["signal_b"].elem_value} + else + params[2] = {signal = {type = "virtual"}} + end + if gui["signal_c"].elem_value and gui["signal_c"].elem_value.name then + params[3] = {signal = gui["signal_c"].elem_value} + else + params[3] = {signal = {type = "virtual"}} + end + end, + on_key = function(player, object) + if not (player.gui.center["uc"]) then + local params = object.meta.params + local gui = player.gui.center + local uc = gui.add{type = "frame", name = "uc", caption = "NAND Gate Combinator"} + local layout = uc.add{type = "table", name = "uc-nand-gate-combinator", column_count = 5} + if params[1].signal and params[1].signal.name then + layout.add{type = "choose-elem-button", name = "signal_a", elem_type = "signal", signal = params[1].signal} + else + layout.add{type = "choose-elem-button", name = "signal_a", elem_type = "signal"} + end + layout.add{type = "label", caption = "NAND"} + if params[2].signal and params[2].signal.name then + layout.add{type = "choose-elem-button", name = "signal_b", elem_type = "signal", signal = params[2].signal} + else + layout.add{type = "choose-elem-button", name = "signal_b", elem_type = "signal"} + end + layout.add{type = "label", caption = " = "} + if params[3].signal and params[3].signal.name then + layout.add{type = "choose-elem-button", name = "signal_c", elem_type = "signal", signal = params[3].signal} + else + layout.add{type = "choose-elem-button", name = "signal_c", elem_type = "signal"} + end + layout.add{type = "button", name = "uc-exit", caption = "Ok"} + end + end, + on_place = function(entity, item) + if item ~= nil and item.get_tag("uc_meta") ~= nil then + local tag = item.get_tag("uc_meta") + tag.meta.entity = entity + return { meta = tag.meta } + end + return { + meta = { + entity = entity, + params = { + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}}, + {signal = {type = "virtual", name = "uc-output-signal"}} + } + } + } + end, + on_destroy = function(meta, item) + item.set_tag("uc_meta", meta) + end, + on_tick = function(object) + local control = object.meta.entity.get_or_create_control_behavior() + if control then + local params = object.meta.params + if params[3].signal then + if control.enabled then + local slots = {} + local c1,c2 = 0,0 + if params[1].signal.name then + c1 = get_count(control, params[1].signal) + end + if params[2].signal.name then + c2 = get_count(control, params[2].signal) + end + if params[3].signal.name then + if (c1 > 0) and (c2 > 0) and (c1 == c2) then + table.insert(slots, {signal = params[3].signal, count = 0, index = 1}) + else + table.insert(slots, {signal = params[3].signal, count = 1, index = 1}) + end + end + control.parameters = slots + end + else + control.parameters = { + {signal = {type = "virtual", name = "uc-output-signal"}, count = 0, index = 1} + } + end + end + end +} \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/combinators/uc-nor-gate-combinator.lua b/UsefulCombinators_0.5.1/combinators/uc-nor-gate-combinator.lua new file mode 100644 index 0000000..f504d6c --- /dev/null +++ b/UsefulCombinators_0.5.1/combinators/uc-nor-gate-combinator.lua @@ -0,0 +1,97 @@ +return { + on_click = function(player, object) + local gui = player.gui.center.uc["uc-nor-gate-combinator"] + local params = object.meta.params + if gui["signal_a"].elem_value and gui["signal_a"].elem_value.name then + params[1] = {signal = gui["signal_a"].elem_value} + else + params[1] = {signal = {type = "virtual"}} + end + if gui["signal_b"].elem_value and gui["signal_b"].elem_value.name then + params[2] = {signal = gui["signal_b"].elem_value} + else + params[2] = {signal = {type = "virtual"}} + end + if gui["signal_c"].elem_value and gui["signal_c"].elem_value.name then + params[3] = {signal = gui["signal_c"].elem_value} + else + params[3] = {signal = {type = "virtual"}} + end + end, + on_key = function(player, object) + if not (player.gui.center["uc"]) then + local params = object.meta.params + local gui = player.gui.center + local uc = gui.add{type = "frame", name = "uc", caption = "NOR Gate Combinator"} + local layout = uc.add{type = "table", name = "uc-nor-gate-combinator", column_count = 5} + if params[1].signal and params[1].signal.name then + layout.add{type = "choose-elem-button", name = "signal_a", elem_type = "signal", signal = params[1].signal} + else + layout.add{type = "choose-elem-button", name = "signal_a", elem_type = "signal"} + end + layout.add{type = "label", caption = "NOR"} + if params[2].signal and params[2].signal.name then + layout.add{type = "choose-elem-button", name = "signal_b", elem_type = "signal", signal = params[2].signal} + else + layout.add{type = "choose-elem-button", name = "signal_b", elem_type = "signal"} + end + layout.add{type = "label", caption = " = "} + if params[3].signal and params[3].signal.name then + layout.add{type = "choose-elem-button", name = "signal_c", elem_type = "signal", signal = params[3].signal} + else + layout.add{type = "choose-elem-button", name = "signal_c", elem_type = "signal"} + end + layout.add{type = "button", name = "uc-exit", caption = "Ok"} + end + end, + on_place = function(entity, item) + if item ~= nil and item.get_tag("uc_meta") ~= nil then + local tag = item.get_tag("uc_meta") + tag.meta.entity = entity + return { meta = tag.meta } + end + return { + meta = { + entity = entity, + params = { + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}}, + {signal = {type = "virtual", name = "uc-output-signal"}} + } + } + } + end, + on_destroy = function(meta, item) + item.set_tag("uc_meta", meta) + end, + on_tick = function(object) + local control = object.meta.entity.get_or_create_control_behavior() + if control then + local params = object.meta.params + if params[3].signal then + if control.enabled then + local slots = {} + local c1,c2 = 0,0 + if params[1].signal.name then + c1 = get_count(control, params[1].signal) + end + if params[2].signal.name then + c2 = get_count(control, params[2].signal) + end + if params[3].signal.name then + if (c1 >= 1) or (c2 >= 1) then + table.insert(slots, {signal = params[3].signal, count = 0, index = 1}) + else + table.insert(slots, {signal = params[3].signal, count = 1, index = 1}) + end + end + control.parameters = slots + end + else + control.parameters = { + {signal = {type = "virtual", name = "uc-output-signal"}, count = 0, index = 1} + } + end + end + end +} \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/combinators/uc-not-gate-combinator.lua b/UsefulCombinators_0.5.1/combinators/uc-not-gate-combinator.lua new file mode 100644 index 0000000..f87b98e --- /dev/null +++ b/UsefulCombinators_0.5.1/combinators/uc-not-gate-combinator.lua @@ -0,0 +1,83 @@ +return { + on_click = function(player, object) + local gui = player.gui.center.uc["uc-not-gate-combinator"] + local params = object.meta.params + if gui["signal_a"].elem_value and gui["signal_a"].elem_value.name then + params[1] = {signal = gui["signal_a"].elem_value} + else + params[1] = {signal = {type = "virtual"}} + end + if gui["signal_b"].elem_value and gui["signal_b"].elem_value.name then + params[2] = {signal = gui["signal_b"].elem_value} + else + params[2] = {signal = {type = "virtual"}} + end + end, + on_key = function(player, object) + if not (player.gui.center["uc"]) then + local params = object.meta.params + local gui = player.gui.center + local uc = gui.add{type = "frame", name = "uc", caption = "NOT Gate Combinator"} + local layout = uc.add{type = "table", name = "uc-not-gate-combinator", column_count = 4} + layout.add{type = "label", caption = "NOT"} + if params[1].signal and params[1].signal.name then + layout.add{type = "choose-elem-button", name = "signal_a", elem_type = "signal", signal = params[1].signal} + else + layout.add{type = "choose-elem-button", name = "signal_a", elem_type = "signal"} + end + layout.add{type = "label", caption = " = "} + if params[2].signal and params[2].signal.name then + layout.add{type = "choose-elem-button", name = "signal_b", elem_type = "signal", signal = params[2].signal} + else + layout.add{type = "choose-elem-button", name = "signal_b", elem_type = "signal"} + end + layout.add{type = "button", name = "uc-exit", caption = "Ok"} + end + end, + on_place = function(entity, item) + if item ~= nil and item.get_tag("uc_meta") ~= nil then + local tag = item.get_tag("uc_meta") + tag.meta.entity = entity + return { meta = tag.meta } + end + return { + meta = { + entity = entity, + params = { + {signal = {type = "virtual"}}, + {signal = {type = "virtual", name = "uc-output-signal"}} + } + } + } + end, + on_destroy = function(meta, item) + item.set_tag("uc_meta", meta) + end, + on_tick = function(object) + local control = object.meta.entity.get_or_create_control_behavior() + if control then + local params = object.meta.params + if params[2].signal then + if control.enabled then + local slots = {} + local c1,c2 = 0,0 + if params[1].signal.name then + c1 = get_count(control, params[1].signal) + end + if params[2].signal.name then + if (c1 > 0) then + table.insert(slots, {signal = params[2].signal, count = 0, index = 1}) + else + table.insert(slots, {signal = params[2].signal, count = 1, index = 1}) + end + end + control.parameters = slots + end + else + control.parameters = { + {signal = {type = "virtual", name = "uc-output-signal"}, count = 0, index = 1} + } + end + end + end +} \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/combinators/uc-or-gate-combinator.lua b/UsefulCombinators_0.5.1/combinators/uc-or-gate-combinator.lua new file mode 100644 index 0000000..b15fcf6 --- /dev/null +++ b/UsefulCombinators_0.5.1/combinators/uc-or-gate-combinator.lua @@ -0,0 +1,97 @@ +return { + on_click = function(player, object) + local gui = player.gui.center.uc["uc-or-gate-combinator"] + local params = object.meta.params + if gui["signal_a"].elem_value and gui["signal_a"].elem_value.name then + params[1] = {signal = gui["signal_a"].elem_value} + else + params[1] = {signal = {type = "virtual"}} + end + if gui["signal_b"].elem_value and gui["signal_b"].elem_value.name then + params[2] = {signal = gui["signal_b"].elem_value} + else + params[2] = {signal = {type = "virtual"}} + end + if gui["signal_c"].elem_value and gui["signal_c"].elem_value.name then + params[3] = {signal = gui["signal_c"].elem_value} + else + params[3] = {signal = {type = "virtual"}} + end + end, + on_key = function(player, object) + if not (player.gui.center["uc"]) then + local params = object.meta.params + local gui = player.gui.center + local uc = gui.add{type = "frame", name = "uc", caption = "OR Gate Combinator"} + local layout = uc.add{type = "table", name = "uc-or-gate-combinator", column_count = 5} + if params[1].signal and params[1].signal.name then + layout.add{type = "choose-elem-button", name = "signal_a", elem_type = "signal", signal = params[1].signal} + else + layout.add{type = "choose-elem-button", name = "signal_a", elem_type = "signal"} + end + layout.add{type = "label", caption = "OR"} + if params[2].signal and params[2].signal.name then + layout.add{type = "choose-elem-button", name = "signal_b", elem_type = "signal", signal = params[2].signal} + else + layout.add{type = "choose-elem-button", name = "signal_b", elem_type = "signal"} + end + layout.add{type = "label", caption = " = "} + if params[3].signal and params[3].signal.name then + layout.add{type = "choose-elem-button", name = "signal_c", elem_type = "signal", signal = params[3].signal} + else + layout.add{type = "choose-elem-button", name = "signal_c", elem_type = "signal"} + end + layout.add{type = "button", name = "uc-exit", caption = "Ok"} + end + end, + on_place = function(entity, item) + if item ~= nil and item.get_tag("uc_meta") ~= nil then + local tag = item.get_tag("uc_meta") + tag.meta.entity = entity + return { meta = tag.meta } + end + return { + meta = { + entity = entity, + params = { + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}}, + {signal = {type = "virtual", name = "uc-output-signal"}} + } + } + } + end, + on_destroy = function(meta, item) + item.set_tag("uc_meta", meta) + end, + on_tick = function(object) + local control = object.meta.entity.get_or_create_control_behavior() + if control then + local params = object.meta.params + if params[3].signal then + if control.enabled then + local slots = {} + local c1,c2 = 0,0 + if params[1].signal.name then + c1 = get_count(control, params[1].signal) + end + if params[2].signal.name then + c2 = get_count(control, params[2].signal) + end + if params[3].signal.name then + if (c1 >= 1) or (c2 >= 1) then + table.insert(slots, {signal = params[3].signal, count = 1, index = 1}) + else + table.insert(slots, {signal = params[3].signal, count = 0, index = 1}) + end + end + control.parameters = slots + end + else + control.parameters = { + {signal = {type = "virtual", name = "uc-output-signal"}, count = 0, index = 1} + } + end + end + end +} \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/combinators/uc-pollution-combinator.lua b/UsefulCombinators_0.5.1/combinators/uc-pollution-combinator.lua new file mode 100644 index 0000000..f8fca68 --- /dev/null +++ b/UsefulCombinators_0.5.1/combinators/uc-pollution-combinator.lua @@ -0,0 +1,59 @@ +return { + on_click = function(player, object) + local gui = player.gui.center + if gui["uc"]["uc-pollution-combinator"]["output"].elem_value and gui["uc"]["uc-pollution-combinator"]["output"].elem_value.name then + object.meta.minutes = gui["uc"]["uc-pollution-combinator"]["output"].elem_value + else + object.meta.minutes = {type = "virtual"} + end + end, + on_key = function(player, object) + if not (player.gui.center["uc"]) then + local meta = object.meta + local gui = player.gui.center + local uc = gui.add{type = "frame", name = "uc", caption = "Pollution Combinator"} + local layout = uc.add{type = "table", name = "uc-pollution-combinator", column_count = 2} + layout.add{type = "label", caption = "Output: (?)", tooltip = {"uc-pollution-combinator.output"}} + if meta.output and meta.output.name then + layout.add{type = "choose-elem-button", name = "output", elem_type = "signal", signal = meta.output} + else + layout.add{type = "choose-elem-button", name = "output", elem_type = "signal"} + end + layout.add{type = "button", name = "uc-exit", caption = "Ok"} + end + end, + on_place = function(entity, item) + if item ~= nil and item.get_tag("uc_meta") ~= nil then + local tag = item.get_tag("uc_meta") + tag.meta.entity = entity + return { meta = tag.meta } + end + return { + meta = { + entity = entity, + output = {type = "virtual", name = "uc-output-signal"} + } + } + end, + on_destroy = function(meta, item) + item.set_tag("uc_meta", meta) + end, + on_tick = function(object) + local control = object.meta.entity.get_or_create_control_behavior() + if control then + if control.enabled then + local slots = {} + local meta = object.meta + local pollution = meta.entity.surface.get_pollution(meta.entity.position) + if meta.output and meta.output.name then + table.insert(slots, {signal = meta.output, count = pollution, index = 1}) + end + control.parameters = slots + end + else + control.parameters = { + {signal = {type = "virtual", name = "uc-output-signal"}, count = 0, index = 1} + } + end + end +} \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/combinators/uc-power-combinator.lua b/UsefulCombinators_0.5.1/combinators/uc-power-combinator.lua new file mode 100644 index 0000000..79281d5 --- /dev/null +++ b/UsefulCombinators_0.5.1/combinators/uc-power-combinator.lua @@ -0,0 +1,102 @@ +return { + on_click = function(player, object) + local gui = player.gui.center + object.meta.ticks = tonumber(gui["uc"]["uc-power-combinator"]["ticks"].text) or 1 + end, + on_key = function(player, object) + if not (player.gui.center["uc"]) then + local gui = player.gui.center + local uc = gui.add{type = "frame", name = "uc", caption = "Power Combinator"} + local layout = uc.add{type = "table", name = "uc-power-combinator", column_count = 2} + layout.add{type = "label", caption = "Ticks: (?)", tooltip = {"uc-power-combinator.ticks"}} + layout.add{type = "textfield", name = "ticks", style = "uc_text", text = object.meta.ticks} + layout.add{type = "button", name = "uc-exit", caption = "Ok"} + end + end, + on_place = function(entity, item) + if item ~= nil and item.get_tag("uc_meta") ~= nil then + local tag = item.get_tag("uc_meta") + tag.meta.entity = entity + return { meta = tag.meta } + end + return { + meta = { + entity = entity, + ticks = 1, + prev = 0, + params = { + {signal = {type = "virtual", name = "uc-watts-signal"}, count = 0, index = 4}, + {signal = {type = "virtual", name = "uc-kilo-watts-signal"}, count = 0, index = 3}, + {signal = {type = "virtual", name = "uc-mega-watts-signal"}, count = 0, index = 2}, + {signal = {type = "virtual", name = "uc-giga-watts-signal"}, count = 0, index = 1} + } + } + } + end, + on_destroy = function(object) end, + on_tick = function(object) + local control = object.meta.entity.get_or_create_control_behavior() + if control then + local params = object.meta.params + if params[1].signal.name then + local ticks = object.meta.ticks + if ticks < 1 then + ticks = 1 + object.meta.ticks = 1 + end + if ticks > 3600 then + ticks = 3600 + object.meta.ticks = 3600 + end + if control.enabled then + local slots = { + {signal = params[4].signal, count = params[4].count, index = 4}, + {signal = params[3].signal, count = params[3].count, index = 3}, + {signal = params[2].signal, count = params[2].count, index = 2}, + {signal = params[1].signal, count = params[1].count, index = 1} + } + local pos = object.meta.entity.position + local poles = object.meta.entity.surface.find_entities_filtered( + { + area = {{pos.x - 1, pos.y - 1}, {pos.x + 1, pos.y + 1}}, + type = "electric-pole" + }) + local power = 0 + local watts = 0 + if #poles > 0 then + for _,p in pairs(poles) do + for k,v in pairs(p.electric_network_statistics.output_counts) do + power = power + (p.electric_network_statistics.get_output_count(k) or 0) + end + if power > 0 then + break + end + end + watts = (power - object.meta.prev) * 60 + object.meta.prev = power + end + if ((game.tick % ticks) == 0) then + slots = {} + local w = watts % 1000 + local kw = ((watts - w) / 1000) % 1000 + local mw = ((watts - (w + (kw * 1000))) / (10 ^ 6)) % 1000 + local gw = ((watts - (w + (kw * 1000) + (mw * 10 ^ 6))) / (10 ^ 9)) + table.insert(slots, {signal = {type = "virtual", name = "uc-giga-watts-signal"}, count = gw, index = 1}) + table.insert(slots, {signal = {type = "virtual", name = "uc-mega-watts-signal"}, count = mw, index = 2}) + table.insert(slots, {signal = {type = "virtual", name = "uc-kilo-watts-signal"}, count = kw, index = 3}) + table.insert(slots, {signal = {type = "virtual", name = "uc-watts-signal"}, count = w, index = 4}) + object.meta.params = slots + end + control.parameters = slots + end + else + control.parameters = { + {signal = {type = "virtual", name = "uc-watts-signal"}, count = 0, index = 4}, + {signal = {type = "virtual", name = "uc-kilo-watts-signal"}, count = 0, index = 3}, + {signal = {type = "virtual", name = "uc-mega-watts-signal"}, count = 0, index = 2}, + {signal = {type = "virtual", name = "uc-giga-watts-signal"}, count = 0, index = 1}, + } + end + end + end +} \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/combinators/uc-railway-combinator.lua b/UsefulCombinators_0.5.1/combinators/uc-railway-combinator.lua new file mode 100644 index 0000000..7be9fbb --- /dev/null +++ b/UsefulCombinators_0.5.1/combinators/uc-railway-combinator.lua @@ -0,0 +1,72 @@ +return { + on_click = function(player, object) + local gui = player.gui.center + if gui["uc"]["uc-railway-combinator"]["signal"].elem_value and gui["uc"]["uc-railway-combinator"]["signal"].elem_value.name then + object.meta.signal = gui["uc"]["uc-railway-combinator"]["signal"].elem_value + else + object.meta.signal = {type = "virtual"} + end + end, + on_key = function(player, object) + if not (player.gui.center["uc"]) then + local meta = object.meta + local gui = player.gui.center + local uc = gui.add{type = "frame", name = "uc", caption = "Railway Combinator"} + local layout = uc.add{type = "table", name = "uc-railway-combinator", column_count = 2} + layout.add{type = "label", caption = "Output: (?)", tooltip = {"uc-railway-combinator.output"}} + if meta.signal and meta.signal.name then + layout.add{type = "choose-elem-button", name = "signal", elem_type = "signal", signal = meta.signal} + else + layout.add{type = "choose-elem-button", name = "signal", elem_type = "signal"} + end + layout.add{type = "button", name = "uc-exit", caption = "Ok"} + end + end, + on_place = function(entity, item) + if item ~= nil and item.get_tag("uc_meta") ~= nil then + local tag = item.get_tag("uc_meta") + tag.meta.entity = entity + return { meta = tag.meta } + end + return { + meta = { + entity = entity, + signal = {type = "virtual", name = "uc-output-signal"} + } + } + end, + on_destroy = function(meta, item) + item.set_tag("uc_meta", meta) + end, + on_tick = function(object) + local control = object.meta.entity.get_or_create_control_behavior() + if control then + local output = object.meta.signal + if output then + if control.enabled then + local slots = {} + local pos = object.meta.entity.position + local units = object.meta.entity.surface.count_entities_filtered( + { + position = pos, + radius = 3, + type = { + "locomotive", + "cargo-wagon", + "fluid-wagon", + "artillery-wagon" + } + }) + if output.name then + table.insert(slots, {signal = output, count = units, index = 1}) + end + control.parameters = slots + end + else + control.parameters = { + {signal = {type = "virtual", name = "uc-output-signal"}, count = 0, index = 1} + } + end + end + end +} \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/combinators/uc-random-combinator.lua b/UsefulCombinators_0.5.1/combinators/uc-random-combinator.lua new file mode 100644 index 0000000..0cd6311 --- /dev/null +++ b/UsefulCombinators_0.5.1/combinators/uc-random-combinator.lua @@ -0,0 +1,97 @@ +return { + on_click = function(player, object) + local params = object.meta.params + local gui = player.gui.center.uc["uc-random-combinator"] + if gui["signal1"].elem_value and gui["signal1"].elem_value.name then + object.meta.params[1] = {signal = gui["signal1"].elem_value} + else + object.meta.params[1] = {signal = {type = "virtual"}} + end + if gui["signal2"].elem_value and gui["signal2"].elem_value.name then + object.meta.params[2] = {signal = gui["signal2"].elem_value} + else + object.meta.params[2] = {signal = {type = "virtual"}} + end + object.meta.range.minimum = tonumber(gui["lower"].text) or object.meta.range.minimum + object.meta.range.maximum = tonumber(gui["upper"].text) or object.meta.range.maximum + object.meta.ticks = tonumber(gui["ticks"].text) or object.meta.ticks + end, + on_key = function(player, object) + if not (player.gui.center["uc"]) then + local params = object.meta.params + local gui = player.gui.center + local uc = gui.add{type = "frame", name = "uc", caption = "Random Combinator"} + local layout = uc.add{type = "table", name = "uc-random-combinator", column_count = 2} + layout.add{type = "label", caption = "Trigger: (?)", tooltip = {"uc-random-combinator.trigger"}} + if params[1].signal and params[1].signal.name then + layout.add{type = "choose-elem-button", name = "signal1", elem_type = "signal", signal = params[1].signal} + else + layout.add{type = "choose-elem-button", name = "signal1", elem_type = "signal"} + end + layout.add{type = "label", caption = "Output: (?)", tooltip = {"uc-random-combinator.output"}} + if params[2].signal and params[2].signal.name then + layout.add{type = "choose-elem-button", name = "signal2", elem_type = "signal", signal = params[2].signal} + else + layout.add{type = "choose-elem-button", name = "signal2", elem_type = "signal"} + end + layout.add{type = "label", caption = "Lower Limit: (?)", tooltip = {"uc-random-combinator.lower"}} + layout.add{type = "textfield", name = "lower", style = "uc_text", text = object.meta.range.minimum} + layout.add{type = "label", caption = "Upper Limit: (?)", tooltip = {"uc-random-combinator.upper"}} + layout.add{type = "textfield", name = "upper", style = "uc_text", text = object.meta.range.maximum} + layout.add{type = "label", caption = "Ticks: (?)", tooltip = {"uc-random-combinator.ticks"}} + layout.add{type = "textfield", name = "ticks", style = "uc_text", text = object.meta.ticks} + layout.add{type = "button", name = "uc-exit", caption = "Ok"} + end + end, + on_place = function(entity, item) + if item ~= nil and item.get_tag("uc_meta") ~= nil then + local tag = item.get_tag("uc_meta") + tag.meta.entity = entity + return { meta = tag.meta } + end + return { + meta = { + entity = entity, + params = { + {signal = {type = "virtual", name = "uc-input-signal"}}, + {signal = {type = "virtual", name = "uc-output-signal"}, count = 0}, + }, + range = { + minimum = 1, + maximum = 10 + }, + ticks = 60 + } + } + end, + on_destroy = function(meta, item) + item.set_tag("uc_meta", meta) + end, + on_tick = function(object) + local control = object.meta.entity.get_or_create_control_behavior() + if control then + local params = object.meta.params + if params[1].signal and params[1].signal.name then + if control.enabled then + if object.meta.range.minimum < 1 then object.meta.range.minimum = 1 end + if object.meta.range.maximum <= object.meta.range.minimum then object.meta.range.maximum = object.meta.range.minimum + 1 end + if object.meta.ticks < 1 then object.meta.ticks = 1 end + if object.meta.ticks > 180 then object.meta.ticks = 180 end + local count = control.parameters[1].count or 0 + if get_count(control, params[1].signal) >= 1 then + count = math.random(object.meta.range.minimum,object.meta.range.maximum) + end + if (game.tick % object.meta.ticks) == 0 then + control.parameters = { + {signal = params[2].signal, count = count, index = 1} + } + end + end + else + control.parameters = { + {signal = {type = "virtual", name = "uc-output-signal"}, count = 0, index = 1} + } + end + end + end +} \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/combinators/uc-receiver-combinator.lua b/UsefulCombinators_0.5.1/combinators/uc-receiver-combinator.lua new file mode 100644 index 0000000..bb6e874 --- /dev/null +++ b/UsefulCombinators_0.5.1/combinators/uc-receiver-combinator.lua @@ -0,0 +1,66 @@ +return { + on_click = function(player, object) + local gui = player.gui.center + if gui["uc"]["uc-receiver-combinator"]["signal"].elem_value then + object.meta.signal = gui["uc"]["uc-receiver-combinator"]["signal"].elem_value + else + object.meta.signal = { type = "virtual" } + end + end, + on_key = function(player, object) + if not (player.gui.center["uc"]) then + local gui = player.gui.center + local uc = gui.add{type = "frame", name = "uc", caption = "Receiver Combinator"} + local layout = uc.add{type = "table", name = "uc-receiver-combinator", column_count = 2} + layout.add{type = "label", caption = "Signal: (?)", tooltip = {"uc-receiver-combinator.signal"}} + layout.add{type = "choose-elem-button", name = "signal", elem_type = "signal", signal = object.meta.signal} + layout.add{type = "button", name = "uc-exit", caption = "Ok"} + end + end, + on_place = function(entity, item) + if item ~= nil and item.get_tag("uc_meta") ~= nil then + local tag = item.get_tag("uc_meta") + tag.meta.entity = entity + return { meta = tag.meta } + end + return { + meta = { + entity = entity, + signal = { type = "virtual", name = "signal-0"} + } + } + end, + on_destroy = function(meta, item) + item.set_tag("uc_meta", meta) + end, + on_tick = function(object) + local control = object.meta.entity.get_or_create_control_behavior() + if control then + local params = control.parameters.parameters + if object.meta.signal.name then + local slots = {} + local p1 = object.meta.signal + if control.enabled then + local sender + for k,v in pairs(global["uc_data"]["uc-emitter-combinator"]) do + if v.meta.params[1] and (p1.name == v.meta.params[1].signal.name) then + sender = v.meta + break + end + end + if sender then + local sender_control = sender.entity.get_control_behavior() + for i = 2,6 do + if sender.params[i].signal and sender.params[i].signal.name then + table.insert(slots, {signal = sender.params[i].signal, count = sender.params[i].count, index = (i - 1)}) + end + end + end + control.parameters = slots + end + else + control.parameters = nil + end + end + end +} \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/combinators/uc-sensor-combinator.lua b/UsefulCombinators_0.5.1/combinators/uc-sensor-combinator.lua new file mode 100644 index 0000000..3bf6224 --- /dev/null +++ b/UsefulCombinators_0.5.1/combinators/uc-sensor-combinator.lua @@ -0,0 +1,81 @@ +return { + on_click = function(player, object) + local gui = player.gui.center + if gui["uc"]["uc-sensor-combinator"]["signal"].elem_value and gui["uc"]["uc-sensor-combinator"]["signal"].elem_value.name then + object.meta.signal = gui["uc"]["uc-sensor-combinator"]["signal"].elem_value + else + object.meta.signal = {type = "virtual"} + end + object.meta.radius = tonumber(gui["uc"]["uc-sensor-combinator"]["radius"].text) or object.meta.radius + end, + on_key = function(player, object) + if not (player.gui.center["uc"]) then + local meta = object.meta + local gui = player.gui.center + local uc = gui.add{type = "frame", name = "uc", caption = "Sensor Combinator"} + local layout = uc.add{type = "table", name = "uc-sensor-combinator", column_count = 4} + layout.add{type = "label", caption = "Radius: (?)", tooltip = {"uc-sensor-combinator.radius"}} + layout.add{type = "textfield", name = "radius", style = "uc_text", text = meta.radius} + layout.add{type = "label", caption = "Signal: (?)", tooltip = {"uc-sensor-combinator.signal"}} + if meta.signal and meta.signal.name then + layout.add{type = "choose-elem-button", name = "signal", elem_type = "signal", signal = meta.signal} + else + layout.add{type = "choose-elem-button", name = "signal", elem_type = "signal"} + end + layout.add{type = "button", name = "uc-exit", caption = "Ok"} + end + end, + on_place = function(entity, item) + if item ~= nil and item.get_tag("uc_meta") ~= nil then + local tag = item.get_tag("uc_meta") + tag.meta.entity = entity + return { meta = tag.meta } + end + return { + meta = { + entity = entity, + radius = 24, + signal = {type = "virtual", name = "uc-output-signal"} + } + } + end, + on_destroy = function(meta, item) + item.set_tag("uc_meta", meta) + end, + on_tick = function(object) + local control = object.meta.entity.get_or_create_control_behavior() + if control then + local signal = object.meta.signal + if signal then + if control.enabled then + local r = object.meta.radius + if r > 24 then + r = 24 + object.meta.radius = 24 + end + if r < 1 then + r = 1 + object.meta.radius = 1 + end + local slots = {} + local pos = object.meta.entity.position + local units = object.meta.entity.surface.count_entities_filtered( + { + position = pos, + --area = {{pos.x - (r + 0.5), pos.y - (r + 0.5)}, {pos.x + (r + 0.5), pos.y + (r + 0.5)}}, + radius = r + 0.5, + type = "player" + }) + if signal.name then + table.insert(slots, {signal = signal, count = units, index = 1}) + end + control.parameters = slots + end + else + control.parameters = { + {signal = {type = "virtual", name = "uc-output-signal"}, count = 0, index = 1} + } + end + end + end +} \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/combinators/uc-statistic-combinator.lua b/UsefulCombinators_0.5.1/combinators/uc-statistic-combinator.lua new file mode 100644 index 0000000..3e37301 --- /dev/null +++ b/UsefulCombinators_0.5.1/combinators/uc-statistic-combinator.lua @@ -0,0 +1,117 @@ +return { + on_click = function(player, object) + local gui = player.gui.center + local params = {} + for i = 1,5 do + if gui["uc"]["uc-statistic-combinator"]["signal"..i].elem_value then + params[i] = {signal = {name = gui["uc"]["uc-statistic-combinator"]["signal"..i].elem_value, type = "item"}} + else + params[i] = {signal = {type = "item"}} + end + end + object.meta.params = params + object.meta.index = gui["uc"]["uc-statistic-combinator"]["stat"].selected_index + --object.meta.ticks = tonumber(gui["uc"]["statistic-combinator"]["ticks"].text) or 1 + end, + on_key = function(player, object) + if not (player.gui.center["uc"]) then + local gui = player.gui.center + local params = object.meta.params + local uc = gui.add{type = "frame", name = "uc", caption = "Statistic Combinator"} + local layout = uc.add{type = "table", name = "uc-statistic-combinator", column_count = 8} + layout.add{type = "label", caption = "Type: (?)", tooltip = {"uc-statistic-combinator.stat"}} + layout.add{type = "drop-down", name = "stat", items = {{"uc-statistic-combinator.production"}, {"uc-statistic-combinator.consumption"}}, selected_index = object.meta.index} + --layout.add{type = "label", caption = "Ticks: (?)", tooltip = {"statistic-combinator.ticks"}} + --layout.add{type = "textfield", name = "ticks", style = "uc_text", text = object.meta.ticks} + layout.add{type = "label", caption = "Filter: (?)", tooltip = {"uc-statistic-combinator.filter"}} + for i= 1,5 do + if params[i] and params[i].signal and params[i].signal.name then + layout.add{type = "choose-elem-button", name = "signal" .. i, elem_type = "item", item = params[i].signal.name} + else + layout.add{type = "choose-elem-button", name = "signal" .. i, elem_type = "item"} + end + end + layout.add{type = "button", name = "uc-exit", caption = "Ok"} + end + end, + on_place = function(entity, item) + if item ~= nil and item.get_tag("uc_meta") ~= nil then + local tag = item.get_tag("uc_meta") + tag.meta.entity = entity + return { meta = tag.meta } + end + return { + meta = { + entity = entity, + params = { + {signal = {type = "item"}, count = 0, index = 1}, + {signal = {type = "item"}, count = 0, index = 2}, + {signal = {type = "item"}, count = 0, index = 3}, + {signal = {type = "item"}, count = 0, index = 4}, + {signal = {type = "item"}, count = 0, index = 5} + }, + --ticks = 300, + prev = {0, 0, 0, 0, 0}, + index = 1 + } + } + end, + on_destroy = function(meta, item) + item.set_tag("uc_meta", meta) + end, + on_tick = function(object) + local control = object.meta.entity.get_or_create_control_behavior() + if control then + local params = object.meta.params + if control.enabled then + local slots = { + {signal = params[1].signal, count = params[1].count or 0, index = 1}, + {signal = params[2].signal, count = params[2].count or 0, index = 2}, + {signal = params[3].signal, count = params[3].count or 0, index = 3}, + {signal = params[4].signal, count = params[4].count or 0, index = 4}, + {signal = params[5].signal, count = params[5].count or 0, index = 5} + } + --[[local ticks = object.meta.ticks + if ticks < 1 then + ticks = 1 + object.meta.ticks = 1 + end + if ticks > 3600 then + ticks = 3600 + object.meta.ticks = 3600 + end]] + if ((game.tick % 60) == 0) then + for i = 1,5 do + if params[i] and params[i].signal and params[i].signal.name then + local stats + local flow + if game.item_prototypes[params[i].signal.name] and game.item_prototypes[params[i].signal.name].type == "fluid" then + stats = object.meta.entity.force.fluid_production_statistics + else + stats = object.meta.entity.force.item_production_statistics + end + if object.meta.index == 1 then + flow = stats.get_input_count(params[i].signal.name) or 0 + elseif object.meta.index == 2 then + flow = stats.get_output_count(params[i].signal.name) or 0 + end + local old = object.meta.prev[i] + object.meta.params[i].count = flow - old + table.insert(slots, {signal = params[i].signal, count = object.meta.params[i].count, index = i}) + object.meta.prev[i] = flow + end + end + end + control.parameters = slots + end + else + control.parameters = { + {signal = {type = "item", name = "coal"}, count = 1, index = 1}, + {signal = {type = "item"}, count = 0, index = 2}, + {signal = {type = "item"}, count = 0, index = 3}, + {signal = {type = "item"}, count = 0, index = 4}, + {signal = {type = "item"}, count = 0, index = 5} + } + end + end +} \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/combinators/uc-timer-combinator.lua b/UsefulCombinators_0.5.1/combinators/uc-timer-combinator.lua new file mode 100644 index 0000000..3152142 --- /dev/null +++ b/UsefulCombinators_0.5.1/combinators/uc-timer-combinator.lua @@ -0,0 +1,73 @@ +return { + on_click = function(player, object) + local gui = player.gui.center.uc["uc-timer-combinator"] + object.meta.reset = tonumber(gui["reset"].text) or object.meta.reset + object.meta.ticks = tonumber(gui["ticks"].text) or object.meta.ticks + if object.meta.running then + object.meta.running = false + end + object.meta.count = 0 + end, + on_key = function(player, object) + if not (player.gui.center["uc"]) then + local gui = player.gui.center + local uc = gui.add{type = "frame", name = "uc", caption = "Timer Combinator"} + local layout = uc.add{type = "table", name = "uc-timer-combinator", column_count = 2} + layout.add{type = "label", caption = "Reset Count: (?)", tooltip = {"uc-timer-combinator.reset"}} + layout.add{type = "textfield", name = "reset", style = "uc_text", text = object.meta.reset} + layout.add{type = "label", caption = "Update Interval: (?)", tooltip = {"uc-timer-combinator.ticks"}} + layout.add{type = "textfield", name = "ticks", style = "uc_text", text = object.meta.ticks} + layout.add{type = "button", name = "uc-exit", caption = "Ok"} + layout.add{type = "label", caption = "(extra info)", tooltip = {"uc-timer-combinator.extra"}} + end + end, + on_place = function(entity, item) + if item ~= nil and item.get_tag("uc_meta") ~= nil then + local tag = item.get_tag("uc_meta") + tag.meta.entity = entity + return { meta = tag.meta } + end + return { + meta = { + entity = entity, + count = 0, + reset = 10, + running = false, + ticks = 60 + } + } + end, + on_destroy = function(meta, item) + item.set_tag("uc_meta", meta) + end, + on_tick = function(object) + local control = object.meta.entity.get_or_create_control_behavior() + if control then + if control.enabled then + if get_count(control, {type = "virtual", name = "uc-start-signal"}) > 0 then + object.meta.running = true + end + if get_count(control, {type = "virtual", name = "uc-stop-signal"}) > 0 then + object.meta.running = false + end + if object.meta.running then + if (object.meta.ticks < 1) then object.meta.ticks = 1 end + if (object.meta.ticks > 3600) then object.meta.ticks = 3600 end + if (game.tick % object.meta.ticks) == 0 then + object.meta.count = object.meta.count + 1 + if object.meta.count > object.meta.reset then + object.meta.count = 0 + end + control.parameters = { + {signal = {type = "virtual", name = "uc-counting-signal"}, count = object.meta.count, index = 1} + } + end + end + else + control.parameters = { + {signal = {type = "virtual", name = "uc-counting-signal"}, count = 0, index = 1} + } + end + end + end +} \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/combinators/uc-xnor-gate-combinator.lua b/UsefulCombinators_0.5.1/combinators/uc-xnor-gate-combinator.lua new file mode 100644 index 0000000..b6b00cf --- /dev/null +++ b/UsefulCombinators_0.5.1/combinators/uc-xnor-gate-combinator.lua @@ -0,0 +1,97 @@ +return { + on_click = function(player, object) + local gui = player.gui.center.uc["uc-xnor-gate-combinator"] + local params = object.meta.params + if gui["signal_a"].elem_value and gui["signal_a"].elem_value.name then + params[1] = {signal = gui["signal_a"].elem_value} + else + params[1] = {signal = {type = "virtual"}} + end + if gui["signal_b"].elem_value and gui["signal_b"].elem_value.name then + params[2] = {signal = gui["signal_b"].elem_value} + else + params[2] = {signal = {type = "virtual"}} + end + if gui["signal_c"].elem_value and gui["signal_c"].elem_value.name then + params[3] = {signal = gui["signal_c"].elem_value} + else + params[3] = {signal = {type = "virtual"}} + end + end, + on_key = function(player, object) + if not (player.gui.center["uc"]) then + local params = object.meta.params + local gui = player.gui.center + local uc = gui.add{type = "frame", name = "uc", caption = "XNOR Gate Combinator"} + local layout = uc.add{type = "table", name = "uc-xnor-gate-combinator", column_count = 5} + if params[1].signal and params[1].signal.name then + layout.add{type = "choose-elem-button", name = "signal_a", elem_type = "signal", signal = params[1].signal} + else + layout.add{type = "choose-elem-button", name = "signal_a", elem_type = "signal"} + end + layout.add{type = "label", caption = "XNOR"} + if params[2].signal and params[2].signal.name then + layout.add{type = "choose-elem-button", name = "signal_b", elem_type = "signal", signal = params[2].signal} + else + layout.add{type = "choose-elem-button", name = "signal_b", elem_type = "signal"} + end + layout.add{type = "label", caption = " = "} + if params[3].signal and params[3].signal.name then + layout.add{type = "choose-elem-button", name = "signal_c", elem_type = "signal", signal = params[3].signal} + else + layout.add{type = "choose-elem-button", name = "signal_c", elem_type = "signal"} + end + layout.add{type = "button", name = "uc-exit", caption = "Ok"} + end + end, + on_place = function(entity, item) + if item ~= nil and item.get_tag("uc_meta") ~= nil then + local tag = item.get_tag("uc_meta") + tag.meta.entity = entity + return { meta = tag.meta } + end + return { + meta = { + entity = entity, + params = { + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}}, + {signal = {type = "virtual", name = "uc-output-signal"}} + } + } + } + end, + on_destroy = function(meta, item) + item.set_tag("uc_meta", meta) + end, + on_tick = function(object) + local control = object.meta.entity.get_or_create_control_behavior() + if control then + local params = object.meta.params + if params[3].signal then + if control.enabled then + local slots = {} + local c1,c2 = 0,0 + if params[1].signal.name then + c1 = get_count(control, params[1].signal) + end + if params[2].signal.name then + c2 = get_count(control, params[2].signal) + end + if params[3].signal.name then + if (c1 == c2) then + table.insert(slots, {signal = params[3].signal, count = 1, index = 1}) + else + table.insert(slots, {signal = params[3].signal, count = 0, index = 1}) + end + end + control.parameters = slots + end + else + control.parameters = { + {signal = {type = "virtual", name = "uc-output-signal"}, count = 0, index = 1} + } + end + end + end +} \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/combinators/uc-xor-gate-combinator.lua b/UsefulCombinators_0.5.1/combinators/uc-xor-gate-combinator.lua new file mode 100644 index 0000000..a391350 --- /dev/null +++ b/UsefulCombinators_0.5.1/combinators/uc-xor-gate-combinator.lua @@ -0,0 +1,97 @@ +return { + on_click = function(player, object) + local gui = player.gui.center.uc["uc-xor-gate-combinator"] + local params = object.meta.params + if gui["signal_a"].elem_value and gui["signal_a"].elem_value.name then + params[1] = {signal = gui["signal_a"].elem_value} + else + params[1] = {signal = {type = "virtual"}} + end + if gui["signal_b"].elem_value and gui["signal_b"].elem_value.name then + params[2] = {signal = gui["signal_b"].elem_value} + else + params[2] = {signal = {type = "virtual"}} + end + if gui["signal_c"].elem_value and gui["signal_c"].elem_value.name then + params[3] = {signal = gui["signal_c"].elem_value} + else + params[3] = {signal = {type = "virtual"}} + end + end, + on_key = function(player, object) + if not (player.gui.center["uc"]) then + local params = object.meta.params + local gui = player.gui.center + local uc = gui.add{type = "frame", name = "uc", caption = "XOR Gate Combinator"} + local layout = uc.add{type = "table", name = "uc-xor-gate-combinator", column_count = 5} + if params[1].signal and params[1].signal.name then + layout.add{type = "choose-elem-button", name = "signal_a", elem_type = "signal", signal = params[1].signal} + else + layout.add{type = "choose-elem-button", name = "signal_a", elem_type = "signal"} + end + layout.add{type = "label", caption = "XOR"} + if params[2].signal and params[2].signal.name then + layout.add{type = "choose-elem-button", name = "signal_b", elem_type = "signal", signal = params[2].signal} + else + layout.add{type = "choose-elem-button", name = "signal_b", elem_type = "signal"} + end + layout.add{type = "label", caption = " = "} + if params[3].signal and params[3].signal.name then + layout.add{type = "choose-elem-button", name = "signal_c", elem_type = "signal", signal = params[3].signal} + else + layout.add{type = "choose-elem-button", name = "signal_c", elem_type = "signal"} + end + layout.add{type = "button", name = "uc-exit", caption = "Ok"} + end + end, + on_place = function(entity, item) + if item ~= nil and item.get_tag("uc_meta") ~= nil then + local tag = item.get_tag("uc_meta") + tag.meta.entity = entity + return { meta = tag.meta } + end + return { + meta = { + entity = entity, + params = { + {signal = {type = "virtual"}}, + {signal = {type = "virtual"}}, + {signal = {type = "virtual", name = "uc-output-signal"}} + } + } + } + end, + on_destroy = function(meta, item) + item.set_tag("uc_meta", meta) + end, + on_tick = function(object) + local control = object.meta.entity.get_or_create_control_behavior() + if control then + local params = object.meta.params + if params[3].signal then + if control.enabled then + local slots = {} + local c1,c2 = 0,0 + if params[1].signal.name then + c1 = get_count(control, params[1].signal) + end + if params[2].signal.name then + c2 = get_count(control, params[2].signal) + end + if params[3].signal.name then + if (c1 == c2) then + table.insert(slots, {signal = params[3].signal, count = 0, index = 1}) + else + table.insert(slots, {signal = params[3].signal, count = 1, index = 1}) + end + end + control.parameters = slots + end + else + control.parameters = { + {signal = {type = "virtual", name = "uc-output-signal"}, count = 0, index = 1} + } + end + end + end +} \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/control.lua b/UsefulCombinators_0.5.1/control.lua new file mode 100644 index 0000000..d914a8c --- /dev/null +++ b/UsefulCombinators_0.5.1/control.lua @@ -0,0 +1,182 @@ +local data = {} +local classes = {} +local selected = {} +function save() + global["uc_data"] = data +end + +for _,name in pairs(require("combinators.list")) do + classes[name] = require("combinators." .. name) +end + +function get_count(control, signal) + if not signal then return 0 end + local red = control.get_circuit_network(defines.wire_type.red) + local green = control.get_circuit_network(defines.wire_type.green) + local val = 0 + if red then + val = red.get_signal(signal) or 0 + end + if green then + val = val + (green.get_signal(signal) or 0) + end + return val +end + +function get_signals(control) + local red = control.get_circuit_network(defines.wire_type.red) + local green = control.get_circuit_network(defines.wire_type.green) + local network = {} + if red and red.signals then + for _,v in pairs(red.signals) do + if v.signal.name then + network[v.signal.name] = v + end + end + end + if green and green.signals then + for _,v in pairs(green.signals) do + if v.signal.name then + network[v.signal.name] = v + end + end + end + return network +end + +function entity_built(event) + if classes[event.created_entity.name] ~= nil then + local tab = data[event.created_entity.name] or {} + table.insert(tab, classes[event.created_entity.name].on_place(event.created_entity, event.stack)) + data[event.created_entity.name] = tab + save() + end +end + +function pre_entity_removed(event) + if classes[event.entity.name] ~= nil then + for k,v in ipairs(data[event.entity.name]) do + if v.meta.entity == event.entity then + local tab = data[event.entity.name] + table.remove(tab, k) + classes[event.entity.name].on_destroy(v, event.buffer[1]) + data[event.entity.name] = tab + for i,j in pairs(selected) do + if j.entity == v.meta.entity then + j.player.gui.center["uc"].destroy() + table.remove(selected, i) + end + end + save() + break + end + end + end +end + +function tick() + for k,v in pairs(classes) do + if data ~= nil and data[k] ~= nil then + for q,i in pairs(data[k]) do + if i.meta and i.meta.entity.valid then + v.on_tick(i, q) + end + end + end + end +end + +function uc_load() + data = global["uc_data"] or {} +end + +function init() + data = global["uc_data"] or {} + for k,v in pairs(classes) do + data[k] = data[k] or {} + end +end + +function configuration_changed(cfg) + if cfg.mod_changes then + local changes = cfg.mod_changes["UsefulCombinators"] + if changes then + init() + if global["uc_data"] then + for k,v in pairs(classes) do + local tab = {} + for _,s in pairs(game.surfaces) do + for i,j in pairs(s.find_entities_filtered({name = k})) do + table.insert(tab, classes[k].on_place(j)) + data[k] = tab + end + end + save() + end + end + end + end +end + +function on_key(event) + local player = game.players[event.player_index] + local entity = player.selected + if entity and player.can_reach_entity(entity) then + for k,v in pairs(classes) do + if data ~= nil and data[k] ~= nil then + if entity.name == k then + for h,i in pairs(data[k]) do + if i.meta.entity.valid then + if i.meta.entity == entity then + if not (player.gui.center["uc"]) and not player.cursor_stack.valid_for_read then + table.insert(selected, { player = player, entity = entity}) + if entity.operable then + entity.operable = false + end + v.on_key(player, i) + break + end + end + end + end + end + end + end + end +end + +function on_click_ok(event) + local player = game.players[event.player_index] + local element = event.element + if element.name and element.name == "uc-exit" then + for k,v in pairs(classes) do + if data and data[k] then + for h,i in pairs(data[k]) do + for l,m in pairs(selected) do + if i.meta.entity == m.entity then + v.on_click(player, i) + table.remove(selected, l) + if not i.meta.entity.operable then + i.meta.entity.operable = true + end + break + end + end + end + end + end + player.gui.center["uc"].destroy() + end +end + +script.on_init(init) +script.on_load(uc_load) +script.on_event(defines.events.on_built_entity, entity_built) +script.on_event(defines.events.on_robot_built_entity, entity_built) +script.on_event(defines.events.on_player_mined_entity, pre_entity_removed) +script.on_event(defines.events.on_robot_mined_entity, pre_entity_removed) +script.on_event(defines.events.on_entity_died, entity_removed) +script.on_event(defines.events.on_tick, tick) +script.on_event(defines.events.on_gui_click, on_click_ok) +script.on_event("uc-edit", on_key) +script.on_configuration_changed(configuration_changed) \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/data.lua b/UsefulCombinators_0.5.1/data.lua new file mode 100644 index 0000000..1e32f1e --- /dev/null +++ b/UsefulCombinators_0.5.1/data.lua @@ -0,0 +1,16 @@ +require("prototypes.styles.uc") +require("prototypes.categories.usefulcombinators") +require("prototypes.categories.changes") +require("prototypes.entity.entities") +require("prototypes.item.items") +require("prototypes.signal.signal") +require("prototypes.recipe.recipes") +require("prototypes.technology.technology") + +data:extend({ + { + type = "custom-input", + name = "uc-edit", + key_sequence = "mouse-button-1", + } +}) \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-and-gate-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-and-gate-combinator.png new file mode 100644 index 0000000..749ca3c Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-and-gate-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-color-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-color-combinator.png new file mode 100644 index 0000000..393f1d8 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-color-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-constant-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-constant-combinator.png new file mode 100644 index 0000000..85520df Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-constant-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-converter-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-converter-combinator.png new file mode 100644 index 0000000..807e194 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-converter-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-counting-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-counting-combinator.png new file mode 100644 index 0000000..87f5c6c Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-counting-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-daytime-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-daytime-combinator.png new file mode 100644 index 0000000..6b308ca Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-daytime-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-detector-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-detector-combinator.png new file mode 100644 index 0000000..cd6db5d Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-detector-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-emitter-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-emitter-combinator.png new file mode 100644 index 0000000..70ff0f1 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-emitter-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-max-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-max-combinator.png new file mode 100644 index 0000000..9b5b86a Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-max-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-min-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-min-combinator.png new file mode 100644 index 0000000..c781332 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-min-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-nand-gate-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-nand-gate-combinator.png new file mode 100644 index 0000000..53b24b7 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-nand-gate-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-nor-gate-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-nor-gate-combinator.png new file mode 100644 index 0000000..a02dd4a Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-nor-gate-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-not-gate-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-not-gate-combinator.png new file mode 100644 index 0000000..93e9bb0 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-not-gate-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-or-gate-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-or-gate-combinator.png new file mode 100644 index 0000000..ce25d7e Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-or-gate-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-pollution-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-pollution-combinator.png new file mode 100644 index 0000000..3e6f514 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-pollution-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-power-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-power-combinator.png new file mode 100644 index 0000000..bd6b96e Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-power-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-railway-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-railway-combinator.png new file mode 100644 index 0000000..ec7eb06 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-railway-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-random-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-random-combinator.png new file mode 100644 index 0000000..1cbdcbb Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-random-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-receiver-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-receiver-combinator.png new file mode 100644 index 0000000..e62aed3 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-receiver-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-sensor-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-sensor-combinator.png new file mode 100644 index 0000000..fd5162d Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-sensor-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-statistic-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-statistic-combinator.png new file mode 100644 index 0000000..f8a6ea9 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-statistic-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-timer-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-timer-combinator.png new file mode 100644 index 0000000..5161252 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-timer-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-xnor-gate-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-xnor-gate-combinator.png new file mode 100644 index 0000000..c00de37 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-xnor-gate-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-xor-gate-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-xor-gate-combinator.png new file mode 100644 index 0000000..776b42c Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/hr-uc-xor-gate-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-and-gate-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-and-gate-combinator.png new file mode 100644 index 0000000..5a301e6 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-and-gate-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-color-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-color-combinator.png new file mode 100644 index 0000000..afd9d51 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-color-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-constant-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-constant-combinator.png new file mode 100644 index 0000000..e33fd5b Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-constant-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-converter-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-converter-combinator.png new file mode 100644 index 0000000..f6f3c5a Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-converter-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-counting-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-counting-combinator.png new file mode 100644 index 0000000..bcf225a Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-counting-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-daytime-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-daytime-combinator.png new file mode 100644 index 0000000..0b13c07 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-daytime-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-detector-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-detector-combinator.png new file mode 100644 index 0000000..5269ada Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-detector-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-emitter-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-emitter-combinator.png new file mode 100644 index 0000000..bcd0398 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-emitter-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-max-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-max-combinator.png new file mode 100644 index 0000000..3ff3def Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-max-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-min-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-min-combinator.png new file mode 100644 index 0000000..781a79f Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-min-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-nand-gate-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-nand-gate-combinator.png new file mode 100644 index 0000000..f86fc33 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-nand-gate-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-nor-gate-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-nor-gate-combinator.png new file mode 100644 index 0000000..d83db82 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-nor-gate-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-not-gate-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-not-gate-combinator.png new file mode 100644 index 0000000..d84cb34 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-not-gate-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-or-gate-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-or-gate-combinator.png new file mode 100644 index 0000000..8fb99b2 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-or-gate-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-pollution-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-pollution-combinator.png new file mode 100644 index 0000000..d9a72a6 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-pollution-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-power-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-power-combinator.png new file mode 100644 index 0000000..764b47f Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-power-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-railway-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-railway-combinator.png new file mode 100644 index 0000000..0227a18 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-railway-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-random-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-random-combinator.png new file mode 100644 index 0000000..817d5c1 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-random-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-receiver-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-receiver-combinator.png new file mode 100644 index 0000000..5cde068 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-receiver-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-sensor-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-sensor-combinator.png new file mode 100644 index 0000000..9cf4c34 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-sensor-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-statistic-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-statistic-combinator.png new file mode 100644 index 0000000..5bf1ef3 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-statistic-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-timer-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-timer-combinator.png new file mode 100644 index 0000000..e5dca47 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-timer-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-xnor-gate-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-xnor-gate-combinator.png new file mode 100644 index 0000000..4dc5670 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-xnor-gate-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-xor-gate-combinator.png b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-xor-gate-combinator.png new file mode 100644 index 0000000..bba51c7 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/entity/combinator/uc-xor-gate-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/clock.png b/UsefulCombinators_0.5.1/graphics/icons/clock.png new file mode 100644 index 0000000..ebe4f55 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/clock.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/signal/blank.png b/UsefulCombinators_0.5.1/graphics/icons/signal/blank.png new file mode 100644 index 0000000..77003d0 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/signal/blank.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/signal/blue-signal.png b/UsefulCombinators_0.5.1/graphics/icons/signal/blue-signal.png new file mode 100644 index 0000000..5776e22 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/signal/blue-signal.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/signal/counting-signal.png b/UsefulCombinators_0.5.1/graphics/icons/signal/counting-signal.png new file mode 100644 index 0000000..9c5b5a8 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/signal/counting-signal.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/signal/cyan-signal.png b/UsefulCombinators_0.5.1/graphics/icons/signal/cyan-signal.png new file mode 100644 index 0000000..c0343c5 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/signal/cyan-signal.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/signal/giga-watts-signal.png b/UsefulCombinators_0.5.1/graphics/icons/signal/giga-watts-signal.png new file mode 100644 index 0000000..c0bc16d Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/signal/giga-watts-signal.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/signal/green-signal.png b/UsefulCombinators_0.5.1/graphics/icons/signal/green-signal.png new file mode 100644 index 0000000..58a55aa Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/signal/green-signal.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/signal/input-signal.png b/UsefulCombinators_0.5.1/graphics/icons/signal/input-signal.png new file mode 100644 index 0000000..d5fac12 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/signal/input-signal.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/signal/kilo-watts-signal.png b/UsefulCombinators_0.5.1/graphics/icons/signal/kilo-watts-signal.png new file mode 100644 index 0000000..96319a3 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/signal/kilo-watts-signal.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/signal/magenta-signal.png b/UsefulCombinators_0.5.1/graphics/icons/signal/magenta-signal.png new file mode 100644 index 0000000..4884741 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/signal/magenta-signal.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/signal/mega-watts-signal.png b/UsefulCombinators_0.5.1/graphics/icons/signal/mega-watts-signal.png new file mode 100644 index 0000000..e9a0ec6 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/signal/mega-watts-signal.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/signal/minus-one-signal.png b/UsefulCombinators_0.5.1/graphics/icons/signal/minus-one-signal.png new file mode 100644 index 0000000..5cff650 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/signal/minus-one-signal.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/signal/output-signal.png b/UsefulCombinators_0.5.1/graphics/icons/signal/output-signal.png new file mode 100644 index 0000000..880f763 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/signal/output-signal.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/signal/plus-one-signal.png b/UsefulCombinators_0.5.1/graphics/icons/signal/plus-one-signal.png new file mode 100644 index 0000000..9cca51d Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/signal/plus-one-signal.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/signal/radius-signal.png b/UsefulCombinators_0.5.1/graphics/icons/signal/radius-signal.png new file mode 100644 index 0000000..80a1cd0 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/signal/radius-signal.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/signal/red-signal.png b/UsefulCombinators_0.5.1/graphics/icons/signal/red-signal.png new file mode 100644 index 0000000..9780a4d Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/signal/red-signal.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/signal/reset-signal.png b/UsefulCombinators_0.5.1/graphics/icons/signal/reset-signal.png new file mode 100644 index 0000000..63e02f1 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/signal/reset-signal.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/signal/start-signal.png b/UsefulCombinators_0.5.1/graphics/icons/signal/start-signal.png new file mode 100644 index 0000000..15aff30 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/signal/start-signal.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/signal/stop-signal.png b/UsefulCombinators_0.5.1/graphics/icons/signal/stop-signal.png new file mode 100644 index 0000000..42d1de3 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/signal/stop-signal.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/signal/ticks-signal.png b/UsefulCombinators_0.5.1/graphics/icons/signal/ticks-signal.png new file mode 100644 index 0000000..ea6b7a3 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/signal/ticks-signal.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/signal/watts-signal.png b/UsefulCombinators_0.5.1/graphics/icons/signal/watts-signal.png new file mode 100644 index 0000000..49c2b5b Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/signal/watts-signal.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/signal/white-signal.png b/UsefulCombinators_0.5.1/graphics/icons/signal/white-signal.png new file mode 100644 index 0000000..a459306 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/signal/white-signal.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/signal/yellow-signal.png b/UsefulCombinators_0.5.1/graphics/icons/signal/yellow-signal.png new file mode 100644 index 0000000..8e79f0b Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/signal/yellow-signal.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/uc-and-gate-combinator.png b/UsefulCombinators_0.5.1/graphics/icons/uc-and-gate-combinator.png new file mode 100644 index 0000000..bb77575 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/uc-and-gate-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/uc-color-combinator.png b/UsefulCombinators_0.5.1/graphics/icons/uc-color-combinator.png new file mode 100644 index 0000000..a1d1437 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/uc-color-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/uc-converter-combinator.png b/UsefulCombinators_0.5.1/graphics/icons/uc-converter-combinator.png new file mode 100644 index 0000000..b9dc54e Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/uc-converter-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/uc-counting-combinator.png b/UsefulCombinators_0.5.1/graphics/icons/uc-counting-combinator.png new file mode 100644 index 0000000..ac767c1 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/uc-counting-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/uc-daytime-combinator.png b/UsefulCombinators_0.5.1/graphics/icons/uc-daytime-combinator.png new file mode 100644 index 0000000..1ceb315 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/uc-daytime-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/uc-detector-combinator.png b/UsefulCombinators_0.5.1/graphics/icons/uc-detector-combinator.png new file mode 100644 index 0000000..1e79926 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/uc-detector-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/uc-emitter-combinator.png b/UsefulCombinators_0.5.1/graphics/icons/uc-emitter-combinator.png new file mode 100644 index 0000000..307f8b7 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/uc-emitter-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/uc-max-combinator.png b/UsefulCombinators_0.5.1/graphics/icons/uc-max-combinator.png new file mode 100644 index 0000000..7278435 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/uc-max-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/uc-min-combinator.png b/UsefulCombinators_0.5.1/graphics/icons/uc-min-combinator.png new file mode 100644 index 0000000..f5fdf6a Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/uc-min-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/uc-nand-gate-combinator.png b/UsefulCombinators_0.5.1/graphics/icons/uc-nand-gate-combinator.png new file mode 100644 index 0000000..bf66ef1 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/uc-nand-gate-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/uc-nor-gate-combinator.png b/UsefulCombinators_0.5.1/graphics/icons/uc-nor-gate-combinator.png new file mode 100644 index 0000000..e9738eb Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/uc-nor-gate-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/uc-not-gate-combinator.png b/UsefulCombinators_0.5.1/graphics/icons/uc-not-gate-combinator.png new file mode 100644 index 0000000..eea9236 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/uc-not-gate-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/uc-or-gate-combinator.png b/UsefulCombinators_0.5.1/graphics/icons/uc-or-gate-combinator.png new file mode 100644 index 0000000..274a557 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/uc-or-gate-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/uc-pollution-combinator.png b/UsefulCombinators_0.5.1/graphics/icons/uc-pollution-combinator.png new file mode 100644 index 0000000..774e738 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/uc-pollution-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/uc-power-combinator.png b/UsefulCombinators_0.5.1/graphics/icons/uc-power-combinator.png new file mode 100644 index 0000000..f118ef5 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/uc-power-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/uc-railway-combinator.png b/UsefulCombinators_0.5.1/graphics/icons/uc-railway-combinator.png new file mode 100644 index 0000000..33273cc Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/uc-railway-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/uc-random-combinator.png b/UsefulCombinators_0.5.1/graphics/icons/uc-random-combinator.png new file mode 100644 index 0000000..cb7a651 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/uc-random-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/uc-receiver-combinator.png b/UsefulCombinators_0.5.1/graphics/icons/uc-receiver-combinator.png new file mode 100644 index 0000000..6673652 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/uc-receiver-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/uc-sensor-combinator.png b/UsefulCombinators_0.5.1/graphics/icons/uc-sensor-combinator.png new file mode 100644 index 0000000..519b709 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/uc-sensor-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/uc-statistic-combinator.png b/UsefulCombinators_0.5.1/graphics/icons/uc-statistic-combinator.png new file mode 100644 index 0000000..56afdda Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/uc-statistic-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/uc-timer-combinator.png b/UsefulCombinators_0.5.1/graphics/icons/uc-timer-combinator.png new file mode 100644 index 0000000..8aa9a1e Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/uc-timer-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/uc-xnor-gate-combinator.png b/UsefulCombinators_0.5.1/graphics/icons/uc-xnor-gate-combinator.png new file mode 100644 index 0000000..81bd379 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/uc-xnor-gate-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/icons/uc-xor-gate-combinator.png b/UsefulCombinators_0.5.1/graphics/icons/uc-xor-gate-combinator.png new file mode 100644 index 0000000..72dd26b Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/icons/uc-xor-gate-combinator.png differ diff --git a/UsefulCombinators_0.5.1/graphics/technology/clock.png b/UsefulCombinators_0.5.1/graphics/technology/clock.png new file mode 100644 index 0000000..ebe4f55 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/technology/clock.png differ diff --git a/UsefulCombinators_0.5.1/graphics/technology/clock1.png b/UsefulCombinators_0.5.1/graphics/technology/clock1.png new file mode 100644 index 0000000..9ea1ca6 Binary files /dev/null and b/UsefulCombinators_0.5.1/graphics/technology/clock1.png differ diff --git a/UsefulCombinators_0.5.1/info.json b/UsefulCombinators_0.5.1/info.json new file mode 100644 index 0000000..35e47ed --- /dev/null +++ b/UsefulCombinators_0.5.1/info.json @@ -0,0 +1,11 @@ +{ + "name": "UsefulCombinators", + "version": "0.5.1", + "title": "Useful Combinators", + "author": "coltonj96", + "contact": "coltonjgriswold@aim.com", + "homepage": "https://mods.factorio.com/mods/coltonj96/UsefulCombinators", + "description": "Adds many useful combinators that do various things! some simplify combinator logic whilst others add new functionality!", + "factorio_version": "1.1", + "dependencies": ["base >= 0.18"] + } \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/locale/en/en.cfg b/UsefulCombinators_0.5.1/locale/en/en.cfg new file mode 100644 index 0000000..ebf8004 --- /dev/null +++ b/UsefulCombinators_0.5.1/locale/en/en.cfg @@ -0,0 +1,233 @@ +[item-group-name] +useful-combinators=Useful Combinators + +[item-name] +uc-and-gate-combinator=And Gate Combinator +uc-color-combinator=Color Combinator +uc-converter-combinator=Converter Combinator +uc-counting-combinator=Counting Combinator +uc-daytime-combinator=Daytime Combinator +uc-detector-combinator=Detector Combinator +uc-emitter-combinator=Emitter Combinator +uc-max-combinator=Max Combinator +uc-min-combinator=Min Combinator +uc-nand-gate-combinator=Nand Gate Combinator +uc-nor-gate-combinator=Nor Gate Combinator +uc-not-gate-combinator=Not Gate Combinator +uc-or-gate-combinator=Or Gate Combinator +uc-pollution-combinator=Pollution Combinator +uc-power-combinator=Power Combinator +uc-railway-combinator=Railway Combinator +uc-random-combinator=Random Combinator +uc-receiver-combinator=Receiver Combinator +uc-sensor-combinator=Sensor Combinator +uc-statistic-combinator=Statistic Combinator +uc-timer-combinator=Timer Combinator +uc-xnor-gate-combinator=Xnor Gate Combinator +uc-xor-gate-combinator=Xor Gate Combinator + +[item-description] +uc-and-gate-combinator=If 'a' and 'b' are more than 0 and 'a' equals 'b' then output 1 else output 0 ((((a > 0) and (b > 0)) and (a == b)) ? 1 : 0) +uc-color-combinator=If input value equals one of Color values, outputs that color +uc-converter-combinator=Converts signal 'a' into signal 'b' +uc-counting-combinator=Adds/Subtracts to its output count when condition is true +uc-daytime-combinator=Outputs in-game time of day +uc-detector-combinator=Outputs number of enemies within its radius +uc-emitter-combinator=Emits its input signals to any receivers with the same first signal +uc-max-combinator=Outputs the largest value of its inputs +uc-min-combinator=Outputs the smallest value of its inputs +uc-nand-gate-combinator=If 'a' and 'b' are more than 0 and 'a' equals 'b' then output 0 else output 1 ((((a > 0) and (b > 0)) and (a == b)) ? 0 : 1) +uc-not-gate-combinator=If 'a' is greater than 0 then output 0 else output 1 (a > 0 ? 0 : 1) +uc-nor-gate-combinator=If 'a' or 'b' is greater than or equal to 1 then output 0 (((a >= 1) or (b >=1)) ? 0 : 1) +uc-or-gate-combinator=If 'a' or 'b' is greater than or equal to 1 then output 1 (((a >= 1) or (b >=1)) ? 1 : 0) +uc-pollution-combinator=Outputs amount of pollution at its location +uc-power-combinator=Outputs power network usage when next to a power pole, when ticks is more than one (60 ticks equals one second) updates output after that many ticks +uc-railway-combinator=Outputs a signal when next to a railway with a train going by +uc-random-combinator=Outputs a random number between Lower and Upper that changes if receives an Input Signal with a value of one or more +uc-receiver-combinator=Receives Emitters signals +uc-sensor-combinator=Outputs number of players within its radius +uc-statistic-combinator=Outputs statistics for production/consumption of items that are selected in items per second +uc-timer-combinator=Counts up until Reset Signal count is reached +uc-xnor-gate-combinator=If 'a' equals 'b' then output 1 else output 0 (a == B ? 1 : 0) +uc-xor-gate-combinator=If 'a' equals 'b' then output 0 else output 1 (a == B ? 0 : 1) + +[entity-name] +uc-and-gate-combinator=And Gate Combinator +uc-color-combinator=Color Combinator +uc-converter-combinator=Converter Combinator +uc-counting-combinator=Counting Combinator +uc-daytime-combinator=Daytime Combinator +uc-detector-combinator=Detector Combinator +uc-emitter-combinator=Emitter Combinator +uc-max-combinator=Max Combinator +uc-min-combinator=Min Combinator +uc-nand-gate-combinator=Nand Gate Combinator +uc-nor-gate-combinator=Nor Gate Combinator +uc-not-gate-combinator=Not Gate Combinator +uc-or-gate-combinator=Or Gate Combinator +uc-pollution-combinator=Pollution Combinator +uc-power-combinator=Power Combinator +uc-railway-combinator=Railway Combinator +uc-random-combinator=Random Combinator +uc-receiver-combinator=Receiver Combinator +uc-sensor-combinator=Sensor Combinator +uc-statistic-combinator=Statistic Combinator +uc-timer-combinator=Timer Combinator +uc-xnor-gate-combinator=Xnor Gate Combinator +uc-xor-gate-combinator=Xor Gate Combinator + +[entity-description] +uc-and-gate-combinator=Default to open GUI is mouse-button-1 or Left Click on the Combinator +uc-color-combinator=Default to open GUI is mouse-button-1 or Left Click on the Combinator +uc-converter-combinator=Default to open GUI is mouse-button-1 or Left Click on the Combinator +uc-counting-combinator=Default to open GUI is mouse-button-1 or Left Click on the Combinator +uc-daytime-combinator=Default to open GUI is mouse-button-1 or Left Click on the Combinator +uc-detector-combinator=Default to open GUI is mouse-button-1 or Left Click on the Combinator +uc-emitter-combinator=Default to open GUI is mouse-button-1 or Left Click on the Combinator +uc-max-combinator=Default to open GUI is mouse-button-1 or Left Click on the Combinator +uc-min-combinator=Default to open GUI is mouse-button-1 or Left Click on the Combinator +uc-nand-gate-combinator=Default to open GUI is mouse-button-1 or Left Click on the Combinator +uc-not-gate-combinator=Default to open GUI is mouse-button-1 or Left Click on the Combinator +uc-nor-gate-combinator=Default to open GUI is mouse-button-1 or Left Click on the Combinator +uc-or-gate-combinator=Default to open GUI is mouse-button-1 or Left Click on the Combinator +uc-pollution-combinator=Default to open GUI is mouse-button-1 or Left Click on the Combinator +uc-uc-power-combinator=Default to open GUI is mouse-button-1 or Left Click on the Combinator +uc-railway-combinator=Default to open GUI is mouse-button-1 or Left Click on the Combinator +uc-random-combinator=Default to open GUI is mouse-button-1 or Left Click on the Combinator +uc-receiver-combinator=Default to open GUI is mouse-button-1 or Left Click on the Combinator +uc-sensor-combinator=Default to open GUI is mouse-button-1 or Left Click on the Combinator +uc-statistic-combinator=Default to open GUI is mouse-button-1 or Left Click on the Combinator +uc-timer-combinator=Default to open GUI is mouse-button-1 or Left Click on the Combinator +uc-xnor-gate-combinator=Default to open GUI is mouse-button-1 or Left Click on the Combinator +uc-xor-gate-combinator=Default to open GUI is mouse-button-1 or Left Click on the Combinator + +[virtual-signal-name] +uc-blank=Blank +uc-blue-signal=Blue Color Signal +uc-counting-signal=Counting Signal +uc-cyan-signal=Cyan Color Signal +uc-giga-watts-signal=GigaWatts Signal +uc-green-signal=Green Color Signal +uc-input-signal=Input Signal +uc-kilo-watts-signal=KiloWatts Signal +uc-magenta-signal=Magenta Color Signal +uc-mega-watts-signal=MegaWatts Signal +uc-minus-one-signal=Minus One Signal +uc-output-signal=Output Signal +uc-plus-one-signal=Plus One Signal +uc-radius-signal=Radius Signal +uc-red-signal=Red Color Signal +uc-reset-signal=Reset Signal +uc-start-signal=Start Signal +uc-stop-signal=Stop Signal +uc-ticks-signal=Ticks Signal +uc-watts-signal=Watts Signal +uc-white-signal=White Color Signal +uc-yellow-signal=Yellow Color Signal + +[recipe-name] +uc-and-gate-combinator=And Gate Combinator +uc-color-combinator=Color Combinator +uc-converter-combinator=Converter Combinator +uc-counting-combinator=Counting Combinator +uc-daytime-combinator=Daytime Combinator +uc-detector-combinator=Detector Combinator +uc-emitter-combinator=Linked Combinator +uc-max-combinator=Max Combinator +uc-min-combinator=Min Combinator +uc-nand-gate-combinator=Nand Gate Combinator +uc-nor-gate-combinator=Nor Gate Combinator +uc-not-gate-combinator=Not Gate Combinator +uc-or-gate-combinator=Or Gate Combinator +uc-pollution-combinator=Pollution Combinator +uc-power-combinator=Power Combinator +uc-railway-combinator=Railway Combinator +uc-random-combinator=Random Combinator +uc-sensor-combinator=Sensor Combinator +uc-statistic-combinator=Statistic Combinator +uc-timer-combinator=Timer Combinator +uc-xnor-gate-combinator=Xnor Gate Combinator +uc-xor-gate-combinator=Xor Gate Combinator + +[technology-name] +useful-combinators=Useful Combinators + +[technology-description] +useful-combinators=Unlock useful combinators! + +[controls] +uc-edit=Open GUI + +[mod-setting-name] +uc-emitter_receiver_filter_count=Emitter/Receiver filter count + +[mod-setting-description] +uc-emitter_receiver_filter_count=Adjust filter count + +[uc-timer-combinator] +extra=Requires 'Start Signal' to start and stops with 'Stop Signal' +reset=Count to restart at +ticks=Ticks before updating (60 ticks ~ 1 second) + +[uc-counting-combinator] +extra=Setting the reset to -1 will make the combinator count indefinitely +reset=Count to restart at + +[uc-random-combinator] +trigger=Signal that triggers the combinator +output=Signal that the combinator will output +lower=Lower random limit +upper=Upper random limit +ticks=Delay before updating output (60 ticks ~ 1 second) + +[uc-min-combinator] +filter=Signals that will be affected + +[uc-max-combinator] +filter=Signals that will be affected + +[uc-converter-combinator] +from=Signal to convert +to=Signal to output + +[uc-detector-combinator] +radius=Search radius in tiles +signal=Signal to output + +[uc-sensor-combinator] +radius=Search radius in tiles +signal=Signal to output + +[uc-railway-combinator] +output=Signal to output + +[uc-color-combinator] +red=Output red when condition is met +green=Output green when condition is met +blue=Output blue when condition is met +yellow=Output yellow when condition is met +magenta=Output magenta when condition is met +cyan=Output cyan when condition is met + +[uc-emitter-combinator] +signal=Signal to act as a channel to output on +filter=Signals to capture and output onto Signal + +[uc-receiver-combinator] +signal=Signal to act as a channel to receive signals from + +[uc-power-combinator] +ticks=Tick delay before outputs update (60 ticks ~ 1 second) + +[uc-daytime-combinator] +minutes=Signal to output in-game minutes +hours=Signal to output in-game hours + +[uc-pollution-combinator] +output=Signal to output + +[uc-statistic-combinator] +filter=Items to track statistics for +stat=Type of statistic to output +production=Production +consumption=Consumption \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.0.2.lua b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.0.2.lua new file mode 100644 index 0000000..10e4b55 --- /dev/null +++ b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.0.2.lua @@ -0,0 +1,11 @@ +game.reload_script() + +for index, force in pairs(game.forces) do + force.reset_technologies() + if force.technologies["useful-combinators"].researched then + force.recipes["random-combinator"].enabled = true + force.recipes["comparator-combinator"].enabled = true + force.recipes["timer-combinator"].enabled = true + force.recipes["counting-combinator"].enabled = true + end +end \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.0.3.lua b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.0.3.lua new file mode 100644 index 0000000..10e4b55 --- /dev/null +++ b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.0.3.lua @@ -0,0 +1,11 @@ +game.reload_script() + +for index, force in pairs(game.forces) do + force.reset_technologies() + if force.technologies["useful-combinators"].researched then + force.recipes["random-combinator"].enabled = true + force.recipes["comparator-combinator"].enabled = true + force.recipes["timer-combinator"].enabled = true + force.recipes["counting-combinator"].enabled = true + end +end \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.0.6.lua b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.0.6.lua new file mode 100644 index 0000000..693e2ca --- /dev/null +++ b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.0.6.lua @@ -0,0 +1,13 @@ +game.reload_script() + +for index, force in pairs(game.forces) do + force.reset_technologies() + if force.technologies["useful-combinators"].researched then + force.recipes["random-combinator"].enabled = true + force.recipes["comparator-combinator"].enabled = true + force.recipes["timer-combinator"].enabled = true + force.recipes["counting-combinator"].enabled = true + force.recipes["min-combinator"].enabled = true + force.recipes["max-combinator"].enabled = true + end +end \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.0.8.lua b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.0.8.lua new file mode 100644 index 0000000..70ba518 --- /dev/null +++ b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.0.8.lua @@ -0,0 +1,20 @@ +game.reload_script() + +for index, force in pairs(game.forces) do + force.reset_technologies() + if force.technologies["useful-combinators"].researched then + force.recipes["random-combinator"].enabled = true + force.recipes["comparator-combinator"].enabled = true + force.recipes["timer-combinator"].enabled = true + force.recipes["counting-combinator"].enabled = true + force.recipes["min-combinator"].enabled = true + force.recipes["max-combinator"].enabled = true + force.recipes["and-gate-combinator"].enabled = true + force.recipes["or-gate-combinator"].enabled = true + force.recipes["not-gate-combinator"].enabled = true + force.recipes["nand-gate-combinator"].enabled = true + force.recipes["nor-gate-combinator"].enabled = true + force.recipes["xor-gate-combinator"].enabled = true + force.recipes["xnor-gate-combinator"].enabled = true + end +end \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.1.4.lua b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.1.4.lua new file mode 100644 index 0000000..5bf2650 --- /dev/null +++ b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.1.4.lua @@ -0,0 +1,21 @@ +game.reload_script() + +for index, force in pairs(game.forces) do + force.reset_technologies() + if force.technologies["useful-combinators"].researched then + force.recipes["random-combinator"].enabled = true + force.recipes["comparator-combinator"].enabled = true + force.recipes["converter-combinator"].enabled = true + force.recipes["timer-combinator"].enabled = true + force.recipes["counting-combinator"].enabled = true + force.recipes["min-combinator"].enabled = true + force.recipes["max-combinator"].enabled = true + force.recipes["and-gate-combinator"].enabled = true + force.recipes["or-gate-combinator"].enabled = true + force.recipes["not-gate-combinator"].enabled = true + force.recipes["nand-gate-combinator"].enabled = true + force.recipes["nor-gate-combinator"].enabled = true + force.recipes["xor-gate-combinator"].enabled = true + force.recipes["xnor-gate-combinator"].enabled = true + end +end \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.1.8.lua b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.1.8.lua new file mode 100644 index 0000000..c2f636a --- /dev/null +++ b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.1.8.lua @@ -0,0 +1,23 @@ +game.reload_script() + +for index, force in pairs(game.forces) do + force.reset_technologies() + if force.technologies["useful-combinators"].researched then + force.recipes["random-combinator"].enabled = true + force.recipes["comparator-combinator"].enabled = true + force.recipes["converter-combinator"].enabled = true + force.recipes["timer-combinator"].enabled = true + force.recipes["counting-combinator"].enabled = true + force.recipes["min-combinator"].enabled = true + force.recipes["max-combinator"].enabled = true + force.recipes["and-gate-combinator"].enabled = true + force.recipes["or-gate-combinator"].enabled = true + force.recipes["not-gate-combinator"].enabled = true + force.recipes["nand-gate-combinator"].enabled = true + force.recipes["nor-gate-combinator"].enabled = true + force.recipes["xor-gate-combinator"].enabled = true + force.recipes["xnor-gate-combinator"].enabled = true + force.recipes["detector-combinator"].enabled = true + force.recipes["sensor-combinator"].enabled = true + end +end \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.1.9.lua b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.1.9.lua new file mode 100644 index 0000000..8974e54 --- /dev/null +++ b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.1.9.lua @@ -0,0 +1,24 @@ +game.reload_script() + +for index, force in pairs(game.forces) do + force.reset_technologies() + if force.technologies["useful-combinators"].researched then + force.recipes["random-combinator"].enabled = true + force.recipes["comparator-combinator"].enabled = true + force.recipes["converter-combinator"].enabled = true + force.recipes["timer-combinator"].enabled = true + force.recipes["counting-combinator"].enabled = true + force.recipes["min-combinator"].enabled = true + force.recipes["max-combinator"].enabled = true + force.recipes["and-gate-combinator"].enabled = true + force.recipes["or-gate-combinator"].enabled = true + force.recipes["not-gate-combinator"].enabled = true + force.recipes["nand-gate-combinator"].enabled = true + force.recipes["nor-gate-combinator"].enabled = true + force.recipes["xor-gate-combinator"].enabled = true + force.recipes["xnor-gate-combinator"].enabled = true + force.recipes["detector-combinator"].enabled = true + force.recipes["sensor-combinator"].enabled = true + force.recipes["railway-combinator"].enabled = true + end +end \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.2.1.lua b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.2.1.lua new file mode 100644 index 0000000..5af50f0 --- /dev/null +++ b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.2.1.lua @@ -0,0 +1,25 @@ +game.reload_script() + +for index, force in pairs(game.forces) do + force.reset_technologies() + if force.technologies["useful-combinators"].researched then + force.recipes["random-combinator"].enabled = true + force.recipes["comparator-combinator"].enabled = true + force.recipes["converter-combinator"].enabled = true + force.recipes["timer-combinator"].enabled = true + force.recipes["counting-combinator"].enabled = true + force.recipes["min-combinator"].enabled = true + force.recipes["max-combinator"].enabled = true + force.recipes["and-gate-combinator"].enabled = true + force.recipes["or-gate-combinator"].enabled = true + force.recipes["not-gate-combinator"].enabled = true + force.recipes["nand-gate-combinator"].enabled = true + force.recipes["nor-gate-combinator"].enabled = true + force.recipes["xor-gate-combinator"].enabled = true + force.recipes["xnor-gate-combinator"].enabled = true + force.recipes["detector-combinator"].enabled = true + force.recipes["sensor-combinator"].enabled = true + force.recipes["railway-combinator"].enabled = true + force.recipes["color-combinator"].enabled = true + end +end \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.2.5.lua b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.2.5.lua new file mode 100644 index 0000000..e7a55aa --- /dev/null +++ b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.2.5.lua @@ -0,0 +1,29 @@ +game.reload_script() + +for index, force in pairs(game.forces) do + force.reset_technologies() + if force.technologies["useful-combinators"].researched then + force.recipes["random-combinator"].enabled = true + force.recipes["converter-combinator"].enabled = true + if force.recipes["comparator-combinator"] then + force.recipes["comparator-combinator"].enabled = true + end + force.recipes["timer-combinator"].enabled = true + force.recipes["counting-combinator"].enabled = true + force.recipes["min-combinator"].enabled = true + force.recipes["max-combinator"].enabled = true + force.recipes["and-gate-combinator"].enabled = true + force.recipes["or-gate-combinator"].enabled = true + force.recipes["not-gate-combinator"].enabled = true + force.recipes["nand-gate-combinator"].enabled = true + force.recipes["nor-gate-combinator"].enabled = true + force.recipes["xor-gate-combinator"].enabled = true + force.recipes["xnor-gate-combinator"].enabled = true + force.recipes["detector-combinator"].enabled = true + force.recipes["sensor-combinator"].enabled = true + force.recipes["railway-combinator"].enabled = true + force.recipes["color-combinator"].enabled = true + force.recipes["emitter-combinator"].enabled = true + force.recipes["receiver-combinator"].enabled = true + end +end \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.2.9.lua b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.2.9.lua new file mode 100644 index 0000000..866f39f --- /dev/null +++ b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.2.9.lua @@ -0,0 +1,30 @@ +game.reload_script() + +for index, force in pairs(game.forces) do + force.reset_technologies() + if force.technologies["useful-combinators"].researched then + force.recipes["random-combinator"].enabled = true + if force.recipes["comparator-combinator"] then + force.recipes["comparator-combinator"].enabled = true + end + force.recipes["converter-combinator"].enabled = true + force.recipes["timer-combinator"].enabled = true + force.recipes["counting-combinator"].enabled = true + force.recipes["min-combinator"].enabled = true + force.recipes["max-combinator"].enabled = true + force.recipes["and-gate-combinator"].enabled = true + force.recipes["or-gate-combinator"].enabled = true + force.recipes["not-gate-combinator"].enabled = true + force.recipes["nand-gate-combinator"].enabled = true + force.recipes["nor-gate-combinator"].enabled = true + force.recipes["xor-gate-combinator"].enabled = true + force.recipes["xnor-gate-combinator"].enabled = true + force.recipes["detector-combinator"].enabled = true + force.recipes["sensor-combinator"].enabled = true + force.recipes["railway-combinator"].enabled = true + force.recipes["color-combinator"].enabled = true + force.recipes["emitter-combinator"].enabled = true + force.recipes["receiver-combinator"].enabled = true + force.recipes["power-combinator"].enabled = true + end +end \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.3.7.lua b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.3.7.lua new file mode 100644 index 0000000..08acf78 --- /dev/null +++ b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.3.7.lua @@ -0,0 +1,31 @@ +game.reload_script() + +for index, force in pairs(game.forces) do + force.reset_technologies() + if force.technologies["useful-combinators"].researched then + force.recipes["random-combinator"].enabled = true + if force.recipes["comparator-combinator"] then + force.recipes["comparator-combinator"].enabled = true + end + force.recipes["converter-combinator"].enabled = true + force.recipes["timer-combinator"].enabled = true + force.recipes["counting-combinator"].enabled = true + force.recipes["min-combinator"].enabled = true + force.recipes["max-combinator"].enabled = true + force.recipes["and-gate-combinator"].enabled = true + force.recipes["or-gate-combinator"].enabled = true + force.recipes["not-gate-combinator"].enabled = true + force.recipes["nand-gate-combinator"].enabled = true + force.recipes["nor-gate-combinator"].enabled = true + force.recipes["xor-gate-combinator"].enabled = true + force.recipes["xnor-gate-combinator"].enabled = true + force.recipes["detector-combinator"].enabled = true + force.recipes["sensor-combinator"].enabled = true + force.recipes["railway-combinator"].enabled = true + force.recipes["color-combinator"].enabled = true + force.recipes["emitter-combinator"].enabled = true + force.recipes["receiver-combinator"].enabled = true + force.recipes["power-combinator"].enabled = true + force.recipes["daytime-combinator"].enabled = true + end +end \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.3.8.lua b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.3.8.lua new file mode 100644 index 0000000..ad50ef6 --- /dev/null +++ b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.3.8.lua @@ -0,0 +1,32 @@ +game.reload_script() + +for index, force in pairs(game.forces) do + force.reset_technologies() + if force.technologies["useful-combinators"].researched then + force.recipes["random-combinator"].enabled = true + if force.recipes["comparator-combinator"] then + force.recipes["comparator-combinator"].enabled = true + end + force.recipes["converter-combinator"].enabled = true + force.recipes["timer-combinator"].enabled = true + force.recipes["counting-combinator"].enabled = true + force.recipes["min-combinator"].enabled = true + force.recipes["max-combinator"].enabled = true + force.recipes["and-gate-combinator"].enabled = true + force.recipes["or-gate-combinator"].enabled = true + force.recipes["not-gate-combinator"].enabled = true + force.recipes["nand-gate-combinator"].enabled = true + force.recipes["nor-gate-combinator"].enabled = true + force.recipes["xor-gate-combinator"].enabled = true + force.recipes["xnor-gate-combinator"].enabled = true + force.recipes["detector-combinator"].enabled = true + force.recipes["sensor-combinator"].enabled = true + force.recipes["railway-combinator"].enabled = true + force.recipes["color-combinator"].enabled = true + force.recipes["emitter-combinator"].enabled = true + force.recipes["receiver-combinator"].enabled = true + force.recipes["power-combinator"].enabled = true + force.recipes["daytime-combinator"].enabled = true + force.recipes["pollution-combinator"].enabled = true + end +end \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.4.0.lua b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.4.0.lua new file mode 100644 index 0000000..5ddbf43 --- /dev/null +++ b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.4.0.lua @@ -0,0 +1,33 @@ +game.reload_script() + +for index, force in pairs(game.forces) do + force.reset_technologies() + if force.technologies["useful-combinators"].researched then + force.recipes["random-combinator"].enabled = true + if force.recipes["comparator-combinator"] then + force.recipes["comparator-combinator"].enabled = true + end + force.recipes["converter-combinator"].enabled = true + force.recipes["timer-combinator"].enabled = true + force.recipes["counting-combinator"].enabled = true + force.recipes["min-combinator"].enabled = true + force.recipes["max-combinator"].enabled = true + force.recipes["and-gate-combinator"].enabled = true + force.recipes["or-gate-combinator"].enabled = true + force.recipes["not-gate-combinator"].enabled = true + force.recipes["nand-gate-combinator"].enabled = true + force.recipes["nor-gate-combinator"].enabled = true + force.recipes["xor-gate-combinator"].enabled = true + force.recipes["xnor-gate-combinator"].enabled = true + force.recipes["detector-combinator"].enabled = true + force.recipes["sensor-combinator"].enabled = true + force.recipes["railway-combinator"].enabled = true + force.recipes["color-combinator"].enabled = true + force.recipes["emitter-combinator"].enabled = true + force.recipes["receiver-combinator"].enabled = true + force.recipes["power-combinator"].enabled = true + force.recipes["daytime-combinator"].enabled = true + force.recipes["pollution-combinator"].enabled = true + force.recipes["statistic-combinator"].enabled = true + end +end \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.4.9.json b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.4.9.json new file mode 100644 index 0000000..5cc7893 --- /dev/null +++ b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.4.9.json @@ -0,0 +1,131 @@ +{ + "entity": + [ + ["and-gate-combinator", "uc-and-gate-combinator"], + ["color-combinator", "uc-color-combinator"], + ["converter-combinator", "uc-onverter-combinator"], + ["counting-combinator", "uc-counting-combinator"], + ["daytime-combinator", "uc-daytime-combinator"], + ["detector-combinator", "uc-detector-combinator"], + ["emitter-combinator", "uc-emitter-combinator"], + ["max-combinator", "uc-max-combinator"], + ["min-combinator", "uc-min-combinator"], + ["nand-gate-combinator", "uc-nand-gate-combinator"], + ["nor-gate-combinator", "uc-nor-gate-combinator"], + ["not-gate-combinator", "uc-not-gate-combinator"], + ["or-gate-combinator", "uc-or-gate-combinator"], + ["pollution-combinator", "uc-pollution-combinator"], + ["power-combinator", "uc-power-combinator"], + ["railway-combinator", "uc-railway-combinator"], + ["random-combinator", "uc-random-combinator"], + ["receiver-combinator", "uc-receiver-combinator"], + ["sensor-combinator", "uc-sensor-combinator"], + ["statistic-combinator", "uc-statistic-combinator"], + ["timer-combinator", "uc-timer-combinator"], + ["xnor-gate-combinator", "uc-xnor-gate-combinator"], + ["xor-gate-combinator", "uc-xor-gate-combinator"] + ], + "item": + [ + ["and-gate-combinator", "uc-and-gate-combinator"], + ["color-combinator", "uc-color-combinator"], + ["converter-combinator", "uc-onverter-combinator"], + ["counting-combinator", "uc-counting-combinator"], + ["daytime-combinator", "uc-daytime-combinator"], + ["detector-combinator", "uc-detector-combinator"], + ["emitter-combinator", "uc-emitter-combinator"], + ["max-combinator", "uc-max-combinator"], + ["min-combinator", "uc-min-combinator"], + ["nand-gate-combinator", "uc-nand-gate-combinator"], + ["nor-gate-combinator", "uc-nor-gate-combinator"], + ["not-gate-combinator", "uc-not-gate-combinator"], + ["or-gate-combinator", "uc-or-gate-combinator"], + ["pollution-combinator", "uc-pollution-combinator"], + ["power-combinator", "uc-power-combinator"], + ["railway-combinator", "uc-railway-combinator"], + ["random-combinator", "uc-random-combinator"], + ["receiver-combinator", "uc-receiver-combinator"], + ["sensor-combinator", "uc-sensor-combinator"], + ["statistic-combinator", "uc-statistic-combinator"], + ["timer-combinator", "uc-timer-combinator"], + ["xnor-gate-combinator", "uc-xnor-gate-combinator"], + ["xor-gate-combinator", "uc-xor-gate-combinator"] + ], + "recipe": + [ + ["and-gate-combinator", "uc-and-gate-combinator"], + ["color-combinator", "uc-color-combinator"], + ["converter-combinator", "uc-onverter-combinator"], + ["counting-combinator", "uc-counting-combinator"], + ["daytime-combinator", "uc-daytime-combinator"], + ["detector-combinator", "uc-detector-combinator"], + ["emitter-combinator", "uc-emitter-combinator"], + ["max-combinator", "uc-max-combinator"], + ["min-combinator", "uc-min-combinator"], + ["nand-gate-combinator", "uc-nand-gate-combinator"], + ["nor-gate-combinator", "uc-nor-gate-combinator"], + ["not-gate-combinator", "uc-not-gate-combinator"], + ["or-gate-combinator", "uc-or-gate-combinator"], + ["pollution-combinator", "uc-pollution-combinator"], + ["power-combinator", "uc-power-combinator"], + ["railway-combinator", "uc-railway-combinator"], + ["random-combinator", "uc-random-combinator"], + ["receiver-combinator", "uc-receiver-combinator"], + ["sensor-combinator", "uc-sensor-combinator"], + ["statistic-combinator", "uc-statistic-combinator"], + ["timer-combinator", "uc-timer-combinator"], + ["xnor-gate-combinator", "uc-xnor-gate-combinator"], + ["xor-gate-combinator", "uc-xor-gate-combinator"] + ], + "technology": + [ + ["and-gate-combinator", "uc-and-gate-combinator"], + ["color-combinator", "uc-color-combinator"], + ["converter-combinator", "uc-onverter-combinator"], + ["counting-combinator", "uc-counting-combinator"], + ["daytime-combinator", "uc-daytime-combinator"], + ["detector-combinator", "uc-detector-combinator"], + ["emitter-combinator", "uc-emitter-combinator"], + ["max-combinator", "uc-max-combinator"], + ["min-combinator", "uc-min-combinator"], + ["nand-gate-combinator", "uc-nand-gate-combinator"], + ["nor-gate-combinator", "uc-nor-gate-combinator"], + ["not-gate-combinator", "uc-not-gate-combinator"], + ["or-gate-combinator", "uc-or-gate-combinator"], + ["pollution-combinator", "uc-pollution-combinator"], + ["power-combinator", "uc-power-combinator"], + ["railway-combinator", "uc-railway-combinator"], + ["random-combinator", "uc-random-combinator"], + ["receiver-combinator", "uc-receiver-combinator"], + ["sensor-combinator", "uc-sensor-combinator"], + ["statistic-combinator", "uc-statistic-combinator"], + ["timer-combinator", "uc-timer-combinator"], + ["xnor-gate-combinator", "uc-xnor-gate-combinator"], + ["xor-gate-combinator", "uc-xor-gate-combinator"] + ], + "signal": + [ + ["blank", "uc-blank"], + ["blue-signal", "uc-blue-signal"], + ["counting-signal", "uc-counting-signal"], + ["cyan-signal", "uc-cyan-signal"], + ["giga-watts-signal", "uc-giga-watts-signal"], + ["green-signal", "uc-green-signal"], + ["input-signal", "uc-input-signal"], + ["kilo-watts-signal", "uc-kilo-watts-signal"], + ["magenta-signal", "uc-magenta-signal"], + ["mega-watts-signal", "uc-mega-watts-signal"], + ["minus-one-signal", "uc-minus-one-signal"], + ["output-signal", "uc-output-signal"], + ["plus-one-signal", "uc-plus-one-signal"], + ["radius-signal", "uc-radius-signal"], + ["red-signal", "uc-red-signal"], + ["reset-signal", "uc-reset-signal"], + ["start-signal", "uc-start-signal"], + ["stop-signal", "uc-stop-signal"], + ["ticks-signal", "uc-ticks-signal"], + ["watts-signal", "uc-watts-signal"], + ["white-signal", "uc-white-signal"], + ["yellow-signal", "uc-yellow-signal"] + ] +} \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.4.9.lua b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.4.9.lua new file mode 100644 index 0000000..bb45035 --- /dev/null +++ b/UsefulCombinators_0.5.1/migrations/UsefulCombinators_0.4.9.lua @@ -0,0 +1,33 @@ +game.reload_script() + +for index, force in pairs(game.forces) do + force.reset_technologies() + if force.technologies["useful-combinators"].researched then + force.recipes["uc-random-combinator"].enabled = true + if force.recipes["uc-comparator-combinator"] then + force.recipes["uc-comparator-combinator"].enabled = true + end + force.recipes["uc-converter-combinator"].enabled = true + force.recipes["uc-timer-combinator"].enabled = true + force.recipes["uc-counting-combinator"].enabled = true + force.recipes["uc-min-combinator"].enabled = true + force.recipes["uc-max-combinator"].enabled = true + force.recipes["uc-and-gate-combinator"].enabled = true + force.recipes["uc-or-gate-combinator"].enabled = true + force.recipes["uc-not-gate-combinator"].enabled = true + force.recipes["uc-nand-gate-combinator"].enabled = true + force.recipes["uc-nor-gate-combinator"].enabled = true + force.recipes["uc-xor-gate-combinator"].enabled = true + force.recipes["uc-xnor-gate-combinator"].enabled = true + force.recipes["uc-detector-combinator"].enabled = true + force.recipes["uc-sensor-combinator"].enabled = true + force.recipes["uc-railway-combinator"].enabled = true + force.recipes["uc-color-combinator"].enabled = true + force.recipes["uc-emitter-combinator"].enabled = true + force.recipes["uc-receiver-combinator"].enabled = true + force.recipes["uc-power-combinator"].enabled = true + force.recipes["uc-daytime-combinator"].enabled = true + force.recipes["uc-pollution-combinator"].enabled = true + force.recipes["uc-statistic-combinator"].enabled = true + end +end \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/prototypes/categories/changes.lua b/UsefulCombinators_0.5.1/prototypes/categories/changes.lua new file mode 100644 index 0000000..fe179ea --- /dev/null +++ b/UsefulCombinators_0.5.1/prototypes/categories/changes.lua @@ -0,0 +1,5 @@ +if not mods.SchallCircuitGroup then + data.raw.item["constant-combinator"].group = "useful-combinators" + data.raw.item["constant-combinator"].subgroup = "main" + data.raw.item["constant-combinator"].order = "a" +end \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/prototypes/categories/usefulcombinators.lua b/UsefulCombinators_0.5.1/prototypes/categories/usefulcombinators.lua new file mode 100644 index 0000000..3ab5e04 --- /dev/null +++ b/UsefulCombinators_0.5.1/prototypes/categories/usefulcombinators.lua @@ -0,0 +1,35 @@ +data:extend( +{ + { + type = "item-group", + name = "useful-combinators", + order = "u", + inventory_order = "u", + icon = "__UsefulCombinators__/graphics/icons/clock.png", + icon_size = 256 + }, + { + type = "item-subgroup", + name = "main", + group = "useful-combinators", + order = "a", + }, + { + type = "item-subgroup", + name = "logic-gates", + group = "useful-combinators", + order = "b", + }, + { + type = "item-subgroup", + name = "other", + group = "useful-combinators", + order = "c", + }, + { + type = "item-subgroup", + name = "other2", + group = "useful-combinators", + order = "d", + } +}) \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/prototypes/entity/entities.lua b/UsefulCombinators_0.5.1/prototypes/entity/entities.lua new file mode 100644 index 0000000..6118345 --- /dev/null +++ b/UsefulCombinators_0.5.1/prototypes/entity/entities.lua @@ -0,0 +1,279 @@ +require ("util") +function make_4way_animation_from_spritesheet(animation) + local function make_animation_layer(idx, anim) + local start_frame = (anim.frame_count or 1) * idx + local x = 0 + local y = 0 + if anim.line_length then + y = anim.height * math.floor(start_frame / (anim.line_length or 1)) + else + x = idx * anim.width + end + return + { + filename = anim.filename, + priority = anim.priority or "high", + x = x, + y = y, + width = anim.width, + height = anim.height, + frame_count = anim.frame_count or 1, + line_length = anim.line_length, + repeat_count = anim.repeat_count, + shift = anim.shift, + draw_as_shadow = anim.draw_as_shadow, + force_hr_shadow = anim.force_hr_shadow, + apply_runtime_tint = anim.apply_runtime_tint, + scale = anim.scale or 1, + tint = anim.tint + } + end + + local function make_animation_layer_with_hr_version(idx, anim) + local anim_parameters = make_animation_layer(idx, anim) + if anim.hr_version and anim.hr_version.filename then + anim_parameters.hr_version = make_animation_layer(idx, anim.hr_version) + end + return anim_parameters + end + + local function make_animation(idx) + if animation.layers then + local tab = { layers = {} } + for k,v in ipairs(animation.layers) do + table.insert(tab.layers, make_animation_layer_with_hr_version(idx, v)) + end + return tab + else + return make_animation_layer_with_hr_version(idx, animation) + end + end + + return + { + north = make_animation(0), + east = make_animation(1), + south = make_animation(2), + west = make_animation(3) + } +end + +function custom(name, count) + local path = "__UsefulCombinators__/graphics/entity/combinator/" + local combinator = { + type = "constant-combinator", + name = name, + icon = "__UsefulCombinators__/graphics/icons/" .. name .. ".png", + icon_size = 32, + flags = {"placeable-neutral", "player-creation"}, + minable = {mining_time = 0.1, result = name}, + max_health = 120, + corpse = "constant-combinator-remnants", + collision_box = {{-0.35, -0.35}, {0.35, 0.35}}, + selection_box = {{-0.5, -0.5}, {0.5, 0.5}}, + item_slot_count = count or 1, + vehicle_impact_sound = { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 }, + activity_led_light = + { + intensity = 0.8, + size = 1, + color = {r = 1.0, g = 1.0, b = 1.0} + }, + activity_led_light_offsets = + { + {0.296875, -0.40625}, + {0.25, -0.03125}, + {-0.296875, -0.078125}, + {-0.21875, -0.46875} + }, + circuit_wire_max_distance = 9, + sprites = make_4way_animation_from_spritesheet( + { layers = + { + { + filename = path .. name .. ".png", + width = 58, + height = 52, + frame_count = 1, + shift = util.by_pixel(0, 5), + hr_version = + { + scale = 0.5, + filename = path .. "hr-" .. name .. ".png", + width = 114, + height = 102, + frame_count = 1, + shift = util.by_pixel(0, 5) + } + }, + { + filename = "__base__/graphics/entity/combinator/constant-combinator-shadow.png", + width = 50, + height = 34, + frame_count = 1, + shift = util.by_pixel(9, 6), + draw_as_shadow = true, + hr_version = + { + scale = 0.5, + filename = "__base__/graphics/entity/combinator/hr-constant-combinator-shadow.png", + width = 98, + height = 66, + frame_count = 1, + shift = util.by_pixel(8.5, 5.5), + draw_as_shadow = true + } + } + } + }), + activity_led_sprites = + { + north = + { + filename = "__base__/graphics/entity/combinator/activity-leds/constant-combinator-LED-N.png", + width = 8, + height = 6, + frame_count = 1, + shift = util.by_pixel(9, -12), + hr_version = + { + scale = 0.5, + filename = "__base__/graphics/entity/combinator/activity-leds/hr-constant-combinator-LED-N.png", + width = 14, + height = 12, + frame_count = 1, + shift = util.by_pixel(9, -11.5) + } + }, + east = + { + filename = "__base__/graphics/entity/combinator/activity-leds/constant-combinator-LED-E.png", + width = 8, + height = 8, + frame_count = 1, + shift = util.by_pixel(8, 0), + hr_version = + { + scale = 0.5, + filename = "__base__/graphics/entity/combinator/activity-leds/hr-constant-combinator-LED-E.png", + width = 14, + height = 14, + frame_count = 1, + shift = util.by_pixel(7.5, -0.5) + } + }, + south = + { + filename = "__base__/graphics/entity/combinator/activity-leds/constant-combinator-LED-S.png", + width = 8, + height = 8, + frame_count = 1, + shift = util.by_pixel(-9, 2), + hr_version = + { + scale = 0.5, + filename = "__base__/graphics/entity/combinator/activity-leds/hr-constant-combinator-LED-S.png", + width = 14, + height = 16, + frame_count = 1, + shift = util.by_pixel(-9, 2.5) + } + }, + west = + { + filename = "__base__/graphics/entity/combinator/activity-leds/constant-combinator-LED-W.png", + width = 8, + height = 8, + frame_count = 1, + shift = util.by_pixel(-7, -15), + hr_version = + { + scale = 0.5, + filename = "__base__/graphics/entity/combinator/activity-leds/hr-constant-combinator-LED-W.png", + width = 14, + height = 16, + frame_count = 1, + shift = util.by_pixel(-7, -15) + } + } + }, + circuit_wire_connection_points = + { + { + shadow = + { + red = util.by_pixel(7, -6), + green = util.by_pixel(23, -6) + }, + wire = + { + red = util.by_pixel(-8.5, -17.5), + green = util.by_pixel(7, -17.5) + } + }, + { + shadow = + { + red = util.by_pixel(32, -5), + green = util.by_pixel(32, 8) + }, + wire = + { + red = util.by_pixel(16, -16.5), + green = util.by_pixel(16, -3.5) + } + }, + { + shadow = + { + red = util.by_pixel(25, 20), + green = util.by_pixel(9, 20) + }, + wire = + { + red = util.by_pixel(9, 7.5), + green = util.by_pixel(-6.5, 7.5) + } + }, + { + shadow = + { + red = util.by_pixel(1, 11), + green = util.by_pixel(1, -2) + }, + wire = + { + red = util.by_pixel(-15, -0.5), + green = util.by_pixel(-15, -13.5) + } + } + } + } + return combinator +end + +data:extend({ + custom("uc-timer-combinator"), + custom("uc-counting-combinator"), + custom("uc-random-combinator"), + custom("uc-converter-combinator", 5), + custom("uc-min-combinator"), + custom("uc-max-combinator"), + custom("uc-and-gate-combinator"), + custom("uc-or-gate-combinator"), + custom("uc-not-gate-combinator"), + custom("uc-nand-gate-combinator"), + custom("uc-nor-gate-combinator"), + custom("uc-xor-gate-combinator"), + custom("uc-xnor-gate-combinator"), + custom("uc-detector-combinator"), + custom("uc-sensor-combinator"), + custom("uc-railway-combinator"), + custom("uc-color-combinator", 6), + custom("uc-emitter-combinator", 0), + custom("uc-receiver-combinator", 5), + custom("uc-power-combinator", 4), + custom("uc-daytime-combinator", 3), + custom("uc-pollution-combinator"), + custom("uc-statistic-combinator", 5) +}) \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/prototypes/item/items.lua b/UsefulCombinators_0.5.1/prototypes/item/items.lua new file mode 100644 index 0000000..0aec3df --- /dev/null +++ b/UsefulCombinators_0.5.1/prototypes/item/items.lua @@ -0,0 +1,277 @@ +local tab = mods.SchallCircuitGroup and 'circuit' or "useful-combinators" +data:extend( +{ + { + type = "item-with-tags", + name = "uc-timer-combinator", + icon = "__UsefulCombinators__/graphics/icons/uc-timer-combinator.png", + icon_size = 32, + group = tab, + subgroup = mods.SchallCircuitGroup and 'circuit-combinator' or 'main', + place_result="uc-timer-combinator", + order = "a[uc-timer]", + stack_size= 50, + }, + { + type = "item-with-tags", + name = "uc-counting-combinator", + icon = "__UsefulCombinators__/graphics/icons/uc-counting-combinator.png", + icon_size = 32, + group = tab, + subgroup = mods.SchallCircuitGroup and 'circuit-combinator' or 'main', + place_result="uc-counting-combinator", + order = "b[uc-counting]", + stack_size= 50, + }, + { + type = "item-with-tags", + name = "uc-random-combinator", + icon = "__UsefulCombinators__/graphics/icons/uc-random-combinator.png", + icon_size = 32, + group = tab, + subgroup = mods.SchallCircuitGroup and 'circuit-combinator' or 'main', + place_result="uc-random-combinator", + order = "c[uc-random]", + stack_size= 50, + }, + { + type = "item-with-tags", + name = "uc-color-combinator", + icon = "__UsefulCombinators__/graphics/icons/uc-color-combinator.png", + icon_size = 32, + group = tab, + subgroup = mods.SchallCircuitGroup + and 'circuit-combinator' or 'other', + place_result="uc-color-combinator", + order = "e[uc-color]", + stack_size= 50, + }, + { + type = "item-with-tags", + name = "uc-converter-combinator", + icon = "__UsefulCombinators__/graphics/icons/uc-converter-combinator.png", + icon_size = 32, + group = tab, + subgroup = mods.SchallCircuitGroup + and 'circuit-combinator' or 'other', + place_result="uc-converter-combinator", + order = "a[uc-converter]", + stack_size= 50, + }, + { + type = "item-with-tags", + name = "uc-min-combinator", + icon = "__UsefulCombinators__/graphics/icons/uc-min-combinator.png", + icon_size = 32, + group = tab, + subgroup = mods.SchallCircuitGroup + and 'circuit-combinator' or 'main', + place_result="uc-min-combinator", + order = "f[uc-min]", + stack_size= 50, + }, + { + type = "item-with-tags", + name = "uc-max-combinator", + icon = "__UsefulCombinators__/graphics/icons/uc-max-combinator.png", + icon_size = 32, + group = tab, + subgroup = mods.SchallCircuitGroup + and 'circuit-combinator' or 'main', + place_result="uc-max-combinator", + order = "e[uc-max]", + stack_size= 50, + }, + { + type = "item-with-tags", + name = "uc-and-gate-combinator", + icon = "__UsefulCombinators__/graphics/icons/uc-and-gate-combinator.png", + icon_size = 32, + group = tab, + subgroup = mods.SchallCircuitGroup + and 'circuit-combinator' or 'logic-gates', + place_result="uc-and-gate-combinator", + order = "a[uc-and]", + stack_size= 50, + }, + { + type = "item-with-tags", + name = "uc-or-gate-combinator", + icon = "__UsefulCombinators__/graphics/icons/uc-or-gate-combinator.png", + icon_size = 32, + group = tab, + subgroup = mods.SchallCircuitGroup + and 'circuit-combinator' or 'logic-gates', + place_result="uc-or-gate-combinator", + order = "o[uc-or]", + stack_size= 50, + }, + { + type = "item-with-tags", + name = "uc-not-gate-combinator", + icon = "__UsefulCombinators__/graphics/icons/uc-not-gate-combinator.png", + icon_size = 32, + group = tab, + subgroup = mods.SchallCircuitGroup + and 'circuit-combinator' or 'logic-gates', + place_result="uc-not-gate-combinator", + order = "n[uc-not]", + stack_size= 50, + }, + { + type = "item-with-tags", + name = "uc-nand-gate-combinator", + icon = "__UsefulCombinators__/graphics/icons/uc-nand-gate-combinator.png", + icon_size = 32, + group = tab, + subgroup = mods.SchallCircuitGroup + and 'circuit-combinator' or 'logic-gates', + place_result="uc-nand-gate-combinator", + order = "n[uc-nand]", + stack_size= 50, + }, + { + type = "item-with-tags", + name = "uc-nor-gate-combinator", + icon = "__UsefulCombinators__/graphics/icons/uc-nor-gate-combinator.png", + icon_size = 32, + group = tab, + subgroup = mods.SchallCircuitGroup + and 'circuit-combinator' or 'logic-gates', + place_result="uc-nor-gate-combinator", + order = "n[uc-nor]", + stack_size= 50, + }, + { + type = "item-with-tags", + name = "uc-xor-gate-combinator", + icon = "__UsefulCombinators__/graphics/icons/uc-xor-gate-combinator.png", + icon_size = 32, + group = tab, + subgroup = mods.SchallCircuitGroup + and 'circuit-combinator' or 'logic-gates', + place_result="uc-xor-gate-combinator", + order = "x[uc-xor]", + stack_size= 50, + }, + { + type = "item-with-tags", + name = "uc-xnor-gate-combinator", + icon = "__UsefulCombinators__/graphics/icons/uc-xnor-gate-combinator.png", + icon_size = 32, + group = tab, + subgroup = mods.SchallCircuitGroup + and 'circuit-combinator' or 'logic-gates', + place_result="uc-xnor-gate-combinator", + order = "x[uc-xnor]", + stack_size= 50, + }, + { + type = "item-with-tags", + name = "uc-detector-combinator", + icon = "__UsefulCombinators__/graphics/icons/uc-detector-combinator.png", + icon_size = 32, + group = tab, + subgroup = mods.SchallCircuitGroup + and 'circuit-combinator' or 'other', + place_result="uc-detector-combinator", + order = "b[uc-detector]", + stack_size= 50, + }, + { + type = "item-with-tags", + name = "uc-sensor-combinator", + icon = "__UsefulCombinators__/graphics/icons/uc-sensor-combinator.png", + icon_size = 32, + group = tab, + subgroup = mods.SchallCircuitGroup + and 'circuit-combinator' or 'other', + place_result="uc-sensor-combinator", + order = "c[uc-sensor]", + stack_size= 50, + }, + { + type = "item-with-tags", + name = "uc-railway-combinator", + icon = "__UsefulCombinators__/graphics/icons/uc-railway-combinator.png", + icon_size = 32, + group = tab, + subgroup = mods.SchallCircuitGroup + and 'circuit-combinator' or 'other', + place_result="uc-railway-combinator", + order = "d[uc-railway]", + stack_size= 50, + }, + { + type = "item-with-tags", + name = "uc-emitter-combinator", + icon = "__UsefulCombinators__/graphics/icons/uc-emitter-combinator.png", + icon_size = 32, + group = tab, + subgroup = mods.SchallCircuitGroup + and 'circuit-combinator' or 'other', + place_result="uc-emitter-combinator", + order = "f[uc-emitter]", + stack_size= 50, + }, + { + type = "item-with-tags", + name = "uc-receiver-combinator", + icon = "__UsefulCombinators__/graphics/icons/uc-receiver-combinator.png", + icon_size = 32, + group = tab, + subgroup = mods.SchallCircuitGroup + and 'circuit-combinator' or 'other', + place_result="uc-receiver-combinator", + order = "g[uc-receiver]", + stack_size= 50, + }, + { + type = "item-with-tags", + name = "uc-power-combinator", + icon = "__UsefulCombinators__/graphics/icons/uc-power-combinator.png", + icon_size = 32, + group = tab, + subgroup = mods.SchallCircuitGroup + and 'circuit-combinator' or 'main', + place_result="uc-power-combinator", + order = "d[uc-power]", + stack_size= 50, + }, + { + type = "item-with-tags", + name = "uc-daytime-combinator", + icon = "__UsefulCombinators__/graphics/icons/uc-daytime-combinator.png", + icon_size = 32, + group = tab, + subgroup = mods.SchallCircuitGroup + and 'circuit-combinator' or 'other2', + place_result="uc-daytime-combinator", + order = "a[uc-daytime]", + stack_size= 50, + }, + { + type = "item-with-tags", + name = "uc-pollution-combinator", + icon = "__UsefulCombinators__/graphics/icons/uc-pollution-combinator.png", + icon_size = 32, + group = tab, + subgroup = mods.SchallCircuitGroup + and 'circuit-combinator' or 'other2', + place_result="uc-pollution-combinator", + order = "c[uc-pollution]", + stack_size= 50, + }, + { + type = "item-with-tags", + name = "uc-statistic-combinator", + icon = "__UsefulCombinators__/graphics/icons/uc-statistic-combinator.png", + icon_size = 32, + group = tab, + subgroup = mods.SchallCircuitGroup + and 'circuit-combinator' or 'other2', + place_result="uc-statistic-combinator", + order = "b[uc-statistic]", + stack_size= 50, + } +}) \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/prototypes/recipe/recipes.lua b/UsefulCombinators_0.5.1/prototypes/recipe/recipes.lua new file mode 100644 index 0000000..a99a127 --- /dev/null +++ b/UsefulCombinators_0.5.1/prototypes/recipe/recipes.lua @@ -0,0 +1,255 @@ +data:extend({ + { + type = "recipe", + name = "uc-timer-combinator", + enabled = "false", + ingredients = + { + {"arithmetic-combinator", 1}, + {"constant-combinator", 1} + }, + result = "uc-timer-combinator" + }, + { + type = "recipe", + name = "uc-counting-combinator", + enabled = "false", + ingredients = + { + {"arithmetic-combinator", 1}, + {"decider-combinator", 1} + }, + result = "uc-counting-combinator" + }, + { + type = "recipe", + name = "uc-random-combinator", + enabled = "false", + ingredients = + { + {"advanced-circuit", 1}, + {"constant-combinator", 1} + }, + result = "uc-random-combinator" + }, + { + type = "recipe", + name = "uc-converter-combinator", + enabled = "false", + ingredients = + { + {"constant-combinator", 1}, + {"electronic-circuit", 2} + }, + result = "uc-converter-combinator" + }, + { + type = "recipe", + name = "uc-min-combinator", + enabled = "false", + ingredients = + { + {"advanced-circuit", 1}, + {"decider-combinator", 1} + }, + result = "uc-min-combinator" + }, + { + type = "recipe", + name = "uc-max-combinator", + enabled = "false", + ingredients = + { + {"advanced-circuit", 1}, + {"decider-combinator", 1} + }, + result = "uc-max-combinator" + }, + { + type = "recipe", + name = "uc-and-gate-combinator", + enabled = "false", + ingredients = + { + {"electronic-circuit", 1}, + {"copper-cable", 2} + }, + result = "uc-and-gate-combinator" + }, + { + type = "recipe", + name = "uc-or-gate-combinator", + enabled = "false", + ingredients = + { + {"electronic-circuit", 1}, + {"copper-cable", 2} + }, + result = "uc-or-gate-combinator" + }, + { + type = "recipe", + name = "uc-not-gate-combinator", + enabled = "false", + ingredients = + { + {"electronic-circuit", 1}, + {"copper-cable", 2} + }, + result = "uc-not-gate-combinator" + }, + { + type = "recipe", + name = "uc-nand-gate-combinator", + enabled = "false", + ingredients = + { + {"electronic-circuit", 1}, + {"copper-cable", 2} + }, + result = "uc-nand-gate-combinator" + }, + { + type = "recipe", + name = "uc-nor-gate-combinator", + enabled = "false", + ingredients = + { + {"electronic-circuit", 1}, + {"copper-cable", 2} + }, + result = "uc-nor-gate-combinator" + }, + { + type = "recipe", + name = "uc-xor-gate-combinator", + enabled = "false", + ingredients = + { + {"electronic-circuit", 1}, + {"copper-cable", 2} + }, + result = "uc-xor-gate-combinator" + }, + { + type = "recipe", + name = "uc-xnor-gate-combinator", + enabled = "false", + ingredients = + { + {"electronic-circuit", 1}, + {"copper-cable", 2} + }, + result = "uc-xnor-gate-combinator" + }, + { + type = "recipe", + name = "uc-detector-combinator", + enabled = "false", + ingredients = + { + {"advanced-circuit", 2}, + {"decider-combinator", 1} + }, + result = "uc-detector-combinator" + }, + { + type = "recipe", + name = "uc-sensor-combinator", + enabled = "false", + ingredients = + { + {"advanced-circuit", 2}, + {"decider-combinator", 1} + }, + result = "uc-sensor-combinator" + }, + { + type = "recipe", + name = "uc-railway-combinator", + enabled = "false", + ingredients = + { + {"advanced-circuit", 2}, + {"decider-combinator", 1} + }, + result = "uc-railway-combinator" + }, + { + type = "recipe", + name = "uc-color-combinator", + enabled = "false", + ingredients = + { + {"electronic-circuit", 1}, + {"small-lamp", 1} + }, + result = "uc-color-combinator" + }, + { + type = "recipe", + name = "uc-emitter-combinator", + enabled = "false", + ingredients = + { + {"processing-unit", 2}, + {"logistic-chest-active-provider", 1} + }, + result = "uc-emitter-combinator" + }, + { + type = "recipe", + name = "uc-receiver-combinator", + enabled = "false", + ingredients = + { + {"processing-unit", 2}, + {"logistic-chest-requester", 1} + }, + result = "uc-receiver-combinator" + }, + { + type = "recipe", + name = "uc-power-combinator", + enabled = "false", + ingredients = + { + {"electronic-circuit", 1}, + {"copper-cable", 3} + }, + result = "uc-power-combinator" + }, + { + type = "recipe", + name = "uc-daytime-combinator", + enabled = "false", + ingredients = + { + {"electronic-circuit", 1}, + {"uc-timer-combinator", 1} + }, + result = "uc-daytime-combinator" + }, + { + type = "recipe", + name = "uc-pollution-combinator", + enabled = "false", + ingredients = + { + {"electronic-circuit", 1}, + {"constant-combinator", 1} + }, + result = "uc-pollution-combinator" + }, + { + type = "recipe", + name = "uc-statistic-combinator", + enabled = "false", + ingredients = + { + {"electronic-circuit", 1}, + {"uc-counting-combinator", 1} + }, + result = "uc-statistic-combinator" + } +}) \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/prototypes/signal/signal.lua b/UsefulCombinators_0.5.1/prototypes/signal/signal.lua new file mode 100644 index 0000000..ece7ce9 --- /dev/null +++ b/UsefulCombinators_0.5.1/prototypes/signal/signal.lua @@ -0,0 +1,179 @@ +data:extend( +{ + { + type = "virtual-signal", + name = "uc-counting-signal", + icon = "__UsefulCombinators__/graphics/icons/signal/counting-signal.png", + icon_size = 32, + subgroup = "virtual-signal", + order = "u[uc-counting]" + }, + { + type = "virtual-signal", + name = "uc-plus-one-signal", + icon = "__UsefulCombinators__/graphics/icons/signal/plus-one-signal.png", + icon_size = 32, + subgroup = "virtual-signal", + order = "u[uc-plus-one]" + }, + { + type = "virtual-signal", + name = "uc-output-signal", + icon = "__UsefulCombinators__/graphics/icons/signal/output-signal.png", + icon_size = 32, + subgroup = "virtual-signal", + order = "u[uc-output]" + }, + { + type = "virtual-signal", + name = "uc-reset-signal", + icon = "__UsefulCombinators__/graphics/icons/signal/reset-signal.png", + icon_size = 32, + subgroup = "virtual-signal", + order = "u[uc-reset]" + }, + { + type = "virtual-signal", + name = "uc-ticks-signal", + icon = "__UsefulCombinators__/graphics/icons/signal/ticks-signal.png", + icon_size = 32, + subgroup = "virtual-signal", + order = "u[uc-ticks]" + }, + { + type = "virtual-signal", + name = "uc-blank", + icon = "__UsefulCombinators__/graphics/icons/signal/blank.png", + icon_size = 32, + subgroup = "virtual-signal", + order = "u[uc-blank]" + }, + { + type = "virtual-signal", + name = "uc-minus-one-signal", + icon = "__UsefulCombinators__/graphics/icons/signal/minus-one-signal.png", + icon_size = 32, + subgroup = "virtual-signal", + order = "u[uc-minus-one]" + }, + { + type = "virtual-signal", + name = "uc-radius-signal", + icon = "__UsefulCombinators__/graphics/icons/signal/radius-signal.png", + icon_size = 32, + subgroup = "virtual-signal", + order = "u[uc-radius]" + }, + { + type = "virtual-signal", + name = "uc-red-signal", + icon = "__UsefulCombinators__/graphics/icons/signal/red-signal.png", + icon_size = 32, + subgroup = "virtual-signal", + order = "u[uc-red]" + }, + { + type = "virtual-signal", + name = "uc-yellow-signal", + icon = "__UsefulCombinators__/graphics/icons/signal/yellow-signal.png", + icon_size = 32, + subgroup = "virtual-signal", + order = "u[uc-yellow]" + }, + { + type = "virtual-signal", + name = "uc-green-signal", + icon = "__UsefulCombinators__/graphics/icons/signal/green-signal.png", + icon_size = 32, + subgroup = "virtual-signal", + order = "u[green]" + }, + { + type = "virtual-signal", + name = "uc-cyan-signal", + icon = "__UsefulCombinators__/graphics/icons/signal/cyan-signal.png", + icon_size = 32, + subgroup = "virtual-signal", + order = "u[uc-cyan]" + }, + { + type = "virtual-signal", + name = "uc-blue-signal", + icon = "__UsefulCombinators__/graphics/icons/signal/blue-signal.png", + icon_size = 32, + subgroup = "virtual-signal", + order = "u[uc-blue]" + }, + { + type = "virtual-signal", + name = "uc-magenta-signal", + icon = "__UsefulCombinators__/graphics/icons/signal/magenta-signal.png", + icon_size = 32, + subgroup = "virtual-signal", + order = "u[uc-magenta]" + }, + { + type = "virtual-signal", + name = "uc-white-signal", + icon = "__UsefulCombinators__/graphics/icons/signal/white-signal.png", + icon_size = 32, + subgroup = "virtual-signal", + order = "u[uc-white]" + }, + { + type = "virtual-signal", + name = "uc-watts-signal", + icon = "__UsefulCombinators__/graphics/icons/signal/watts-signal.png", + icon_size = 32, + subgroup = "virtual-signal", + order = "u[uc-watts]" + }, + { + type = "virtual-signal", + name = "uc-kilo-watts-signal", + icon = "__UsefulCombinators__/graphics/icons/signal/kilo-watts-signal.png", + icon_size = 32, + subgroup = "virtual-signal", + order = "u[uc-kilo]" + }, + { + type = "virtual-signal", + name = "uc-mega-watts-signal", + icon = "__UsefulCombinators__/graphics/icons/signal/mega-watts-signal.png", + icon_size = 32, + subgroup = "virtual-signal", + order = "u[uc-mega]" + }, + { + type = "virtual-signal", + name = "uc-giga-watts-signal", + icon = "__UsefulCombinators__/graphics/icons/signal/giga-watts-signal.png", + icon_size = 32, + subgroup = "virtual-signal", + order = "u[uc-giga]" + }, + { + type = "virtual-signal", + name = "uc-input-signal", + icon = "__UsefulCombinators__/graphics/icons/signal/input-signal.png", + icon_size = 32, + subgroup = "virtual-signal", + order = "u[uc-input]" + }, + { + type = "virtual-signal", + name = "uc-start-signal", + icon = "__UsefulCombinators__/graphics/icons/signal/start-signal.png", + icon_size = 32, + subgroup = "virtual-signal", + order = "u[uc-start]" + }, + { + type = "virtual-signal", + name = "uc-stop-signal", + icon = "__UsefulCombinators__/graphics/icons/signal/stop-signal.png", + icon_size = 32, + subgroup = "virtual-signal", + order = "u[uc-stop]" + } +}) \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/prototypes/styles/uc.lua b/UsefulCombinators_0.5.1/prototypes/styles/uc.lua new file mode 100644 index 0000000..7655b78 --- /dev/null +++ b/UsefulCombinators_0.5.1/prototypes/styles/uc.lua @@ -0,0 +1,5 @@ +data.raw["gui-style"]["default"]["uc_text"] = +{ + type = "textbox_style", + maximal_width = 64 +} \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/prototypes/technology/technology.lua b/UsefulCombinators_0.5.1/prototypes/technology/technology.lua new file mode 100644 index 0000000..6480c18 --- /dev/null +++ b/UsefulCombinators_0.5.1/prototypes/technology/technology.lua @@ -0,0 +1,115 @@ +data:extend({ + { + type = "technology", + name = "useful-combinators", + icon = "__UsefulCombinators__/graphics/technology/clock.png", + icon_size = 256, + effects = + { + { + type = "unlock-recipe", + recipe = "uc-timer-combinator" + }, + { + type = "unlock-recipe", + recipe = "uc-counting-combinator" + }, + { + type = "unlock-recipe", + recipe = "uc-random-combinator" + }, + { + type = "unlock-recipe", + recipe = "uc-converter-combinator" + }, + { + type = "unlock-recipe", + recipe = "uc-min-combinator" + }, + { + type = "unlock-recipe", + recipe = "uc-max-combinator" + }, + { + type = "unlock-recipe", + recipe = "uc-and-gate-combinator" + }, + { + type = "unlock-recipe", + recipe = "uc-nand-gate-combinator" + }, + { + type = "unlock-recipe", + recipe = "uc-nor-gate-combinator" + }, + { + type = "unlock-recipe", + recipe = "uc-not-gate-combinator" + }, + { + type = "unlock-recipe", + recipe = "uc-or-gate-combinator" + }, + { + type = "unlock-recipe", + recipe = "uc-xnor-gate-combinator" + }, + { + type = "unlock-recipe", + recipe = "uc-xor-gate-combinator" + }, + { + type = "unlock-recipe", + recipe = "uc-detector-combinator" + }, + { + type = "unlock-recipe", + recipe = "uc-sensor-combinator" + }, + { + type = "unlock-recipe", + recipe = "uc-railway-combinator" + }, + { + type = "unlock-recipe", + recipe = "uc-color-combinator" + }, + { + type = "unlock-recipe", + recipe = "uc-emitter-combinator" + }, + { + type = "unlock-recipe", + recipe = "uc-receiver-combinator" + }, + { + type = "unlock-recipe", + recipe = "uc-power-combinator" + }, + { + type = "unlock-recipe", + recipe = "uc-daytime-combinator" + }, + { + type = "unlock-recipe", + recipe = "uc-pollution-combinator" + }, + { + type = "unlock-recipe", + recipe = "uc-statistic-combinator" + } + }, + prerequisites = {"circuit-network"}, + unit = + { + count = 100, + ingredients = + { + {"automation-science-pack", 1}, + {"logistic-science-pack", 1} + }, + time = 15 + }, + order = "a-d-d" + } +}) \ No newline at end of file diff --git a/UsefulCombinators_0.5.1/thumbnail.png b/UsefulCombinators_0.5.1/thumbnail.png new file mode 100644 index 0000000..ebe4f55 Binary files /dev/null and b/UsefulCombinators_0.5.1/thumbnail.png differ