parent
3683a492c0
commit
4e415782f2
3 changed files with 19 additions and 54 deletions
|
@ -134,6 +134,7 @@ data.raw["string-setting"]["lignumis-second-planet"].default_value = "gleba"
|
|||
- Fix pipe graphics on desiccation furnace and quality assembler
|
||||
- Trees must not die when absorbing noise
|
||||
- https://lua-api.factorio.com/latest/types/TreeVariation.html
|
||||
- Improve transition to Nauvis a bit more
|
||||
- Add information in Factoriopedia
|
||||
- Compatibility with [On Wayward Seas](https://mods.factorio.com/mod/wayward-seas)
|
||||
- Compatibility with [Exotic Space Industries](https://mods.factorio.com/mod/exotic-space-industries)
|
||||
|
|
|
@ -29,7 +29,7 @@ end
|
|||
local function teleport_player(player)
|
||||
local nauvis = game.planets[storage.target_planet].surface
|
||||
if player.surface.name == "lignumis" then
|
||||
local position = nauvis.find_non_colliding_position("character", { 2, 2 }, 100, 1) or { 0, 0 }
|
||||
local position = nauvis.find_non_colliding_position("character", { 0, 0 }, 100, 1) or { 0, 0 }
|
||||
player.teleport(position, storage.target_planet)
|
||||
chart_starting_area(nauvis, player)
|
||||
end
|
||||
|
@ -57,69 +57,35 @@ local function init_freeplay()
|
|||
end
|
||||
|
||||
|
||||
local function transit_player(player_index)
|
||||
local player = game.get_player(player_index)
|
||||
local transition = storage.transitions[player_index]
|
||||
ToNauvis.events[defines.events.on_rocket_launched] = function(event)
|
||||
if not event.rocket_silo or event.rocket_silo.name ~= "provisional-rocket-silo" then return end
|
||||
|
||||
transition.rocket_entry.cargo_pod.set_passenger(nil)
|
||||
transition.rocket_entry.cargo_pod.destroy()
|
||||
local rocket_entry
|
||||
local rocket_entry_index
|
||||
local player
|
||||
|
||||
for i, entry in pairs(storage.rocket_silos) do
|
||||
if entry.real_silo == event.rocket_silo then
|
||||
rocket_entry = entry
|
||||
rocket_entry_index = i
|
||||
player = entry.player and game.get_player(entry.player) or game.players[1]
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
init_nauvis()
|
||||
teleport_player(player)
|
||||
init_freeplay()
|
||||
|
||||
-- Give the player the content of the rocket
|
||||
if transition.rocket_entry.rocket_content then
|
||||
if rocket_entry.rocket_content then
|
||||
local inventory = player.get_main_inventory()
|
||||
for _, item in pairs(transition.rocket_entry.rocket_content) do
|
||||
for _, item in pairs(rocket_entry.rocket_content) do
|
||||
inventory.insert(item)
|
||||
end
|
||||
inventory.sort_and_merge()
|
||||
end
|
||||
table.remove(storage.rocket_silos, transition.rocket_entry_index)
|
||||
end
|
||||
|
||||
|
||||
local function explode_silo(silo)
|
||||
silo.die()
|
||||
end
|
||||
|
||||
ToNauvis.events[defines.events.on_rocket_launch_ordered] = function(event)
|
||||
if not event.rocket_silo or event.rocket_silo.name ~= "provisional-rocket-silo" then return end
|
||||
|
||||
local player
|
||||
|
||||
for i, entry in pairs(storage.rocket_silos) do
|
||||
if entry.real_silo == event.rocket_silo then
|
||||
if not storage.transitions then
|
||||
storage.transitions = {}
|
||||
end
|
||||
player = entry.player and game.get_player(entry.player) or game.players[1]
|
||||
storage.transitions[player.index] = {
|
||||
rocket_entry = entry,
|
||||
rocket_entry_index = i
|
||||
}
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
local transit_tick = game.tick + (26 * 59)
|
||||
local explode_tick = game.tick + (31 * 59)
|
||||
|
||||
script.on_nth_tick(explode_tick, function()
|
||||
explode_silo(event.rocket_silo)
|
||||
script.on_nth_tick(explode_tick, nil)
|
||||
end)
|
||||
|
||||
script.on_nth_tick(transit_tick, function()
|
||||
transit_player(player.index)
|
||||
script.on_nth_tick(transit_tick, nil)
|
||||
end)
|
||||
end
|
||||
|
||||
ToNauvis.events[defines.events.on_post_entity_died] = function(event)
|
||||
if not event.ghost or event.prototype.name ~= "provisional-rocket-silo" then return end
|
||||
event.ghost.destroy()
|
||||
table.remove(storage.rocket_silos, rocket_entry_index)
|
||||
end
|
||||
|
||||
return ToNauvis
|
||||
|
|
|
@ -92,10 +92,8 @@ local function launch(event)
|
|||
if entry.fake_silo == fake_silo then
|
||||
entry.player = event.player_index
|
||||
entry.rocket_content = rocket_content
|
||||
entry.cargo_pod = entry.real_silo.rocket.attached_cargo_pod
|
||||
fake_silo.destroy()
|
||||
entry.real_silo.launch_rocket()
|
||||
entry.cargo_pod.set_passenger(player)
|
||||
break
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue