From 856ef236f3eac9663144cd9decc3c5d08531697e Mon Sep 17 00:00:00 2001
From: Ghommie <42542238+Ghommie@users.noreply.github.com>
Date: Fri, 24 Jan 2020 23:01:30 +0100
Subject: [PATCH] Further runtime fixes by AnturK.
---
code/datums/traits/_quirk.dm | 1 +
code/game/gamemodes/objective.dm | 2 +-
code/game/machinery/camera/camera.dm | 3 ++-
code/game/machinery/constructable_frame.dm | 3 +++
code/game/objects/items/devices/desynchronizer.dm | 9 +++++++--
code/game/objects/structures/headpike.dm | 5 +++--
.../antagonists/abductor/equipment/abduction_gear.dm | 5 +++++
code/modules/antagonists/swarmer/swarmer.dm | 3 ++-
code/modules/clothing/outfits/ert.dm | 5 +++--
code/modules/mob/living/carbon/human/death.dm | 3 ++-
.../living/carbon/human/species_types/jellypeople.dm | 10 +++-------
code/modules/paperwork/paperplane.dm | 2 ++
12 files changed, 34 insertions(+), 17 deletions(-)
diff --git a/code/datums/traits/_quirk.dm b/code/datums/traits/_quirk.dm
index 12e34b0c90..d68b11135f 100644
--- a/code/datums/traits/_quirk.dm
+++ b/code/datums/traits/_quirk.dm
@@ -15,6 +15,7 @@
/datum/quirk/New(mob/living/quirk_mob, spawn_effects)
if(!quirk_mob || (human_only && !ishuman(quirk_mob)) || quirk_mob.has_quirk(type))
qdel(src)
+ return
quirk_holder = quirk_mob
SSquirks.quirk_objects += src
to_chat(quirk_holder, gain_text)
diff --git a/code/game/gamemodes/objective.dm b/code/game/gamemodes/objective.dm
index f99fe5c3e4..b7003e4f1e 100644
--- a/code/game/gamemodes/objective.dm
+++ b/code/game/gamemodes/objective.dm
@@ -527,7 +527,7 @@ GLOBAL_LIST_EMPTY(possible_items)
else if(targetinfo.check_special_completion(I))//Returns 1 by default. Items with special checks will return 1 if the conditions are fulfilled.
return TRUE
- if(targetinfo && I.type in targetinfo.altitems) //Ok, so you don't have the item. Do you have an alternative, at least?
+ if(targetinfo && (I.type in targetinfo.altitems)) //Ok, so you don't have the item. Do you have an alternative, at least?
if(targetinfo.check_special_completion(I))//Yeah, we do! Don't return 0 if we don't though - then you could fail if you had 1 item that didn't pass and got checked first!
return TRUE
return FALSE
diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm
index bef5effb54..22c1ff811c 100644
--- a/code/game/machinery/camera/camera.dm
+++ b/code/game/machinery/camera/camera.dm
@@ -319,7 +319,8 @@
if(status)
change_msg = "reactivates"
triggerCameraAlarm()
- addtimer(CALLBACK(src, .proc/cancelCameraAlarm), 100)
+ if(!QDELETED(src)) //We'll be doing it anyway in destroy
+ addtimer(CALLBACK(src, .proc/cancelCameraAlarm), 100)
if(displaymessage)
if(user)
visible_message("[user] [change_msg] [src]!")
diff --git a/code/game/machinery/constructable_frame.dm b/code/game/machinery/constructable_frame.dm
index a238c4a451..b007bc0161 100644
--- a/code/game/machinery/constructable_frame.dm
+++ b/code/game/machinery/constructable_frame.dm
@@ -119,6 +119,9 @@
if(istype(P, /obj/item/circuitboard/machine))
var/obj/item/circuitboard/machine/B = P
+ if(!B.build_path)
+ to_chat(user, "This circuitboard seems to be broken.")
+ return
if(!anchored && B.needs_anchored)
to_chat(user, "The frame needs to be secured first!")
return
diff --git a/code/game/objects/items/devices/desynchronizer.dm b/code/game/objects/items/devices/desynchronizer.dm
index ff58af2405..0fa557f666 100644
--- a/code/game/objects/items/devices/desynchronizer.dm
+++ b/code/game/objects/items/devices/desynchronizer.dm
@@ -14,6 +14,7 @@
var/last_use = 0
var/next_use = 0
var/obj/effect/abstract/sync_holder/sync_holder
+ var/resync_timer
/obj/item/desynchronizer/attack_self(mob/living/user)
if(world.time < next_use)
@@ -56,16 +57,20 @@
SEND_SIGNAL(AM, COMSIG_MOVABLE_SECLUDED_LOCATION)
last_use = world.time
icon_state = "desynchronizer-on"
- addtimer(CALLBACK(src, .proc/resync), duration)
+ resync_timer = addtimer(CALLBACK(src, .proc/resync), duration , TIMER_STOPPABLE)
/obj/item/desynchronizer/proc/resync()
new /obj/effect/temp_visual/desynchronizer(sync_holder.drop_location())
QDEL_NULL(sync_holder)
+ if(resync_timer)
+ deltimer(resync_timer)
+ resync_timer = null
icon_state = initial(icon_state)
next_use = world.time + (world.time - last_use) // Could be 2*world.time-last_use but that would just be confusing
/obj/item/desynchronizer/Destroy()
- resync()
+ if(sync_holder)
+ resync()
return ..()
/obj/effect/abstract/sync_holder
diff --git a/code/game/objects/structures/headpike.dm b/code/game/objects/structures/headpike.dm
index ceed9cb759..81433b562d 100644
--- a/code/game/objects/structures/headpike.dm
+++ b/code/game/objects/structures/headpike.dm
@@ -42,8 +42,9 @@
if(.)
return
to_chat(user, "You take down [src].")
- victim.forceMove(drop_location())
- victim = null
+ if(victim)
+ victim.forceMove(drop_location())
+ victim = null
spear.forceMove(drop_location())
spear = null
qdel(src)
\ No newline at end of file
diff --git a/code/modules/antagonists/abductor/equipment/abduction_gear.dm b/code/modules/antagonists/abductor/equipment/abduction_gear.dm
index e6af9fa487..332329a221 100644
--- a/code/modules/antagonists/abductor/equipment/abduction_gear.dm
+++ b/code/modules/antagonists/abductor/equipment/abduction_gear.dm
@@ -29,6 +29,11 @@
var/stealth_armor = list("melee" = 15, "bullet" = 15, "laser" = 15, "energy" = 15, "bomb" = 15, "bio" = 15, "rad" = 15, "fire" = 70, "acid" = 70)
var/combat_armor = list("melee" = 50, "bullet" = 50, "laser" = 50, "energy" = 50, "bomb" = 50, "bio" = 50, "rad" = 50, "fire" = 90, "acid" = 90)
+/obj/item/clothing/suit/armor/abductor/vest/Initialize()
+ . = ..()
+ stealth_armor = getArmor(arglist(stealth_armor))
+ combat_armor = getArmor(arglist(combat_armor))
+
/obj/item/clothing/suit/armor/abductor/vest/proc/toggle_nodrop()
if(HAS_TRAIT_FROM(src, TRAIT_NODROP, ABDUCTOR_VEST_TRAIT))
REMOVE_TRAIT(src, TRAIT_NODROP, ABDUCTOR_VEST_TRAIT)
diff --git a/code/modules/antagonists/swarmer/swarmer.dm b/code/modules/antagonists/swarmer/swarmer.dm
index ce455d9e67..f2296d239f 100644
--- a/code/modules/antagonists/swarmer/swarmer.dm
+++ b/code/modules/antagonists/swarmer/swarmer.dm
@@ -274,7 +274,8 @@
/obj/machinery/camera/swarmer_act(mob/living/simple_animal/hostile/swarmer/S)
S.DisIntegrate(src)
- toggle_cam(S, 0)
+ if(!QDELETED(S)) //If it got blown up no need to turn it off.
+ toggle_cam(S, 0)
return TRUE
/obj/machinery/particle_accelerator/control_box/swarmer_act(mob/living/simple_animal/hostile/swarmer/S)
diff --git a/code/modules/clothing/outfits/ert.dm b/code/modules/clothing/outfits/ert.dm
index 1532f50808..bdbac1165e 100644
--- a/code/modules/clothing/outfits/ert.dm
+++ b/code/modules/clothing/outfits/ert.dm
@@ -18,8 +18,9 @@
R.freqlock = TRUE
var/obj/item/card/id/W = H.wear_id
- W.registered_name = H.real_name
- W.update_label(W.registered_name, W.assignment)
+ if(W)
+ W.registered_name = H.real_name
+ W.update_label(W.registered_name, W.assignment)
/datum/outfit/ert/commander
name = "ERT Commander"
diff --git a/code/modules/mob/living/carbon/human/death.dm b/code/modules/mob/living/carbon/human/death.dm
index a6595100a1..d6f6b6d9ae 100644
--- a/code/modules/mob/living/carbon/human/death.dm
+++ b/code/modules/mob/living/carbon/human/death.dm
@@ -44,7 +44,8 @@
if(M.occupant == src)
M.go_out()
- dna.species.spec_death(gibbed, src)
+ if(!QDELETED(dna)) //The gibbed param is bit redundant here since dna won't exist at this point if they got deleted.
+ dna.species.spec_death(gibbed, src)
if(SSticker.HasRoundStarted())
SSblackbox.ReportDeath(src)
diff --git a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm
index 2a5ec51b55..eb1e194c0f 100644
--- a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm
+++ b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm
@@ -849,6 +849,8 @@
linked_mobs.Add(M)
if(!selflink)
to_chat(M, "You are now connected to [slimelink_owner.real_name]'s Slime Link.")
+ RegisterSignal(M, COMSIG_MOB_DEATH , .proc/unlink_mob)
+ RegisterSignal(M, COMSIG_PARENT_QDELETING, .proc/unlink_mob)
var/datum/action/innate/linked_speech/action = new(src)
linked_actions.Add(action)
action.Grant(M)
@@ -858,6 +860,7 @@
var/link_id = linked_mobs.Find(M)
if(!(link_id))
return
+ UnregisterSignal(M, list(COMSIG_MOB_DEATH, COMSIG_PARENT_QDELETING))
var/datum/action/innate/linked_speech/action = linked_actions[link_id]
action.Remove(M)
to_chat(M, "You are no longer connected to [slimelink_owner.real_name]'s Slime Link.")
@@ -890,18 +893,11 @@
Remove(H)
return
- if(QDELETED(H) || H.stat == DEAD)
- species.unlink_mob(H)
- return
-
if(message)
var/msg = "\[[species.slimelink_owner.real_name]'s Slime Link\] [H]: [message]"
log_directed_talk(H, species.slimelink_owner, msg, LOG_SAY, "slime link")
for(var/X in species.linked_mobs)
var/mob/living/M = X
- if(QDELETED(M) || M.stat == DEAD)
- species.unlink_mob(M)
- continue
to_chat(M, msg)
for(var/X in GLOB.dead_mob_list)
diff --git a/code/modules/paperwork/paperplane.dm b/code/modules/paperwork/paperplane.dm
index cfd028c4df..076d8b026a 100644
--- a/code/modules/paperwork/paperplane.dm
+++ b/code/modules/paperwork/paperplane.dm
@@ -34,7 +34,9 @@
/obj/item/paperplane/handle_atom_del(atom/A)
if(A == internalPaper)
+ var/obj/item/paper/P = internalPaper
internalPaper = null
+ P.moveToNullspace() //So we're not deleting it twice when deleting our contents.
if(!QDELETED(src))
qdel(src)
return ..()