Files
Aurora.3/code/modules/assembly/infrared.dm
Matt Atlas 31956c7eb0 Rock the UI Away - Removes VueUI and adds TGUI (#16509)
* tgui the beginning

* binaries and the like

* Bring in the last of it

* Example radio UI

* delete example

* NTOS Main Menu, start on manifest, tgui states

* tasks.json

* gunnery ui pt 1

* okay

* fix everything

* scss update

* oops

* manifest gigablast

* downloader part 1

* download prt 2

* NTOSDownloader final

* mfw committing to_worlds

* gunnery console pt2

* i cooked

* targeting (finished)

* one vueui down

* voting ui almost done

* MY MIND FEELS LIKE AN ARCH ENEMYYYY

* voting ui down

* photocopier

* ntos config + download fixes

* photocopier 2

* refactor define

* NTOS client manager + fixes

* fax machine final (it also uses toner now)

* marching forwards... left behind...

* ntnrc part 1

* canister

* add quotes

* portable pumps pt1 + more backgrounds

* oops

* finish the portable pump

* freezers

so I'll keep on pushing forward... you haven't seen the last of me... oooooooh...

* doors ui pt1

* finish doors UI (forgive me wildkins it's a bit of shitcode)

* vitals monitor, make things use labeled lists, new backgrounds

* mais j'envoyé aucun mayday...

* maglock pt1

* pour ça je me suis perdu...

* infrared

* fix that

* prox sensor pt1

* prox sensor

* signaler (this was actually pretty hard)

* atmos control pt1

* atmos control pt1.1

* atmos pt 2

* fuel injector

* multitool UI

* jammer

* list viewer

* APC

* portgen

* targeting console updates + SMES ui

* new themes, shield generator

* supermatter

* Add ore detector and (shitty) NTNet Relay

* orderterminal pt1

* orderterminal pt2

* smartfridge

* Add (air-)tank GUI update ore detector size

* Adds Transfer Valves

* Add AtmoScrubber

* analyzer pt1

* weapons analyzer pt2

* bodyscanner pt1

* bodyscanner pt2

* fix this shitcode

* seed storage

* appearance changer

* appearance changer final

* sleeper pt1

* sleeper

* gps

* vehicles

* chem dispenser

* lily request

* holopad

* tgui modules pt1

* ppanel

* damage menu

* fixes

* im here too now

* follow menu, search bars

* quikpay

* quikpay fixes

* circuit printer

* ppanel

* ppanel updates

* pai

* turret controls (i want to kill myself)

* tweak

* remove the boardgame

* guntracker

* implant tracker

* penal mechs

come close to me, come close to me

* chem codex

* pai radio

* doorjack

* pai directives

* signaler removal, sensors

* ghost spawner

* spawnpoint

* fixes

* teleporter

* one more to the chopping block

* account database

* remove divider

* scanner, atmos

* latejoin ui pt1

* latejoin

* records pt1

* RECORDS UI DONE

* delete interpreter & records

* CHAT FUCKING CLIENT

* data updates

* fix some things

* final UI, log

* basic nanoui fix

* antag panel

* remove vueui

* atm update

* vending update

* warrants, cameras

* ntmonitor

* time comes for all

* preserve this legacy

* bring that back (oops)

* rcon, ui auto update for computer UIs, remove rcon computers

* alarm monitoring (a bit broke and also todo: add custom alarm monitoring programs to a few consoles)

* A LIKE SUPREME

* a

* power monitor

* lights on

* fuck this code, fuck nanoui modules, and fuck nanoui

* LEAVE IT OH SO FAR BEHIND

* fix alarm monitoring for synths

* I SAW IN YOU WHAT LIFE WAS MISSING

* comms console

* idcard and record updates

* turn the light on

* arcade

* pt2

* news browser

* static

* crusher

* f

* COULD I JUST SLEIGH THE GOLD FROM THE BALLS? I'M SO FRUSTRATED OH COULD YOU TELL? IF I HEAR ONE MORE VUEUI OR ONE NANOUI I'M GONNA LOSE IT SO LET ME GOOOOOOOOOOOOOOOOO

* codeowners & suit sensors

* html ui style removal

* make lint happy

* resist and disorder

* i slowly get up and turn off the noise, already fed up...

* pleaseeeeeeeeeeeeeee

* THE CREDIT LARP IS NECESSARY

* i hold the keys

* RISE UP

* fix that?

* harry's suggestions xoxo

* runtime fix pt2

* You are the only thing that I still care about

* adds build workflow

* Update update_tgui.yml

* adds some needed steps

* ATM

* misc fixes and tweaks

* fixes 2

* make newscasters usable and fix use power on freezers

* turret control is clearer

---------

Co-authored-by: John Wildkins <john.wildkins@gmail.com>
Co-authored-by: Matt Atlas <liermattia@gmail.com>
Co-authored-by: harryob <55142896+harryob@users.noreply.github.com>
Co-authored-by: Werner <Arrow768@users.noreply.github.com>
Co-authored-by: Geeves <ggrobler447@gmail.com>
Co-authored-by: harryob <me@harryob.live>
2023-06-25 19:03:33 +02:00

247 lines
5.9 KiB
Plaintext

/obj/item/device/assembly/infra
name = "infrared emitter"
desc = "Emits a visible or invisible beam and is triggered when the beam is interrupted."
icon_state = "infrared"
drop_sound = 'sound/items/drop/component.ogg'
pickup_sound = 'sound/items/pickup/component.ogg'
origin_tech = list(TECH_MAGNET = 2)
matter = list(DEFAULT_WALL_MATERIAL = 1000, MATERIAL_GLASS = 500)
secured = FALSE
obj_flags = OBJ_FLAG_ROTATABLE
var/on = FALSE
var/visible = FALSE
var/obj/effect/beam/i_beam/first = null
var/turf/beam_origin //If we're not on this turf anymore, we've moved. Catches holder.master movements when we're attached to bombs and stuff.
/obj/item/device/assembly/infra/activate()
if(!..())
return FALSE //Cooldown check
toggle_on()
return TRUE
/obj/item/device/assembly/infra/proc/toggle_on()
on = !on
if(secured && on)
START_PROCESSING(SSprocessing, src)
else
on = FALSE
QDEL_NULL(first)
STOP_PROCESSING(SSprocessing, src)
update_icon()
/obj/item/device/assembly/infra/toggle_secure()
secured = !secured
if(secured && on)
START_PROCESSING(SSprocessing, src)
else
on = FALSE
QDEL_NULL(first)
STOP_PROCESSING(SSprocessing, src)
update_icon()
return secured
/obj/item/device/assembly/infra/update_icon()
cut_overlays()
attached_overlays = list()
if(on)
add_overlay("infrared_on")
attached_overlays += "infrared_on"
if(holder)
holder.update_icon()
/obj/item/device/assembly/infra/rotate(var/mob/user, var/anchored_ignore = FALSE)
if(..())
var/direction_text = dir2text(dir)
to_chat(user, SPAN_NOTICE("You rotate \the [src] to face [direction_text]."))
QDEL_NULL(first)
/obj/item/device/assembly/infra/examine(mob/user)
. = ..()
var/direction_text = dir2text(dir)
to_chat(user, SPAN_NOTICE("It is facing [direction_text]."))
/obj/item/device/assembly/infra/process()
if(!on || !secured)
QDEL_NULL(first)
return ..()
if(first && !isturf(first.loc))
QDEL_NULL(first)
//We have no infrared beam, so create one.
if(!first)
//We cannot create beams while being held or in a bag. So we have to compare locs to turfs.
//We need to check if whatever we're attached to, if anything, is on a turf. Since we can be attached to an assembly and that assembly can be attached, we have to check a couple locs.
//First check if we're part of an assembly(holder) and if that assembly is attached (holder.master). If we are, THOSE are the locs we care about.
var/true_location = holder ? holder.master ? holder.master.loc : holder.loc : loc
if(!isturf(true_location)) //Wherever we are, we're not on a turf, nor is our assembly, nor is our bomb/whatever the assembly is attached to. We cannot make a beam.
return
beam_origin = true_location
var/obj/effect/beam/i_beam/I = new /obj/effect/beam/i_beam(true_location, src)
I.density = TRUE
step(I, I.dir)
if(I)
I.density = FALSE
spawn(0)
if(I)
I.limit = 8
I.process()
return
if(first)
if(beam_origin != get_turf(src)) //If the assembly we're attached to has moved, delete the beam.
QDEL_NULL(first)
beam_origin = null
return
first.process()
/obj/item/device/assembly/infra/attack_hand()
QDEL_NULL(first)
return ..()
/obj/item/device/assembly/infra/Move()
var/t = dir
..()
set_dir(t)
QDEL_NULL(first)
return
/obj/item/device/assembly/infra/holder_movement()
if(!holder)
return FALSE
QDEL_NULL(first)
return TRUE
/obj/item/device/assembly/infra/proc/trigger_beam()
if(!secured || !on || cooldown)
return FALSE
pulse(FALSE)
if(!holder)
audible_message("[icon2html(src, viewers(get_turf(src)))] *beep* *beep*")
cooldown = 2
addtimer(CALLBACK(src, PROC_REF(process_cooldown)), 10)
/obj/item/device/assembly/infra/interact(mob/user)
. = ..()
if(!secured)
to_chat(user, SPAN_WARNING("\The [src] is unsecured!"))
return
ui_interact(user)
/obj/item/device/assembly/infra/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "Infrared", "Infrared Emitter", 320, 220)
ui.open()
/obj/item/device/assembly/infra/ui_data(mob/user)
var/list/data = list()
data["active"] = on
data["visible"] = visible
return data
/obj/item/device/assembly/infra/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
if(.)
return
switch(action)
if("state")
toggle_on()
. = TRUE
if("visible")
visible = !visible
. = TRUE
/***************************IBeam*********************************/
/obj/effect/beam/i_beam
name = "i beam"
icon = 'icons/obj/projectiles.dmi'
icon_state = "ibeam"
var/obj/effect/beam/i_beam/next = null
var/obj/item/device/assembly/infra/master = null
var/limit = null
/obj/effect/beam/i_beam/New(loc, var/set_master)
..()
master = set_master
if(!master.first)
master.first = src
set_dir(master.dir)
check_visiblity()
/obj/effect/beam/i_beam/proc/hit()
if(master)
master.trigger_beam()
qdel(src)
/obj/effect/beam/i_beam/proc/check_visiblity()
if(master.visible)
set_invisibility(0)
else
set_invisibility(101)
/obj/effect/beam/i_beam/process()
if(loc?.density || !master)
qdel(src)
return
check_visiblity()
if(!limit)
return
if(!QDELETED(next))
next.process()
return
var/obj/effect/beam/i_beam/I = new /obj/effect/beam/i_beam(loc, master)
I.density = TRUE
step(I, I.dir)
if(I)
I.density = FALSE
next = I
spawn(0)
if(I && limit > 0)
I.limit = limit - 1
I.process()
/obj/effect/beam/i_beam/Collide()
. = ..()
qdel(src)
/obj/effect/beam/i_beam/CollidedWith()
..()
hit()
/obj/effect/beam/i_beam/Crossed(atom/movable/AM as mob|obj)
if(istype(AM, /obj/effect/beam))
return
if(AM.invisibility == INVISIBILITY_OBSERVER || AM.invisibility == 101)
return
spawn(0)
hit()
/obj/effect/beam/i_beam/Destroy()
if(master.first == src)
master.first = null
if(next)
QDEL_NULL(next)
return ..()
/obj/effect/beam/i_beam/set_dir(ndir)
. = ..()
if(ndir & EAST || ndir & WEST)
var/matrix/M = matrix()
M.Turn(90)
transform = M