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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"files.eol": "\n",
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
---------------------------------------------------------------------------------------------------
Version: 0.17.0
Date: 11. 23. 2021
Features:
- Crafting combinator can now read and output ingredients of set recipe (new setting)
- Crafting combinator can now read from rocket silos
- Crafting combinator can now read product and ingredients for machines that have fixed (static) recipes (like a rocket silo and modded assemblers)
---------------------------------------------------------------------------------------------------
Version: 0.16.3
Date: 11. 12. 2021
Changes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ return {
read_recipe = true,
read_speed = false,
read_bottleneck = false,
read_ingredients = false,
},
RC_DEFAULT_SETTINGS = {
mode = 'ing',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ local config = require 'config'
-- Crafting Combinator
local cc = table.deepcopy(data.raw['constant-combinator']['constant-combinator'])
cc.name = config.CC_NAME
cc.icon = '__crafting_combinator__/graphics/icon-crafting-combinator.png'
cc.icon = '__crafting-combinator-extended__/graphics/icon-crafting-combinator.png'
cc.icon_size = 32
cc.item_slot_count = 3
cc.item_slot_count = 255
cc.minable.result = cc.name
table.insert(cc.flags, 'not-deconstructable')

for _, image in pairs(cc.sprites) do
local im = image.layers[1]
im.filename = '__crafting_combinator__/graphics/entities.png'
im.filename = '__crafting-combinator-extended__/graphics/entities.png'
im.y = 0
im.hr_version = nil
end
Expand All @@ -38,7 +38,7 @@ rc.minable.result = rc.name
rc.energy_source = { type = 'void' }
rc.energy_usage_per_tick = '1W'
for direction, definition in pairs(rc.multiply_symbol_sprites) do
definition.hr_version.filename = '__crafting_combinator__/graphics/hr-combinator-displays.png'
definition.hr_version.filename = '__crafting-combinator-extended__/graphics/hr-combinator-displays.png'
rc.multiply_symbol_sprites[direction] = definition.hr_version
end

Expand All @@ -56,7 +56,7 @@ table.insert(data.raw['technology']['circuit-network'].effects, {type = 'unlock-


local trans = {
filename = '__crafting_combinator__/graphics/trans.png',
filename = '__crafting-combinator-extended__/graphics/trans.png',
width = 1,
height = 1,
}
Expand Down Expand Up @@ -169,7 +169,7 @@ data:extend {
type = 'item-group',
name = config.GROUP_NAME,
order = 'fb',
icon = '__crafting_combinator__/graphics/recipe-book.png',
icon = '__crafting-combinator-extended__/graphics/recipe-book.png',
icon_size = 64,
},
{
Expand All @@ -195,7 +195,7 @@ data:extend {
{
type = 'virtual-signal',
name = config.SPEED_SIGNAL_NAME,
icon = '__crafting_combinator__/graphics/speed-icon.png',
icon = '__crafting-combinator-extended__/graphics/speed-icon.png',
subgroup = 'crafting_combinator:signals',
order = 'b[crafting-speed]',
icon_size = 32,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "crafting_combinator",
"version": "0.16.3",
"name": "crafting-combinator-extended",
"version": "0.17.0",
"factorio_version": "1.1",
"title": "Crafting Combinator",
"author": "LuziferSenpai and TheRustyKnife",
"title": "Crafting Combinator Extended",
"author": "LuziferSenpai, TheRustyKnife, MarximusMaximus",
"description": "Includes combinators that allow you to set or read the recipe of any crafting machine, get ingredients or products of a recipe and more!",
"dependencies": ["base", "rusty-locale"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ empty-inserters=Vyprazdňovat překladače (zamezuje zasekávání)
read-recipe=Číst aktuální recept
read-speed=Číst rychlost výrobny
read-machine-status=Číst status výrobny
read-ingredients=Číst ingredience výrobny
multiply-by-input=Vynásobit výsledky vstupní hodnotou
multiply-by-input:tooltip=Každý výstupní signál bude před nastavením na výstup vynásoben hodnotou vybraného vstupního signálu
divide-by-output=Vydělit výsledky počtem produktu/ingredience
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ discard-fluids=Flüssigkeiten verwerfen
empty-inserters=Greifer leeren (verhindert Blockierungen)
read-speed=Herstellungsgeschwindigkeit auslesen
read-machine-status=Status auslesen
read-ingredients=Zutaten auslesen
multiply-by-input=Ergebnisse mit der Einganssignalstärke multiplizieren
multiply-by-input:tooltip=Mulpiziert jedes Signal mit der Signalstärke des ausgewählten Einganssignals bevor es ausgegeben wird
divide-by-output=Ergebnisse durch die Menge im Rezept teilen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ empty-inserters=Empty inserters' hands (prevents jamming)
read-recipe=Read the current recipe
read-speed=Read the machine's crafting speed
read-machine-status=Read machine status
read-ingredients=Read ingredients
multiply-by-input=Multiply results by input count
multiply-by-input:tooltip=Take each resulting signal and multiply it by the strength of the chosen input signal before outputting it
divide-by-output=Divide results by product/ingredient count
Expand Down
11 changes: 11 additions & 0 deletions crafting-combinator-extended/migrations/0.17.0.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
if not late_migrations then return end

local config = require 'config'
local cc_control = require 'script.cc'
local settings_parser = require 'script.settings-parser'


log("Adding missing settings to combinators...")
for _, combinator in pairs(global.cc.data) do
settings_parser.fill_defaults(combinator.settings, config.CC_DEFAULT_SETTINGS)
end
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ _M.settings_parser = settings_parser {
read_speed = {'s', 'bool'},
read_machine_status = {'st', 'bool'},
wait_for_output_to_clear = {'wo', 'bool'},
read_ingredients = {'ing', 'bool'},
}


Expand Down Expand Up @@ -194,6 +195,7 @@ function _M:update()
if self.settings.read_recipe then self:read_recipe(params); end
if self.settings.read_speed then self:read_speed(params); end
if self.settings.read_machine_status then self:read_machine_status(params); end
if self.settings.read_ingredients then self:read_ingredients(params); end
end
end

Expand Down Expand Up @@ -223,6 +225,7 @@ function _M:open(player_index)
gui.checkbox('read-recipe', self.settings.read_recipe),
gui.checkbox('read-speed', self.settings.read_speed),
gui.checkbox('read-machine-status', self.settings.read_machine_status),
gui.checkbox('read-ingredients', self.settings.read_ingredients),
}
}):open(player_index)

Expand Down Expand Up @@ -259,6 +262,7 @@ function _M:update_disabled_checkboxes(root)
self:disable_checkbox(root, 'misc:read-recipe', 'r')
self:disable_checkbox(root, 'misc:read-speed', 'r')
self:disable_checkbox(root, 'misc:read-machine-status', 'r')
self:disable_checkbox(root, 'misc:read-ingredients', 'r')
end

function _M:disable_checkbox(root, name, mode)
Expand Down Expand Up @@ -313,6 +317,21 @@ function _M:read_machine_status(params)
})
end

function _M:read_ingredients(params)
local recipe = self.assembler.get_recipe()
if recipe then
local append_index = 4
for k, v in pairs(recipe.ingredients) do
table.insert(params, {
signal = recipe_selector.get_signal(v.name),
count = v.amount,
index = append_index,
})
append_index = append_index + 1
end
end
end

function _M:set_recipe()
local changed, recipe
if self.settings.craft_until_zero then
Expand Down Expand Up @@ -496,9 +515,9 @@ end
function _M:find_assembler(assembler_to_ignore)
self.assembler = self.entity.surface.find_entities_filtered {
position = util.position(self.entity.position):shift(self.entity.direction, config.ASSEMBLER_DISTANCE),
type = 'assembling-machine',
}[1]
if self.assembler and (self.assembler == assembler_to_ignore or self.assembler.prototype.fixed_recipe) then
type = {'assembling-machine', 'rocket-silo'},
}[1]
if self.assembler and (self.assembler == assembler_to_ignore) then
self.assembler = nil
end

Expand Down