From b6a45313037def0d2e8b5e3d79c4ddf2792e680c Mon Sep 17 00:00:00 2001 From: Leshana Date: Sat, 20 Jan 2018 17:28:14 -0500 Subject: [PATCH 1/3] Enhance orbiting animations to actually support circles. --- code/_helpers/matrices.dm | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/code/_helpers/matrices.dm b/code/_helpers/matrices.dm index 129e0d41b7..2e7247543c 100644 --- a/code/_helpers/matrices.dm +++ b/code/_helpers/matrices.dm @@ -3,18 +3,27 @@ Turn(.) //BYOND handles cases such as -270, 360, 540 etc. DOES NOT HANDLE 180 TURNS WELL, THEY TWEEN AND LOOK LIKE SHIT -/atom/proc/SpinAnimation(speed = 10, loops = -1) - var/matrix/m120 = matrix(transform) - m120.Turn(120) - var/matrix/m240 = matrix(transform) - m240.Turn(240) - var/matrix/m360 = matrix(transform) - speed /= 3 //Gives us 3 equal time segments for our three turns. - //Why not one turn? Because byond will see that the start and finish are the same place and do nothing - //Why not two turns? Because byond will do a flip instead of a turn - animate(src, transform = m120, time = speed, loops) - animate(transform = m240, time = speed) - animate(transform = m360, time = speed) +/atom/proc/SpinAnimation(speed = 10, loops = -1, clockwise = 1, segments = 3) + if(!segments) + return + var/segment = 360/segments + if(!clockwise) + segment = -segment + var/list/matrices = list() + for(var/i in 1 to segments-1) + var/matrix/M = matrix(transform) + M.Turn(segment*i) + matrices += M + var/matrix/last = matrix(transform) + matrices += last + + speed /= segments + + animate(src, transform = matrices[1], time = speed, loops) + for(var/i in 2 to segments) //2 because 1 is covered above + animate(transform = matrices[i], time = speed) + //doesn't have an object argument because this is "Stacking" with the animate call above + //3 billion% intentional //The X pixel offset of this matrix /matrix/proc/get_x_shift() From c8929d5bdbd8d19fdc8fc1f759ea09bb3aacb13e Mon Sep 17 00:00:00 2001 From: Leshana Date: Sun, 21 Jan 2018 00:17:37 -0500 Subject: [PATCH 2/3] Add checks to allow Tesla to fully dissipate once it runs out of energy. --- code/modules/power/tesla/energy_ball.dm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/code/modules/power/tesla/energy_ball.dm b/code/modules/power/tesla/energy_ball.dm index 9b89e35b77..71cb8a35e7 100644 --- a/code/modules/power/tesla/energy_ball.dm +++ b/code/modules/power/tesla/energy_ball.dm @@ -55,7 +55,8 @@ /obj/singularity/energy_ball/process(var/wait = 20) set waitfor = FALSE if(!orbiting) - handle_energy() + if (handle_energy()) + return move_the_basket_ball(max(wait - 5, 4 + orbiting_balls.len * 1.5)) @@ -91,6 +92,11 @@ sleep(1) // So movement is smooth /obj/singularity/energy_ball/proc/handle_energy() + if (energy <= 0) + investigate_log("collapsed.", I_SINGULO) + qdel(src) + return TRUE + if(energy >= energy_to_raise) energy_to_lower = energy_to_raise - 20 energy_to_raise = energy_to_raise * 1.25 From 00d13c58325a1aa3cdb488c1bd03e534789d7c5b Mon Sep 17 00:00:00 2001 From: Leshana Date: Sun, 21 Jan 2018 22:35:22 -0500 Subject: [PATCH 3/3] Fix more Destroy / GC issues. Fixes recursive Destroy call on containment field. Fix unable to GC issue on air alarms. Fix unable to GC issue on radiation sources. --- code/datums/repositories/radiation.dm | 2 +- code/game/machinery/alarm.dm | 7 ++++++- code/modules/power/singularity/containment_field.dm | 2 +- code/modules/power/singularity/field_generator.dm | 6 +++--- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/code/datums/repositories/radiation.dm b/code/datums/repositories/radiation.dm index 4e3259a6de..4755b982ec 100644 --- a/code/datums/repositories/radiation.dm +++ b/code/datums/repositories/radiation.dm @@ -18,7 +18,7 @@ var/global/repository/radiation/radiation_repository = new() /datum/radiation_source/Destroy() radiation_repository.sources -= src if(radiation_repository.sources_assoc[src.source_turf] == src) - radiation_repository.sources -= src.source_turf + radiation_repository.sources_assoc -= src.source_turf src.source_turf = null . = ..() diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm index e9bfb9f927..0f75d1efd0 100644 --- a/code/game/machinery/alarm.dm +++ b/code/game/machinery/alarm.dm @@ -103,6 +103,9 @@ unregister_radio(src, frequency) qdel(wires) wires = null + if(alarm_area && alarm_area.master_air_alarm == src) + alarm_area.master_air_alarm = null + elect_master(exclude_self = TRUE) return ..() /obj/machinery/alarm/New() @@ -271,8 +274,10 @@ /obj/machinery/alarm/proc/master_is_operating() return alarm_area && alarm_area.master_air_alarm && !(alarm_area.master_air_alarm.stat & (NOPOWER | BROKEN)) -/obj/machinery/alarm/proc/elect_master() +/obj/machinery/alarm/proc/elect_master(exclude_self = FALSE) for(var/obj/machinery/alarm/AA in alarm_area) + if(exclude_self && AA == src) + continue if(!(AA.stat & (NOPOWER|BROKEN))) alarm_area.master_air_alarm = AA return 1 diff --git a/code/modules/power/singularity/containment_field.dm b/code/modules/power/singularity/containment_field.dm index 751e2cf157..d57c133cd1 100644 --- a/code/modules/power/singularity/containment_field.dm +++ b/code/modules/power/singularity/containment_field.dm @@ -20,7 +20,7 @@ FG1.cleanup() if(FG2 && !FG2.clean_up) FG2.cleanup() - ..() + . = ..() /obj/machinery/containment_field/attack_hand(mob/user as mob) if(get_dist(src, user) > 1) diff --git a/code/modules/power/singularity/field_generator.dm b/code/modules/power/singularity/field_generator.dm index a801c5b396..a9251e27ee 100644 --- a/code/modules/power/singularity/field_generator.dm +++ b/code/modules/power/singularity/field_generator.dm @@ -168,7 +168,7 @@ field_generator power level display /obj/machinery/field_generator/Destroy() src.cleanup() - ..() + . = ..() @@ -312,12 +312,12 @@ field_generator power level display /obj/machinery/field_generator/proc/cleanup() clean_up = 1 for (var/obj/machinery/containment_field/F in fields) - if (isnull(F)) + if (QDELETED(F)) continue qdel(F) fields = list() for(var/obj/machinery/field_generator/FG in connected_gens) - if (isnull(FG)) + if (QDELETED(FG)) continue FG.connected_gens.Remove(src) if(!FG.clean_up)//Makes the other gens clean up as well