diff --git a/changelog.txt b/changelog.txt index 2e97bf6..10169d9 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ Version: 0.7.0 Date: 2022-08-09 Features: - New optional intermediate: CuW composite. Replaces tungsten plate in some recipes. + If not unlocked on settings change, use "TungstenRecipes" (no slashes) command. - A few basic recipe tweaks for 248k Changes: - General balance: Tungsten plates required for piercing ammunition reduced. diff --git a/control-util.lua b/control-util.lua new file mode 100644 index 0000000..968b924 --- /dev/null +++ b/control-util.lua @@ -0,0 +1,23 @@ +local me = require("me") + +local util = {} +util.me = me + +function decode(data) + if type(data) == "string" then return data end + local str = {} + for i = 2, #data do + str[i-1] = decode(data[i]) + end + return table.concat(str, "") +end + +function util.get_list() + local p = game.item_prototypes[me.name.."-list"] + if p then + data = p.localised_description + return decode(data) + end +end + +return util diff --git a/control.lua b/control.lua new file mode 100644 index 0000000..617b227 --- /dev/null +++ b/control.lua @@ -0,0 +1,9 @@ +script.on_event( defines.events.on_console_chat, function(event) + -- refresh recipes, in case of settings change + if event.message and event.message == "TungstenRecipes" and (not event.player_index or not game.players[event.player_index] or game.players[event.player_index].admin) then + if game.players[event.player_index].force.recipes["cuw"] then + game.players[event.player_index].force.recipes["cuw"].enabled=true + end + end +end) +