mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2026-08-28 05:36:34 +01:00
Science TGUI & More (#3901)
* Day 1 * Circuits, Bots, UAV * Fixes * Cleaning * Finished Science * e * asdasd * aesfesf * Fix Medibots (including the bee one) * Bleh * Fixes RPD with some code improvements * RCON Patch * RCON PATCHES * Rename popper.tsx to Popper.tsx * Rename popper.stories.js to Popper.stories.js * Yarn and Popper Updates * I am going to shit bricks * So Tired * asdas * Finally fixed tanks * Radio is fixed * Fixes Pipes * RCD SCROLLING! * Fixes Chat (because everyone uses hybrid???) * Fixes bugged themes * habhabahab - Fixes Air Alarm modes * Fixes Medibot UI and UI Action Buttons * Fixing say_emphasis missing on NIF messages * a
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
#define WIRE_RECEIVE (1<<0)
|
||||
#define WIRE_PULSE (1<<1)
|
||||
#define WIRE_PULSE_SPECIAL (1<<2)
|
||||
#define WIRE_RADIO_RECEIVE (1<<3)
|
||||
#define WIRE_RADIO_PULSE (1<<4)
|
||||
#define ASSEMBLY_BEEP_VOLUME 5
|
||||
|
||||
/obj/item/assembly
|
||||
name = "assembly"
|
||||
desc = "A small electronic device that should never exist."
|
||||
@@ -15,87 +22,52 @@
|
||||
var/secured = 1
|
||||
var/list/attached_overlays = null
|
||||
var/obj/item/assembly_holder/holder = null
|
||||
var/cooldown = 0//To prevent spam
|
||||
var/cooldown = FALSE //To prevent spam
|
||||
var/wires = WIRE_RECEIVE | WIRE_PULSE
|
||||
|
||||
var/const/WIRE_RECEIVE = 1 //Allows Pulsed(0) to call Activate()
|
||||
var/const/WIRE_PULSE = 2 //Allows Pulse(0) to act on the holder
|
||||
var/const/WIRE_PULSE_SPECIAL = 4 //Allows Pulse(0) to act on the holders special assembly
|
||||
var/const/WIRE_RADIO_RECEIVE = 8 //Allows Pulsed(1) to call Activate()
|
||||
var/const/WIRE_RADIO_PULSE = 16 //Allows Pulse(1) to send a radio message
|
||||
/obj/item/assembly/Destroy()
|
||||
holder = null
|
||||
return ..()
|
||||
|
||||
/obj/item/assembly/proc/activate() //What the device does when turned on
|
||||
/obj/item/assembly/proc/holder_movement()
|
||||
return
|
||||
|
||||
/obj/item/assembly/proc/pulsed(var/radio = 0) //Called when another assembly acts on this one, var/radio will determine where it came from for wire calcs
|
||||
return
|
||||
/obj/item/assembly/proc/process_cooldown()
|
||||
if(cooldown)
|
||||
return FALSE
|
||||
cooldown = TRUE
|
||||
VARSET_IN(src, cooldown, FALSE, 2 SECONDS)
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/proc/pulse(var/radio = 0) //Called when this device attempts to act on another device, var/radio determines if it was sent via radio or direct
|
||||
return
|
||||
|
||||
/obj/item/assembly/proc/toggle_secure() //Code that has to happen when the assembly is un\secured goes here
|
||||
return
|
||||
|
||||
/obj/item/assembly/proc/attach_assembly(var/obj/A, var/mob/user) //Called when an assembly is attacked by another
|
||||
return
|
||||
|
||||
/obj/item/assembly/proc/process_cooldown() //Called via spawn(10) to have it count down the cooldown var
|
||||
return
|
||||
|
||||
/obj/item/assembly/proc/holder_movement() //Called when the holder is moved
|
||||
return
|
||||
|
||||
/obj/item/assembly/interact(mob/user as mob) //Called when attack_self is called
|
||||
return
|
||||
|
||||
|
||||
/obj/item/assembly/process_cooldown()
|
||||
cooldown--
|
||||
if(cooldown <= 0) return 0
|
||||
spawn(10)
|
||||
process_cooldown()
|
||||
return 1
|
||||
|
||||
|
||||
/obj/item/assembly/pulsed(var/radio = 0)
|
||||
/obj/item/assembly/proc/pulsed(var/radio = 0)
|
||||
if(holder && (wires & WIRE_RECEIVE))
|
||||
activate()
|
||||
if(radio && (wires & WIRE_RADIO_RECEIVE))
|
||||
activate()
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/assembly/pulse(var/radio = 0)
|
||||
/obj/item/assembly/proc/pulse(var/radio = 0)
|
||||
if(holder && (wires & WIRE_PULSE))
|
||||
holder.process_activation(src, 1, 0)
|
||||
if(holder && (wires & WIRE_PULSE_SPECIAL))
|
||||
holder.process_activation(src, 0, 1)
|
||||
// if(radio && (wires & WIRE_RADIO_PULSE))
|
||||
//Not sure what goes here quite yet send signal?
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/proc/activate()
|
||||
if(!secured || !process_cooldown())
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/activate()
|
||||
if(!secured || (cooldown > 0)) return 0
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
process_cooldown()
|
||||
return 1
|
||||
|
||||
|
||||
/obj/item/assembly/toggle_secure()
|
||||
/obj/item/assembly/proc/toggle_secure()
|
||||
secured = !secured
|
||||
update_icon()
|
||||
return secured
|
||||
|
||||
|
||||
/obj/item/assembly/attach_assembly(var/obj/item/assembly/A, var/mob/user)
|
||||
/obj/item/assembly/proc/attach_assembly(var/obj/item/assembly/A, var/mob/user)
|
||||
holder = new/obj/item/assembly_holder(get_turf(src))
|
||||
if(holder.attach(A,src,user))
|
||||
to_chat(user, "<span class='notice'>You attach \the [A] to \the [src]!</span>")
|
||||
return 1
|
||||
return 0
|
||||
|
||||
to_chat(user, SPAN_NOTICE("You attach \the [A] to \the [src]!"))
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(isassembly(W))
|
||||
@@ -105,18 +77,14 @@
|
||||
return
|
||||
if(W.is_screwdriver())
|
||||
if(toggle_secure())
|
||||
to_chat(user, "<span class='notice'>\The [src] is ready!</span>")
|
||||
to_chat(user, SPAN_NOTICE("\The [src] is ready!"))
|
||||
else
|
||||
to_chat(user, "<span class='notice'>\The [src] can now be attached!</span>")
|
||||
to_chat(user, SPAN_NOTICE("\The [src] can now be attached!"))
|
||||
return
|
||||
..()
|
||||
return
|
||||
|
||||
return ..()
|
||||
|
||||
/obj/item/assembly/process(delta_time)
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
return
|
||||
|
||||
return PROCESS_KILL
|
||||
|
||||
/obj/item/assembly/examine(mob/user)
|
||||
. = ..()
|
||||
@@ -129,54 +97,19 @@
|
||||
|
||||
|
||||
/obj/item/assembly/attack_self(mob/user as mob)
|
||||
if(!user) return 0
|
||||
if(!user)
|
||||
return FALSE
|
||||
user.set_machine(src)
|
||||
interact(user)
|
||||
return 1
|
||||
ui_interact(user)
|
||||
return TRUE
|
||||
|
||||
/obj/item/device/assembly/ui_state(mob/user)
|
||||
return GLOB.deep_inventory_state
|
||||
|
||||
/obj/item/assembly/interact(mob/user as mob)
|
||||
return //HTML MENU FOR WIRES GOES HERE
|
||||
/obj/item/device/assembly/ui_interact(mob/user, datum/tgui/ui)
|
||||
return // tgui goes here
|
||||
|
||||
/obj/item/assembly/nano_host()
|
||||
if(istype(loc, /obj/item/assembly_holder))
|
||||
return loc.nano_host()
|
||||
return ..()
|
||||
|
||||
/*
|
||||
var/small_icon_state = null//If this obj will go inside the assembly use this for icons
|
||||
var/list/small_icon_state_overlays = null//Same here
|
||||
var/obj/holder = null
|
||||
var/cooldown = 0//To prevent spam
|
||||
|
||||
proc
|
||||
Activate()//Called when this assembly is pulsed by another one
|
||||
Process_cooldown()//Call this via spawn(10) to have it count down the cooldown var
|
||||
Attach_Holder(var/obj/H, var/mob/user)//Called when an assembly holder attempts to attach, sets src's loc in here
|
||||
|
||||
|
||||
Activate()
|
||||
if(cooldown > 0)
|
||||
return 0
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
Process_cooldown()
|
||||
//Rest of code here
|
||||
return 0
|
||||
|
||||
|
||||
Process_cooldown()
|
||||
cooldown--
|
||||
if(cooldown <= 0) return 0
|
||||
spawn(10)
|
||||
Process_cooldown()
|
||||
return 1
|
||||
|
||||
|
||||
Attach_Holder(var/obj/H, var/mob/user)
|
||||
if(!H) return 0
|
||||
if(!H.IsAssemblyHolder()) return 0
|
||||
//Remember to have it set its loc somewhere in here
|
||||
|
||||
|
||||
*/
|
||||
/obj/item/device/assembly/ui_host()
|
||||
if(istype(loc, /obj/item/assembly_holder))
|
||||
return loc.ui_host()
|
||||
return ..()
|
||||
|
||||
@@ -27,18 +27,3 @@
|
||||
if(istype(O, /obj/item/assembly/timer))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/*
|
||||
Name: IsSpecialAssembly
|
||||
Desc: If true is an object that can be attached to an assembly holder but is a special thing like a phoron can or door
|
||||
*/
|
||||
|
||||
/obj/proc/IsSpecialAssembly()
|
||||
return 0
|
||||
|
||||
/*
|
||||
Name: IsAssemblyHolder
|
||||
Desc: If true is an object that can hold an assemblyholder object
|
||||
*/
|
||||
/obj/proc/IsAssemblyHolder()
|
||||
return 0
|
||||
|
||||
+50
-107
@@ -14,76 +14,49 @@
|
||||
var/obj/item/assembly/a_right = null
|
||||
var/obj/special_assembly = null
|
||||
|
||||
/obj/item/assembly_holder/proc/attach(var/obj/item/D, var/obj/item/D2, var/mob/user)
|
||||
return
|
||||
/obj/item/assembly_holder/proc/attach(var/obj/item/assembly/D, var/obj/item/assembly/D2, var/mob/user)
|
||||
if(!D || !D2)
|
||||
return FALSE
|
||||
|
||||
/obj/item/assembly_holder/proc/attach_special(var/obj/O, var/mob/user)
|
||||
return
|
||||
if(!istype(D) || !istype(D2))
|
||||
return FALSE
|
||||
|
||||
/obj/item/assembly_holder/proc/process_activation(var/obj/item/D)
|
||||
return
|
||||
|
||||
/obj/item/assembly_holder/proc/detached()
|
||||
return
|
||||
if(D.secured || D2.secured)
|
||||
return FALSE
|
||||
|
||||
|
||||
/obj/item/assembly_holder/IsAssemblyHolder()
|
||||
return 1
|
||||
|
||||
|
||||
/obj/item/assembly_holder/attach(var/obj/item/D, var/obj/item/D2, var/mob/user)
|
||||
if((!D)||(!D2)) return 0
|
||||
if((!isassembly(D))||(!isassembly(D2))) return 0
|
||||
if((D:secured)||(D2:secured)) return 0
|
||||
if(user)
|
||||
user.remove_from_mob(D)
|
||||
user.remove_from_mob(D2)
|
||||
D:holder = src
|
||||
D2:holder = src
|
||||
D.loc = src
|
||||
D2.loc = src
|
||||
|
||||
D.holder = src
|
||||
D2.holder = src
|
||||
D.forceMove(src)
|
||||
D2.forceMove(src)
|
||||
a_left = D
|
||||
a_right = D2
|
||||
name = "[D.name]-[D2.name] assembly"
|
||||
update_icon()
|
||||
usr.put_in_hands(src)
|
||||
user.put_in_hands(src)
|
||||
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/assembly_holder/attach_special(var/obj/O, var/mob/user)
|
||||
if(!O) return
|
||||
if(!O.IsSpecialAssembly()) return 0
|
||||
|
||||
/* if(O:Attach_Holder())
|
||||
special_assembly = O
|
||||
update_icon()
|
||||
src.name = "[a_left.name] [a_right.name] [special_assembly.name] assembly"
|
||||
*/
|
||||
/obj/item/assembly_holder/proc/detached()
|
||||
return
|
||||
|
||||
|
||||
/obj/item/assembly_holder/update_icon()
|
||||
overlays.Cut()
|
||||
cut_overlays()
|
||||
if(a_left)
|
||||
overlays += "[a_left.icon_state]_left"
|
||||
add_overlay("[a_left.icon_state]_left")
|
||||
for(var/O in a_left.attached_overlays)
|
||||
overlays += "[O]_l"
|
||||
add_overlay("[O]_l")
|
||||
if(a_right)
|
||||
src.overlays += "[a_right.icon_state]_right"
|
||||
add_overlay("[a_right.icon_state]_right")
|
||||
for(var/O in a_right.attached_overlays)
|
||||
overlays += "[O]_r"
|
||||
add_overlay("[O]_r")
|
||||
if(master)
|
||||
master.update_icon()
|
||||
|
||||
/* if(special_assembly)
|
||||
special_assembly.update_icon()
|
||||
if(special_assembly:small_icon_state)
|
||||
src.overlays += special_assembly:small_icon_state
|
||||
for(var/O in special_assembly:small_icon_state_overlays)
|
||||
src.overlays += O
|
||||
*/
|
||||
|
||||
/obj/item/assembly_holder/examine(mob/user)
|
||||
. = ..()
|
||||
if ((in_range(src, user) || src.loc == user))
|
||||
@@ -91,17 +64,12 @@
|
||||
. += "\The [src] is ready!"
|
||||
else
|
||||
. += "\The [src] can be attached!"
|
||||
return
|
||||
|
||||
|
||||
/obj/item/assembly_holder/HasProximity(atom/movable/AM as mob|obj)
|
||||
if(a_left)
|
||||
a_left.HasProximity(AM)
|
||||
if(a_right)
|
||||
a_right.HasProximity(AM)
|
||||
if(special_assembly)
|
||||
special_assembly.HasProximity(AM)
|
||||
|
||||
|
||||
/obj/item/assembly_holder/Crossed(atom/movable/AM)
|
||||
. = ..()
|
||||
@@ -111,41 +79,27 @@
|
||||
a_left.Crossed(AM)
|
||||
if(a_right)
|
||||
a_right.Crossed(AM)
|
||||
if(special_assembly)
|
||||
special_assembly.Crossed(AM)
|
||||
|
||||
/obj/item/assembly_holder/on_found(mob/finder as mob)
|
||||
if(a_left)
|
||||
a_left.on_found(finder)
|
||||
if(a_right)
|
||||
a_right.on_found(finder)
|
||||
if(special_assembly)
|
||||
if(istype(special_assembly, /obj/item))
|
||||
var/obj/item/S = special_assembly
|
||||
S.on_found(finder)
|
||||
|
||||
|
||||
/obj/item/assembly_holder/Move()
|
||||
..()
|
||||
if(a_left && a_right)
|
||||
a_left.holder_movement()
|
||||
a_right.holder_movement()
|
||||
// if(special_assembly)
|
||||
// special_assembly:holder_movement()
|
||||
return
|
||||
|
||||
|
||||
/obj/item/assembly_holder/attack_hand()//Perhapse this should be a holder_pickup proc instead, can add if needbe I guess
|
||||
if(a_left && a_right)
|
||||
a_left.holder_movement()
|
||||
a_right.holder_movement()
|
||||
// if(special_assembly)
|
||||
// special_assembly:Holder_Movement()
|
||||
..()
|
||||
return
|
||||
|
||||
|
||||
/obj/item/assembly_holder/attackby(obj/item/W as obj, mob/user as mob)
|
||||
/obj/item/assembly_holder/attackby(var/obj/item/W, var/mob/user)
|
||||
if(W.is_screwdriver())
|
||||
if(!a_left || !a_right)
|
||||
to_chat(user, "<span class='warning'> BUG:Assembly part missing, please report this!</span>")
|
||||
@@ -159,14 +113,10 @@
|
||||
to_chat(user, "<span class='notice'>\The [src] can now be taken apart!</span>")
|
||||
update_icon()
|
||||
return
|
||||
else if(W.IsSpecialAssembly())
|
||||
attach_special(W, user)
|
||||
else
|
||||
..()
|
||||
return
|
||||
|
||||
|
||||
/obj/item/assembly_holder/attack_self(mob/user as mob)
|
||||
/obj/item/assembly_holder/attack_self(var/mob/user)
|
||||
src.add_fingerprint(user)
|
||||
if(src.secured)
|
||||
if(!a_left || !a_right)
|
||||
@@ -184,20 +134,20 @@
|
||||
a_right.attack_self(user)
|
||||
else
|
||||
var/turf/T = get_turf(src)
|
||||
if(!T) return 0
|
||||
if(!T)
|
||||
return FALSE
|
||||
if(a_left)
|
||||
a_left:holder = null
|
||||
a_left.loc = T
|
||||
a_left.holder = null
|
||||
a_left.forceMove(T)
|
||||
if(a_right)
|
||||
a_right:holder = null
|
||||
a_right.loc = T
|
||||
spawn(0)
|
||||
qdel(src)
|
||||
return
|
||||
a_right.holder = null
|
||||
a_right.forceMove(T)
|
||||
qdel(src)
|
||||
|
||||
|
||||
/obj/item/assembly_holder/process_activation(var/obj/D, var/normal = 1, var/special = 1)
|
||||
if(!D) return 0
|
||||
/obj/item/assembly_holder/proc/process_activation(var/obj/D, var/normal = 1)
|
||||
if(!D)
|
||||
return FALSE
|
||||
if(!secured)
|
||||
visible_message("[icon2html(thing = src, target = world)] *beep* *beep*", "*beep* *beep*")
|
||||
if((normal) && (a_right) && (a_left))
|
||||
@@ -207,42 +157,35 @@
|
||||
a_left.pulsed(0)
|
||||
if(master)
|
||||
master.receive_signal()
|
||||
// if(special && special_assembly)
|
||||
// if(!special_assembly == D)
|
||||
// special_assembly.dothings()
|
||||
return 1
|
||||
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly_holder/hear_talk(mob/living/M as mob, msg, verb, datum/language/speaking)
|
||||
if(a_right)
|
||||
a_right.hear_talk(M,msg,verb,speaking)
|
||||
if(a_left)
|
||||
a_left.hear_talk(M,msg,verb,speaking)
|
||||
|
||||
|
||||
|
||||
|
||||
/obj/item/assembly_holder/timer_igniter
|
||||
name = "timer-igniter assembly"
|
||||
|
||||
New()
|
||||
..()
|
||||
/obj/item/assembly_holder/timer_igniter/New()
|
||||
..()
|
||||
|
||||
var/obj/item/assembly/igniter/ign = new(src)
|
||||
ign.secured = 1
|
||||
ign.holder = src
|
||||
var/obj/item/assembly/timer/tmr = new(src)
|
||||
tmr.time=5
|
||||
tmr.secured = 1
|
||||
tmr.holder = src
|
||||
START_PROCESSING(SSobj, tmr)
|
||||
a_left = tmr
|
||||
a_right = ign
|
||||
secured = 1
|
||||
update_icon()
|
||||
name = initial(name) + " ([tmr.time] secs)"
|
||||
var/obj/item/assembly/igniter/ign = new(src)
|
||||
ign.secured = 1
|
||||
ign.holder = src
|
||||
|
||||
loc.verbs += /obj/item/assembly_holder/timer_igniter/verb/configure
|
||||
var/obj/item/assembly/timer/tmr = new(src)
|
||||
tmr.time = 5
|
||||
tmr.secured = 1
|
||||
tmr.holder = src
|
||||
|
||||
a_left = tmr
|
||||
a_right = ign
|
||||
secured = 1
|
||||
update_icon()
|
||||
name = initial(name) + " ([tmr.time] secs)"
|
||||
|
||||
loc.verbs += /obj/item/assembly_holder/timer_igniter/verb/configure
|
||||
|
||||
/obj/item/assembly_holder/timer_igniter/detached()
|
||||
loc.verbs -= /obj/item/assembly_holder/timer_igniter/verb/configure
|
||||
|
||||
@@ -5,11 +5,12 @@
|
||||
origin_tech = list(TECH_MAGNET = 1)
|
||||
matter = list(DEFAULT_WALL_MATERIAL = 500, "glass" = 50)
|
||||
|
||||
secured = 1
|
||||
secured = TRUE
|
||||
wires = WIRE_RECEIVE
|
||||
|
||||
/obj/item/assembly/igniter/activate()
|
||||
if(!..()) return 0//Cooldown check
|
||||
if(!..())
|
||||
return FALSE
|
||||
|
||||
if(holder && istype(holder.loc,/obj/item/grenade/chem_grenade))
|
||||
var/obj/item/grenade/chem_grenade/grenade = holder.loc
|
||||
@@ -28,13 +29,12 @@
|
||||
s.set_up(3, 1, src)
|
||||
s.start()
|
||||
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/assembly/igniter/attack_self(mob/user as mob)
|
||||
/obj/item/assembly/igniter/attack_self(var/mob/user)
|
||||
activate()
|
||||
add_fingerprint(user)
|
||||
return
|
||||
|
||||
/obj/item/assembly/igniter/is_hot()
|
||||
return TRUE
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:32
|
||||
|
||||
/obj/item/assembly/infra
|
||||
name = "infrared emitter"
|
||||
desc = "Emits a visible or invisible beam and is triggered when the beam is interrupted."
|
||||
@@ -23,11 +21,7 @@
|
||||
var/dirty = FALSE
|
||||
/// current atom listening to
|
||||
var/atom/movable/listening
|
||||
|
||||
/obj/item/assembly/infra/Destroy()
|
||||
if(on)
|
||||
turn_off()
|
||||
return ..()
|
||||
var/hearing_range = 3
|
||||
|
||||
/obj/item/assembly/infra/activate()
|
||||
. = ..()
|
||||
@@ -159,45 +153,44 @@
|
||||
return FALSE
|
||||
pulse(0)
|
||||
if(!holder)
|
||||
visible_message("[icon2html(thing = src, target = world)] *beep* *beep*")
|
||||
audible_message(SPAN_INFOPLAIN("[icon2html(src, hearers(src))] *beep* *beep* *beep*"), null, hearing_range)
|
||||
for(var/mob/hearing_mob in get_hearers_in_view(hearing_range, src))
|
||||
hearing_mob.playsound_local(get_turf(src), 'sound/machines/triple_beep.ogg', ASSEMBLY_BEEP_VOLUME, TRUE)
|
||||
cooldown = 2
|
||||
addtimer(CALLBACK(src, /obj/item/assembly/proc/process_cooldown), 10)
|
||||
|
||||
/obj/item/assembly/infra/interact(mob/user as mob)//TODO: change this this to the wire control panel
|
||||
/obj/item/assembly/infra/ui_interact(mob/user, datum/tgui/ui)
|
||||
if(!secured)
|
||||
return
|
||||
user.set_machine(src)
|
||||
var/dat = text("<TT><B>Infrared Laser</B>\n<B>Status</B>: []<BR>\n<B>Visibility</B>: []<BR>\n</TT>", (on ? text("<A href='?src=\ref[];state=0'>On</A>", src) : text("<A href='?src=\ref[];state=1'>Off</A>", src)), (src.visible ? text("<A href='?src=\ref[];visible=0'>Visible</A>", src) : text("<A href='?src=\ref[];visible=1'>Invisible</A>", src)))
|
||||
dat += "<BR><BR><A href='?src=\ref[src];refresh=1'>Refresh</A>"
|
||||
dat += "<BR><BR><A href='?src=\ref[src];close=1'>Close</A>"
|
||||
user << browse(dat, "window=infra")
|
||||
onclose(user, "infra")
|
||||
to_chat(user, SPAN_WARNING("[src] is unsecured!"))
|
||||
return FALSE
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "AssemblyInfrared", name)
|
||||
ui.open()
|
||||
|
||||
/obj/item/assembly/infra/Topic(href, href_list, state = deep_inventory_state)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
if(!usr.canmove || usr.stat || usr.restrained() || !in_range(loc, usr))
|
||||
usr << browse(null, "window=infra")
|
||||
onclose(usr, "infra")
|
||||
return
|
||||
/obj/item/assembly/infra/ui_data(mob/user)
|
||||
var/list/data = ..()
|
||||
|
||||
if(href_list["state"])
|
||||
if(on)
|
||||
turn_off()
|
||||
else
|
||||
turn_on()
|
||||
interact(usr)
|
||||
return
|
||||
data["on"] = on
|
||||
data["visible"] = visible
|
||||
|
||||
if(href_list["visible"])
|
||||
toggle_visible()
|
||||
interact(usr)
|
||||
return
|
||||
return data
|
||||
|
||||
if(href_list["close"])
|
||||
usr << browse(null, "window=infra")
|
||||
return
|
||||
/obj/item/assembly/infra/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
switch(action)
|
||||
if("state")
|
||||
activate()
|
||||
return TRUE
|
||||
if("visible")
|
||||
visible = !visible
|
||||
for(var/ibeam in head)
|
||||
var/obj/effect/beam/i_beam/I = ibeam
|
||||
I.visible = visible
|
||||
CHECK_TICK
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/infra/verb/rotate_clockwise()
|
||||
set name = "Rotate Infrared Laser Clockwise"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
var/armed = 0
|
||||
|
||||
|
||||
/obj/item/assembly/mousetrap/examine(mob/user)
|
||||
/obj/item/assembly/mousetrap/examine(var/mob/user)
|
||||
. = ..()
|
||||
if(armed)
|
||||
. += "It looks like it's armed."
|
||||
@@ -20,7 +20,7 @@
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
|
||||
/obj/item/assembly/mousetrap/proc/triggered(mob/target as mob, var/type = "feet")
|
||||
/obj/item/assembly/mousetrap/proc/triggered(var/mob/target, var/type = "feet")
|
||||
if(!armed)
|
||||
return
|
||||
var/obj/item/organ/external/affecting = null
|
||||
@@ -49,8 +49,7 @@
|
||||
update_icon()
|
||||
pulse(0)
|
||||
|
||||
|
||||
/obj/item/assembly/mousetrap/attack_self(mob/living/user as mob)
|
||||
/obj/item/assembly/mousetrap/attack_self(var/mob/living/user)
|
||||
if(!armed)
|
||||
to_chat(user, "<span class='notice'>You arm [src].</span>")
|
||||
else
|
||||
@@ -69,7 +68,7 @@
|
||||
playsound(user.loc, 'sound/weapons/handcuffs.ogg', 30, 1, -3)
|
||||
|
||||
|
||||
/obj/item/assembly/mousetrap/attack_hand(mob/living/user as mob)
|
||||
/obj/item/assembly/mousetrap/attack_hand(var/mob/living/user)
|
||||
if(armed)
|
||||
if((CLUMSY in user.mutations) && prob(50))
|
||||
var/which_hand = "l_hand"
|
||||
@@ -82,7 +81,7 @@
|
||||
..()
|
||||
|
||||
|
||||
/obj/item/assembly/mousetrap/Crossed(atom/movable/AM as mob|obj)
|
||||
/obj/item/assembly/mousetrap/Crossed(var/atom/movable/AM)
|
||||
if(AM.is_incorporeal())
|
||||
return
|
||||
if(armed)
|
||||
@@ -97,7 +96,7 @@
|
||||
..()
|
||||
|
||||
|
||||
/obj/item/assembly/mousetrap/on_found(mob/living/finder as mob)
|
||||
/obj/item/assembly/mousetrap/on_found(var/mob/living/finder)
|
||||
if(armed)
|
||||
finder.visible_message("<span class='warning'>[finder] accidentally sets off [src], breaking their fingers.</span>", \
|
||||
"<span class='warning'>You accidentally trigger [src]!</span>")
|
||||
@@ -106,18 +105,16 @@
|
||||
return 0
|
||||
|
||||
|
||||
/obj/item/assembly/mousetrap/hitby(A as mob|obj)
|
||||
/obj/item/assembly/mousetrap/hitby(var/atom/movable/A)
|
||||
if(!armed)
|
||||
return ..()
|
||||
visible_message("<span class='warning'>[src] is triggered by [A].</span>")
|
||||
triggered(null)
|
||||
|
||||
|
||||
/obj/item/assembly/mousetrap/armed
|
||||
icon_state = "mousetraparmed"
|
||||
armed = 1
|
||||
|
||||
|
||||
/obj/item/assembly/mousetrap/verb/hide_under()
|
||||
set src in oview(1)
|
||||
set name = "Hide"
|
||||
@@ -126,5 +123,5 @@
|
||||
if(usr.stat)
|
||||
return
|
||||
|
||||
layer = TURF_LAYER+0.2
|
||||
layer = HIDING_LAYER
|
||||
to_chat(usr, "<span class='notice'>You hide [src].</span>")
|
||||
|
||||
@@ -12,15 +12,15 @@
|
||||
var/scanning = 0
|
||||
var/timing = 0
|
||||
var/time = 10
|
||||
|
||||
var/hearing_range = 3
|
||||
var/range = 2
|
||||
|
||||
/obj/item/assembly/prox_sensor/activate()
|
||||
if(!..()) return 0//Cooldown check
|
||||
if(!..())
|
||||
return FALSE
|
||||
timing = !timing
|
||||
update_icon()
|
||||
return 0
|
||||
|
||||
return FALSE
|
||||
|
||||
/obj/item/assembly/prox_sensor/toggle_secure()
|
||||
secured = !secured
|
||||
@@ -33,29 +33,25 @@
|
||||
update_icon()
|
||||
return secured
|
||||
|
||||
|
||||
/obj/item/assembly/prox_sensor/HasProximity(atom/movable/AM as mob|obj)
|
||||
if(!istype(AM))
|
||||
log_debug("DEBUG: HasProximity called with [AM] on [src] ([usr]).")
|
||||
return
|
||||
if (istype(AM, /obj/effect/beam)) return
|
||||
if (!isobserver(AM) && AM.move_speed < 12) sense()
|
||||
return
|
||||
|
||||
if (istype(AM, /obj/effect/beam))
|
||||
return
|
||||
if (!isobserver(AM) && AM.move_speed < 12)
|
||||
sense()
|
||||
|
||||
/obj/item/assembly/prox_sensor/proc/sense()
|
||||
var/turf/mainloc = get_turf(src)
|
||||
// if(scanning && cooldown <= 0)
|
||||
// mainloc.visible_message("[icon2html(thing = src, target = world)] *boop* *boop*", "*boop* *boop*")
|
||||
if((!holder && !secured)||(!scanning)||(cooldown > 0)) return 0
|
||||
pulse(0)
|
||||
if(!holder)
|
||||
mainloc.visible_message("[icon2html(thing = src, target = world)] *beep* *beep*", "*beep* *beep*")
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
process_cooldown()
|
||||
return
|
||||
|
||||
if((!holder && !secured) || !scanning || !process_cooldown())
|
||||
return FALSE
|
||||
pulse(FALSE)
|
||||
audible_message(SPAN_INFOPLAIN("[icon2html(src, hearers(src))] *beep* *beep* *beep*"), null, hearing_range)
|
||||
for(var/CHM in get_hearers_in_view(hearing_range, src))
|
||||
if(ismob(CHM))
|
||||
var/mob/LM = CHM
|
||||
LM.playsound_local(get_turf(src), 'sound/machines/triple_beep.ogg', ASSEMBLY_BEEP_VOLUME, TRUE)
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/prox_sensor/process(delta_time)
|
||||
if(scanning)
|
||||
@@ -69,90 +65,80 @@
|
||||
if(timing && time <= 0)
|
||||
timing = 0
|
||||
toggle_scan()
|
||||
time = 10
|
||||
return
|
||||
|
||||
time = initial(time)
|
||||
|
||||
/obj/item/assembly/prox_sensor/dropped()
|
||||
. = ..()
|
||||
INVOKE_ASYNC(src, .proc/sense)
|
||||
|
||||
/obj/item/assembly/prox_sensor/proc/toggle_scan()
|
||||
if(!secured) return 0
|
||||
if(!secured)
|
||||
return FALSE
|
||||
scanning = !scanning
|
||||
update_icon()
|
||||
return
|
||||
|
||||
|
||||
/obj/item/assembly/prox_sensor/update_icon()
|
||||
overlays.Cut()
|
||||
attached_overlays = list()
|
||||
cut_overlays()
|
||||
LAZYCLEARLIST(attached_overlays)
|
||||
if(timing)
|
||||
overlays += "prox_timing"
|
||||
attached_overlays += "prox_timing"
|
||||
add_overlay("prox_timing")
|
||||
LAZYADD(attached_overlays, "prox_timing")
|
||||
if(scanning)
|
||||
overlays += "prox_scanning"
|
||||
attached_overlays += "prox_scanning"
|
||||
add_overlay("prox_scanning")
|
||||
LAZYADD(attached_overlays, "prox_scanning")
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
if(holder && istype(holder.loc,/obj/item/grenade/chem_grenade))
|
||||
var/obj/item/grenade/chem_grenade/grenade = holder.loc
|
||||
grenade.primed(scanning)
|
||||
return
|
||||
|
||||
|
||||
/obj/item/assembly/prox_sensor/Move()
|
||||
..()
|
||||
sense()
|
||||
return
|
||||
|
||||
|
||||
/obj/item/assembly/prox_sensor/interact(mob/user as mob)//TODO: Change this to the wires thingy
|
||||
/obj/item/assembly/prox_sensor/ui_interact(mob/user, datum/tgui/ui)
|
||||
if(!secured)
|
||||
user.show_message("<font color='red'>The [name] is unsecured!</font>")
|
||||
return 0
|
||||
var/second = time % 60
|
||||
var/minute = (time - second) / 60
|
||||
var/dat = text("<TT><B>Proximity Sensor</B>\n[] []:[]\n<A href='?src=\ref[];tp=-30'>-</A> <A href='?src=\ref[];tp=-1'>-</A> <A href='?src=\ref[];tp=1'>+</A> <A href='?src=\ref[];tp=30'>+</A>\n</TT>", (timing ? text("<A href='?src=\ref[];time=0'>Arming</A>", src) : text("<A href='?src=\ref[];time=1'>Not Arming</A>", src)), minute, second, src, src, src, src)
|
||||
dat += text("<BR>Range: <A href='?src=\ref[];range=-1'>-</A> [] <A href='?src=\ref[];range=1'>+</A>", src, range, src)
|
||||
dat += "<BR><A href='?src=\ref[src];scanning=1'>[scanning?"Armed":"Unarmed"]</A> (Movement sensor active when armed!)"
|
||||
dat += "<BR><BR><A href='?src=\ref[src];refresh=1'>Refresh</A>"
|
||||
dat += "<BR><BR><A href='?src=\ref[src];close=1'>Close</A>"
|
||||
user << browse(dat, "window=prox")
|
||||
onclose(user, "prox")
|
||||
return
|
||||
to_chat(user, SPAN_WARNING("[src] is unsecured!"))
|
||||
return FALSE
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "AssemblyProx", name)
|
||||
ui.open()
|
||||
|
||||
/obj/item/assembly/prox_sensor/ui_data(mob/user)
|
||||
var/list/data = ..()
|
||||
|
||||
/obj/item/assembly/prox_sensor/Topic(href, href_list, state = deep_inventory_state)
|
||||
if(..()) return 1
|
||||
if(!usr.canmove || usr.stat || usr.restrained() || !in_range(loc, usr))
|
||||
usr << browse(null, "window=prox")
|
||||
onclose(usr, "prox")
|
||||
return
|
||||
data["time"] = time * 10
|
||||
data["timing"] = timing
|
||||
data["range"] = range
|
||||
data["maxRange"] = 5
|
||||
data["scanning"] = scanning
|
||||
|
||||
if(href_list["scanning"])
|
||||
toggle_scan()
|
||||
return data
|
||||
|
||||
if(href_list["time"])
|
||||
timing = text2num(href_list["time"])
|
||||
update_icon()
|
||||
/obj/item/assembly/prox_sensor/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
if(href_list["tp"])
|
||||
var/tp = text2num(href_list["tp"])
|
||||
time += tp
|
||||
time = min(max(round(time), 0), 600)
|
||||
|
||||
if(href_list["range"])
|
||||
var/r = text2num(href_list["range"])
|
||||
range += r
|
||||
range = min(max(range, 1), 5)
|
||||
|
||||
if(href_list["close"])
|
||||
usr << browse(null, "window=prox")
|
||||
return
|
||||
|
||||
if(usr)
|
||||
attack_self(usr)
|
||||
|
||||
|
||||
return
|
||||
switch(action)
|
||||
if("scanning")
|
||||
toggle_scan()
|
||||
return TRUE
|
||||
if("timing")
|
||||
timing = !timing
|
||||
update_icon()
|
||||
return TRUE
|
||||
if("set_time")
|
||||
var/real_new_time = 0
|
||||
var/new_time = params["time"]
|
||||
var/list/L = splittext(new_time, ":")
|
||||
if(LAZYLEN(L))
|
||||
for(var/i in 1 to LAZYLEN(L))
|
||||
real_new_time += text2num(L[i]) * (60 ** (LAZYLEN(L) - i))
|
||||
else
|
||||
real_new_time = text2num(new_time)
|
||||
time = clamp(real_new_time, 0, 600)
|
||||
return TRUE
|
||||
if("range")
|
||||
range = clamp(params["range"], 1, 5)
|
||||
return TRUE
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
..()
|
||||
return
|
||||
|
||||
/obj/item/assembly/shock_kit/attackby(obj/item/W as obj, mob/user as mob)
|
||||
/obj/item/assembly/shock_kit/attackby(var/obj/item/W, var/mob/user)
|
||||
if(W.is_wrench() && !status)
|
||||
var/turf/T = loc
|
||||
if(ismob(T))
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
var/code = 30
|
||||
var/frequency = 1457
|
||||
var/delay = 0
|
||||
var/hearing_range = 1
|
||||
var/airlock_wire = null
|
||||
var/datum/wires/connected = null
|
||||
var/datum/radio_frequency/radio_connection
|
||||
@@ -26,79 +27,54 @@
|
||||
set_frequency(frequency)
|
||||
|
||||
/obj/item/assembly/signaler/activate()
|
||||
if(cooldown > 0) return FALSE
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
process_cooldown()
|
||||
|
||||
if(!process_cooldown())
|
||||
return FALSE
|
||||
signal()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/signaler/update_icon()
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
return
|
||||
|
||||
/obj/item/assembly/signaler/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>
|
||||
/obj/item/assembly/signaler/ui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "Signaler", name)
|
||||
ui.open()
|
||||
|
||||
<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>
|
||||
/obj/item/assembly/signaler/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["frequency"] = frequency
|
||||
data["code"] = code
|
||||
data["minFrequency"] = RADIO_LOW_FREQ
|
||||
data["maxFrequency"] = RADIO_HIGH_FREQ
|
||||
return data
|
||||
|
||||
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
|
||||
|
||||
|
||||
/obj/item/assembly/signaler/Topic(href, href_list, state = deep_inventory_state)
|
||||
/obj/item/assembly/signaler/ui_act(action, params)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
if(!usr.canmove || usr.stat || usr.restrained() || !in_range(loc, usr))
|
||||
usr << browse(null, "window=radio")
|
||||
onclose(usr, "radio")
|
||||
return
|
||||
switch(action)
|
||||
if("signal")
|
||||
INVOKE_ASYNC(src, .proc/signal)
|
||||
. = TRUE
|
||||
if("freq")
|
||||
frequency = unformat_frequency(params["freq"])
|
||||
frequency = sanitize_frequency(frequency, RADIO_LOW_FREQ, RADIO_HIGH_FREQ)
|
||||
set_frequency(frequency)
|
||||
. = TRUE
|
||||
if("code")
|
||||
code = text2num(params["code"])
|
||||
code = clamp(round(code), 1, 100)
|
||||
. = TRUE
|
||||
if("reset")
|
||||
if(params["reset"] == "freq")
|
||||
set_frequency(initial(frequency))
|
||||
else
|
||||
code = initial(code)
|
||||
. = TRUE
|
||||
|
||||
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"])
|
||||
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
|
||||
update_icon()
|
||||
|
||||
/obj/item/assembly/signaler/attackby(obj/item/W, mob/user, params)
|
||||
if(issignaler(W))
|
||||
@@ -121,8 +97,6 @@ Code:
|
||||
signal.encryption = code
|
||||
signal.data["message"] = "ACTIVATE"
|
||||
radio_connection.post_signal(src, signal)
|
||||
return
|
||||
|
||||
|
||||
/obj/item/assembly/signaler/pulse(var/radio = 0)
|
||||
if(is_jammed(src))
|
||||
@@ -135,7 +109,6 @@ Code:
|
||||
..(radio)
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/assembly/signaler/receive_signal(datum/signal/signal)
|
||||
if(!signal)
|
||||
return FALSE
|
||||
@@ -145,13 +118,14 @@ Code:
|
||||
return FALSE
|
||||
if(is_jammed(src))
|
||||
return FALSE
|
||||
pulse(1)
|
||||
|
||||
if(!holder)
|
||||
for(var/mob/O in hearers(1, src.loc))
|
||||
to_chat(O,"[icon2html(thing = src, target = O)] *beep beep*")
|
||||
return
|
||||
pulse(TRUE)
|
||||
|
||||
audible_message(SPAN_INFOPLAIN("[icon2html(src, hearers(src))] *beep* *beep* *beep*"), null, hearing_range)
|
||||
for(var/CHM in get_hearers_in_view(hearing_range, src))
|
||||
if(ismob(CHM))
|
||||
var/mob/LM = CHM
|
||||
LM.playsound_local(get_turf(src), 'sound/machines/triple_beep.ogg', ASSEMBLY_BEEP_VOLUME, TRUE)
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/signaler/proc/set_frequency(new_frequency)
|
||||
if(!frequency)
|
||||
@@ -164,7 +138,6 @@ Code:
|
||||
radio_controller.remove_object(src, frequency)
|
||||
frequency = new_frequency
|
||||
radio_connection = radio_controller.add_object(src, frequency, RADIO_CHAT)
|
||||
return
|
||||
|
||||
/obj/item/assembly/signaler/process(delta_time)
|
||||
if(!deadman)
|
||||
@@ -177,7 +150,6 @@ Code:
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
else if(prob(5))
|
||||
M.visible_message("[M]'s finger twitches a bit over [src]'s signal button!")
|
||||
return
|
||||
|
||||
/obj/item/assembly/signaler/verb/deadman_it()
|
||||
set src in usr
|
||||
|
||||
@@ -7,99 +7,101 @@
|
||||
|
||||
wires = WIRE_PULSE
|
||||
|
||||
secured = 0
|
||||
secured = FALSE
|
||||
|
||||
var/timing = 0
|
||||
drop_sound = 'sound/items/handling/component_drop.ogg'
|
||||
pickup_sound = 'sound/items/handling/component_pickup.ogg'
|
||||
var/timing = FALSE
|
||||
var/time = 10
|
||||
var/saved_time = 10
|
||||
var/loop = FALSE
|
||||
var/hearing_range = 3
|
||||
|
||||
|
||||
/obj/item/assembly/timer/activate()
|
||||
if(!..()) return 0//Cooldown check
|
||||
|
||||
if(!..())
|
||||
return FALSE //Cooldown check
|
||||
timing = !timing
|
||||
|
||||
update_icon()
|
||||
return 0
|
||||
|
||||
update_appearance()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/timer/toggle_secure()
|
||||
secured = !secured
|
||||
if(secured)
|
||||
START_PROCESSING(SSprocessing, src)
|
||||
START_PROCESSING(SSobj, src)
|
||||
else
|
||||
timing = 0
|
||||
STOP_PROCESSING(SSprocessing, src)
|
||||
update_icon()
|
||||
timing = FALSE
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
update_appearance()
|
||||
return secured
|
||||
|
||||
|
||||
/obj/item/assembly/timer/proc/timer_end()
|
||||
if(!secured) return 0
|
||||
pulse(0)
|
||||
if(!holder)
|
||||
visible_message("[icon2html(thing = src, target = world)] *beep* *beep*", "*beep* *beep*")
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
process_cooldown()
|
||||
return
|
||||
|
||||
if(!secured)
|
||||
return FALSE
|
||||
pulse(FALSE)
|
||||
audible_message(SPAN_INFOPLAIN("[icon2html(src, hearers(src))] *beep* *beep* *beep*"), null, hearing_range)
|
||||
for(var/mob/hearing_mob in get_hearers_in_view(hearing_range, src))
|
||||
hearing_mob.playsound_local(get_turf(src), 'sound/machines/triple_beep.ogg', ASSEMBLY_BEEP_VOLUME, TRUE)
|
||||
if(loop)
|
||||
timing = TRUE
|
||||
update_appearance()
|
||||
|
||||
/obj/item/assembly/timer/process(delta_time)
|
||||
if(timing && (time > 0))
|
||||
time--
|
||||
if(timing && time <= 0)
|
||||
timing = 0
|
||||
if(!timing)
|
||||
return
|
||||
time -= delta_time
|
||||
if(time <= 0)
|
||||
timing = FALSE
|
||||
timer_end()
|
||||
time = 10
|
||||
return
|
||||
time = saved_time
|
||||
|
||||
/obj/item/assembly/timer/update_appearance()
|
||||
. = ..()
|
||||
holder?.update_appearance()
|
||||
|
||||
/obj/item/assembly/timer/update_icon()
|
||||
overlays.Cut()
|
||||
/obj/item/assembly/timer/update_overlays()
|
||||
. = ..()
|
||||
attached_overlays = list()
|
||||
if(timing)
|
||||
overlays += "timer_timing"
|
||||
. += "timer_timing"
|
||||
attached_overlays += "timer_timing"
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
return
|
||||
|
||||
|
||||
/obj/item/assembly/timer/interact(mob/user as mob)//TODO: Have this use the wires
|
||||
/obj/item/assembly/timer/ui_interact(mob/user, datum/tgui/ui)
|
||||
if(!secured)
|
||||
user.show_message("<font color='red'>The [name] is unsecured!</font>")
|
||||
return 0
|
||||
var/second = time % 60
|
||||
var/minute = (time - second) / 60
|
||||
var/dat = text("<TT><B>Timing Unit</B>\n[] []:[]\n<A href='?src=\ref[];tp=-30'>-</A> <A href='?src=\ref[];tp=-1'>-</A> <A href='?src=\ref[];tp=1'>+</A> <A href='?src=\ref[];tp=30'>+</A>\n</TT>", (timing ? text("<A href='?src=\ref[];time=0'>Timing</A>", src) : text("<A href='?src=\ref[];time=1'>Not Timing</A>", src)), minute, second, src, src, src, src)
|
||||
dat += "<BR><BR><A href='?src=\ref[src];refresh=1'>Refresh</A>"
|
||||
dat += "<BR><BR><A href='?src=\ref[src];close=1'>Close</A>"
|
||||
user << browse(dat, "window=timer")
|
||||
onclose(user, "timer")
|
||||
return
|
||||
to_chat(user, SPAN_WARNING("[src] is unsecured!"))
|
||||
return FALSE
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "AssemblyTimer", name)
|
||||
ui.open()
|
||||
|
||||
/obj/item/assembly/timer/ui_data(mob/user)
|
||||
var/list/data = ..()
|
||||
var/time_left = time
|
||||
data["seconds"] = round(time_left % 60)
|
||||
data["minutes"] = round((time_left - data["seconds"]) / 60)
|
||||
data["timing"] = timing
|
||||
data["loop"] = loop
|
||||
return data
|
||||
|
||||
/obj/item/assembly/timer/Topic(href, href_list, state = deep_inventory_state)
|
||||
if(..()) return 1
|
||||
if(!usr.canmove || usr.stat || usr.restrained() || !in_range(loc, usr))
|
||||
usr << browse(null, "window=timer")
|
||||
onclose(usr, "timer")
|
||||
return
|
||||
/obj/item/assembly/timer/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
if(href_list["time"])
|
||||
timing = text2num(href_list["time"])
|
||||
update_icon()
|
||||
|
||||
if(href_list["tp"])
|
||||
var/tp = text2num(href_list["tp"])
|
||||
time += tp
|
||||
time = min(max(round(time), 0), 600)
|
||||
|
||||
if(href_list["close"])
|
||||
usr << browse(null, "window=timer")
|
||||
return
|
||||
|
||||
if(usr)
|
||||
attack_self(usr)
|
||||
|
||||
return
|
||||
switch(action)
|
||||
if("time")
|
||||
timing = !timing
|
||||
//if(timing && istype(holder, /obj/item/transfer_valve))
|
||||
//log_bomber(usr, "activated a", src, "attachment on [holder]")
|
||||
update_appearance()
|
||||
. = TRUE
|
||||
if("repeat")
|
||||
loop = !loop
|
||||
. = TRUE
|
||||
if("input")
|
||||
var/value = text2num(params["adjust"])
|
||||
if(value)
|
||||
value = round(time + value)
|
||||
time = clamp(value, 1, 600)
|
||||
saved_time = time
|
||||
. = TRUE
|
||||
|
||||
@@ -26,10 +26,10 @@
|
||||
|
||||
|
||||
/obj/item/assembly/voice/attack_self(mob/user)
|
||||
if(!user) return 0
|
||||
if(!user)
|
||||
return FALSE
|
||||
activate()
|
||||
return 1
|
||||
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/voice/toggle_secure()
|
||||
. = ..()
|
||||
|
||||
Reference in New Issue
Block a user