From 4fb2e612dfe4eb4d0a5b95e1fc729060bc0c8448 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Tue, 3 Apr 2018 17:08:52 -0700 Subject: [PATCH 1/2] Fixes bloodbath effects not working on people in crit (#36598) Also some minor improvements to performance by caching the nearby mobs list once --- code/game/objects/effects/mines.dm | 6 +++--- code/modules/flufftext/Hallucination.dm | 5 ++++- code/modules/mob/inventory.dm | 10 +++++----- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/code/game/objects/effects/mines.dm b/code/game/objects/effects/mines.dm index b169f9944f..482c0631f0 100644 --- a/code/game/objects/effects/mines.dm +++ b/code/game/objects/effects/mines.dm @@ -123,8 +123,8 @@ to_chat(victim, "RIP AND TEAR") SEND_SOUND(victim, sound('sound/misc/e1m1.ogg')) var/old_color = victim.client.color - var/red_splash = list(1,0,0,0.8,0.2,0, 0.8,0,0.2,0.1,0,0) - var/pure_red = list(0,0,0,0,0,0,0,0,0,1,0,0) + var/static/list/red_splash = list(1,0,0,0.8,0.2,0, 0.8,0,0.2,0.1,0,0) + var/static/list/pure_red = list(0,0,0,0,0,0,0,0,0,1,0,0) spawn(0) new /datum/hallucination/delusion(victim, TRUE, "demon",duration,0) @@ -132,7 +132,7 @@ var/obj/item/twohanded/required/chainsaw/doomslayer/chainsaw = new(victim.loc) chainsaw.flags_1 |= NODROP_1 victim.drop_all_held_items() - victim.put_in_hands(chainsaw) + victim.put_in_hands(chainsaw, forced = TRUE) chainsaw.attack_self(victim) chainsaw.wield(victim) victim.reagents.add_reagent("adminordrazine",25) diff --git a/code/modules/flufftext/Hallucination.dm b/code/modules/flufftext/Hallucination.dm index 26391c0957..621bca26ff 100644 --- a/code/modules/flufftext/Hallucination.dm +++ b/code/modules/flufftext/Hallucination.dm @@ -471,10 +471,13 @@ GLOBAL_LIST_INIT(hallucinations_major, list( var/image/A = null var/kind = force_kind ? force_kind : pick("monkey","corgi","carp","skeleton","demon","zombie") feedback_details += "Type: [kind]" + var/list/nearby + if(skip_nearby) + nearby = get_hearers_in_view(7, target) for(var/mob/living/carbon/human/H in GLOB.alive_mob_list) if(H == target) continue - if(skip_nearby && (H in view(target))) + if(skip_nearby && (H in nearby)) continue switch(kind) if("monkey")//Monkey diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index d804b3c499..bf083b654d 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -208,8 +208,8 @@ //Puts the item into our active hand if possible. returns TRUE on success. -/mob/proc/put_in_active_hand(obj/item/I) - return put_in_hand(I, active_hand_index) +/mob/proc/put_in_active_hand(obj/item/I, forced = FALSE) + return put_in_hand(I, active_hand_index, forced) //Puts the item into our inactive hand if possible, returns TRUE on success @@ -220,7 +220,7 @@ //Puts the item our active hand if possible. Failing that it tries other hands. Returns TRUE on success. //If both fail it drops it on the floor and returns FALSE. //This is probably the main one you need to know :) -/mob/proc/put_in_hands(obj/item/I, del_on_fail = FALSE, merge_stacks = TRUE) +/mob/proc/put_in_hands(obj/item/I, del_on_fail = FALSE, merge_stacks = TRUE, forced = FALSE) if(!I) return FALSE @@ -244,14 +244,14 @@ to_chat(usr, "Your [inactive_stack.name] stack now contains [inactive_stack.get_amount()] [inactive_stack.singular_name]\s.") return TRUE - if(put_in_active_hand(I)) + if(put_in_active_hand(I, forced)) return TRUE var/hand = get_empty_held_index_for_side("l") if(!hand) hand = get_empty_held_index_for_side("r") if(hand) - if(put_in_hand(I, hand)) + if(put_in_hand(I, hand, forced)) return TRUE if(del_on_fail) qdel(I)