-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontrol.lua
26 lines (24 loc) · 974 Bytes
/
control.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
local kit={}
if settings.global["ironOre"].value>0 then
table.insert(kit,{name="iron-ore",count=settings.global["ironOre"].value})
end
if settings.global["copperOre"].value>0 then
table.insert(kit,{name="copper-ore",count=settings.global["copperOre"].value})
end
if settings.global["coal"].value>0 then
table.insert(kit,{name="coal",count=settings.global["coal"].value})
end
if settings.global["stone"].value>0 then
table.insert(kit,{name="stone",count=settings.global["stone"].value})
end
if settings.global["wood"].value>0 then
table.insert(kit,{name="wood",count=settings.global["wood"].value})
end
-- Now lets get the player that just joined, and clear all of his inventory to replace with ours.
script.on_event(defines.events.on_player_created,function(param)
local p=game.players[param.player_index]
-- Now we will add all the items from our mod settings choices.
for i,v in pairs(kit) do
p.insert(v)
end
end)