Files
Bubberstation/code/modules/awaymissions/signpost.dm
SkyratBot 19e80c32c7 [MIRROR] Tweaks some instances of get_safe_turf so things like the nuclear disk doesn't accidentally teleport to the Icebox Syndicate Base (#28184)
* Tweaks some instances of get_safe_turf so things like the nuclear disk doesn't accidentally teleport to the Icebox Syndicate Base (#83012)

Yes, I know preventing the nuke disk teleporting to the icebox syndicate
base (or possibly the wendigo arena) is removing soul. Please don't kill
me :(

## About The Pull Request

Adds some missing variables to instances of get_safe_turf() so they will
only teleport to the given z-level.
Replaces some instances of get_safe_turf() with
get_safe_random_station_turf().

## Why It's Good For The Game

First, the differences between get_safe_turf() and
get_safe_random_station_turf():

### get_safe_turf()
- gets a random safe turf on a z-level (usually any of the staiton
z-levels), not accounting for the /area/
- should be used if you don't care if it spawns on the station or not,
or if you need to specifically teleport to a z-level
- not very expensive performance wise

###  get_safe_random_station_turf()
- gets a random safe turf that will always be a station area, ignoring
z-level.
- should be used if you NEED the turf to be on a station's area
- slightly more expensive performance wise than get_safe_turf, but still
very cheap

Some code was using get_safe_turf() when it should've been using
get_safe_random_station_turf(), and some code that should be using
get_safe_turf() were incorrectly using the zlevels arg instead of zlevel
arg (Yes, there is a difference), or didn't include it at all.

All the changes were made to my best judgement. If you're curious about
a change, please ask and I will explain why I did it.

## Changelog

🆑 BurgerBB
fix: Tweaks some instances of get_safe_turf so things like the nuclear
disk doesn't accidentally teleport to the Icebox Syndicate Base
/🆑

---------

Co-authored-by: Jacquerel <hnevard@ gmail.com>

* Tweaks some instances of get_safe_turf so things like the nuclear disk doesn't accidentally teleport to the Icebox Syndicate Base

---------

Co-authored-by: BurgerLUA <8602857+BurgerLUA@users.noreply.github.com>
Co-authored-by: Jacquerel <hnevard@ gmail.com>
2024-06-15 04:17:39 +01:00

71 lines
2.0 KiB
Plaintext

/*An alternative to exit gateways, signposts send you back to somewhere safe onstation with their semiotic magic.*/
/obj/structure/signpost
icon = 'icons/obj/fluff/general.dmi'
icon_state = "signpost"
anchored = TRUE
density = TRUE
var/question = "Travel back?"
var/list/zlevels
/obj/structure/signpost/Initialize(mapload)
. = ..()
set_light(2)
zlevels = SSmapping.levels_by_trait(ZTRAIT_STATION)
/obj/structure/signpost/interact(mob/user)
. = ..()
if(.)
return
if(tgui_alert(usr,question,name,list("Yes","No")) == "Yes" && Adjacent(user))
var/turf/T = zlevels ? find_safe_turf(zlevels=zlevels) : get_safe_random_station_turf()
if(T)
var/atom/movable/AM = user.pulling
if(AM)
AM.forceMove(T)
user.forceMove(T)
if(AM)
user.start_pulling(AM)
to_chat(user, span_notice("You blink and find yourself in [get_area_name(T)]."))
else
to_chat(user, "Nothing happens. You feel that this is a bad sign.")
/obj/structure/signpost/attackby(obj/item/W, mob/user, params)
return interact(user)
/obj/structure/signpost/attack_paw(mob/user, list/modifiers)
return interact(user)
/obj/structure/signpost/attack_hulk(mob/user)
return
/obj/structure/signpost/attack_larva(mob/user, list/modifiers)
return interact(user)
/obj/structure/signpost/attack_robot(mob/user)
if (Adjacent(user))
return interact(user)
/obj/structure/signpost/attack_animal(mob/user, list/modifiers)
return interact(user)
/obj/structure/signpost/salvation
name = "\proper salvation"
desc = "In the darkest times, we will find our way home."
resistance_flags = INDESTRUCTIBLE
/obj/structure/signpost/exit
name = "exit"
desc = "Make sure to bring all your belongings with you when you \
exit the area."
question = "Leave? You might never come back."
/obj/structure/signpost/exit/Initialize(mapload)
. = ..()
zlevels = list()
for(var/i in 1 to world.maxz)
zlevels += i
zlevels -= SSmapping.levels_by_trait(ZTRAIT_CENTCOM) // no easy victory, even with meme signposts
// also, could you think of the horror if they ended up in a holodeck
// template or something