Skip to content

Commit

Permalink
sigh
Browse files Browse the repository at this point in the history
  • Loading branch information
DeltaFire15 committed May 26, 2024
1 parent 8f2fa33 commit 823e0c2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
9 changes: 7 additions & 2 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
17 changes: 14 additions & 3 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()

//FIXME:
/*
Working theories:
a) something is being fucky with the reserved_z 0 of the fighter being used
b) asteroid reserved areas for their zs are fucked.
c) something is being fucked with the last overmap var.
d) something weird is going on with e.g. the aetherwhisp ruin, asteroids that do not delete once left. - might be if it gets destroyed by damage after the ship leaves? what is get_turf(null)?
//ATD: They DID dock to other rocks before, and the one before bricking was one that remained loaded.
*/

/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 @@ -367,6 +378,6 @@
to_chat(pilot, "<span class='notice'>Docking complete. <b>Gun safeties have been engaged automatically.</b></span>")
SEND_SIGNAL(src, COMSIG_FTL_STATE_CHANGE)
if(reserved_z)
free_treadmills += reserved_z
free_treadmills += reserved_z //THIS IS SUPER UNSAFE!! What if the fighter was holding a z with other player ships on it?? Should realloc it to another eligible overmap in system if that is the case!
reserved_z = null
return TRUE
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 823e0c2

Please sign in to comment.