mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Protolathe and CI build procs moved to them from RD console. Protolathe and CI now have a build queue. Designs take varying time to build. P and CI material storage is now a list instead of a set of vars. origin_tech is now a list. All sheets now contain exactly 2000 units of matter. In design datum, chemicals and materials are two separate lists. Designs are now sorted. The method is kinda hacky but flexible. They have a var, sort_string. Designs are sorted alphabetically using it. Circuits how show whether they build a machine or a computer in CI menu. Adds item construction, for now protolathe is used.
173 lines
4.6 KiB
Plaintext
173 lines
4.6 KiB
Plaintext
/obj/item/device/assembly/signaler
|
|
name = "remote signaling device"
|
|
desc = "Used to remotely activate devices."
|
|
icon_state = "signaller"
|
|
item_state = "signaler"
|
|
matter = list("metal" = 1000, "glass" = 200, "waste" = 100)
|
|
origin_tech = list(TECH_MAGNET = 1)
|
|
wires = WIRE_RECEIVE | WIRE_PULSE | WIRE_RADIO_PULSE | WIRE_RADIO_RECEIVE
|
|
|
|
secured = 1
|
|
|
|
var/code = 30
|
|
var/frequency = 1457
|
|
var/delay = 0
|
|
var/airlock_wire = null
|
|
var/datum/wires/connected = null
|
|
var/datum/radio_frequency/radio_connection
|
|
var/deadman = 0
|
|
|
|
New()
|
|
..()
|
|
spawn(40)
|
|
set_frequency(frequency)
|
|
return
|
|
|
|
|
|
activate()
|
|
if(cooldown > 0) return 0
|
|
cooldown = 2
|
|
spawn(10)
|
|
process_cooldown()
|
|
|
|
signal()
|
|
return 1
|
|
|
|
update_icon()
|
|
if(holder)
|
|
holder.update_icon()
|
|
return
|
|
|
|
interact(mob/user as mob, flag1)
|
|
var/t1 = "-------"
|
|
// if ((src.b_stat && !( flag1 )))
|
|
// t1 = text("-------<BR>\nGreen Wire: []<BR>\nRed Wire: []<BR>\nBlue Wire: []<BR>\n", (src.wires & 4 ? text("<A href='?src=\ref[];wires=4'>Cut Wire</A>", src) : text("<A href='?src=\ref[];wires=4'>Mend Wire</A>", src)), (src.wires & 2 ? text("<A href='?src=\ref[];wires=2'>Cut Wire</A>", src) : text("<A href='?src=\ref[];wires=2'>Mend Wire</A>", src)), (src.wires & 1 ? text("<A href='?src=\ref[];wires=1'>Cut Wire</A>", src) : text("<A href='?src=\ref[];wires=1'>Mend Wire</A>", src)))
|
|
// else
|
|
// t1 = "-------" Speaker: [src.listening ? "<A href='byond://?src=\ref[src];listen=0'>Engaged</A>" : "<A href='byond://?src=\ref[src];listen=1'>Disengaged</A>"]<BR>
|
|
var/dat = {"
|
|
<TT>
|
|
|
|
<A href='byond://?src=\ref[src];send=1'>Send Signal</A><BR>
|
|
<B>Frequency/Code</B> for signaler:<BR>
|
|
Frequency:
|
|
<A href='byond://?src=\ref[src];freq=-10'>-</A>
|
|
<A href='byond://?src=\ref[src];freq=-2'>-</A>
|
|
[format_frequency(src.frequency)]
|
|
<A href='byond://?src=\ref[src];freq=2'>+</A>
|
|
<A href='byond://?src=\ref[src];freq=10'>+</A><BR>
|
|
|
|
Code:
|
|
<A href='byond://?src=\ref[src];code=-5'>-</A>
|
|
<A href='byond://?src=\ref[src];code=-1'>-</A>
|
|
[src.code]
|
|
<A href='byond://?src=\ref[src];code=1'>+</A>
|
|
<A href='byond://?src=\ref[src];code=5'>+</A><BR>
|
|
[t1]
|
|
</TT>"}
|
|
user << browse(dat, "window=radio")
|
|
onclose(user, "radio")
|
|
return
|
|
|
|
|
|
Topic(href, href_list)
|
|
if(..()) return 1
|
|
|
|
if(!usr.canmove || 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 < 1200 || new_frequency > 1600)
|
|
new_frequency = sanitize_frequency(new_frequency)
|
|
set_frequency(new_frequency)
|
|
|
|
if(href_list["code"])
|
|
src.code += text2num(href_list["code"])
|
|
src.code = round(src.code)
|
|
src.code = min(100, src.code)
|
|
src.code = max(1, src.code)
|
|
|
|
if(href_list["send"])
|
|
spawn( 0 )
|
|
signal()
|
|
|
|
if(usr)
|
|
attack_self(usr)
|
|
|
|
return
|
|
|
|
|
|
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)
|
|
return
|
|
/*
|
|
for(var/obj/item/device/assembly/signaler/S in world)
|
|
if(!S) continue
|
|
if(S == src) continue
|
|
if((S.frequency == src.frequency) && (S.code == src.code))
|
|
spawn(0)
|
|
if(S) S.pulse(0)
|
|
return 0*/
|
|
|
|
|
|
pulse(var/radio = 0)
|
|
if(src.connected && src.wires)
|
|
connected.Pulse(src)
|
|
else if(holder)
|
|
holder.process_activation(src, 1, 0)
|
|
else
|
|
..(radio)
|
|
return 1
|
|
|
|
|
|
receive_signal(datum/signal/signal)
|
|
if(!signal) return 0
|
|
if(signal.encryption != code) return 0
|
|
if(!(src.wires & WIRE_RADIO_RECEIVE)) return 0
|
|
pulse(1)
|
|
|
|
if(!holder)
|
|
for(var/mob/O in hearers(1, src.loc))
|
|
O.show_message(text("\icon[] *beep* *beep*", src), 3, "*beep* *beep*", 2)
|
|
return
|
|
|
|
|
|
proc/set_frequency(new_frequency)
|
|
if(!radio_controller)
|
|
sleep(20)
|
|
if(!radio_controller)
|
|
return
|
|
radio_controller.remove_object(src, frequency)
|
|
frequency = new_frequency
|
|
radio_connection = radio_controller.add_object(src, frequency, RADIO_CHAT)
|
|
return
|
|
|
|
process()
|
|
if(!deadman)
|
|
processing_objects.Remove(src)
|
|
var/mob/M = src.loc
|
|
if(!M || !ismob(M))
|
|
if(prob(5))
|
|
signal()
|
|
deadman = 0
|
|
processing_objects.Remove(src)
|
|
else if(prob(5))
|
|
M.visible_message("[M]'s finger twitches a bit over [src]'s signal button!")
|
|
return
|
|
|
|
verb/deadman_it()
|
|
set src in usr
|
|
set name = "Threaten to push the button!"
|
|
set desc = "BOOOOM!"
|
|
deadman = 1
|
|
processing_objects.Add(src)
|
|
usr.visible_message("\red [usr] moves their finger over [src]'s signal button...")
|