Slip behaviour component
Add this component to an object to make it a slippery object, slippery objects make mobs that cross them fall over. Items with this component that get picked up may give their parent mob the slip behaviour.
Here is a simple example of adding the component behaviour to an object.area
AddComponent(/datum/component/slippery, 80, (NO_SLIP_WHEN_WALKING | SLIDE))
This adds slippery behaviour to the parent atom, with a 80 decisecond (~8 seconds) knockdown The lube flags control how the slip behaves, in this case, the mob wont slip if it's in walking mode (NO_SLIP_WHEN_WALKING) and if they do slip, they will slide a few tiles (SLIDE)
This component has configurable behaviours, see the Initialize proc for the argument listing.
Vars | |
can_slip_callback | Optional callback allowing you to define custom conditions for slipping |
---|---|
default_connections | what we give to connect_loc by default, makes slippable mobs moving over us slip |
force_drop_items | If the slip forces the crossing mob to drop held items. |
holder | If parent is an item, this is the person currently holding/wearing the parent (or the parent if no one is holding it) |
holder_connect_loc_behalf | The connect_loc_behalf component for the holder_connections list. |
holder_connections | what we give to connect_loc if we're an item and get equipped by a mob. makes slippable mobs moving over our holder slip |
knockdown_time | How long the slip keeps the crossing mob knocked over (they can still crawl and use weapons) for. |
lube_flags | Flags for how slippery the parent is. See [__DEFINES/mobs.dm] |
on_slip_callback | Optional call back that is called when a mob slips on this component |
paralyze_time | How long the slip paralyzes (prevents the crossing mob doing anything) for. |
slot_whitelist | Whitelist of item slots the parent can be equipped in that make the holder slippery. If null or empty, it will always make the holder slippery. |
Procs | |
Initialize | Initialize the slippery component behaviour |
Slip | The proc that does the sliping. Invokes the slip callback we have set. |
Slip_on_wearer | The slip proc, but for equipped items. Slips the person who crossed us if we're lying down and unbuckled. |
holder_deleted | Detects if the holder mob is deleted. If our holder mob is the holder set in this component, we null it. |
on_drop | Gets called when COMSIG_ITEM_DROPPED is sent to parent. Makes our holder mob un-slippery. |
on_equip | Gets called when COMSIG_ITEM_EQUIPPED is sent to parent. This proc register slip signals to the equipper. If we have a slot whitelist, we only register the signals if the slot is valid (ex: clown PDA only slips in ID or belt slot). |
Var Details
can_slip_callback
Optional callback allowing you to define custom conditions for slipping
default_connections
what we give to connect_loc by default, makes slippable mobs moving over us slip
force_drop_items
If the slip forces the crossing mob to drop held items.
holder
If parent is an item, this is the person currently holding/wearing the parent (or the parent if no one is holding it)
holder_connect_loc_behalf
The connect_loc_behalf component for the holder_connections list.
holder_connections
what we give to connect_loc if we're an item and get equipped by a mob. makes slippable mobs moving over our holder slip
knockdown_time
How long the slip keeps the crossing mob knocked over (they can still crawl and use weapons) for.
lube_flags
Flags for how slippery the parent is. See [__DEFINES/mobs.dm]
on_slip_callback
Optional call back that is called when a mob slips on this component
paralyze_time
How long the slip paralyzes (prevents the crossing mob doing anything) for.
slot_whitelist
Whitelist of item slots the parent can be equipped in that make the holder slippery. If null or empty, it will always make the holder slippery.
Proc Details
Initialize
Initialize the slippery component behaviour
When applied to any atom in the game this will apply slipping behaviours to that atom
Arguments:
- knockdown - Length of time the knockdown applies (Deciseconds)
- lube_flags - Controls the slip behaviour, they are listed starting here
- datum/callback/on_slip_callback - Callback to define further custom controls on when slipping is applied
- paralyze - length of time to paralyze the crossing mob for (Deciseconds)
- force_drop - should the crossing mob drop items in it's hands or not
- slot_whitelist - flags controlling where on a mob this item can be equipped to make the parent mob slippery full list here
- datum/callback/on_slip_callback - Callback to add custom behaviours as the crossing mob is slipped
Slip
The proc that does the sliping. Invokes the slip callback we have set.
Arguments
- source - the source of the signal
- arrived - the atom/movable that is being slipped.
Slip_on_wearer
The slip proc, but for equipped items. Slips the person who crossed us if we're lying down and unbuckled.
Arguments:
- source - the source of the signal
- arrived - the atom/movable that slipped on us.
holder_deleted
Detects if the holder mob is deleted. If our holder mob is the holder set in this component, we null it.
Arguments:
- source - the source of the signal
- possible_holder - the mob being deleted.
on_drop
Gets called when COMSIG_ITEM_DROPPED is sent to parent. Makes our holder mob un-slippery.
Arguments:
- source - the source of the signal
- user - the mob that was formerly wearing our slippery item.
on_equip
Gets called when COMSIG_ITEM_EQUIPPED is sent to parent. This proc register slip signals to the equipper. If we have a slot whitelist, we only register the signals if the slot is valid (ex: clown PDA only slips in ID or belt slot).
Arguments
- source - the source of the signal
- equipper - the mob we're equipping the slippery thing to
- slot - the slot we're equipping the slippery thing to on the equipper.