Files
Paradise/code/modules/assembly/signaler.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

153 lines
3.8 KiB
Plaintext

/obj/item/assembly/signaler
name = "remote signaling device"
desc = "Used to remotely activate devices."
icon_state = "signaller"
item_state = "signaler"
materials = list(MAT_METAL=400, MAT_GLASS=120)
origin_tech = "magnets=1;bluespace=1"
wires = WIRE_RECEIVE | WIRE_PULSE | WIRE_RADIO_PULSE | WIRE_RADIO_RECEIVE
secured = TRUE
var/receiving = FALSE
bomb_name = "remote-control bomb"
var/code = 30
var/frequency = RSD_FREQ
var/delay = 0
var/datum/radio_frequency/radio_connection
var/airlock_wire = null
/obj/item/assembly/signaler/New()
..()
if(SSradio)
set_frequency(frequency)
/obj/item/assembly/signaler/Initialize()
..()
if(SSradio)
set_frequency(frequency)
/obj/item/assembly/signaler/Destroy()
if(SSradio)
SSradio.remove_object(src, frequency)
radio_connection = null
return ..()
/obj/item/assembly/signaler/describe()
return "[src]'s power light is [receiving ? "on" : "off"]"
/obj/item/assembly/signaler/activate()
if(cooldown > 0)
return FALSE
cooldown = 2
addtimer(CALLBACK(src, .proc/process_cooldown), 10)
signal()
return TRUE
/obj/item/assembly/signaler/update_icon_state()
if(holder)
holder.update_icon()
/obj/item/assembly/signaler/interact(mob/user, flag1)
var/t1 = "-------"
var/dat = {"
<TT>
"}
if(!flag1)
dat += {"
<A href='byond://?src=[UID()];send=1'>Send Signal</A><BR>
Receiver is <A href='byond://?src=[UID()];receive=1'>[receiving?"on":"off"]</A><BR>
"}
dat += {"
<B>Frequency/Code</B> for signaler:<BR>
Frequency:
<A href='byond://?src=[UID()];freq=-10'>-</A>
<A href='byond://?src=[UID()];freq=-2'>-</A>
[format_frequency(frequency)]
<A href='byond://?src=[UID()];freq=2'>+</A>
<A href='byond://?src=[UID()];freq=10'>+</A><BR>
Code:
<A href='byond://?src=[UID()];code=-5'>-</A>
<A href='byond://?src=[UID()];code=-1'>-</A>
[code]
<A href='byond://?src=[UID()];code=1'>+</A>
<A href='byond://?src=[UID()];code=5'>+</A><BR>
[t1]
</TT>
"}
var/datum/browser/popup = new(user, "radio", name, 400, 400)
popup.set_content(dat)
popup.open(0)
onclose(user, "radio")
/obj/item/assembly/signaler/Topic(href, href_list)
..()
if(HAS_TRAIT(usr, TRAIT_HANDS_BLOCKED)|| usr.stat || usr.restrained() || !in_range(loc, usr))
usr << browse(null, "window=radio")
onclose(usr, "radio")
return
if(href_list["freq"])
var/new_frequency = (frequency + text2num(href_list["freq"]))
if(new_frequency < RADIO_LOW_FREQ || new_frequency > RADIO_HIGH_FREQ)
new_frequency = sanitize_frequency(new_frequency, RADIO_LOW_FREQ, RADIO_HIGH_FREQ)
set_frequency(new_frequency)
if(href_list["code"])
code += text2num(href_list["code"])
code = round(code)
code = min(100, code)
code = max(1, code)
if(href_list["receive"])
receiving = !receiving
if(href_list["send"])
spawn( 0 )
signal()
if(usr)
attack_self(usr)
/obj/item/assembly/signaler/proc/signal()
if(!radio_connection)
return
var/datum/signal/signal = new
signal.source = src
signal.encryption = code
signal.data["message"] = "ACTIVATE"
radio_connection.post_signal(src, signal)
var/time = time2text(world.realtime,"hh:mm:ss")
var/turf/T = get_turf(src)
if(usr)
GLOB.lastsignalers.Add("[time] <B>:</B> [usr.key] used [src] @ location ([T.x],[T.y],[T.z]) <B>:</B> [format_frequency(frequency)]/[code]")
/obj/item/assembly/signaler/receive_signal(datum/signal/signal)
if(!receiving || !signal)
return FALSE
if(signal.encryption != code)
return FALSE
if(!(wires & WIRE_RADIO_RECEIVE))
return FALSE
pulse(1)
for(var/mob/O in hearers(1, loc))
O.show_message("[bicon(src)] *beep* *beep*", 3, "*beep* *beep*", 2)
return TRUE
/obj/item/assembly/signaler/proc/set_frequency(new_frequency)
if(!SSradio)
sleep(20)
if(!SSradio)
return
SSradio.remove_object(src, frequency)
frequency = new_frequency
radio_connection = SSradio.add_object(src, frequency, RADIO_CHAT)