diff --git a/html/changelog.html b/html/changelog.html
index a7edadd9339..af8c4df6db6 100644
--- a/html/changelog.html
+++ b/html/changelog.html
@@ -56,6 +56,21 @@
-->
+
06 September 2024
+
Bokkiewokkie updated:
+
+ - Changed asteroid ore spawning to respect asteroid maps more
+
+
DeltaFire15 updated:
+
+ - Possibly fixes some weird Sabre behavior.
+ - Also makes one single gun check of the plasma caster slightly safer.
+ - Fixes a weird edge case with docking behavior.
+ - Fixes remove_ship() assuming all remove_ship() calls were FTL based.
+ - Overmap objects when deleting have remove_ship() called for them (this should mostly only affect z carriers which drop their z or pass it to another ship).
+ - Overmap objects that are deleted now drop their current_system var.
+
+
24 August 2024
DeltaFire15 updated:
@@ -113,12 +128,6 @@ Pockets-byte updated:
- Added new fighter sprite and fighter with shields
- Added new fighter weapon and sprite
-
-
05 July 2024
-
Pockets-byte updated:
-
- - Added relayed (overmap) laser projectiles for boom
-
GoonStation 13 Development Team
diff --git a/html/changelogs/.all_changelog.yml b/html/changelogs/.all_changelog.yml
index fb622fc6cea..b4f81691ab5 100644
--- a/html/changelogs/.all_changelog.yml
+++ b/html/changelogs/.all_changelog.yml
@@ -2136,3 +2136,15 @@ DO NOT EDIT THIS FILE BY HAND! AUTOMATICALLY GENERATED BY ss13_genchangelog.py.
- tweak: turf changes
- balance: added random ore spawns
- bugfix: pre-beebase objects and turfs
+2024-09-06:
+ Bokkiewokkie:
+ - tweak: Changed asteroid ore spawning to respect asteroid maps more
+ DeltaFire15:
+ - bugfix: Possibly fixes some weird Sabre behavior.
+ - bugfix: Also makes one single gun check of the plasma caster slightly safer.
+ - bugfix: Fixes a weird edge case with docking behavior.
+ - bugfix: Fixes remove_ship() assuming all remove_ship() calls were FTL based.
+ - bugfix: Overmap objects when deleting have remove_ship() called for them (this
+ should mostly only affect z carriers which drop their z or pass it to another
+ ship).
+ - bugfix: Overmap objects that are deleted now drop their current_system var.
diff --git a/nsv13/code/controllers/subsystem/starsystem.dm b/nsv13/code/controllers/subsystem/starsystem.dm
index 0a4f35dde2e..366242bf860 100644
--- a/nsv13/code/controllers/subsystem/starsystem.dm
+++ b/nsv13/code/controllers/subsystem/starsystem.dm
@@ -253,6 +253,7 @@ Returns a faction datum by its name (case insensitive!)
if(sys.name == id)
return sys
+///AVOID using this if possible, go by the objects current_system var if you can. Do not trust the weird ships[] list unless you HAVE to (e.g. you haven't set the system yet)
/datum/controller/subsystem/star_system/proc/find_system(obj/O) //Used to determine what system a ship is currently in. Famously used to determine the starter system that you've put the ship in.
var/datum/star_system/system
if(isovermap(O))
@@ -355,9 +356,13 @@ Returns a faction datum by its name (case insensitive!)
highestTickets = F.tickets
return winner
-/datum/controller/subsystem/star_system/proc/add_ship(obj/structure/overmap/OM, turf/target)
+/datum/controller/subsystem/star_system/proc/add_ship(obj/structure/overmap/OM, turf/target, datum/star_system/system_override)
ships[OM] = list("ship" = OM, "x" = 0, "y" = 0, "current_system" = system_by_id(OM.starting_system), "last_system" = system_by_id(OM.starting_system), "target_system" = null, "from_time" = 0, "to_time" = 0, "occupying_z" = OM.z)
- var/datum/star_system/curr = ships[OM]["current_system"]
+ var/datum/star_system/curr
+ if(!system_override)
+ curr = ships[OM]["current_system"]
+ else
+ curr = system_override
curr.add_ship(OM, target)
//Welcome to bracket hell.
@@ -675,7 +680,7 @@ Returns a faction datum by its name (case insensitive!)
for(var/mob/M in OM.mobs_in_ship)
M?.client?.color = null
if(dist <= 2)
- OM.current_system?.remove_ship(OM)
+ OM.current_system?.remove_ship(OM, is_ftl_jump = FALSE)
for(var/area/crushed as() in OM.linked_areas)
if(istype(crushed, /area/space))
continue
diff --git a/nsv13/code/modules/mining/asteroid.dm b/nsv13/code/modules/mining/asteroid.dm
index dc6896a7577..6ae18405aab 100644
--- a/nsv13/code/modules/mining/asteroid.dm
+++ b/nsv13/code/modules/mining/asteroid.dm
@@ -130,8 +130,8 @@ GLOBAL_LIST_EMPTY(asteroid_spawn_markers) //handles mining asteroids, kind of s
center = T
else
center = locate(T.x+(width/2), T.y+(height/2), T.z)
- for(var/turf/target_turf as() in RANGE_TURFS(rand(3,5), center)) //Give that boi a nice core.
- if(prob(85)) //Bit of random distribution
+ for(var/turf/closed/mineral/target_turf as() in RANGE_TURFS(rand(4,6), center)) //Give that boi a nice core.
+ if(prob(80)) //Bit of random distribution
var/turf_type = pick(core_composition)
target_turf.ChangeTurf(turf_type) //Make the core itself
// add boundaries
diff --git a/nsv13/code/modules/overmap/FTL/ftl_jump.dm b/nsv13/code/modules/overmap/FTL/ftl_jump.dm
index 8fd06aa7043..08cbd3547fd 100644
--- a/nsv13/code/modules/overmap/FTL/ftl_jump.dm
+++ b/nsv13/code/modules/overmap/FTL/ftl_jump.dm
@@ -81,7 +81,7 @@
contents_positions = null
contents_positions = list()
-/datum/star_system/proc/remove_ship(obj/structure/overmap/OM, turf/new_location)
+/datum/star_system/proc/remove_ship(obj/structure/overmap/OM, turf/new_location, is_ftl_jump = TRUE)
var/list/other_player_ships = list()
for(var/atom/X in system_contents)
if(istype(X, /obj/structure/overmap))
@@ -95,7 +95,8 @@
OM.reserved_z = temp
OM.forceMove(new_location ? new_location : locate(OM.x, OM.y, OM.reserved_z)) //Annnd actually kick them out of the current system.
system_contents -= OM
- ftl_pull_small_craft(OM)
+ if(is_ftl_jump)
+ ftl_pull_small_craft(OM)
return //Early return here. This means that another player ship is already holding the system, and we really don't need to double-check for this.
OM.forceMove(new_location ? new_location : locate(OM.x, OM.y, OM.reserved_z)) //Annnd actually kick them out of the current system.
@@ -104,16 +105,28 @@
if(!OM.reserved_z) //If this isn't actually a big ship with its own interior, do not pull ships, as only those get their own reserved z.
return
if(other_player_ships.len) //There's still other ships here, only pull ships of our own faction.
- ftl_pull_small_craft(OM)
+ if(is_ftl_jump)
+ ftl_pull_small_craft(OM)
return
+
for(var/atom/movable/X in system_contents) //Do a last check for safety so we don't stasis a player ship that slid by our other checks somehow.
if(istype(X, /obj/structure/overmap))
var/obj/structure/overmap/ship = X
if(ship != OM && ship.reserved_z) //If there's somehow a player ship in the system that is somehow not in other_player_ships, emergency return.
message_admins("Somehow [ship] got by the initial checks for system exits. This probably shouldn't happen, yell at a coder and / or check ftl.dm")
- ftl_pull_small_craft(OM)
+ if(is_ftl_jump)
+ ftl_pull_small_craft(OM)
return
- ftl_pull_small_craft(OM, FALSE)
+ if(is_ftl_jump)
+ ftl_pull_small_craft(OM, FALSE)
+ else //We are leaving the overmap while holding system and with no other current holders, which risks nullspacing
+ for(var/obj/structure/overmap/last_chance in system_contents)
+ if(!last_chance.spec_pre_system_unload())
+ continue
+ last_chance.reserved_z = OM.reserved_z //We are about to nullspace something that should preserve z. Hand over your z instead.
+ OM.reserved_z = null
+ return
+
for(var/atom/movable/X in system_contents)
contents_positions[X] = list("x" = X.x, "y" = X.y) //Cache the ship's position so we can regenerate it later.
X.moveToNullspace() //Anything that's an NPC should be stored safely in nullspace until we return.
diff --git a/nsv13/code/modules/overmap/fighters/fighters_launcher.dm b/nsv13/code/modules/overmap/fighters/fighters_launcher.dm
index 4faa951073e..2417666ffec 100644
--- a/nsv13/code/modules/overmap/fighters/fighters_launcher.dm
+++ b/nsv13/code/modules/overmap/fighters/fighters_launcher.dm
@@ -267,9 +267,20 @@
speed_limit = 20 //Let them accelerate to hyperspeed due to the launch, and temporarily break the speed limit.
addtimer(VARSET_CALLBACK(src, speed_limit, initial(speed_limit)), 5 SECONDS) //Give them 5 seconds of super speed mode before we take it back from them
-/obj/structure/overmap/small_craft/proc/handle_moved()
+/obj/structure/overmap/small_craft/proc/handle_moved() //Sooo we call this every single tile we move. Is there no better way? (There probably is)
+ //SIGNAL_HANDLER //This should be a signal handler but the proc it calls sleeps and I am not asyncing *this*.
check_overmap_elegibility()
+
+/*
+Welcome to the "uh oh" zone because fighters travelling from and to overmaps is a bit volatile.
+Last time things broke it was caused by d), but if small ship docking starts being weird again, check these four possible weak points first:
+a) something is being weird with the reserved_z of the fighter being used.
+b) asteroid reserved areas for their zs are not being handled properly.
+c) something is being odd with the last overmap var.
+d) the ships[] list of ssstarsystem is acting up again.
+*/
+
/obj/structure/overmap/small_craft/proc/check_overmap_elegibility(ignore_position = FALSE, ignore_cooldown = FALSE) //What we're doing here is checking if the fighter's hitting the bounds of the Zlevel. If they are, we need to transfer them to overmap space.
if(!ignore_position && !is_near_boundary())
return FALSE
@@ -305,7 +316,7 @@
get_reserved_z()
if(current_system) // No I can't use ?, because if it's null we use the previous value instead
starting_system = current_system.name //Just fuck off it works alright?
- SSstar_system.add_ship(src, get_turf(OM))
+ SSstar_system.add_ship(src, get_turf(OM), current_system)
if(current_system && !LAZYFIND(current_system.system_contents, src))
LAZYADD(current_system.system_contents, src)
@@ -357,8 +368,8 @@
var/turf/T = get_turf(pick(OM.docking_points))
forceMove(T)
if(current_system)
- current_system.remove_ship(src, T)
- OM.overmaps_in_ship |= src
+ current_system.remove_ship(src, T, is_ftl_jump = FALSE)
+ OM.overmaps_in_ship += src
bound_width = initial(bound_width)
bound_height = initial(bound_height)
DC.docking_mode = FALSE
diff --git a/nsv13/code/modules/overmap/overmap.dm b/nsv13/code/modules/overmap/overmap.dm
index 96ac015cb01..6184028ce4e 100644
--- a/nsv13/code/modules/overmap/overmap.dm
+++ b/nsv13/code/modules/overmap/overmap.dm
@@ -537,9 +537,12 @@ Proc to spool up a new Z-level for a player ship and assign it a treadmill.
M.forceMove(T)
M.apply_damage(200)
kill_boarding_level()
+ if(current_system)
+ current_system.remove_ship(src, is_ftl_jump = FALSE) //bit risky call since we already do some things before but probably should still work.
if(reserved_z)
free_treadmills += reserved_z
reserved_z = null
+ current_system = null //I'm not sure why we never dropped this variable.
return ..()
/obj/structure/overmap/forceMove(atom/destination)
@@ -975,3 +978,17 @@ Proc to spool up a new Z-level for a player ship and assign it a treadmill.
var/_z = pick_n_take(free_treadmills)
reserved_z = _z
return reserved_z
+
+///Special proc called right before a system is nullspaced and a last chance to assume a z. Returns TRUE if the ship should not be unloaded.
+/obj/structure/overmap/proc/spec_pre_system_unload()
+ if(!ai_controlled && length(mobs_in_ship))
+ return TRUE
+ return FALSE
+
+/obj/structure/overmap/small_craft/spec_pre_system_unload()
+ . = ..()
+ if(.)
+ return
+ if(ftl_drive)
+ return TRUE
+ return FALSE
diff --git a/nsv13/code/modules/overmap/weapons/plasma_gun.dm b/nsv13/code/modules/overmap/weapons/plasma_gun.dm
index 98e35f509e1..5fec3945d80 100644
--- a/nsv13/code/modules/overmap/weapons/plasma_gun.dm
+++ b/nsv13/code/modules/overmap/weapons/plasma_gun.dm
@@ -377,7 +377,9 @@
return
var/obj/structure/overmap/target_lock
var/target_distance
- var/datum/star_system/target_system = SSstar_system.find_system(overmap_firer)
+ var/datum/star_system/target_system = overmap_firer.current_system
+ if(!target_system)
+ return
var/list/targets = target_system.system_contents
for(var/obj/structure/overmap/ship in targets)
if(QDELETED(ship) && ship.mass != MASS_TINY) //It destroys itself when its target is destroyed, ignoring destroyed fighters