-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontrol.lua
More file actions
54 lines (43 loc) · 1.66 KB
/
Copy pathcontrol.lua
File metadata and controls
54 lines (43 loc) · 1.66 KB
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
47
48
49
50
51
52
53
54
local start_items = require("scripts.start_items")
local signal = require("scripts.signal")
local foundry_surface = require("scripts.foundry_surface")
local function setup()
start_items.give_to_all()
signal.check_unlock()
foundry_surface.process_surface()
foundry_surface.recreate_if_needed()
end
commands.add_command("hf-reset-foundry-surface", "Deletes and recreates the Heliopause Foundry surface for testing.", function(command)
local player = command.player_index and game.get_player(command.player_index) or nil
if player and not player.admin then
player.print("Heliopause Foundry: Nur Admins können die Foundry-Oberfläche zurücksetzen.")
return
end
foundry_surface.request_reset(player)
end)
script.on_init(setup)
script.on_configuration_changed(setup)
script.on_event({
defines.events.on_player_created,
defines.events.on_player_joined_game,
defines.events.on_player_respawned
}, function(event)
start_items.give_to_player(game.get_player(event.player_index))
end)
script.on_event(defines.events.on_surface_created, function(event)
local surface = game.surfaces[event.surface_index]
foundry_surface.process_existing_chunks(surface)
end)
script.on_event(defines.events.on_player_changed_surface, function(event)
local player = game.get_player(event.player_index)
if not player or not player.valid then return end
foundry_surface.process_existing_chunks(player.surface)
end)
script.on_event(defines.events.on_chunk_generated, function(event)
foundry_surface.process_area(event.surface, event.area)
end)
script.on_nth_tick(60, function()
start_items.process_pending()
signal.check_unlock()
foundry_surface.recreate_if_needed()
end)