Files
Paradise/code/datums/components/slippery.dm
Charlie bead47ea29 Adds crawling. (#17899)
* crawling?

* knockdown. CONTAINS CHANGES THAT NEED REVERTING

* plotting can_moves death

* CANMOVE IS DEAD

* mappers are insane

* removes todos as the are todone

* decreases crawling speed

* silly-con fixes

* surgery fixes

* fixes death

* pAI fixes

* removes var/lying

* runtime fix

* decreases default crawling speed

* correct crawling dir

* some more fixes

* stunbaton tweak, revert later

* rejuv fix

* restraint and incapacitated refactor

* crawling dir in line with TG

* fixes vehicle movement and grabs

* alien rest fixes

* antistun fixes

* fixed fall sounds

* forgor to stage this

* first review

* canmove zombie dispersal

* fix

* lots of fixes

* defines

* fixes the trait helper

* if you got no legs you can still crawl

* sillyconfix

* no reverty keepy

* jaunt fix

* hopefully fixes perma sleepy zzz

* admin rejuv temp fix

* rest canceling

* antistun chems now remove knockdown

* buckle offset fix

* fixes some stuff

* crawling delay = 4

* descuffs bed

* sleeping hotfix

* fixes simple mob resting

* V is the macro for resting

* projectiles no dodgy

* refines the projectile check

* god I hate strings

* MORE FIXES

* I hate buckling

* fixes capulettium plus

* winding down

* farie review

* bugs did stop showing up

* SEAN

* todo

* sean review

* ed209

* i HATE cyborgs

* steel review

* laaaaaast things

* reverts stun baton changes

* and done
2022-06-30 11:57:52 -05:00

54 lines
2.2 KiB
Plaintext

/**
* # Slip Component
*
* This is a component that can be applied to any movable atom (mob or obj).
*
* While the atom has this component, any human mob that walks over it will have a chance to slip.
* Duration, tiles moved, and so on, depend on what variables are passed in when the component is added.
*
*/
/datum/component/slippery
/// Text that gets displayed in the slip proc, i.e. "user slips on [description]"
var/description
/// The amount of knockdown to apply after slip.
var/knockdown
/// The chance that walking over the parent will slip you.
var/slip_chance
/// The amount of tiles someone will be moved after slip.
var/slip_tiles
/// TRUE If this slip can be avoided by walking.
var/walking_is_safe
/// FALSE if you want no slip shoes to make you immune to the slip
var/slip_always
/// The verb that players will see when someone slips on the parent. In the form of "You [slip_verb]ped on".
var/slip_verb
/datum/component/slippery/Initialize(_description, _knockdown = 0, _slip_chance = 100, _slip_tiles = 0, _walking_is_safe = TRUE, _slip_always = FALSE, _slip_verb = "slip")
if(!isatom(parent))
return COMPONENT_INCOMPATIBLE
description = _description
knockdown = max(0, _knockdown)
slip_chance = max(0, _slip_chance)
slip_tiles = max(0, _slip_tiles)
walking_is_safe = _walking_is_safe
slip_always = _slip_always
slip_verb = _slip_verb
/datum/component/slippery/RegisterWithParent()
RegisterSignal(parent, list(COMSIG_MOVABLE_CROSSED, COMSIG_ATOM_ENTERED), .proc/Slip)
/datum/component/slippery/UnregisterFromParent()
UnregisterSignal(parent, list(COMSIG_MOVABLE_CROSSED, COMSIG_ATOM_ENTERED))
/**
Called whenever the parent recieves either the `MOVABLE_CROSSED` signal or the `ATOM_ENTERED` signal.
Calls the `victim`'s `slip()` proc with the component's variables as arguments.
Additionally calls the parent's `after_slip()` proc on the `victim`.
*/
/datum/component/slippery/proc/Slip(datum/source, mob/living/carbon/human/victim)
if(istype(victim) && !victim.flying && prob(slip_chance) && victim.slip(description, knockdown, slip_tiles, walking_is_safe, slip_always, slip_verb))
var/atom/movable/owner = parent
owner.after_slip(victim)