From c9c09e31d6213b1823185aae48cfd53155be0f2e Mon Sep 17 00:00:00 2001 From: DeltaFire <46569814+DeltaFire15@users.noreply.github.com> Date: Fri, 22 Sep 2023 00:01:08 +0200 Subject: [PATCH] Adds a overmap z failsafe (#2525) --- nsv13/code/__DEFINES/overmap.dm | 3 +++ nsv13/code/modules/overmap/FTL/ftl_jump.dm | 6 ++++++ nsv13/code/modules/overmap/ai-skynet.dm | 2 ++ nsv13/code/modules/overmap/overmap.dm | 1 + 4 files changed, 12 insertions(+) diff --git a/nsv13/code/__DEFINES/overmap.dm b/nsv13/code/__DEFINES/overmap.dm index ed4354121b9..beb76f66c13 100644 --- a/nsv13/code/__DEFINES/overmap.dm +++ b/nsv13/code/__DEFINES/overmap.dm @@ -102,6 +102,9 @@ GLOBAL_LIST_INIT(overmap_impact_sounds, list('nsv13/sound/effects/ship/freespace #define INTERIOR_DELETING 3 #define INTERIOR_DELETED 4 +//Overmap flags +#define OVERMAP_FLAG_ZLEVEL_CARRIER (1<<0) //! This overmap is meant to carry a z with it, prompting restoration in certain cases. + //Ship mass #define MASS_TINY 1 //1 Player - Fighters #define MASS_SMALL 2 //2-5 Players - FoB/Mining Ship diff --git a/nsv13/code/modules/overmap/FTL/ftl_jump.dm b/nsv13/code/modules/overmap/FTL/ftl_jump.dm index e6b585cf61c..f63c95723a9 100644 --- a/nsv13/code/modules/overmap/FTL/ftl_jump.dm +++ b/nsv13/code/modules/overmap/FTL/ftl_jump.dm @@ -1,11 +1,17 @@ /datum/star_system/proc/add_ship(obj/structure/overmap/OM, turf/target_turf) if(!system_contents.Find(OM)) system_contents += OM //Lets be safe while I cast some black magic. + var/did_restore_system = FALSE if(!occupying_z && OM.z) //Does this system have a physical existence? if not, we'll set this now so that any inbound ships jump to the same Z-level that we're on. if(!SSmapping.level_trait(OM.z, ZTRAIT_OVERMAP)) occupying_z = OM.get_reserved_z() else occupying_z = OM.z + did_restore_system = TRUE + else if(!occupying_z && ((OM.overmap_flags & OVERMAP_FLAG_ZLEVEL_CARRIER) || length(OM.mobs_in_ship))) //If someone is inside, or we always want it loaded, load it. + occupying_z = OM.get_reserved_z() + did_restore_system = TRUE + if(did_restore_system) if(fleets.len) for(var/datum/fleet/F in fleets) if(!F.current_system) diff --git a/nsv13/code/modules/overmap/ai-skynet.dm b/nsv13/code/modules/overmap/ai-skynet.dm index bb1164370fa..eab22f31145 100644 --- a/nsv13/code/modules/overmap/ai-skynet.dm +++ b/nsv13/code/modules/overmap/ai-skynet.dm @@ -1610,6 +1610,8 @@ Seek a ship thich we'll station ourselves around var/ai_can_launch_fighters = FALSE //AI variable. Allows your ai ships to spawn fighter craft var/list/ai_fighter_type = list() var/ai_flags = AI_FLAG_DESTROYER + ///Overmap bitflags + var/overmap_flags = NONE var/list/holding_cargo = list() // list of objective datums. This station has cargo to deliver to the players as part of a courier objective var/list/expecting_cargo = list() // list of objective datums. This station is expecting cargo delivered to them by the players as a part of a courier objective diff --git a/nsv13/code/modules/overmap/overmap.dm b/nsv13/code/modules/overmap/overmap.dm index 00f5b0650d7..9216e047d2a 100644 --- a/nsv13/code/modules/overmap/overmap.dm +++ b/nsv13/code/modules/overmap/overmap.dm @@ -232,6 +232,7 @@ Proc to spool up a new Z-level for a player ship and assign it a treadmill. var/turf/exit = get_turf(locate(round(world.maxx * 0.5, 1), round(world.maxy * 0.5, 1), world.maxz)) //Plop them bang in the center of the system. var/obj/structure/overmap/OM = new _path(exit) //Ship'll pick up the info it needs, so just domp eet at the exit turf. OM.reserved_z = world.maxz + OM.overmap_flags |= OVERMAP_FLAG_ZLEVEL_CARRIER OM.current_system = SSstar_system.find_system(OM) if(OM.role == MAIN_OVERMAP) //If we're the main overmap, we'll cheat a lil' and apply our status to all of the Zs under "station" for(var/z in SSmapping.levels_by_trait(ZTRAIT_STATION))