Files
Yogstation/code/datums/components/slippery.dm
Ling c7226a179b Modernizes components (#17260)
* Part 1

* Refactor signals into different files

* Remove redundant file

* Add missing movable signals

* Add signals log

* Split signal registering with list into new proc

* Add comments to component.dm and remove signal_enabled

* Fix yogs code

* Not this one

* Hopefully make linter happy

* Remove duplicate file

* More duplicates signals
2023-01-04 22:29:34 +00:00

20 lines
750 B
Plaintext

/datum/component/slippery
var/force_drop_items = FALSE
var/knockdown_time = 0
var/stun_time = 0
var/lube_flags
var/datum/callback/callback
/datum/component/slippery/Initialize(_knockdown, _lube_flags = NONE, datum/callback/_callback, _stun, _force_drop = FALSE)
knockdown_time = max(_knockdown, 0)
stun_time = max(_stun, 0)
force_drop_items = _force_drop
lube_flags = _lube_flags
callback = _callback
RegisterSignals(parent, list(COMSIG_MOVABLE_CROSSED, COMSIG_ATOM_ENTERED), .proc/Slip)
/datum/component/slippery/proc/Slip(datum/source, atom/movable/AM)
var/mob/victim = AM
if(istype(victim) && !victim.is_flying() && victim.slip(knockdown_time, parent, lube_flags, stun_time, force_drop_items) && callback)
callback.Invoke(victim)