Files
Bubberstation/code/datums/components/banned_from_space.dm
SkyratBot 16854f2358 [MIRROR] The Voidwalker | New Midround Antagonist (#28832)
* The Voidwalker | New Midround Antagonist

* [MIRROR] The Voidwalker | New Midround Antagonist [MDB IGNORE] (#3755)

* The Voidwalker | New Midround Antagonist

* Update role_preferences.dm

* Update sql_ban_system.dm

* Update _bodyparts.dm

* Update role_preferences.dm

* Update lazy_templates.dm

* Update _bodyparts.dm

* Update _bodyparts.dm

* Grep

---------

Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com>
Co-authored-by: SomeRandomOwl <2568378+SomeRandomOwl@users.noreply.github.com>
Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>

---------

Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com>
Co-authored-by: SpaceLoveSs13 <68121607+SpaceLoveSs13@users.noreply.github.com>
Co-authored-by: NovaBot <154629622+NovaBot13@users.noreply.github.com>
Co-authored-by: SomeRandomOwl <2568378+SomeRandomOwl@users.noreply.github.com>
Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
2024-07-20 17:44:24 +05:30

38 lines
991 B
Plaintext

/// Following recent tomfoolery, we've decided to ban you from space.
/datum/component/banned_from_space
/// List of recent tiles we walked on that aren't space
var/list/tiles = list()
/// The max amount of tiles we store
var/max_tile_list_size = 4
/datum/component/banned_from_space/Initialize(...)
if(!ismovable(parent))
return COMPONENT_INCOMPATIBLE
RegisterSignal(parent, COMSIG_ATOM_ENTERING, PROC_REF(check_if_space))
/datum/component/banned_from_space/proc/check_if_space(atom/source, atom/new_location)
SIGNAL_HANDLER
if(!isturf(new_location))
return
if(isspaceturf(new_location))
send_back(parent)
else
tiles.Add(new_location)
if(tiles.len > max_tile_list_size)
tiles.Cut(1, 2)
/datum/component/banned_from_space/proc/send_back(atom/movable/parent)
var/new_turf
if(tiles.len)
new_turf = tiles[1]
new /obj/effect/temp_visual/portal_animation(parent.loc, new_turf, parent)
else
new_turf = get_random_station_turf()
parent.forceMove(new_turf)