Skip to content

Commit

Permalink
[MIRROR] Reworks stop, drop, roll into a gradual, interruptable thing…
Browse files Browse the repository at this point in the history
…, 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 <[email protected]>
Co-authored-by: MrMelbert <[email protected]>
  • Loading branch information
3 people authored Nov 16, 2023
1 parent cc601e9 commit 7fc14dd
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 14 deletions.
10 changes: 7 additions & 3 deletions code/_onclick/hud/alert.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
66 changes: 66 additions & 0 deletions code/datums/status_effects/buffs/stop_drop_roll.dm
Original file line number Diff line number Diff line change
@@ -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()
11 changes: 1 addition & 10 deletions code/modules/mob/living/carbon/carbon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1219,7 +1219,7 @@
buckled.user_unbuckle_mob(src,src)

/mob/living/proc/resist_fire()
return
return FALSE

/mob/living/proc/resist_restraints()
return
Expand Down
1 change: 1 addition & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 7fc14dd

Please sign in to comment.