Skip to content

Commit

Permalink
Merge branch 'BeeStation:master' into Robot-Ship
Browse files Browse the repository at this point in the history
  • Loading branch information
Pockets-byte authored Sep 8, 2024
2 parents 9a2740e + 71d251b commit 492f3ab
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 21 deletions.
21 changes: 15 additions & 6 deletions html/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,21 @@
-->
<div class="commit sansserif">

<h2 class="date">06 September 2024</h2>
<h3 class="author">Bokkiewokkie updated:</h3>
<ul class="changes bgimages16">
<li class="tweak">Changed asteroid ore spawning to respect asteroid maps more</li>
</ul>
<h3 class="author">DeltaFire15 updated:</h3>
<ul class="changes bgimages16">
<li class="bugfix">Possibly fixes some weird Sabre behavior.</li>
<li class="bugfix">Also makes one single gun check of the plasma caster slightly safer.</li>
<li class="bugfix">Fixes a weird edge case with docking behavior.</li>
<li class="bugfix">Fixes remove_ship() assuming all remove_ship() calls were FTL based.</li>
<li class="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).</li>
<li class="bugfix">Overmap objects that are deleted now drop their current_system var.</li>
</ul>

<h2 class="date">24 August 2024</h2>
<h3 class="author">DeltaFire15 updated:</h3>
<ul class="changes bgimages16">
Expand Down Expand Up @@ -113,12 +128,6 @@ <h3 class="author">Pockets-byte updated:</h3>
<li class="rscadd">Added new fighter sprite and fighter with shields</li>
<li class="rscadd">Added new fighter weapon and sprite</li>
</ul>

<h2 class="date">05 July 2024</h2>
<h3 class="author">Pockets-byte updated:</h3>
<ul class="changes bgimages16">
<li class="rscadd">Added relayed (overmap) laser projectiles for boom</li>
</ul>
</div>

<b>GoonStation 13 Development Team</b>
Expand Down
12 changes: 12 additions & 0 deletions html/changelogs/.all_changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
11 changes: 8 additions & 3 deletions nsv13/code/controllers/subsystem/starsystem.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions nsv13/code/modules/mining/asteroid.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 18 additions & 5 deletions nsv13/code/modules/overmap/FTL/ftl_jump.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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.
Expand All @@ -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.
Expand Down
19 changes: 15 additions & 4 deletions nsv13/code/modules/overmap/fighters/fighters_launcher.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions nsv13/code/modules/overmap/overmap.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
4 changes: 3 additions & 1 deletion nsv13/code/modules/overmap/weapons/plasma_gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 492f3ab

Please sign in to comment.