Files
Aurora.3/code/game/objects/items/devices/radio_jammer.dm
T
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

164 lines
4.7 KiB
Plaintext

//Global list for housing active radiojammers:
var/list/active_radio_jammers = list()
// tests if an object is near a radio jammer
// if need_all_blocked is false, the jammer only needs to be on JAMMER_SYNTHETIC to work
/proc/within_jamming_range(var/atom/test, var/need_all_blocked = TRUE)
if(length(active_radio_jammers))
var/turf/our_turf = get_turf(test)
for(var/obj/item/device/radiojammer/J in active_radio_jammers)
var/turf/jammer_turf = get_turf(J)
if(our_turf.z != jammer_turf.z)
continue
if(get_dist(our_turf, jammer_turf) <= J.radius)
if(need_all_blocked && J.active != JAMMER_ALL)
continue
return TRUE
return FALSE
/obj/item/device/radiojammer
name = "radio jammer"
desc = "A small, inconspicious looking item with an 'ON/OFF' toggle."
desc_info = "Use in-hand to activate or deactivate, alt-click while adjacent or in-hand to toggle whether it blocks all wireless signals, or just stationbound wireless interfacing."
icon = 'icons/obj/device.dmi'
icon_state = "shield0"
w_class = ITEMSIZE_SMALL
var/active = JAMMER_OFF
var/radius = 7
var/icon_state_active = "shield1"
var/icon_state_inactive = "shield0"
/obj/item/device/radiojammer/active
active = JAMMER_ALL
/obj/item/device/radiojammer/New()
..()
update_icon()
/obj/item/device/radiojammer/Destroy()
active_radio_jammers -= src
return ..()
/obj/item/device/radiojammer/attack_self(mob/user)
ui_interact(user)
/obj/item/device/radiojammer/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "Jammer", "Radio Jammer", 200, 200)
ui.open()
/obj/item/device/radiojammer/ui_data(mob/user)
var/list/data = list()
data["active"] = active
return data
/obj/item/device/radiojammer/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
if(.)
return TRUE
switch(action)
if("set_active")
active = text2num(params["set_active"])
update_icon()
. = TRUE
/obj/item/device/radiojammer/emp_act()
toggle()
/obj/item/device/radiojammer/proc/toggle(var/mob/user)
if(active)
if(user)
to_chat(user, SPAN_NOTICE("You deactivate \the [src]."))
active = JAMMER_OFF
else
if(user)
to_chat(user, SPAN_NOTICE("You activate \the [src]."))
active = JAMMER_ALL
update_icon()
/obj/item/device/radiojammer/update_icon()
if(active > 0)
active_radio_jammers += src
icon_state = icon_state_active
else
active_radio_jammers -= src
icon_state = icon_state_inactive
/obj/item/device/radiojammer/improvised
name = "improvised radio jammer"
desc = "An awkward bundle of wires, batteries, and radio transmitters."
desc_info = "Use in-hand to activate or deactivate."
var/obj/item/cell/cell
var/obj/item/device/assembly_holder/assembly_holder
// 10 seconds of operation on a standard cell. 200 (roughly 3 minutes) on a super cap.
var/power_drain_per_second = 100
var/last_updated = null
radius = 5
icon = 'icons/obj/assemblies/new_assemblies.dmi'
icon_state = "improvised_jammer_inactive"
icon_state_active = "improvised_jammer_active"
/obj/item/device/radiojammer/improvised/New(var/obj/item/device/assembly_holder/incoming_holder, var/obj/item/cell/incoming_cell, var/mob/user)
..()
cell = incoming_cell
assembly_holder = incoming_holder
// Spawn() required to properly move the assembly. Why? No clue!
// This does not make any sense, but sure.
spawn(0)
incoming_holder.forceMove(src, 1)
incoming_cell.forceMove(src, 1)
user.put_in_active_hand(src)
/obj/item/device/radiojammer/improvised/Destroy()
STOP_PROCESSING(SSprocessing, src)
return ..()
/obj/item/device/radiojammer/improvised/process()
var/current = world.time // current tick
var/delta = (current - last_updated) / 10.0 // delta in seconds
last_updated = current
if (!cell.use(delta * power_drain_per_second))
active = JAMMER_OFF
cell.charge = 0 // drain the last of the battery
update_icon()
/obj/item/device/radiojammer/improvised/attackby(obj/item/W as obj, mob/user as mob)
if (W.isscrewdriver())
to_chat(user, "<span class='notice'>You disassemble the improvised signal jammer.</span>")
user.put_in_hands(assembly_holder)
assembly_holder.detached()
user.put_in_hands(cell)
qdel(src)
return TRUE
/obj/item/device/radiojammer/improvised/toggle(mob/user)
if(!active)
if(!cell)
if(user)
to_chat(user, SPAN_WARNING("\The [src] has no cell!"))
return
if(!cell.charge)
if(user)
to_chat(user, SPAN_WARNING("\The [src]'s battery is completely empty!"))
return
return ..()
/obj/item/device/radiojammer/improvised/update_icon()
if(active > 0)
active_radio_jammers += src
icon_state = icon_state_active
START_PROCESSING(SSprocessing, src)
last_updated = world.time
else
active_radio_jammers -= src
icon_state = initial(icon_state)
STOP_PROCESSING(SSprocessing, src)