From 7fc14dd47406f02f5cbc0aa19354f69b359a0e55 Mon Sep 17 00:00:00 2001 From: Iajret Creature <122297233+AnArgonianLizardThatStealsPRs@users.noreply.github.com> Date: Thu, 16 Nov 2023 12:46:20 +0300 Subject: [PATCH] [MIRROR] Reworks stop, drop, roll into a gradual, interruptable thing, that repeats until extinguished [MDB IGNORE] (#662) * Reworks stop, drop, roll into a gradual, interruptable thing, that repeats until extinguished (#79694) --------- Co-authored-by: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> --- code/_onclick/hud/alert.dm | 10 ++- .../status_effects/buffs/stop_drop_roll.dm | 66 +++++++++++++++++++ code/modules/mob/living/carbon/carbon.dm | 11 +--- code/modules/mob/living/living.dm | 2 +- tgstation.dme | 1 + 5 files changed, 76 insertions(+), 14 deletions(-) create mode 100644 code/datums/status_effects/buffs/stop_drop_roll.dm diff --git a/code/_onclick/hud/alert.dm b/code/_onclick/hud/alert.dm index 4886c2c86ae..c1c22091593 100644 --- a/code/_onclick/hud/alert.dm +++ b/code/_onclick/hud/alert.dm @@ -298,13 +298,17 @@ or shoot a gun to move around via Newton's 3rd Law of Motion." /atom/movable/screen/alert/fire/Click() . = ..() if(!.) - return + return FALSE var/mob/living/living_owner = owner + if(!living_owner.can_resist()) + return FALSE living_owner.changeNext_move(CLICK_CD_RESIST) - if(living_owner.mobility_flags & MOBILITY_MOVE) - return living_owner.resist_fire() + if(!(living_owner.mobility_flags & MOBILITY_MOVE)) + return FALSE + + return living_owner.resist_fire() /atom/movable/screen/alert/give // information set when the give alert is made icon_state = "default" diff --git a/code/datums/status_effects/buffs/stop_drop_roll.dm b/code/datums/status_effects/buffs/stop_drop_roll.dm new file mode 100644 index 00000000000..43d37654e61 --- /dev/null +++ b/code/datums/status_effects/buffs/stop_drop_roll.dm @@ -0,0 +1,66 @@ +/datum/status_effect/stop_drop_roll + id = "stop_drop_roll" + alert_type = null + + tick_interval = 0.8 SECONDS + +/datum/status_effect/stop_drop_roll/on_apply() + if(!iscarbon(owner)) + return FALSE + + var/actual_interval = initial(tick_interval) + if(!owner.Knockdown(actual_interval * 2, ignore_canstun = TRUE) || owner.body_position != LYING_DOWN) + to_chat(owner, span_warning("You try to stop, drop, and roll - but you can't get on the ground!")) + return FALSE + + RegisterSignal(owner, COMSIG_MOVABLE_MOVED, PROC_REF(stop_rolling)) + RegisterSignal(owner, COMSIG_LIVING_SET_BODY_POSITION, PROC_REF(body_position_changed)) + ADD_TRAIT(owner, TRAIT_HANDS_BLOCKED, id) // they're kinda busy! + + owner.visible_message( + span_danger("[owner] rolls on the floor, trying to put [owner.p_them()]self out!"), + span_notice("You stop, drop, and roll!"), + ) + // Start with one weaker roll + owner.spin(spintime = actual_interval, speed = actual_interval / 4) + owner.adjust_fire_stacks(-0.25) + return TRUE + +/datum/status_effect/stop_drop_roll/on_remove() + UnregisterSignal(owner, list(COMSIG_MOVABLE_MOVED, COMSIG_LIVING_SET_BODY_POSITION)) + REMOVE_TRAIT(owner, TRAIT_HANDS_BLOCKED, id) + +/datum/status_effect/stop_drop_roll/tick(seconds_between_ticks) + if(HAS_TRAIT(owner, TRAIT_IMMOBILIZED) || HAS_TRAIT(owner, TRAIT_INCAPACITATED)) + qdel(src) + return + + var/actual_interval = initial(tick_interval) + if(!owner.Knockdown(actual_interval * 1.2, ignore_canstun = TRUE)) + stop_rolling() + return + + owner.spin(spintime = actual_interval, speed = actual_interval / 4) + owner.adjust_fire_stacks(-1) + + if(owner.fire_stacks > 0) + return + + owner.visible_message( + span_danger("[owner] successfully extinguishes [owner.p_them()]self!"), + span_notice("You extinguish yourself."), + ) + qdel(src) + +/datum/status_effect/stop_drop_roll/proc/stop_rolling(datum/source, ...) + SIGNAL_HANDLER + + if(!QDELING(owner)) + to_chat(owner, span_notice("You stop rolling around.")) + qdel(src) + +/datum/status_effect/stop_drop_roll/proc/body_position_changed(datum/source, new_value, old_value) + SIGNAL_HANDLER + + if(new_value != LYING_DOWN) + stop_rolling() diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 28b7caa16fd..786b663758f 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -228,16 +228,7 @@ buckled.user_unbuckle_mob(src,src) /mob/living/carbon/resist_fire() - adjust_fire_stacks(-5) - Paralyze(60, ignore_canstun = TRUE) - spin(32,2) - visible_message(span_danger("[src] rolls on the floor, trying to put [p_them()]self out!"), \ - span_notice("You stop, drop, and roll!")) - sleep(3 SECONDS) - if(fire_stacks <= 0 && !QDELETED(src)) - visible_message(span_danger("[src] successfully extinguishes [p_them()]self!"), \ - span_notice("You extinguish yourself.")) - return + return !!apply_status_effect(/datum/status_effect/stop_drop_roll) /mob/living/carbon/resist_restraints() var/obj/item/I = null diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index d329dc819d7..a42a0365bc5 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -1219,7 +1219,7 @@ buckled.user_unbuckle_mob(src,src) /mob/living/proc/resist_fire() - return + return FALSE /mob/living/proc/resist_restraints() return diff --git a/tgstation.dme b/tgstation.dme index c11181afd0b..d3eac9691fd 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -1822,6 +1822,7 @@ #include "code\datums\status_effects\wound_effects.dm" #include "code\datums\status_effects\buffs\food_haste.dm" #include "code\datums\status_effects\buffs\food_traits.dm" +#include "code\datums\status_effects\buffs\stop_drop_roll.dm" #include "code\datums\status_effects\buffs\stun_absorption.dm" #include "code\datums\status_effects\debuffs\blindness.dm" #include "code\datums\status_effects\debuffs\choke.dm"