From b01eea52158bb0cb378522984f0ac64b9d712d4b Mon Sep 17 00:00:00 2001 From: FabianK3 <21039694+FabianK3@users.noreply.github.com> Date: Mon, 10 Aug 2026 01:51:04 +0200 Subject: [PATCH] Fix mineral asteroid position (#23041) # Summary This PR fixes the mineral asteroids position not being updated after the Horizons persistent position was applied, resulting in the asteroid being too far away. ## Issues - Fixes #23037 - Fixes #23039 --- .../fabiank3-mineral-asteroid-loc-fix.yml | 6 +++ maps/sccv_horizon/code/sccv_horizon.dm | 45 ++++++++++++++++--- 2 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 html/changelogs/fabiank3-mineral-asteroid-loc-fix.yml diff --git a/html/changelogs/fabiank3-mineral-asteroid-loc-fix.yml b/html/changelogs/fabiank3-mineral-asteroid-loc-fix.yml new file mode 100644 index 00000000000..496ae0c833f --- /dev/null +++ b/html/changelogs/fabiank3-mineral-asteroid-loc-fix.yml @@ -0,0 +1,6 @@ +author: FabianK3 + +delete-after: True + +changes: + - bugfix: "Fixed the mineral asteroid position not being updated after the Horizon's persistent position was applied." diff --git a/maps/sccv_horizon/code/sccv_horizon.dm b/maps/sccv_horizon/code/sccv_horizon.dm index c3df47f6426..b245aed19df 100644 --- a/maps/sccv_horizon/code/sccv_horizon.dm +++ b/maps/sccv_horizon/code/sccv_horizon.dm @@ -178,12 +178,45 @@ var/area/overmap/map = GLOB.map_overmap // Set Horizon location var/obj/effect/overmap/visitable/ship/sccv_horizon/ship = locate(/obj/effect/overmap/visitable/ship/sccv_horizon) in map - ship.x = horizon_location_generic.content["x"] - ship.y = horizon_location_generic.content["y"] - // Make safe space for the Horizon - for(var/obj/effect/overmap/hazard in map) - if(hazard.x == ship.x && hazard.y == ship.y && istype(hazard, /obj/effect/overmap/event/)) // Ions, dust, carps, meteors, etc. - qdel(hazard) + if(ship) + ship.x = horizon_location_generic.content["x"] + ship.y = horizon_location_generic.content["y"] + + // Make safe space for the Horizon + for(var/obj/effect/overmap/hazard in map) + if(hazard.x == ship.x && hazard.y == ship.y && istype(hazard, /obj/effect/overmap/event/)) // Ions, dust, carps, meteors, etc. + qdel(hazard) + + // Move mineral asteroid to a nearby location + var/obj/effect/overmap/visitable/sector/exoplanet/barren/asteroid/mining_asteroid = locate(/obj/effect/overmap/visitable/sector/exoplanet/barren/asteroid) in map + if(mining_asteroid) + for(var/dir in shuffle(GLOB.cardinals)) + var/candidate_x = ship.x + var/candidate_y = ship.y + if(dir & NORTH) + candidate_y += 1 + if(dir & SOUTH) + candidate_y -= 1 + if(dir & EAST) + candidate_x += 1 + if(dir & WEST) + candidate_x -= 1 + + if(candidate_x < 0 || candidate_y < 0 || candidate_x > overmap_size || candidate_y > overmap_size) + continue // Location out of bounds + + for(var/obj/effect/overmap/visitable/sector/exoplanet/exoplanet in map) + if(exoplanet.x == candidate_x && exoplanet.y == candidate_y) + continue // Location occupied + + mining_asteroid.x = candidate_x + mining_asteroid.y = candidate_y + break + + // Make safe space for the asteroid + for(var/obj/effect/overmap/hazard in map) + if(hazard.x == mining_asteroid.x && hazard.y == mining_asteroid.y && istype(hazard, /obj/effect/overmap/event/)) // Ions, dust, carps, meteors, etc. + qdel(hazard) // ##### Send different faxes after slight delay var/faxes_send_delay = rand(60 SECONDS , 180 SECONDS)