up
This commit is contained in:
parent
9c356a7029
commit
3df93fd7a6
3 changed files with 174 additions and 24 deletions
29
control-util.lua
Normal file
29
control-util.lua
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
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
|
||||
|
||||
function util.force_enable_recipe(event, recipe_name)
|
||||
if game.players[event.player_index].force.recipes[recipe_name] then
|
||||
game.players[event.player_index].force.recipes[recipe_name].enabled=true
|
||||
end
|
||||
end
|
||||
|
||||
return util
|
||||
Loading…
Add table
Add a link
Reference in a new issue