Migrate control code to using event_handler
This commit is contained in:
parent
f3713fd201
commit
366a16f76d
5 changed files with 309 additions and 198 deletions
|
@ -1,181 +1,10 @@
|
||||||
require("script/to-nauvis")
|
local handler = require("event_handler")
|
||||||
|
|
||||||
local crash_site = require("crash-site")
|
handler.add_libraries({
|
||||||
local util = require("util")
|
require("script/init-existing"),
|
||||||
local e = defines.events
|
require("script/init-new"),
|
||||||
|
require("script/init"),
|
||||||
|
require("script/to-nauvis")
|
||||||
|
})
|
||||||
|
|
||||||
local function chart_starting_area()
|
|
||||||
local r = 200
|
|
||||||
local force = game.forces.player
|
|
||||||
local surface = storage.surface
|
|
||||||
local origin = force.get_spawn_position(surface)
|
|
||||||
force.chart(surface, { { origin.x - r, origin.y - r }, { origin.x + r, origin.y + r } })
|
|
||||||
end
|
|
||||||
|
|
||||||
local function correct_space_locations()
|
|
||||||
local force = game.forces.player
|
|
||||||
force.technologies["planet-discovery-lignumis"].researched = true
|
|
||||||
if not force.technologies["planet-discovery-nauvis"].researched then
|
|
||||||
force.lock_space_location("nauvis")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
script.on_init(function()
|
|
||||||
if game.tick > 0 then
|
|
||||||
storage.init = {}
|
|
||||||
for _, player in pairs(game.players) do
|
|
||||||
storage.init[player.index] = true
|
|
||||||
end
|
|
||||||
game.print { "", { "lignumis.start-new-game" } }
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if remote.interfaces.freeplay then
|
|
||||||
storage.disable_crashsite = remote.call("freeplay", "get_disable_crashsite")
|
|
||||||
remote.call("freeplay", "set_disable_crashsite", true)
|
|
||||||
remote.call("freeplay", "set_skip_intro", true)
|
|
||||||
|
|
||||||
if not script.active_mods["wood-military"] then
|
|
||||||
local respawn_items = remote.call("freeplay", "get_respawn_items")
|
|
||||||
respawn_items["wood-darts-magazine"] = respawn_items["firearm-magazine"]
|
|
||||||
respawn_items["firearm-magazine"] = nil
|
|
||||||
remote.call("freeplay", "set_respawn_items", respawn_items)
|
|
||||||
|
|
||||||
local created_items = remote.call("freeplay", "get_created_items")
|
|
||||||
created_items["wood-darts-magazine"] = created_items["firearm-magazine"]
|
|
||||||
created_items["firearm-magazine"] = nil
|
|
||||||
remote.call("freeplay", "set_created_items", created_items)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
correct_space_locations()
|
|
||||||
|
|
||||||
storage.surface = game.planets["lignumis"].create_surface()
|
|
||||||
storage.surface.request_to_generate_chunks({ 0, 0 }, 3)
|
|
||||||
storage.surface.force_generate_chunk_requests()
|
|
||||||
storage.surface.daytime = 0.7
|
|
||||||
end)
|
|
||||||
|
|
||||||
script.on_event(e.on_player_created, function(event)
|
|
||||||
if not storage.nauvis_visited then
|
|
||||||
local nauvis = game.get_surface("nauvis") --[[@as LuaSurface]]
|
|
||||||
nauvis.clear()
|
|
||||||
end
|
|
||||||
|
|
||||||
if storage.init and type(storage.init) == "boolean" then
|
|
||||||
storage.init = {
|
|
||||||
[event.player_index] = true
|
|
||||||
}
|
|
||||||
else
|
|
||||||
storage.init = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
local player = game.get_player(event.player_index) --[[@as LuaPlayer]]
|
|
||||||
local surface = storage.surface or game.planets["lignumis"].surface
|
|
||||||
|
|
||||||
if not storage.init[event.player_index] then
|
|
||||||
storage.init[event.player_index] = true
|
|
||||||
chart_starting_area()
|
|
||||||
|
|
||||||
if player then
|
|
||||||
if player.character then
|
|
||||||
player.teleport(surface.find_non_colliding_position("character", { 0, 0 }, 0, 1), "lignumis")
|
|
||||||
player.character.destructible = false
|
|
||||||
local main_inventory = player.character.get_main_inventory()
|
|
||||||
main_inventory.insert({ name = "burner-mining-drill", count = 1 })
|
|
||||||
main_inventory.insert({ name = "burner-agricultural-tower", count = 2 })
|
|
||||||
end
|
|
||||||
|
|
||||||
if remote.interfaces.freeplay then
|
|
||||||
storage.crashed_ship_items = remote.call("freeplay", "get_ship_items")
|
|
||||||
storage.crashed_debris_items = remote.call("freeplay", "get_debris_items")
|
|
||||||
storage.crashed_ship_parts = remote.call("freeplay", "get_ship_parts")
|
|
||||||
storage.starting_message = remote.call("freeplay", "get_custom_intro_message")
|
|
||||||
|
|
||||||
local ship_items = { ["wood-darts-magazine"] = 2 }
|
|
||||||
local debris_items = { ["lumber"] = 8 }
|
|
||||||
|
|
||||||
crash_site.create_crash_site(surface, { -5, -6 }, ship_items, debris_items,
|
|
||||||
table.deepcopy(storage.crashed_ship_parts))
|
|
||||||
util.remove_safe(player, storage.crashed_ship_items)
|
|
||||||
util.remove_safe(player, storage.crashed_debris_items)
|
|
||||||
|
|
||||||
player.get_main_inventory().sort_and_merge()
|
|
||||||
|
|
||||||
storage.crash_site_cutscene_active = true
|
|
||||||
crash_site.create_cutscene(player, { -5, -4 })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
script.on_event(e.on_player_changed_surface, function(event)
|
|
||||||
local player = game.get_player(event.player_index) --[[@as LuaPlayer]]
|
|
||||||
if player.surface.name == "nauvis" then
|
|
||||||
storage.nauvis_visited = true
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
local get_starting_message = function()
|
|
||||||
if storage.custom_intro_message then
|
|
||||||
return storage.custom_intro_message
|
|
||||||
end
|
|
||||||
return { "msg-intro-space-age" }
|
|
||||||
end
|
|
||||||
|
|
||||||
local function show_intro_message(player)
|
|
||||||
if storage.skip_intro then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if game.is_multiplayer() then
|
|
||||||
player.print(get_starting_message())
|
|
||||||
else
|
|
||||||
game.show_message_dialog { text = get_starting_message() }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
script.on_event(e.on_cutscene_waypoint_reached, function(event)
|
|
||||||
if not storage.crash_site_cutscene_active then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if not crash_site.is_crash_site_cutscene(event) then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local player = game.get_player(event.player_index) --[[@as LuaPlayer]]
|
|
||||||
|
|
||||||
player.exit_cutscene()
|
|
||||||
show_intro_message(player)
|
|
||||||
end)
|
|
||||||
|
|
||||||
script.on_event("crash-site-skip-cutscene", function(event)
|
|
||||||
if not storage.crash_site_cutscene_active then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if event.player_index ~= 1 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local player = game.get_player(event.player_index) --[[@as LuaPlayer]]
|
|
||||||
if player.controller_type == defines.controllers.cutscene then
|
|
||||||
player.exit_cutscene()
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
script.on_event(e.on_cutscene_cancelled, function(event)
|
|
||||||
if not storage.crash_site_cutscene_active then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if event.player_index ~= 1 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
storage.crash_site_cutscene_active = nil
|
|
||||||
local player = game.get_player(event.player_index) --[[@as LuaPlayer]]
|
|
||||||
if player.gui.screen.skip_cutscene_label then
|
|
||||||
player.gui.screen.skip_cutscene_label.destroy()
|
|
||||||
end
|
|
||||||
if player.character then
|
|
||||||
player.character.destructible = true
|
|
||||||
end
|
|
||||||
player.zoom = 1.5
|
|
||||||
end)
|
|
||||||
|
|
21
lignumis/script/init-existing.lua
Normal file
21
lignumis/script/init-existing.lua
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
local InitExisting = {}
|
||||||
|
|
||||||
|
-- Initialization for existing games
|
||||||
|
-- Don't send players to Lignumis but instead print a warning
|
||||||
|
|
||||||
|
InitExisting.on_init = function()
|
||||||
|
if game.tick == 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
storage.init = {}
|
||||||
|
for _, player in pairs(game.players) do
|
||||||
|
storage.init[player.index] = true
|
||||||
|
if player.physical_surface.name == "nauvis" then
|
||||||
|
storage.nauvis_visited = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
game.print { "", { "lignumis.start-new-game" } }
|
||||||
|
end
|
||||||
|
|
||||||
|
return InitExisting
|
76
lignumis/script/init-new.lua
Normal file
76
lignumis/script/init-new.lua
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
local InitNew = {}
|
||||||
|
|
||||||
|
-- Initialization for new games
|
||||||
|
-- Send all players to Lignumis and clear Nauvis
|
||||||
|
|
||||||
|
|
||||||
|
-- Initialize the freeplay intro
|
||||||
|
local function init_intro()
|
||||||
|
if not remote.interfaces.freeplay then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Disable Nauvis intro
|
||||||
|
remote.call("freeplay", "set_disable_crashsite", true)
|
||||||
|
remote.call("freeplay", "set_skip_intro", true)
|
||||||
|
|
||||||
|
-- Replace yellow ammo with wood ammo
|
||||||
|
-- Wooden military does the same already
|
||||||
|
if not script.active_mods["wood-military"] then
|
||||||
|
local respawn_items = remote.call("freeplay", "get_respawn_items")
|
||||||
|
respawn_items["wood-darts-magazine"] = respawn_items["firearm-magazine"]
|
||||||
|
respawn_items["firearm-magazine"] = nil
|
||||||
|
remote.call("freeplay", "set_respawn_items", respawn_items)
|
||||||
|
|
||||||
|
local created_items = remote.call("freeplay", "get_created_items")
|
||||||
|
created_items["wood-darts-magazine"] = created_items["firearm-magazine"]
|
||||||
|
created_items["firearm-magazine"] = nil
|
||||||
|
remote.call("freeplay", "set_created_items", created_items)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Initialize space locations
|
||||||
|
-- Lock Nauvis, unlock Lignumis
|
||||||
|
local function init_space_locations()
|
||||||
|
local force = game.forces.player
|
||||||
|
force.technologies["planet-discovery-lignumis"].researched = true
|
||||||
|
if not force.technologies["planet-discovery-nauvis"].researched then
|
||||||
|
force.lock_space_location("nauvis")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Initialize Lignumis
|
||||||
|
local function init_lignumis()
|
||||||
|
storage.surface = game.planets["lignumis"].create_surface()
|
||||||
|
storage.surface.request_to_generate_chunks({ 0, 0 }, 3)
|
||||||
|
storage.surface.force_generate_chunk_requests()
|
||||||
|
storage.surface.daytime = 0.7
|
||||||
|
|
||||||
|
-- Chart starting area
|
||||||
|
local r = 200
|
||||||
|
local force = game.forces.player
|
||||||
|
local origin = force.get_spawn_position(storage.surface)
|
||||||
|
force.chart(storage.surface, { { origin.x - r, origin.y - r }, { origin.x + r, origin.y + r } })
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Clear Nauvis surface as we start on Lignumis
|
||||||
|
local function clear_nauvis()
|
||||||
|
game.get_surface("nauvis").clear()
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
InitNew.on_init = function()
|
||||||
|
if game.tick > 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
init_intro()
|
||||||
|
init_space_locations()
|
||||||
|
init_lignumis()
|
||||||
|
clear_nauvis()
|
||||||
|
end
|
||||||
|
|
||||||
|
return InitNew
|
155
lignumis/script/init.lua
Normal file
155
lignumis/script/init.lua
Normal file
|
@ -0,0 +1,155 @@
|
||||||
|
local crash_site = require("crash-site")
|
||||||
|
local util = require("util")
|
||||||
|
|
||||||
|
-- General initialization
|
||||||
|
|
||||||
|
local Init = {
|
||||||
|
events = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-- Migrate storage init as it was just a boolean before not supporting multiple players
|
||||||
|
local function migrate_0_9_6(event)
|
||||||
|
if storage.init and type(storage.init) == "boolean" then
|
||||||
|
storage.init = {
|
||||||
|
[event.player_index] = true
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Initialize the player
|
||||||
|
-- Teleport to Lignumis and give some starting items
|
||||||
|
local function init_player(event)
|
||||||
|
local player = game.get_player(event.player_index)
|
||||||
|
|
||||||
|
if not player.character then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local surface = storage.surface or game.planets["lignumis"].surface
|
||||||
|
player.teleport(surface.find_non_colliding_position("character", { 0, 0 }, 0, 1), "lignumis")
|
||||||
|
player.character.destructible = false
|
||||||
|
local main_inventory = player.character.get_main_inventory()
|
||||||
|
|
||||||
|
-- Add some starting items to player inventory
|
||||||
|
main_inventory.insert({ name = "lumber", count = 8 })
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Initialize the freeplay scenario
|
||||||
|
local function init_freeplay(event)
|
||||||
|
local player = game.get_player(event.player_index)
|
||||||
|
|
||||||
|
if not player or not remote.interfaces.freeplay then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local surface = storage.surface or game.planets["lignumis"].surface
|
||||||
|
storage.crashed_ship_items = remote.call("freeplay", "get_ship_items")
|
||||||
|
storage.crashed_debris_items = remote.call("freeplay", "get_debris_items")
|
||||||
|
storage.crashed_ship_parts = remote.call("freeplay", "get_ship_parts")
|
||||||
|
storage.starting_message = remote.call("freeplay", "get_custom_intro_message")
|
||||||
|
|
||||||
|
local ship_items = {
|
||||||
|
["burner-mining-drill"] = 1,
|
||||||
|
["burner-agricultural-tower"] = 2
|
||||||
|
}
|
||||||
|
local debris_items = {
|
||||||
|
["lumber"] = 8,
|
||||||
|
["wood-darts-magazine"] = 2
|
||||||
|
}
|
||||||
|
|
||||||
|
crash_site.create_crash_site(surface, { -5, -6 }, ship_items, debris_items,
|
||||||
|
table.deepcopy(storage.crashed_ship_parts))
|
||||||
|
util.remove_safe(player, storage.crashed_ship_items)
|
||||||
|
util.remove_safe(player, storage.crashed_debris_items)
|
||||||
|
player.character.get_main_inventory().sort_and_merge()
|
||||||
|
|
||||||
|
storage.crash_site_cutscene_active = true
|
||||||
|
crash_site.create_cutscene(player, { -5, -4 })
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Init.events[defines.events.on_player_created] = function(event)
|
||||||
|
migrate_0_9_6(event)
|
||||||
|
storage.init = storage.init or {}
|
||||||
|
|
||||||
|
if storage.init[event.player_index] then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
storage.init[event.player_index] = true
|
||||||
|
init_player(event)
|
||||||
|
init_freeplay(event)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Watch Nauvis being visited for the first time
|
||||||
|
Init.events[defines.events.on_player_changed_surface] = function(event)
|
||||||
|
local player = game.get_player(event.player_index)
|
||||||
|
if player and player.surface.name == "nauvis" then
|
||||||
|
storage.nauvis_visited = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- End intro and show starting message
|
||||||
|
Init.events[defines.events.on_cutscene_waypoint_reached] = function(event)
|
||||||
|
if not storage.crash_site_cutscene_active then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not crash_site.is_crash_site_cutscene(event) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local player = game.get_player(event.player_index)
|
||||||
|
player.exit_cutscene()
|
||||||
|
|
||||||
|
if storage.skip_intro then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local intro_message = storage.custom_intro_message or { "msg-intro-space-age" }
|
||||||
|
|
||||||
|
if game.is_multiplayer() then
|
||||||
|
player.print(intro_message)
|
||||||
|
else
|
||||||
|
game.show_message_dialog { text = intro_message }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Cancel intro
|
||||||
|
Init.events["crash-site-skip-cutscene"] = function(event)
|
||||||
|
if not storage.crash_site_cutscene_active then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if event.player_index ~= 1 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local player = game.get_player(event.player_index)
|
||||||
|
if player.controller_type == defines.controllers.cutscene then
|
||||||
|
player.exit_cutscene()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Init.events[defines.events.on_cutscene_cancelled] = function(event)
|
||||||
|
if not storage.crash_site_cutscene_active then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if event.player_index ~= 1 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
storage.crash_site_cutscene_active = nil
|
||||||
|
local player = game.get_player(event.player_index)
|
||||||
|
if player.gui.screen.skip_cutscene_label then
|
||||||
|
player.gui.screen.skip_cutscene_label.destroy()
|
||||||
|
end
|
||||||
|
if player.character then
|
||||||
|
player.character.destructible = true
|
||||||
|
end
|
||||||
|
player.zoom = 1.5
|
||||||
|
end
|
||||||
|
|
||||||
|
return Init
|
|
@ -1,7 +1,14 @@
|
||||||
local crash_site = require("crash-site")
|
local crash_site = require("crash-site")
|
||||||
local util = require("util")
|
local util = require("util")
|
||||||
local e = defines.events
|
|
||||||
|
|
||||||
|
-- Transition from Lignumis to Nauvis with the provisional rocket silo
|
||||||
|
|
||||||
|
local ToNauvis = {
|
||||||
|
events = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-- Chart the starting area for the player
|
||||||
local function chart_starting_area(surface, player)
|
local function chart_starting_area(surface, player)
|
||||||
local r = 200
|
local r = 200
|
||||||
local force = player.force
|
local force = player.force
|
||||||
|
@ -9,35 +16,58 @@ local function chart_starting_area(surface, player)
|
||||||
force.chart(surface, { { origin.x - r, origin.y - r }, { origin.x + r, origin.y + r } })
|
force.chart(surface, { { origin.x - r, origin.y - r }, { origin.x + r, origin.y + r } })
|
||||||
end
|
end
|
||||||
|
|
||||||
local function travel_to_nauvis()
|
|
||||||
|
-- Initialize Nauvis
|
||||||
|
local function init_nauvis()
|
||||||
local nauvis = game.planets["nauvis"].create_surface()
|
local nauvis = game.planets["nauvis"].create_surface()
|
||||||
nauvis.request_to_generate_chunks({ 0, 0 }, 3)
|
nauvis.request_to_generate_chunks({ 0, 0 }, 3)
|
||||||
nauvis.force_generate_chunk_requests()
|
nauvis.force_generate_chunk_requests()
|
||||||
|
nauvis.daytime = 0.7
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Teleport all players to Nauvis and show welcoe message
|
||||||
|
local function teleport_players()
|
||||||
|
local nauvis = game.planets["nauvis"].surface
|
||||||
for _, player in pairs(game.players) do
|
for _, player in pairs(game.players) do
|
||||||
if player.surface.name == "lignumis" then
|
if player.surface.name == "lignumis" then
|
||||||
player.teleport(nauvis.find_non_colliding_position("character", { 0, 0 }, 0, 1) --[[@as MapPosition]],
|
player.teleport(nauvis.find_non_colliding_position("character", { 0, 0 }, 0, 1), "nauvis")
|
||||||
"nauvis")
|
|
||||||
chart_starting_area(nauvis, player)
|
chart_starting_area(nauvis, player)
|
||||||
player.print("Oh no, not again. But... Welcome to Nauvis!")
|
player.print("Oh no, not again. But... Welcome to Nauvis!")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
nauvis.daytime = 0.7
|
|
||||||
|
|
||||||
if remote.interfaces.freeplay then
|
|
||||||
local ship_items = { ["burner-mining-drill"] = 5, ["stone-furnace"] = 5, ["burner-assembling-machine"] = 2, ["burner-agricultural-tower"] = 4, ["wood-lab"] = 4 }
|
|
||||||
local debris_items = { ["wood-darts-magazine"] = 20, ["wood"] = 20, ["lumber"] = 20 }
|
|
||||||
local crashed_ship_parts = remote.call("freeplay", "get_ship_parts")
|
|
||||||
|
|
||||||
crash_site.create_crash_site(nauvis, { -5, -6 }, ship_items, debris_items, table.deepcopy(crashed_ship_parts))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
script.on_event(e.on_rocket_launched, function(event)
|
|
||||||
local rocket_silo = event.rocket_silo
|
-- Initialize the Nauvis freeplay scenario
|
||||||
if rocket_silo.name == "provisional-rocket-silo" then
|
local function init_freeplay()
|
||||||
--rocket_silo.destroy()
|
if not remote.interfaces.freeplay then
|
||||||
travel_to_nauvis()
|
return
|
||||||
end
|
end
|
||||||
end)
|
|
||||||
|
local nauvis = game.planets["nauvis"].surface
|
||||||
|
local ship_items = {
|
||||||
|
["burner-mining-drill"] = 5,
|
||||||
|
["stone-furnace"] = 5,
|
||||||
|
["burner-assembling-machine"] = 2,
|
||||||
|
["burner-agricultural-tower"] = 4,
|
||||||
|
["wood-lab"] = 4
|
||||||
|
}
|
||||||
|
local debris_items = { ["wood-darts-magazine"] = 20, ["wood"] = 20, ["lumber"] = 20 }
|
||||||
|
local crashed_ship_parts = remote.call("freeplay", "get_ship_parts")
|
||||||
|
|
||||||
|
crash_site.create_crash_site(nauvis, { -5, -6 }, ship_items, debris_items, table.deepcopy(crashed_ship_parts))
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
ToNauvis.events[defines.events.on_rocket_launched] = function(event)
|
||||||
|
if not event.rocket_silo.name == "provisional-rocket-silo" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
init_nauvis()
|
||||||
|
teleport_players()
|
||||||
|
init_freeplay()
|
||||||
|
end
|
||||||
|
|
||||||
|
return ToNauvis
|
Loading…
Add table
Reference in a new issue