Split mod
This commit is contained in:
parent
9d94502296
commit
efb0b6aad7
101 changed files with 803 additions and 786 deletions
79
lignumis-base/scripts/init-new.lua
Normal file
79
lignumis-base/scripts/init-new.lua
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
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 game.planets["nauvis"] and force.technologies["planet-discovery-nauvis"] and 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
|
||||
|
||||
storage.target_planet = settings.startup["lignumis-second-planet"].value or "nauvis"
|
||||
|
||||
if script.active_mods["any-planet-start"] then
|
||||
storage.target_planet = settings.startup["aps-planet"].value ~= "none" and settings.startup["aps-planet"].value or storage.target_planet
|
||||
remote.call("APS", "override_planet", "lignumis")
|
||||
end
|
||||
|
||||
init_intro()
|
||||
init_space_locations()
|
||||
init_lignumis()
|
||||
clear_nauvis()
|
||||
end
|
||||
|
||||
return InitNew
|
||||
Loading…
Add table
Add a link
Reference in a new issue