Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sabre insanity, also known as one proc adjustment that might possibly fix stuff (now includes ~300% more proc adjustments) #2666

Merged
merged 5 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
18 changes: 15 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,21 @@
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 weird with the reserved_z 0 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) 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)?
e) the ships[] list of ssstarsystem is acting up again, aka the current working hypothesis.
//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 +317,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 +379,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
Loading