Files
Paradise/code/modules/awaymissions/gateway.dm
Vi3trice f4b37b4177 Port TG updating appearances (#17943)
* Get pants that match or else you gonna look silly yo

* Posters

* Fix other hud elements

* Rereviewed

* Update shotglass.dm

* Fix for new merged PRs

* Typo

* Coming across other stuff

* Update theblob.dm

* No takebacksies

* smh i forget to leave a comment

* Updated for the detgun and cards

* Should have rerun langserver again

* No longer plastic, more in scope

* Damn you bluespace

* Reverting turret logic, out of scope at this point

* Tweak that part

* Went over energy guns again, and fixed UI White's sprite sheet

* Welding masks, glasses, and JUSTICE

* Update portable_atmospherics.dm

* Cleaning up, clearing things up

* Review and suggestions

* Update valve.dm

* More tweaks

* Missing character

* Not distinct lightmasks, so they can be overlays

* Update generator.dm

* Add parameter so holodeck doesn't try to make a perfect copy

* Update unsorted.dm

* Spiders

* Better fix for spiders, fix vamps too

* Ghosts

* Update telekinesis.dm

* Cleaning up old procs

* It's set up to not copy datums... Unless they're in a list

* Donuts, duct tape, and detgun. D3VR coming to Early Access

* Update procs that interact with doors so they call update_state instead

* Forgot one spot, and actually might as well just force lock

* Cleaning up other things... Sigh, and kitty ears

* oops

* Getting used to how it works

* blinds

* Going back to the suit obscuring thing, so it doesn't update all the time

* Missed that from merging master

* I made this PR and forgot about it

* Fix runtimes in cards

* Make things a bit more unified

* Update update_icons.dm

* yarn, really?

* Update library_equipment.dm

* Update shieldgen.dm

* Every time Charlie merges something, I go back and see if I can improve things further

* what's this? more?

* Update misc_special.dm

* wow, paper

* Review

* More reviews

* To be sure, seems like being broken messed something sometimes

* Brought airlocks closer to how TG works to iron out some stuff

* Pizza and morgue

* Doesn't seem to hurt, tried with holodeck

* Revert "Doesn't seem to hurt, tried with holodeck"

This reverts commit 158529302b.

* Icon conflict

* Fix organ damage

* Don't ask how. Why. It's like that on prod too.

* Cutting down on things and updating from TG.

* More flexible. Just in case the thing you stuck it on didn't destroy.

* Hydro was one the things I touched earlier on, better rework it

* Reviews

* Cleaning up further, also bri'ish

* Undo a change I did, and switch over to a more recent implementation

* Update biogenerator.dm

* Rolling back to old airlocks, but with new duct taped note

* Functionally the same. I'd just rather not have the smoothing happen there

* Went over APCs again

* Fix welding helmet names in species files

* Update airlock.dm

* Update persistent_overlay.dm

* Oh, topic
2022-07-21 08:11:59 +02:00

286 lines
7.3 KiB
Plaintext

GLOBAL_DATUM_INIT(the_gateway, /obj/machinery/gateway/centerstation, null)
/obj/machinery/gateway
name = "gateway"
desc = "A mysterious gateway built by unknown hands, it allows for faster than light travel to far-flung locations."
icon = 'icons/obj/machines/gateway.dmi'
icon_state = "off"
density = TRUE
anchored = TRUE
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
flags_2 = NO_MALF_EFFECT_2
var/active = FALSE
/obj/machinery/gateway/Initialize()
..()
update_icon(UPDATE_ICON_STATE)
update_density_from_dir()
/obj/machinery/gateway/proc/update_density_from_dir()
if(dir == 2)
density = FALSE
/obj/machinery/gateway/update_icon_state()
icon_state = active ? "on" : "off"
//this is da important part wot makes things go
/obj/machinery/gateway/centerstation
density = TRUE
icon_state = "offcenter"
use_power = IDLE_POWER_USE
//warping vars
var/list/linked = list()
var/ready = FALSE //have we got all the parts for a gateway?
var/wait = 0 //this just grabs world.time at world start
var/obj/machinery/gateway/centeraway/awaygate = null
/obj/machinery/gateway/centerstation/Initialize(mapload)
. = ..()
if(!GLOB.the_gateway)
GLOB.the_gateway = src
update_icon(UPDATE_ICON_STATE)
wait = world.time + GLOB.configuration.gateway.away_mission_delay
return INITIALIZE_HINT_LATELOAD
/obj/machinery/gateway/centerstation/LateInitialize()
awaygate = locate(/obj/machinery/gateway/centeraway) in GLOB.machines
/obj/machinery/gateway/centerstation/update_density_from_dir()
return
/obj/machinery/gateway/centerstation/Destroy()
if(GLOB.the_gateway == src)
GLOB.the_gateway = null
return ..()
/obj/machinery/gateway/centerstation/update_icon_state()
icon_state = active ? "oncenter" : "offcenter"
/obj/machinery/gateway/centerstation/process()
if(stat & (NOPOWER))
if(active) toggleoff()
return
if(active)
use_power(5000)
/obj/machinery/gateway/centerstation/proc/detect()
linked = list() //clear the list
var/turf/T = loc
for(var/i in GLOB.alldirs)
T = get_step(loc, i)
var/obj/machinery/gateway/G = locate(/obj/machinery/gateway) in T
if(G)
linked.Add(G)
continue
//this is only done if we fail to find a part
ready = FALSE
toggleoff()
break
if(linked.len == 8)
ready = TRUE
/obj/machinery/gateway/centerstation/proc/toggleon(mob/user as mob)
if(!ready)
return
if(linked.len != 8)
return
if(!powered())
return
if(!awaygate)
awaygate = locate(/obj/machinery/gateway/centeraway) in GLOB.machines
if(!awaygate)
to_chat(user, "<span class='notice'>Error: No destination found.</span>")
return
if(world.time < wait)
to_chat(user, "<span class='notice'>Error: Warpspace triangulation in progress. Estimated time to completion: [round(((wait - world.time) / 10) / 60)] minutes.</span>")
return
for(var/obj/machinery/gateway/G in linked)
G.active = TRUE
G.update_icon(UPDATE_ICON_STATE)
active = TRUE
update_icon(UPDATE_ICON_STATE)
/obj/machinery/gateway/centerstation/proc/toggleoff()
for(var/obj/machinery/gateway/G in linked)
G.active = FALSE
G.update_icon(UPDATE_ICON_STATE)
active = FALSE
update_icon(UPDATE_ICON_STATE)
/obj/machinery/gateway/centerstation/attack_hand(mob/user as mob)
if(!ready)
detect()
return
if(!active)
toggleon(user)
return
toggleoff()
//okay, here's the good teleporting stuff
/obj/machinery/gateway/centerstation/Bumped(atom/movable/M as mob|obj)
if(!ready)
return
if(!active)
return
if(!awaygate)
return
if(awaygate.calibrated)
M.forceMove(get_step(awaygate.loc, SOUTH))
M.dir = SOUTH
return
else
var/obj/effect/landmark/dest = pick(GLOB.awaydestinations)
if(dest)
M.forceMove(dest.loc)
M.dir = SOUTH
use_power(5000)
return
/obj/machinery/gateway/centerstation/attackby(obj/item/W as obj, mob/user as mob, params)
if(istype(W,/obj/item/multitool))
to_chat(user, "The gate is already calibrated, there is no work for you to do here.")
return
return ..()
/////////////////////////////////////Away////////////////////////
/obj/machinery/gateway/centeraway
density = TRUE
icon_state = "offcenter"
use_power = NO_POWER_USE
var/calibrated = 1
var/list/linked = list() //a list of the connected gateway chunks
var/ready = FALSE
var/obj/machinery/gateway/centeraway/stationgate = null
/obj/machinery/gateway/centeraway/Initialize()
..()
update_icon(UPDATE_ICON_STATE)
stationgate = locate(/obj/machinery/gateway/centerstation) in GLOB.machines
/obj/machinery/gateway/centeraway/update_density_from_dir()
return
/obj/machinery/gateway/centeraway/update_icon_state()
icon_state = active ? "oncenter" : "offcenter"
/obj/machinery/gateway/centeraway/proc/detect()
linked = list() //clear the list
var/turf/T = loc
for(var/i in GLOB.alldirs)
T = get_step(loc, i)
var/obj/machinery/gateway/G = locate(/obj/machinery/gateway) in T
if(G)
linked.Add(G)
continue
//this is only done if we fail to find a part
ready = FALSE
toggleoff()
break
if(linked.len == 8)
ready = TRUE
/obj/machinery/gateway/centeraway/proc/toggleon(mob/user as mob)
if(!ready)
return
if(linked.len != 8)
return
if(!stationgate)
stationgate = locate(/obj/machinery/gateway/centerstation) in GLOB.machines
if(!stationgate)
to_chat(user, "<span class='notice'>Error: No destination found.</span>")
return
for(var/obj/machinery/gateway/G in linked)
G.active = TRUE
G.update_icon(UPDATE_ICON_STATE)
active = TRUE
update_icon(UPDATE_ICON_STATE)
/obj/machinery/gateway/centeraway/proc/toggleoff()
for(var/obj/machinery/gateway/G in linked)
G.active = FALSE
G.update_icon(UPDATE_ICON_STATE)
active = FALSE
update_icon(UPDATE_ICON_STATE)
/obj/machinery/gateway/centeraway/attack_hand(mob/user as mob)
if(!ready)
detect()
return
if(!active)
toggleon(user)
return
toggleoff()
/obj/machinery/gateway/centeraway/Bumped(atom/movable/AM)
if(!ready)
return
if(!active)
return
if(!stationgate || QDELETED(stationgate))
return
if(isliving(AM))
if(exilecheck(AM))
return
else
for(var/mob/living/L in AM.contents)
if(exilecheck(L))
atom_say("Rejecting [AM]: Exile implant detected in contained lifeform.")
return
if(AM.has_buckled_mobs())
for(var/mob/living/L in AM.buckled_mobs)
if(exilecheck(L))
atom_say("Rejecting [AM]: Exile implant detected in close proximity lifeform.")
return
AM.forceMove(get_step(stationgate.loc, SOUTH))
AM.setDir(SOUTH)
if(ismob(AM))
var/mob/M = AM
if(M.client)
M.client.move_delay = max(world.time + 5, M.client.move_delay)
/obj/machinery/gateway/centeraway/proc/exilecheck(mob/living/carbon/M)
for(var/obj/item/implant/exile/E in M)//Checking that there is an exile implant in the contents
if(E.imp_in == M)//Checking that it's actually implanted vs just in their pocket
to_chat(M, "<span class='notice'>The station gate has detected your exile implant and is blocking your entry.</span>")
return 1
return 0
/obj/machinery/gateway/centeraway/attackby(obj/item/W as obj, mob/user as mob, params)
if(istype(W,/obj/item/multitool))
if(calibrated)
to_chat(user, "<span class='notice'>The gate is already calibrated, there is no work for you to do here.</span>")
return
else
to_chat(user, "<span class='boldnotice'>Recalibration successful!</span><span class='notice'>: This gate's systems have been fine tuned. Travel to this gate will now be on target.</span>")
calibrated = 1
return
return ..()