diff --git a/code/datums/chatmessage.dm b/code/datums/chatmessage.dm
index 361915e5941d..b2424821daaa 100644
--- a/code/datums/chatmessage.dm
+++ b/code/datums/chatmessage.dm
@@ -187,6 +187,10 @@
///finishes the image generation after the MeasureText() call in generate_image().
///necessary because after that call the proc can resume at the end of the tick and cause overtime.
/datum/chatmessage/proc/finish_image_generation(mheight, atom/target, mob/owner, complete_text, lifespan)
+ // If client is gone, then we just clean ourselves up.
+ if(QDELETED(owned_by))
+ qdel(src)
+ return
var/rough_time = REALTIMEOFDAY
approx_lines = max(1, mheight / CHAT_MESSAGE_APPROX_LHEIGHT)
diff --git a/code/modules/admin/smites/boneless.dm b/code/modules/admin/smites/boneless.dm
index bf402abdfdb6..a6a868caa4bb 100644
--- a/code/modules/admin/smites/boneless.dm
+++ b/code/modules/admin/smites/boneless.dm
@@ -12,10 +12,10 @@
var/mob/living/carbon/carbon_target = target
for(var/obj/item/bodypart/limb as anything in carbon_target.bodyparts)
var/severity = pick(list(
- "[WOUND_SEVERITY_MODERATE]",
- "[WOUND_SEVERITY_SEVERE]",
- "[WOUND_SEVERITY_SEVERE]",
- "[WOUND_SEVERITY_CRITICAL]",
- "[WOUND_SEVERITY_CRITICAL]",
+ WOUND_SEVERITY_MODERATE,
+ WOUND_SEVERITY_SEVERE,
+ WOUND_SEVERITY_SEVERE,
+ WOUND_SEVERITY_CRITICAL,
+ WOUND_SEVERITY_CRITICAL,
))
carbon_target.cause_wound_of_type_and_severity(WOUND_BLUNT, limb, severity)
diff --git a/code/modules/mob/dead/new_player/login.dm b/code/modules/mob/dead/new_player/login.dm
index 6b60c51f61bd..c15d7adc51ca 100644
--- a/code/modules/mob/dead/new_player/login.dm
+++ b/code/modules/mob/dead/new_player/login.dm
@@ -71,6 +71,5 @@
var/tl = SSticker.GetTimeLeft()
to_chat(src, "Please set up your character and select \"Ready\". The game will start [tl > 0 ? "in about [DisplayTimeText(tl)]" : "soon"].")
-
spawn(4 SECONDS)
- client.playtitlemusic()
+ client?.playtitlemusic()
diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm
index dcc19b859344..4a62706c9040 100644
--- a/code/modules/mob/inventory.dm
+++ b/code/modules/mob/inventory.dm
@@ -144,7 +144,7 @@
return FALSE
/mob/proc/can_put_in_hand(I, hand_index)
- if(hand_index > held_items.len)
+ if(hand_index > length(held_items))
return FALSE
if(!put_in_hand_check(I))
return FALSE
@@ -153,7 +153,7 @@
return !held_items[hand_index]
/mob/proc/put_in_hand(obj/item/I, hand_index, forced = FALSE, ignore_anim = TRUE)
- if(hand_index == null || !held_items.len || (!forced && !can_put_in_hand(I, hand_index)))
+ if(hand_index == null || !length(held_items) || (!forced && !can_put_in_hand(I, hand_index)))
return FALSE
if(isturf(I.loc) && !ignore_anim)
@@ -260,7 +260,7 @@
//Here lie drop_from_inventory and before_item_take, already forgotten and not missed.
/mob/proc/canUnEquip(obj/item/I, force)
- if(!I)
+ if(QDELETED(I))
return TRUE
if(HAS_TRAIT(I, TRAIT_NODROP) && !force)
return FALSE
@@ -286,13 +286,13 @@
* If the item can be dropped, it will be forceMove()'d to the ground and the turf's Entered() will be called.
*/
/mob/proc/dropItemToGround(obj/item/I, force = FALSE, silent = FALSE, invdrop = TRUE)
- if (isnull(I))
+ if(QDELETED(I))
return TRUE
SEND_SIGNAL(src, COMSIG_MOB_DROPPING_ITEM)
. = doUnEquip(I, force, drop_location(), FALSE, invdrop = invdrop, silent = silent)
- if(!. || !I) //ensure the item exists and that it was dropped properly.
+ if(!. || QDELETED(I)) //ensure the item exists and that it was dropped properly.
return
if(!(I.item_flags & NO_PIXEL_RANDOM_DROP))
@@ -303,7 +303,8 @@
//for when the item will be immediately placed in a loc other than the ground
/mob/proc/transferItemToLoc(obj/item/I, newloc = null, force = FALSE, silent = TRUE)
. = doUnEquip(I, force, newloc, FALSE, silent = silent)
- I.do_drop_animation(src)
+ if(!QDELETED(I)) // since some items do in fact delete themselves on unequip
+ I.do_drop_animation(src)
//visibly unequips I but it is NOT MOVED AND REMAINS IN SRC
//item MUST BE FORCEMOVE'D OR QDEL'D
@@ -317,7 +318,7 @@
//Use no_move if the item is just gonna be immediately moved afterward
//Invdrop is used to prevent stuff in pockets dropping. only set to false if it's going to immediately be replaced
PROTECTED_PROC(TRUE)
- if(!I) //If there's nothing to drop, the drop is automatically succesfull. If(unEquip) should generally be used to check for TRAIT_NODROP.
+ if(QDELETED(I)) //If there's nothing to drop, the drop is automatically succesfull. If(unEquip) should generally be used to check for TRAIT_NODROP.
return TRUE
if(HAS_TRAIT(I, TRAIT_NODROP) && !force)
@@ -330,7 +331,7 @@
if(hand_index)
held_items[hand_index] = null
update_held_items()
- if(I)
+ if(!QDELETED(I))
if(client)
client.screen -= I
I.layer = initial(I.layer)
@@ -342,7 +343,7 @@
else
I.forceMove(newloc)
I.dropped(src, silent)
- SEND_SIGNAL(I, COMSIG_ITEM_POST_UNEQUIP, force, newloc, no_move, invdrop, silent)
+ SEND_SIGNAL(I, COMSIG_ITEM_POST_UNEQUIP, force, newloc, no_move, invdrop, silent)
SEND_SIGNAL(src, COMSIG_MOB_UNEQUIPPED_ITEM, I, force, newloc, no_move, invdrop, silent)
return TRUE
diff --git a/code/modules/reagents/chemistry/reagents.dm b/code/modules/reagents/chemistry/reagents.dm
index 8da6da798265..61009de2dac9 100644
--- a/code/modules/reagents/chemistry/reagents.dm
+++ b/code/modules/reagents/chemistry/reagents.dm
@@ -187,7 +187,7 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent())
current_cycle++
if(length(reagent_removal_skip_list))
return
- holder.remove_reagent(type, metabolization_rate * M.metabolism_efficiency * seconds_per_tick) //By default it slowly disappears.
+ holder?.remove_reagent(type, metabolization_rate * M.metabolism_efficiency * seconds_per_tick) //By default it slowly disappears.
/// Called in burns.dm *if* the reagent has the REAGENT_AFFECTS_WOUNDS process flag
/datum/reagent/proc/on_burn_wound_processing(datum/wound/burn/flesh/burn_wound)
diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm
index 741f644b29e6..798e79ca8900 100644
--- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm
+++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm
@@ -13,7 +13,7 @@
current_cycle++
if(length(reagent_removal_skip_list))
return
- holder.remove_reagent(type, metabolization_rate * seconds_per_tick / affected_mob.metabolism_efficiency) //medicine reagents stay longer if you have a better metabolism
+ holder?.remove_reagent(type, metabolization_rate * seconds_per_tick / affected_mob.metabolism_efficiency) //medicine reagents stay longer if you have a better metabolism
/datum/reagent/medicine/leporazine
name = "Leporazine"
diff --git a/monkestation/code/datums/dna.dm b/monkestation/code/datums/dna.dm
index 2dd03c6e7d07..eebd05695c1a 100644
--- a/monkestation/code/datums/dna.dm
+++ b/monkestation/code/datums/dna.dm
@@ -3,7 +3,7 @@
/datum/dna/proc/update_body_height()
var/mob/living/carbon/human/human_holder = holder
- if(!istype(holder))
+ if(!istype(human_holder))
return
var/height = GLOB.body_heights[body_height]
if(isnull(height))
diff --git a/monkestation/code/game/machinery/exp_cloner.dm b/monkestation/code/game/machinery/exp_cloner.dm
index 7a1f3dd3e4e9..c7f3c9b74e71 100644
--- a/monkestation/code/game/machinery/exp_cloner.dm
+++ b/monkestation/code/game/machinery/exp_cloner.dm
@@ -300,6 +300,6 @@
temp = "Cloning cycle already in progress."
playsound(src, 'sound/machines/terminal_prompt_deny.ogg', 50, FALSE)
else
- pod.growclone(mob_occupant.real_name, dna.unique_identity, dna.mutation_index, null, null, dna.blood_type, clone_species, dna.features, mob_occupant.faction)
+ pod.growclone(mob_occupant.real_name, dna.unique_identity, dna.mutation_index, null, dna.blood_type, clone_species, dna.features, mob_occupant.faction)
temp = "[mob_occupant.real_name] => Cloning data sent to pod."
playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, FALSE)
diff --git a/monkestation/code/game/objects/items/implants/hardlight.dm b/monkestation/code/game/objects/items/implants/hardlight.dm
index 5d7518b40a53..c567f275e4c7 100644
--- a/monkestation/code/game/objects/items/implants/hardlight.dm
+++ b/monkestation/code/game/objects/items/implants/hardlight.dm
@@ -23,19 +23,16 @@
/obj/item/implant/hard_spear/implant(mob/living/target, mob/user, silent = FALSE, force = FALSE)
. = ..()
- if (!.)
+ if (!. || !spell_to_give)
return
-
- if (!spell_to_give)
- return FALSE
-
- var/datum/action/cooldown/spell/existing = locate(spell_to_give) in user.actions
- if(existing)
- if(!existing.level_spell())
- to_chat(target, span_boldnotice("The implant is unable to upgrade your hardlight spear further"))
- return FALSE
- timerid = QDEL_IN_STOPPABLE(src, deltime)
- return TRUE
+ if(!QDELETED(user))
+ var/datum/action/cooldown/spell/existing = locate(spell_to_give) in user.actions
+ if(existing)
+ if(!existing.level_spell())
+ to_chat(target, span_boldnotice("The implant is unable to upgrade your hardlight spear further"))
+ return FALSE
+ timerid = QDEL_IN_STOPPABLE(src, deltime)
+ return TRUE
spell_inside = TRUE
spell_to_give.Grant(target)
return TRUE
@@ -45,12 +42,11 @@
if (!.)
return FALSE
- if(spell_inside)
- if(spell_to_give)
- spell_inside_level = spell_to_give.spell_level
- spell_to_give.Remove(source)
- if(source.stat != DEAD && !silent)
- to_chat(source, span_boldnotice(""))
+ if(spell_inside && spell_to_give)
+ spell_inside_level = spell_to_give.spell_level
+ spell_to_give.Remove(source)
+ if(source.stat != DEAD && !silent)
+ to_chat(source, span_boldnotice(""))
if(timerid)
deltimer(timerid)