mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-02-15 13:53:09 +02:00
no marooning
This commit is contained in:
parent
b99afc3d6a
commit
5125bd13b2
maps/pirates
@ -598,7 +598,7 @@ function Public.check_for_destination_collisions()
|
||||
if (relativex == 4 and relativey + destination_data.iconized_map_height/2 >= -3.5 and relativey - destination_data.iconized_map_height/2 <= 3.5) then
|
||||
--or (relativey - destination_data.iconized_map.height/2 == 5 and (relativex >= -3.5 or relativex <= 4.5)) or (relativey + destination_data.iconized_map.height/2 == -4 and (relativex >= -3.5 or relativex <= 4.5))
|
||||
|
||||
Surfaces.clean_up(Common.current_destination())
|
||||
-- Surfaces.clean_up(Common.current_destination())
|
||||
|
||||
Surfaces.create_surface(destination_data)
|
||||
|
||||
@ -622,7 +622,7 @@ function Public.check_for_destination_collisions()
|
||||
end
|
||||
|
||||
|
||||
function Public.cleanup_old_destination_data() --we do actually access destinations behind us (during the cleanup process and for marooned players), so only fire this when safe
|
||||
function Public.cleanup_old_destination_data() --we do actually access destinations behind us (during the cleanup process and for marooned players), so only fire this when safe. (EDIT: Can this be refactored now that we no longer maroon?)
|
||||
local memory = Memory.get_crew_memory()
|
||||
for i, destination_data in pairs(memory.destinations) do
|
||||
if destination_data.overworld_position.x < memory.overworldx then
|
||||
|
@ -640,7 +640,6 @@ function Public.go_from_currentdestination_to_sea()
|
||||
|
||||
Overworld.try_overworld_move_v2{x = d, y = 0}
|
||||
|
||||
|
||||
-- If crew revealed treasure, but couldn't figure out how to dig it, give them tip
|
||||
if destination.dynamic_data.some_player_was_close_to_buried_treasure then
|
||||
local maps = destination.dynamic_data.treasure_maps or {}
|
||||
@ -651,32 +650,8 @@ function Public.go_from_currentdestination_to_sea()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local players_marooned_count = 0
|
||||
for _, player in pairs(Common.crew_get_crew_members()) do
|
||||
if (player.surface == oldsurface and player.character and player.character.valid) then
|
||||
players_marooned_count = players_marooned_count + 1
|
||||
|
||||
-- When players are "hanging in front of ship" when boat departs, teleport them inside ship.
|
||||
-- Side effect: if players happen to be on water tile during this tick and not too far from ship, they will be teleported to the boat.
|
||||
-- @TODO: instead of checking 50 radius, check only smaller area around boat
|
||||
if Math.distance(old_boatposition, player.character.position) < 50 then
|
||||
local tile = oldsurface.get_tile(player.character.position.x, player.character.position.y)
|
||||
if tile.valid then
|
||||
if Utils.contains(CoreData.water_tile_names, tile.name) then
|
||||
local newsurface = game.surfaces[seaname]
|
||||
if newsurface and newsurface.valid then
|
||||
player.teleport(newsurface.find_non_colliding_position('character', memory.spawnpoint, 32, 0.5) or memory.spawnpoint, newsurface)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if players_marooned_count == 0 then
|
||||
Surfaces.clean_up(destination)
|
||||
end
|
||||
|
||||
Surfaces.clean_up(destination)
|
||||
end
|
||||
|
||||
|
||||
|
@ -766,14 +766,7 @@ end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function Public.clean_up(destination)
|
||||
-- game.print('clean_up')
|
||||
|
||||
local memory = Memory.get_crew_memory()
|
||||
|
||||
local oldsurface = game.surfaces[destination.surface_name]
|
||||
@ -802,15 +795,6 @@ function Public.clean_up(destination)
|
||||
memory.scripted_unit_groups = nil
|
||||
memory.floating_pollution = nil
|
||||
|
||||
if memory.enemy_force_name then
|
||||
local ef = memory.enemy_force
|
||||
if ef and ef.valid then
|
||||
memory.enemy_force.reset_evolution()
|
||||
local base_evo = Balance.base_evolution_leagues(memory.overworldx)
|
||||
Common.set_evo(base_evo)
|
||||
end
|
||||
end
|
||||
|
||||
game.delete_surface(oldsurface)
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user