-
Notifications
You must be signed in to change notification settings - Fork 0
/
equipment.lua
46 lines (40 loc) · 1.5 KB
/
equipment.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
local function ticks_from_minutes(minutes)
return minutes * 60 * 60
end
-- Give player starting items.
-- @param event on_player_joined event
function player_joined(event)
local player = game.players[event.player_index]
if game.tick < ticks_from_minutes(10) then
player.insert { name = "pistol", count = 1 }
player.insert { name = "firearm-magazine", count = 20 }
player.insert { name = "burner-mining-drill", count = 2 }
player.insert { name = "stone-furnace", count = 2 }
end
if (player.force.technologies["steel-processing"].researched) then
player.insert { name = "steel-axe", count = 2 }
else
player.insert { name = "iron-axe", count = 5 }
end
end
-- Give player weapons after they respawn.
-- @param event on_player_respawned event
function player_respawned(event)
local player = game.players[event.player_index]
if (player.force.technologies["military"].researched) then
player.insert { name = "submachine-gun", count = 1 }
else
player.insert { name = "pistol", count = 1 }
end
if (player.force.technologies["uranium-ammo"].researched) then
player.insert { name = "uranium-rounds-magazine", count = 10 }
else
if (player.force.technologies["military-2"].researched) then
player.insert { name = "piercing-rounds-magazine", count = 10 }
else
player.insert { name = "firearm-magazine", count = 10 }
end
end
end
Event.register(defines.events.on_player_created, player_joined)
Event.register(defines.events.on_player_respawned, player_respawned)