Files
Bubberstation/code/datums/elements/floorloving.dm
Ghom 32aa798d36 [NO GBP] Fixes hoverboard being able to be used in space. (#84533)
## About The Pull Request
Apparently I've left out that `isopenspaceturf(A)` returns false on
normal (not multi-z) space turfs because they're of a different path.
This should fix the fact you can use hoverboards as a substitute
jetpacks, which wasn't intended. You can still use them in space if
there's lattice/catwalk underneath, or another kind of turf on the
z-level below however.

## Why It's Good For The Game
Unintended bit from the skateboard buff PR I had made months ago.

## Changelog

🆑
fix: Hoverboards properly dysfunction in space without any kind of
support underneath them.
/🆑
2024-07-07 15:18:08 -04:00

22 lines
797 B
Plaintext

/// Prevents a movable atom from moving to somewhere which isn't an open turf with floor on it
/datum/element/floor_loving
/datum/element/floor_loving/Attach(datum/target)
. = ..()
if(!ismovable(target))
return ELEMENT_INCOMPATIBLE
RegisterSignal(target, COMSIG_MOVABLE_PRE_MOVE, PROC_REF(attempting_move))
/datum/element/floor_loving/Detach(datum/target)
UnregisterSignal(target, COMSIG_MOVABLE_PRE_MOVE)
return ..()
/// Block movement to any non-floor location
/datum/element/floor_loving/proc/attempting_move(atom/movable/parent, newloc)
SIGNAL_HANDLER
if (!isopenturf(newloc) || is_space_or_openspace(newloc))
return COMPONENT_MOVABLE_BLOCK_PRE_MOVE
if (isliving(parent))
var/mob/living/living_parent = parent
living_parent.balloon_alert(living_parent, "can't move there!")