From ab06c23a2b52c9a9c10798907a75a0872d0c0135 Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Wed, 5 Feb 2020 23:48:17 +0100 Subject: [PATCH 1/5] runtime is forever, errors are eternal. --- code/game/machinery/dance_machine.dm | 2 +- code/game/objects/effects/contraband.dm | 3 +- code/game/objects/effects/wanted_poster.dm | 1 + .../mob/living/carbon/carbon_defense.dm | 51 +++++++++---------- code/modules/mob/living/say.dm | 3 +- code/modules/surgery/organs/eyes.dm | 2 +- 6 files changed, 32 insertions(+), 30 deletions(-) diff --git a/code/game/machinery/dance_machine.dm b/code/game/machinery/dance_machine.dm index c6b4f2fcf5..6bedfb0a10 100644 --- a/code/game/machinery/dance_machine.dm +++ b/code/game/machinery/dance_machine.dm @@ -430,6 +430,6 @@ /obj/machinery/jukebox/disco/process() . = ..() if(active) - for(var/mob/M in rangers) + for(var/mob/living/M in rangers) if(prob(5+(allowed(M)*4)) && M.canmove) dance(M) diff --git a/code/game/objects/effects/contraband.dm b/code/game/objects/effects/contraband.dm index 6e8387c07b..eea3bace98 100644 --- a/code/game/objects/effects/contraband.dm +++ b/code/game/objects/effects/contraband.dm @@ -57,6 +57,7 @@ var/poster_item_name = "hypothetical poster" var/poster_item_desc = "This hypothetical poster item should not exist, let's be honest here." var/poster_item_icon_state = "rolled_poster" + var/poster_item_type = /obj/item/poster /obj/structure/sign/poster/Initialize() . = ..() @@ -114,7 +115,7 @@ /obj/structure/sign/poster/proc/roll_and_drop(loc) pixel_x = 0 pixel_y = 0 - var/obj/item/poster/P = new(loc, src) + var/obj/item/poster/P = new poster_item_type(loc, src) forceMove(P) return P diff --git a/code/game/objects/effects/wanted_poster.dm b/code/game/objects/effects/wanted_poster.dm index 35d16070ff..2e3244b4b8 100644 --- a/code/game/objects/effects/wanted_poster.dm +++ b/code/game/objects/effects/wanted_poster.dm @@ -8,6 +8,7 @@ /obj/structure/sign/poster/wanted var/wanted_name + poster_item_type = /obj/item/poster/wanted /obj/structure/sign/poster/wanted/Initialize(mapload, icon/person_icon, person_name, description) . = ..() diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index bb4442559e..637178ffe6 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -274,7 +274,7 @@ return if(health >= 0 && !(HAS_TRAIT(src, TRAIT_FAKEDEATH))) - + var/friendly_check = FALSE if(lying) if(buckled) to_chat(M, "You need to unbuckle [src] first to do that!") @@ -289,39 +289,35 @@ playsound(src, 'sound/items/Nose_boop.ogg', 50, 0) else if(check_zone(M.zone_selected) == "head") - var/mob/living/carbon/human/H = src - var/datum/species/pref_species = H.dna.species + var/datum/species/S + if(ishuman(src)) + S = dna.species - M.visible_message("[M] gives [H] a pat on the head to make [p_them()] feel better!", \ - "You give [H] a pat on the head to make [p_them()] feel better!") + M.visible_message("[M] gives [src] a pat on the head to make [p_them()] feel better!", \ + "You give [src] a pat on the head to make [p_them()] feel better!") SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "headpat", /datum/mood_event/headpat) - if(HAS_TRAIT(M, TRAIT_FRIENDLY)) - var/datum/component/mood/mood = M.GetComponent(/datum/component/mood) - if (mood.sanity >= SANITY_GREAT) - SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "friendly_hug", /datum/mood_event/besthug, M) - else if (mood.sanity >= SANITY_DISTURBED) - SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "friendly_hug", /datum/mood_event/betterhug, M) - if(H.dna.species.can_wag_tail(H)) - if("tail_human" in pref_species.default_features) - if(H.dna.features["tail_human"] == "None") + friendly_check = TRUE + if(S?.can_wag_tail(src)) + if("tail_human" in S.default_features) + if(dna.features["tail_human"] == "None") return else - if(!H.dna.species.is_wagging_tail()) - H.emote("wag") + if(!dna.species.is_wagging_tail()) + emote("wag") - if("tail_lizard" in pref_species.default_features) - if(H.dna.features["tail_lizard"] == "None") + if("tail_lizard" in S.default_features) + if(dna.features["tail_lizard"] == "None") return else - if(!H.dna.species.is_wagging_tail()) - H.emote("wag") + if(!dna.species.is_wagging_tail()) + emote("wag") - if("mam_tail" in pref_species.default_features) - if(H.dna.features["mam_tail"] == "None") + if("mam_tail" in S.default_features) + if(dna.features["mam_tail"] == "None") return else - if(!H.dna.species.is_wagging_tail()) - H.emote("wag") + if(!dna.species.is_wagging_tail()) + emote("wag") else return @@ -335,8 +331,11 @@ M.visible_message("[M] hugs [src] to make [p_them()] feel better!", \ "You hug [src] to make [p_them()] feel better!") SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "hug", /datum/mood_event/hug) - if(HAS_TRAIT(M, TRAIT_FRIENDLY)) - var/datum/component/mood/mood = M.GetComponent(/datum/component/mood) + friendly_check = TRUE + + if(friendly_check && HAS_TRAIT(M, TRAIT_FRIENDLY)) + var/datum/component/mood/mood = M.GetComponent(/datum/component/mood) + if(mood) if (mood.sanity >= SANITY_GREAT) SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "friendly_hug", /datum/mood_event/besthug, M) else if (mood.sanity >= SANITY_DISTURBED) diff --git a/code/modules/mob/living/say.dm b/code/modules/mob/living/say.dm index a12d468e24..0fb48f65b1 100644 --- a/code/modules/mob/living/say.dm +++ b/code/modules/mob/living/say.dm @@ -103,7 +103,8 @@ GLOBAL_LIST_INIT(department_radio_keys, list( else if(message_mode || saymode) message = copytext_char(message, 3) message = trim_left(message) - + if(!message) + return if(message_mode == MODE_ADMIN) if(client) client.cmd_admin_say(message) diff --git a/code/modules/surgery/organs/eyes.dm b/code/modules/surgery/organs/eyes.dm index dfbf4ee21e..44e92e464b 100644 --- a/code/modules/surgery/organs/eyes.dm +++ b/code/modules/surgery/organs/eyes.dm @@ -51,7 +51,7 @@ clear_eye_trauma() . = ..() var/mob/living/carbon/C = . - if(C) + if(!QDELETED(C)) if(ishuman(C) && eye_color) var/mob/living/carbon/human/H = C H.eye_color = old_eye_color From 233ed5873f22c411c90dbaa23fd9bda984101ce5 Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Thu, 6 Feb 2020 01:13:28 +0100 Subject: [PATCH 2/5] race conditions and turfs beings special. --- code/game/objects/items/implants/implant_explosive.dm | 5 +++-- code/game/turfs/simulated/walls.dm | 2 +- code/modules/projectiles/guns/energy.dm | 7 ++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/code/game/objects/items/implants/implant_explosive.dm b/code/game/objects/items/implants/implant_explosive.dm index b93c9419a3..bf8d215a11 100644 --- a/code/game/objects/items/implants/implant_explosive.dm +++ b/code/game/objects/items/implants/implant_explosive.dm @@ -82,8 +82,9 @@ /obj/item/implant/explosive/proc/boom_goes_the_weasel() explosion(get_turf(imp_in ? imp_in : src), heavy, medium, weak, weak, flame_range = weak) - imp_in?.gib(TRUE) - qdel(src) + if(!QDELETED(imp_in)) + imp_in.gib(TRUE) + qdel(src) /obj/item/implant/explosive/macro name = "macrobomb implant" diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index 460c6a52c9..bd0b85a498 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -171,7 +171,7 @@ var/turf/T = user.loc //get user's location for delay checks //the istype cascade has been spread among various procs for easy overriding - if(try_clean(W, user, T) || try_wallmount(W, user, T) || try_decon(W, user, T) || try_destroy(W, user, T)) + if(try_clean(W, user, T) || try_wallmount(W, user, T) || try_decon(W, user, T) || (iswall(src) && try_destroy(W, user, T))) return return ..() diff --git a/code/modules/projectiles/guns/energy.dm b/code/modules/projectiles/guns/energy.dm index 3ca732eb0b..eeea961037 100644 --- a/code/modules/projectiles/guns/energy.dm +++ b/code/modules/projectiles/guns/energy.dm @@ -57,9 +57,10 @@ fire_delay = shot.delay /obj/item/gun/energy/Destroy() - QDEL_NULL(cell) - QDEL_LIST(ammo_type) - STOP_PROCESSING(SSobj, src) + if(flags_1 & INITIALIZED_1) + QDEL_NULL(cell) + QDEL_LIST(ammo_type) + STOP_PROCESSING(SSobj, src) return ..() /obj/item/gun/energy/process() From a3e2ec372f5b95f893465d3ee2a72b8d98d259da Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Thu, 6 Feb 2020 01:40:14 +0100 Subject: [PATCH 3/5] Makes it compile also custom emote fix. --- code/game/say.dm | 2 +- code/game/turfs/simulated/walls.dm | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/code/game/say.dm b/code/game/say.dm index b275d8b69c..85ae9f0681 100644 --- a/code/game/say.dm +++ b/code/game/say.dm @@ -129,7 +129,7 @@ GLOBAL_LIST_INIT(freqtospan, list( /atom/movable/proc/attach_spans(input, list/spans) var/customsayverb = findtext(input, "*") if(customsayverb) - input = capitalize(copytext(input, length(input[customsayverb]) + 1)) + input = capitalize(copytext(input, customsayverb + length(input[customsayverb]))) if(input) return "[message_spans_start(spans)][input]" else diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index bd0b85a498..d26a6efb02 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -171,7 +171,8 @@ var/turf/T = user.loc //get user's location for delay checks //the istype cascade has been spread among various procs for easy overriding - if(try_clean(W, user, T) || try_wallmount(W, user, T) || try_decon(W, user, T) || (iswall(src) && try_destroy(W, user, T))) + var/srctype = type + if(try_clean(W, user, T) || try_wallmount(W, user, T) || try_decon(W, user, T) || (type == srctype && try_destroy(W, user, T))) return return ..() From 60b6d96f45d7eed2c69cda148e5b5df47e3b8947 Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Thu, 6 Feb 2020 02:17:51 +0100 Subject: [PATCH 4/5] typecheck. --- .../mob/living/simple_animal/hostile/mining_mobs/basilisk.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/basilisk.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/basilisk.dm index 2fbcf376dd..ccd80573c0 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/basilisk.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/basilisk.dm @@ -144,7 +144,7 @@ /obj/item/projectile/temp/basilisk/icewing/on_hit(atom/target, blocked = FALSE) . = ..() - if(.) + if(. && isliving(target)) var/mob/living/L = target L.apply_status_effect(/datum/status_effect/freon/watcher) From 639ec8066dfe7e487d9f6b8df32396479f97e9a1 Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Thu, 6 Feb 2020 02:19:14 +0100 Subject: [PATCH 5/5] Another typecheck --- .../mob/living/simple_animal/hostile/mining_mobs/basilisk.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/basilisk.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/basilisk.dm index ccd80573c0..91b76974b5 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/basilisk.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/basilisk.dm @@ -131,7 +131,7 @@ /obj/item/projectile/temp/basilisk/magmawing/on_hit(atom/target, blocked = FALSE) . = ..() - if(.) + if(. && isliving(target)) var/mob/living/L = target if (istype(L)) L.adjust_fire_stacks(0.1)