control script TungstenRecipes
This commit is contained in:
parent
750c3f0043
commit
1deec17d08
3 changed files with 33 additions and 0 deletions
|
|
@ -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.
|
||||
|
|
|
|||
23
control-util.lua
Normal file
23
control-util.lua
Normal file
|
|
@ -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
|
||||
9
control.lua
Normal file
9
control.lua
Normal file
|
|
@ -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)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue