From cb909df3cfbc37f160d0a93289bdcbf9850aee9c Mon Sep 17 00:00:00 2001 From: Contrabang <91113370+Contrabang@users.noreply.github.com> Date: Sun, 17 Sep 2023 20:19:28 -0400 Subject: [PATCH] Fixes dusting. (#22344) * dust properly * oops * Update code/_globalvars/traits.dm Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com> --------- Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com> --- code/__HELPERS/trait_helpers.dm | 1 + code/_globalvars/traits.dm | 3 ++- .../items/weapons/implants/implant_dust.dm | 5 ----- code/modules/mob/living/carbon/carbon.dm | 7 +------ .../mob/living/carbon/human/human_death.dm | 9 ++++++--- .../living/carbon/human/human_inventory.dm | 4 ++-- code/modules/mob/living/init_signals.dm | 20 +++++++++++++++++++ .../modules/mob/living/living_status_procs.dm | 3 +++ code/modules/mod/modules/modules_supply.dm | 2 ++ 9 files changed, 37 insertions(+), 17 deletions(-) diff --git a/code/__HELPERS/trait_helpers.dm b/code/__HELPERS/trait_helpers.dm index 3c36fd0986b..c63a61b20c2 100644 --- a/code/__HELPERS/trait_helpers.dm +++ b/code/__HELPERS/trait_helpers.dm @@ -211,6 +211,7 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai #define TRAIT_XENO_INTERACTABLE "can_be_interacted_with_by_xenos" #define TRAIT_DODGE_ALL_OBJECTS "dodges_all_objects" /// Allows a mob to dodge all thrown objects #define TRAIT_BADASS "trait_badass" +#define TRAIT_FORCED_STANDING "forced_standing" // The mob cannot be floored, or lie down //***** ITEM AND MOB TRAITS *****// /// Show what machine/door wires do when held. diff --git a/code/_globalvars/traits.dm b/code/_globalvars/traits.dm index fb837332a0e..f8a374e8abd 100644 --- a/code/_globalvars/traits.dm +++ b/code/_globalvars/traits.dm @@ -82,7 +82,8 @@ GLOBAL_LIST_INIT(traits_by_type, list( "TRAIT_TABLE_LEAP" = TRAIT_TABLE_LEAP, "TRAIT_DODGE_ALL_THROWN_OBJECTS" = TRAIT_DODGE_ALL_OBJECTS, "TRAIT_SUPERMATTER_IMMUNE" = TRAIT_SUPERMATTER_IMMUNE, - "TRAIT_BADASS" = TRAIT_BADASS + "TRAIT_BADASS" = TRAIT_BADASS, + "TRAIT_FORCED_STANDING" = TRAIT_FORCED_STANDING ), /obj/item = list( "TRAIT_SHOW_WIRE_INFO" = TRAIT_SHOW_WIRE_INFO, diff --git a/code/game/objects/items/weapons/implants/implant_dust.dm b/code/game/objects/items/weapons/implants/implant_dust.dm index e3a00ecaf84..8079bbae8f8 100644 --- a/code/game/objects/items/weapons/implants/implant_dust.dm +++ b/code/game/objects/items/weapons/implants/implant_dust.dm @@ -20,11 +20,6 @@ return FALSE to_chat(imp_in, "Your dusting bio-chip activates!") imp_in.visible_message("[imp_in] burns up in a flash!") - for(var/obj/item/I in imp_in.contents) - if(I == src) - continue - if(I.flags & NODROP) - qdel(I) imp_in.dust() /obj/item/implant/dust/emp_act(severity) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index cdd553d21b1..0f066bc96ce 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -3,14 +3,9 @@ GLOB.carbon_list += src /mob/living/carbon/Destroy() - // We need to delete the back slot first, for modsuits. Otherwise, we have issues. - if(back) - var/obj/I = back - unEquip(I) - qdel(I) // This clause is here due to items falling off from limb deletion for(var/obj/item in get_all_slots()) - unEquip(item) + unEquip(item, silent = TRUE) qdel(item) QDEL_LIST_CONTENTS(internal_organs) QDEL_LIST_CONTENTS(stomach_contents) diff --git a/code/modules/mob/living/carbon/human/human_death.dm b/code/modules/mob/living/carbon/human/human_death.dm index d159d8101b8..8954337b3e3 100644 --- a/code/modules/mob/living/carbon/human/human_death.dm +++ b/code/modules/mob/living/carbon/human/human_death.dm @@ -43,21 +43,24 @@ return TRUE /mob/living/carbon/human/dust() + if(!IS_HORIZONTAL(src)) + // keep us upright so the animation fits. + ADD_TRAIT(src, TRAIT_FORCED_STANDING, TRAIT_GENERIC) if(!death(TRUE) && stat != DEAD) return FALSE notransform = TRUE dust_animation() - QDEL_IN(src, 20) + QDEL_IN(src, 2 SECONDS) return TRUE /mob/living/carbon/human/dust_animation() // Animate them being dusted out of existence var/obj/effect/dusting_anim/dust_effect = new(loc, UID()) filters += filter(type = "displace", size = 256, render_source = "*snap[UID()]") - animate(src, alpha = 0, time = 20, easing = (EASE_IN | SINE_EASING)) + animate(src, alpha = 0, time = 2 SECONDS, easing = (EASE_IN | SINE_EASING)) new dna.species.remains_type(get_turf(src)) - QDEL_IN(dust_effect, 20) + QDEL_IN(dust_effect, 2 SECONDS) return TRUE /mob/living/carbon/human/melt() diff --git a/code/modules/mob/living/carbon/human/human_inventory.dm b/code/modules/mob/living/carbon/human/human_inventory.dm index dbca3fce213..eb6ffc7946d 100644 --- a/code/modules/mob/living/carbon/human/human_inventory.dm +++ b/code/modules/mob/living/carbon/human/human_inventory.dm @@ -372,13 +372,13 @@ return null /mob/living/carbon/human/get_all_slots() - . = get_head_slots() | get_body_slots() + . = get_body_slots() | get_head_slots() /mob/living/carbon/human/proc/get_body_slots() return list( + back, l_hand, r_hand, - back, s_store, handcuffed, legcuffed, diff --git a/code/modules/mob/living/init_signals.dm b/code/modules/mob/living/init_signals.dm index a644583e0cb..3450e5e9e72 100644 --- a/code/modules/mob/living/init_signals.dm +++ b/code/modules/mob/living/init_signals.dm @@ -12,6 +12,9 @@ RegisterSignal(src, SIGNAL_ADDTRAIT(TRAIT_FLOORED), PROC_REF(on_floored_trait_gain)) RegisterSignal(src, SIGNAL_REMOVETRAIT(TRAIT_FLOORED), PROC_REF(on_floored_trait_loss)) + RegisterSignal(src, SIGNAL_ADDTRAIT(TRAIT_FORCED_STANDING), PROC_REF(on_forced_standing_trait_gain)) + RegisterSignal(src, SIGNAL_REMOVETRAIT(TRAIT_FORCED_STANDING), PROC_REF(on_forced_standing_trait_loss)) + RegisterSignal(src, SIGNAL_ADDTRAIT(TRAIT_HANDS_BLOCKED), PROC_REF(on_handsblocked_trait_gain)) RegisterSignal(src, SIGNAL_REMOVETRAIT(TRAIT_HANDS_BLOCKED), PROC_REF(on_handsblocked_trait_loss)) @@ -50,6 +53,8 @@ /// Called when [TRAIT_FLOORED] is added to the mob. /mob/living/proc/on_floored_trait_gain(datum/source) SIGNAL_HANDLER + if(HAS_TRAIT(src, TRAIT_FORCED_STANDING)) + return // Don't go horizontal if mob has forced standing trait. mobility_flags &= ~MOBILITY_STAND on_floored_start() @@ -68,6 +73,21 @@ if(!resting) stand_up(FALSE) + /// Called when [TRAIT_FORCED_STANDING] is added to the mob. +/mob/living/proc/on_forced_standing_trait_gain(datum/source) + SIGNAL_HANDLER + + set_body_position(STANDING_UP) + +/// Called when [TRAIT_FORCED_STANDING] is removed from the mob. +/mob/living/proc/on_forced_standing_trait_loss(datum/source) + SIGNAL_HANDLER + + if(HAS_TRAIT(src, TRAIT_FLOORED)) + fall() + else if(resting) + lay_down() + /// Called when [TRAIT_HANDS_BLOCKED] is added to the mob. /mob/living/proc/on_handsblocked_trait_gain(datum/source) SIGNAL_HANDLER diff --git a/code/modules/mob/living/living_status_procs.dm b/code/modules/mob/living/living_status_procs.dm index 70accbf4878..2932761ed2e 100644 --- a/code/modules/mob/living/living_status_procs.dm +++ b/code/modules/mob/living/living_status_procs.dm @@ -102,6 +102,9 @@ STATUS EFFECTS return FALSE if(buckled) // if they are buckled they aint movin nowhere return FALSE + if(HAS_TRAIT(src, TRAIT_FORCED_STANDING) && new_value == LYING_DOWN) + return FALSE + . = TRUE body_position = new_value if(new_value == LYING_DOWN) // From standing to lying down. diff --git a/code/modules/mod/modules/modules_supply.dm b/code/modules/mod/modules/modules_supply.dm index e91aea3df3f..e98e4ccdc01 100644 --- a/code/modules/mod/modules/modules_supply.dm +++ b/code/modules/mod/modules/modules_supply.dm @@ -433,6 +433,8 @@ mod.wearer.add_filter("mod_outline", 3, outline_filter(color = "#000000AA")) animate(mod.wearer, animate_time, pixel_y = mod.wearer.pixel_y - 4, flags = ANIMATION_PARALLEL) mod.wearer.SpinAnimation(1.5) + // todo, someone get balance approval to add TRAIT_FORCED_STANDING here, like it is on tg. + // Or, register a signal on floored trait signal ADD_TRAIT(mod.wearer, TRAIT_HANDS_BLOCKED, "metriod[UID()]") ADD_TRAIT(mod.wearer, TRAIT_GOTTAGOFAST, "metroid[UID()]") RegisterSignal(mod.wearer, COMSIG_MOB_STATCHANGE, PROC_REF(on_statchange))