mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
See changelog.
This commit is contained in:
@@ -243,6 +243,7 @@
|
||||
var/obj/item/device/multitool/M = W
|
||||
M.connecting = src
|
||||
user << "<span class='notice'>You load connection data from [src] to [M].</span>"
|
||||
M.update_icon()
|
||||
return
|
||||
else
|
||||
..()
|
||||
|
||||
@@ -168,6 +168,7 @@
|
||||
dat += "<br><br>MULTITOOL BUFFER: [P.buffer] ([P.buffer.id]) <a href='?src=\ref[src];link=1'>\[Link\]</a> <a href='?src=\ref[src];flush=1'>\[Flush\]"
|
||||
else
|
||||
dat += "<br><br>MULTITOOL BUFFER: <a href='?src=\ref[src];buffer=1'>\[Add Machine\]</a>"
|
||||
P.update_icon()
|
||||
|
||||
dat += "</font>"
|
||||
temp = ""
|
||||
|
||||
@@ -23,119 +23,119 @@
|
||||
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
|
||||
|
||||
proc/activate() //What the device does when turned on
|
||||
return
|
||||
/obj/item/device/assembly/proc/activate() //What the device does when turned on
|
||||
return
|
||||
|
||||
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/device/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
|
||||
|
||||
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/device/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
|
||||
|
||||
proc/toggle_secure() //Code that has to happen when the assembly is un\secured goes here
|
||||
return
|
||||
/obj/item/device/assembly/proc/toggle_secure() //Code that has to happen when the assembly is un\secured goes here
|
||||
return
|
||||
|
||||
proc/attach_assembly(var/obj/A, var/mob/user) //Called when an assembly is attacked by another
|
||||
return
|
||||
/obj/item/device/assembly/proc/attach_assembly(var/obj/A, var/mob/user) //Called when an assembly is attacked by another
|
||||
return
|
||||
|
||||
proc/process_cooldown() //Called via spawn(10) to have it count down the cooldown var
|
||||
return
|
||||
/obj/item/device/assembly/proc/process_cooldown() //Called via spawn(10) to have it count down the cooldown var
|
||||
return
|
||||
|
||||
proc/holder_movement() //Called when the holder is moved
|
||||
return
|
||||
/obj/item/device/assembly/proc/holder_movement() //Called when the holder is moved
|
||||
return
|
||||
|
||||
interact(mob/user as mob) //Called when attack_self is called
|
||||
return
|
||||
/obj/item/device/assembly/interact(mob/user as mob) //Called when attack_self is called
|
||||
return
|
||||
|
||||
|
||||
process_cooldown()
|
||||
cooldown--
|
||||
if(cooldown <= 0) return 0
|
||||
spawn(10)
|
||||
process_cooldown()
|
||||
return 1
|
||||
/obj/item/device/assembly/process_cooldown()
|
||||
cooldown--
|
||||
if(cooldown <= 0) return 0
|
||||
spawn(10)
|
||||
process_cooldown()
|
||||
return 1
|
||||
|
||||
|
||||
pulsed(var/radio = 0)
|
||||
if(holder && (wires & WIRE_RECEIVE))
|
||||
activate()
|
||||
if(radio && (wires & WIRE_RADIO_RECEIVE))
|
||||
activate()
|
||||
return 1
|
||||
/obj/item/device/assembly/pulsed(var/radio = 0)
|
||||
if(holder && (wires & WIRE_RECEIVE))
|
||||
activate()
|
||||
if(radio && (wires & WIRE_RADIO_RECEIVE))
|
||||
activate()
|
||||
return 1
|
||||
|
||||
|
||||
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)
|
||||
/obj/item/device/assembly/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?
|
||||
//Not sure what goes here quite yet send signal?
|
||||
return 1
|
||||
|
||||
|
||||
/obj/item/device/assembly/activate()
|
||||
if(!secured || (cooldown > 0)) return 0
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
process_cooldown()
|
||||
return 1
|
||||
|
||||
|
||||
/obj/item/device/assembly/toggle_secure()
|
||||
secured = !secured
|
||||
update_icon()
|
||||
return secured
|
||||
|
||||
|
||||
/obj/item/device/assembly/attach_assembly(var/obj/item/device/assembly/A, var/mob/user)
|
||||
holder = new/obj/item/device/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
|
||||
|
||||
|
||||
activate()
|
||||
if(!secured || (cooldown > 0)) return 0
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
process_cooldown()
|
||||
return 1
|
||||
|
||||
|
||||
toggle_secure()
|
||||
secured = !secured
|
||||
update_icon()
|
||||
return secured
|
||||
|
||||
|
||||
attach_assembly(var/obj/item/device/assembly/A, var/mob/user)
|
||||
holder = new/obj/item/device/assembly_holder(get_turf(src))
|
||||
if(holder.attach(A,src,user))
|
||||
user << "\blue You attach \the [A] to \the [src]!"
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(isassembly(W))
|
||||
var/obj/item/device/assembly/A = W
|
||||
if((!A.secured) && (!secured))
|
||||
attach_assembly(A,user)
|
||||
return
|
||||
if(isscrewdriver(W))
|
||||
if(toggle_secure())
|
||||
user << "\blue \The [src] is ready!"
|
||||
else
|
||||
user << "\blue \The [src] can now be attached!"
|
||||
/obj/item/device/assembly/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(isassembly(W))
|
||||
var/obj/item/device/assembly/A = W
|
||||
if((!A.secured) && (!secured))
|
||||
attach_assembly(A,user)
|
||||
return
|
||||
..()
|
||||
if(isscrewdriver(W))
|
||||
if(toggle_secure())
|
||||
to_chat(user, "<span class='notice'>\The [src] is ready!</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>\The [src] can now be attached!</span>")
|
||||
return
|
||||
..()
|
||||
return
|
||||
|
||||
|
||||
process()
|
||||
processing_objects.Remove(src)
|
||||
return
|
||||
/obj/item/device/assembly/process()
|
||||
processing_objects.Remove(src)
|
||||
return
|
||||
|
||||
|
||||
examine(mob/user)
|
||||
..(user)
|
||||
if((in_range(src, user) || loc == user))
|
||||
if(secured)
|
||||
user << "\The [src] is ready!"
|
||||
else
|
||||
user << "\The [src] can be attached!"
|
||||
return
|
||||
/obj/item/device/assembly/examine(mob/user)
|
||||
..(user)
|
||||
if((in_range(src, user) || loc == user))
|
||||
if(secured)
|
||||
to_chat(user, "\The [src] is ready!")
|
||||
else
|
||||
to_chat(user, "\The [src] can be attached!")
|
||||
return
|
||||
|
||||
|
||||
attack_self(mob/user as mob)
|
||||
if(!user) return 0
|
||||
user.set_machine(src)
|
||||
interact(user)
|
||||
return 1
|
||||
/obj/item/device/assembly/attack_self(mob/user as mob)
|
||||
if(!user) return 0
|
||||
user.set_machine(src)
|
||||
interact(user)
|
||||
return 1
|
||||
|
||||
|
||||
interact(mob/user as mob)
|
||||
return //HTML MENU FOR WIRES GOES HERE
|
||||
/obj/item/device/assembly/interact(mob/user as mob)
|
||||
return //HTML MENU FOR WIRES GOES HERE
|
||||
|
||||
/obj/item/device/assembly/nano_host()
|
||||
if(istype(loc, /obj/item/device/assembly_holder))
|
||||
|
||||
@@ -14,201 +14,201 @@
|
||||
var/obj/item/device/assembly/a_right = null
|
||||
var/obj/special_assembly = null
|
||||
|
||||
proc/attach(var/obj/item/device/D, var/obj/item/device/D2, var/mob/user)
|
||||
return
|
||||
/obj/item/device/assembly_holder/proc/attach(var/obj/item/device/D, var/obj/item/device/D2, var/mob/user)
|
||||
return
|
||||
|
||||
proc/attach_special(var/obj/O, var/mob/user)
|
||||
return
|
||||
/obj/item/device/assembly_holder/proc/attach_special(var/obj/O, var/mob/user)
|
||||
return
|
||||
|
||||
proc/process_activation(var/obj/item/device/D)
|
||||
return
|
||||
/obj/item/device/assembly_holder/proc/process_activation(var/obj/item/device/D)
|
||||
return
|
||||
|
||||
proc/detached()
|
||||
return
|
||||
/obj/item/device/assembly_holder/proc/detached()
|
||||
return
|
||||
|
||||
|
||||
IsAssemblyHolder()
|
||||
return 1
|
||||
/obj/item/device/assembly_holder/IsAssemblyHolder()
|
||||
return 1
|
||||
|
||||
|
||||
attach(var/obj/item/device/D, var/obj/item/device/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
|
||||
a_left = D
|
||||
a_right = D2
|
||||
name = "[D.name]-[D2.name] assembly"
|
||||
update_icon()
|
||||
usr.put_in_hands(src)
|
||||
/obj/item/device/assembly_holder/attach(var/obj/item/device/D, var/obj/item/device/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
|
||||
a_left = D
|
||||
a_right = D2
|
||||
name = "[D.name]-[D2.name] assembly"
|
||||
update_icon()
|
||||
usr.put_in_hands(src)
|
||||
|
||||
return 1
|
||||
return 1
|
||||
|
||||
|
||||
attach_special(var/obj/O, var/mob/user)
|
||||
if(!O) return
|
||||
if(!O.IsSpecialAssembly()) return 0
|
||||
/obj/item/device/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"
|
||||
special_assembly = O
|
||||
update_icon()
|
||||
src.name = "[a_left.name] [a_right.name] [special_assembly.name] assembly"
|
||||
*/
|
||||
return
|
||||
return
|
||||
|
||||
|
||||
update_icon()
|
||||
overlays.Cut()
|
||||
if(a_left)
|
||||
overlays += "[a_left.icon_state]_left"
|
||||
for(var/O in a_left.attached_overlays)
|
||||
overlays += "[O]_l"
|
||||
if(a_right)
|
||||
src.overlays += "[a_right.icon_state]_right"
|
||||
for(var/O in a_right.attached_overlays)
|
||||
overlays += "[O]_r"
|
||||
if(master)
|
||||
master.update_icon()
|
||||
/obj/item/device/assembly_holder/update_icon()
|
||||
overlays.Cut()
|
||||
if(a_left)
|
||||
overlays += "[a_left.icon_state]_left"
|
||||
for(var/O in a_left.attached_overlays)
|
||||
overlays += "[O]_l"
|
||||
if(a_right)
|
||||
src.overlays += "[a_right.icon_state]_right"
|
||||
for(var/O in a_right.attached_overlays)
|
||||
overlays += "[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
|
||||
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
|
||||
*/
|
||||
|
||||
examine(mob/user)
|
||||
..(user)
|
||||
if ((in_range(src, user) || src.loc == user))
|
||||
if (src.secured)
|
||||
user << "\The [src] is ready!"
|
||||
else
|
||||
user << "\The [src] can be attached!"
|
||||
return
|
||||
/obj/item/device/assembly_holder/examine(mob/user)
|
||||
..(user)
|
||||
if ((in_range(src, user) || src.loc == user))
|
||||
if (src.secured)
|
||||
to_chat(user, "\The [src] is ready!")
|
||||
else
|
||||
to_chat(user, "\The [src] can be attached!")
|
||||
return
|
||||
|
||||
|
||||
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/device/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)
|
||||
|
||||
|
||||
Crossed(atom/movable/AM as mob|obj)
|
||||
if(a_left)
|
||||
a_left.Crossed(AM)
|
||||
if(a_right)
|
||||
a_right.Crossed(AM)
|
||||
if(special_assembly)
|
||||
special_assembly.Crossed(AM)
|
||||
/obj/item/device/assembly_holder/Crossed(atom/movable/AM as mob|obj)
|
||||
if(a_left)
|
||||
a_left.Crossed(AM)
|
||||
if(a_right)
|
||||
a_right.Crossed(AM)
|
||||
if(special_assembly)
|
||||
special_assembly.Crossed(AM)
|
||||
|
||||
|
||||
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/device/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)
|
||||
|
||||
|
||||
Move()
|
||||
..()
|
||||
if(a_left && a_right)
|
||||
a_left.holder_movement()
|
||||
a_right.holder_movement()
|
||||
/obj/item/device/assembly_holder/Move()
|
||||
..()
|
||||
if(a_left && a_right)
|
||||
a_left.holder_movement()
|
||||
a_right.holder_movement()
|
||||
// if(special_assembly)
|
||||
// special_assembly:holder_movement()
|
||||
return
|
||||
return
|
||||
|
||||
|
||||
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()
|
||||
/obj/item/device/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
|
||||
..()
|
||||
return
|
||||
|
||||
|
||||
attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(isscrewdriver(W))
|
||||
if(!a_left || !a_right)
|
||||
user << "\red BUG:Assembly part missing, please report this!"
|
||||
return
|
||||
a_left.toggle_secure()
|
||||
a_right.toggle_secure()
|
||||
secured = !secured
|
||||
if(secured)
|
||||
user << "\blue \The [src] is ready!"
|
||||
else
|
||||
user << "\blue \The [src] can now be taken apart!"
|
||||
update_icon()
|
||||
/obj/item/device/assembly_holder/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(isscrewdriver(W))
|
||||
if(!a_left || !a_right)
|
||||
to_chat(user, "<span class='warning'> BUG:Assembly part missing, please report this!</span>")
|
||||
return
|
||||
else if(W.IsSpecialAssembly())
|
||||
attach_special(W, user)
|
||||
a_left.toggle_secure()
|
||||
a_right.toggle_secure()
|
||||
secured = !secured
|
||||
if(secured)
|
||||
to_chat(user, "<span class='notice'>\The [src] is ready!</span>")
|
||||
else
|
||||
..()
|
||||
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
|
||||
|
||||
|
||||
attack_self(mob/user as mob)
|
||||
src.add_fingerprint(user)
|
||||
if(src.secured)
|
||||
if(!a_left || !a_right)
|
||||
user << "\red Assembly part missing!"
|
||||
return
|
||||
if(istype(a_left,a_right.type))//If they are the same type it causes issues due to window code
|
||||
switch(alert("Which side would you like to use?",,"Left","Right"))
|
||||
if("Left") a_left.attack_self(user)
|
||||
if("Right") a_right.attack_self(user)
|
||||
return
|
||||
else
|
||||
if(!istype(a_left,/obj/item/device/assembly/igniter))
|
||||
a_left.attack_self(user)
|
||||
if(!istype(a_right,/obj/item/device/assembly/igniter))
|
||||
a_right.attack_self(user)
|
||||
/obj/item/device/assembly_holder/attack_self(mob/user as mob)
|
||||
src.add_fingerprint(user)
|
||||
if(src.secured)
|
||||
if(!a_left || !a_right)
|
||||
to_chat(user, "<span class='warning'> BUG:Assembly part missing, please report this!</span>")
|
||||
return
|
||||
if(istype(a_left,a_right.type))//If they are the same type it causes issues due to window code
|
||||
switch(alert("Which side would you like to use?",,"Left","Right"))
|
||||
if("Left") a_left.attack_self(user)
|
||||
if("Right") a_right.attack_self(user)
|
||||
return
|
||||
else
|
||||
var/turf/T = get_turf(src)
|
||||
if(!T) return 0
|
||||
if(a_left)
|
||||
a_left:holder = null
|
||||
a_left.loc = T
|
||||
if(a_right)
|
||||
a_right:holder = null
|
||||
a_right.loc = T
|
||||
spawn(0)
|
||||
qdel(src)
|
||||
return
|
||||
if(!istype(a_left,/obj/item/device/assembly/igniter))
|
||||
a_left.attack_self(user)
|
||||
if(!istype(a_right,/obj/item/device/assembly/igniter))
|
||||
a_right.attack_self(user)
|
||||
else
|
||||
var/turf/T = get_turf(src)
|
||||
if(!T) return 0
|
||||
if(a_left)
|
||||
a_left:holder = null
|
||||
a_left.loc = T
|
||||
if(a_right)
|
||||
a_right:holder = null
|
||||
a_right.loc = T
|
||||
spawn(0)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
|
||||
process_activation(var/obj/D, var/normal = 1, var/special = 1)
|
||||
if(!D) return 0
|
||||
if(!secured)
|
||||
visible_message("\icon[src] *beep* *beep*", "*beep* *beep*")
|
||||
if((normal) && (a_right) && (a_left))
|
||||
if(a_right != D)
|
||||
a_right.pulsed(0)
|
||||
if(a_left != D)
|
||||
a_left.pulsed(0)
|
||||
if(master)
|
||||
master.receive_signal()
|
||||
/obj/item/device/assembly_holder/process_activation(var/obj/D, var/normal = 1, var/special = 1)
|
||||
if(!D) return 0
|
||||
if(!secured)
|
||||
visible_message("\icon[src] *beep* *beep*", "*beep* *beep*")
|
||||
if((normal) && (a_right) && (a_left))
|
||||
if(a_right != D)
|
||||
a_right.pulsed(0)
|
||||
if(a_left != D)
|
||||
a_left.pulsed(0)
|
||||
if(master)
|
||||
master.receive_signal()
|
||||
// if(special && special_assembly)
|
||||
// if(!special_assembly == D)
|
||||
// special_assembly.dothings()
|
||||
return 1
|
||||
return 1
|
||||
|
||||
|
||||
/obj/item/device/assembly_holder/hear_talk(mob/living/M as mob, msg, verb, datum/language/speaking)
|
||||
@@ -242,36 +242,36 @@
|
||||
|
||||
loc.verbs += /obj/item/device/assembly_holder/timer_igniter/verb/configure
|
||||
|
||||
detached()
|
||||
loc.verbs -= /obj/item/device/assembly_holder/timer_igniter/verb/configure
|
||||
..()
|
||||
/obj/item/device/assembly_holder/timer_igniterdetached()
|
||||
loc.verbs -= /obj/item/device/assembly_holder/timer_igniter/verb/configure
|
||||
..()
|
||||
|
||||
verb/configure()
|
||||
set name = "Set Timer"
|
||||
set category = "Object"
|
||||
set src in usr
|
||||
/obj/item/device/assembly_holder/timer_igniterverb/configure()
|
||||
set name = "Set Timer"
|
||||
set category = "Object"
|
||||
set src in usr
|
||||
|
||||
if ( !(usr.stat || usr.restrained()) )
|
||||
var/obj/item/device/assembly_holder/holder
|
||||
if(istype(src,/obj/item/weapon/grenade/chem_grenade))
|
||||
var/obj/item/weapon/grenade/chem_grenade/gren = src
|
||||
holder=gren.detonator
|
||||
var/obj/item/device/assembly/timer/tmr = holder.a_left
|
||||
if(!istype(tmr,/obj/item/device/assembly/timer))
|
||||
tmr = holder.a_right
|
||||
if(!istype(tmr,/obj/item/device/assembly/timer))
|
||||
usr << "<span class='notice'>This detonator has no timer.</span>"
|
||||
return
|
||||
if ( !(usr.stat || usr.restrained()) )
|
||||
var/obj/item/device/assembly_holder/holder
|
||||
if(istype(src,/obj/item/weapon/grenade/chem_grenade))
|
||||
var/obj/item/weapon/grenade/chem_grenade/gren = src
|
||||
holder=gren.detonator
|
||||
var/obj/item/device/assembly/timer/tmr = holder.a_left
|
||||
if(!istype(tmr,/obj/item/device/assembly/timer))
|
||||
tmr = holder.a_right
|
||||
if(!istype(tmr,/obj/item/device/assembly/timer))
|
||||
to_chat(usr, "<span class='notice'>This detonator has no timer.</span>")
|
||||
return
|
||||
|
||||
if(tmr.timing)
|
||||
usr << "<span class='notice'>Clock is ticking already.</span>"
|
||||
else
|
||||
var/ntime = input("Enter desired time in seconds", "Time", "5") as num
|
||||
if (ntime>0 && ntime<1000)
|
||||
tmr.time = ntime
|
||||
name = initial(name) + "([tmr.time] secs)"
|
||||
usr << "<span class='notice'>Timer set to [tmr.time] seconds.</span>"
|
||||
else
|
||||
usr << "<span class='notice'>Timer can't be [ntime<=0?"negative":"more than 1000 seconds"].</span>"
|
||||
if(tmr.timing)
|
||||
to_chat(usr, "<span class='notice'>Clock is ticking already.</span>")
|
||||
else
|
||||
usr << "<span class='notice'>You cannot do this while [usr.stat?"unconscious/dead":"restrained"].</span>"
|
||||
var/ntime = input("Enter desired time in seconds", "Time", "5") as num
|
||||
if (ntime>0 && ntime<1000)
|
||||
tmr.time = ntime
|
||||
name = initial(name) + "([tmr.time] secs)"
|
||||
to_chat(usr, "<span class='notice'>Timer set to [tmr.time] seconds.</span>")
|
||||
else
|
||||
to_chat(usr, "<span class='notice'>Timer can't be [ntime<=0?"negative":"more than 1000 seconds"].</span>")
|
||||
else
|
||||
to_chat(usr, "<span class='notice'>You cannot do this while [usr.stat?"unconscious/dead":"restrained"].</span>")
|
||||
|
||||
@@ -2,36 +2,36 @@
|
||||
name = "igniter"
|
||||
desc = "A small electronic device able to ignite combustable substances."
|
||||
icon_state = "igniter"
|
||||
origin_tech = list(TECH_MAGNET = 1)
|
||||
matter = list(DEFAULT_WALL_MATERIAL = 500, "glass" = 50, "waste" = 10)
|
||||
origin_tech = list(TECH_MAGNET = 1)
|
||||
matter = list(DEFAULT_WALL_MATERIAL = 500, "glass" = 50, "waste" = 10)
|
||||
|
||||
secured = 1
|
||||
wires = WIRE_RECEIVE
|
||||
|
||||
/obj/item/device/assembly/igniter/activate()
|
||||
if(!..()) return 0//Cooldown check
|
||||
|
||||
if(holder && istype(holder.loc,/obj/item/weapon/grenade/chem_grenade))
|
||||
var/obj/item/weapon/grenade/chem_grenade/grenade = holder.loc
|
||||
grenade.prime()
|
||||
else
|
||||
var/turf/location = get_turf(loc)
|
||||
if(location)
|
||||
location.hotspot_expose(1000,1000)
|
||||
if (istype(src.loc,/obj/item/device/assembly_holder))
|
||||
if (istype(src.loc.loc, /obj/structure/reagent_dispensers/fueltank/))
|
||||
var/obj/structure/reagent_dispensers/fueltank/tank = src.loc.loc
|
||||
if (tank && tank.modded)
|
||||
tank.explode()
|
||||
|
||||
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
|
||||
s.set_up(3, 1, src)
|
||||
s.start()
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
/obj/item/device/assembly/igniter/attack_self(mob/user as mob)
|
||||
activate()
|
||||
if(!..()) return 0//Cooldown check
|
||||
|
||||
if(holder && istype(holder.loc,/obj/item/weapon/grenade/chem_grenade))
|
||||
var/obj/item/weapon/grenade/chem_grenade/grenade = holder.loc
|
||||
grenade.prime()
|
||||
else
|
||||
var/turf/location = get_turf(loc)
|
||||
if(location)
|
||||
location.hotspot_expose(1000,1000)
|
||||
if (istype(src.loc,/obj/item/device/assembly_holder))
|
||||
if (istype(src.loc.loc, /obj/structure/reagent_dispensers/fueltank/))
|
||||
var/obj/structure/reagent_dispensers/fueltank/tank = src.loc.loc
|
||||
if (tank && tank.modded)
|
||||
tank.explode()
|
||||
|
||||
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
|
||||
s.set_up(3, 1, src)
|
||||
s.start()
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
attack_self(mob/user as mob)
|
||||
activate()
|
||||
add_fingerprint(user)
|
||||
return
|
||||
add_fingerprint(user)
|
||||
return
|
||||
@@ -15,145 +15,141 @@
|
||||
var/visible = 0
|
||||
var/obj/effect/beam/i_beam/first = null
|
||||
|
||||
proc
|
||||
trigger_beam()
|
||||
|
||||
|
||||
activate()
|
||||
/obj/item/device/assembly/infra/activate()
|
||||
if(!..()) return 0//Cooldown check
|
||||
on = !on
|
||||
update_icon()
|
||||
return 1
|
||||
|
||||
|
||||
toggle_secure()
|
||||
secured = !secured
|
||||
if(secured)
|
||||
processing_objects.Add(src)
|
||||
else
|
||||
on = 0
|
||||
if(first) qdel(first)
|
||||
processing_objects.Remove(src)
|
||||
update_icon()
|
||||
return secured
|
||||
|
||||
|
||||
/obj/item/device/assembly/infra/toggle_secure()
|
||||
secured = !secured
|
||||
if(secured)
|
||||
processing_objects.Add(src)
|
||||
else
|
||||
on = 0
|
||||
if(first) qdel(first)
|
||||
processing_objects.Remove(src)
|
||||
update_icon()
|
||||
overlays.Cut()
|
||||
attached_overlays = list()
|
||||
if(on)
|
||||
overlays += "infrared_on"
|
||||
attached_overlays += "infrared_on"
|
||||
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
return
|
||||
return secured
|
||||
|
||||
|
||||
process()//Old code
|
||||
if(!on)
|
||||
if(first)
|
||||
qdel(first)
|
||||
return
|
||||
/obj/item/device/assembly/infra/update_icon()
|
||||
overlays.Cut()
|
||||
attached_overlays = list()
|
||||
if(on)
|
||||
overlays += "infrared_on"
|
||||
attached_overlays += "infrared_on"
|
||||
|
||||
if((!(first) && (secured && (istype(loc, /turf) || (holder && istype(holder.loc, /turf))))))
|
||||
var/obj/effect/beam/i_beam/I = new /obj/effect/beam/i_beam((holder ? holder.loc : loc) )
|
||||
I.master = src
|
||||
I.density = 1
|
||||
I.set_dir(dir)
|
||||
step(I, I.dir)
|
||||
if(I)
|
||||
I.density = 0
|
||||
first = I
|
||||
I.vis_spread(visible)
|
||||
spawn(0)
|
||||
if(I)
|
||||
//world << "infra: setting limit"
|
||||
I.limit = 8
|
||||
//world << "infra: processing beam \ref[I]"
|
||||
I.process()
|
||||
return
|
||||
return
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
return
|
||||
|
||||
|
||||
attack_hand()
|
||||
qdel(first)
|
||||
..()
|
||||
return
|
||||
|
||||
|
||||
Move()
|
||||
var/t = dir
|
||||
..()
|
||||
set_dir(t)
|
||||
qdel(first)
|
||||
return
|
||||
|
||||
|
||||
holder_movement()
|
||||
if(!holder) return 0
|
||||
// set_dir(holder.dir)
|
||||
qdel(first)
|
||||
return 1
|
||||
|
||||
|
||||
trigger_beam()
|
||||
if((!secured)||(!on)||(cooldown > 0)) return 0
|
||||
pulse(0)
|
||||
if(!holder)
|
||||
visible_message("\icon[src] *beep* *beep*")
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
process_cooldown()
|
||||
return
|
||||
|
||||
|
||||
interact(mob/user as mob)//TODO: change this this to the wire control panel
|
||||
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")
|
||||
return
|
||||
|
||||
|
||||
Topic(href, href_list)
|
||||
if(..()) return 1
|
||||
if(!usr.canmove || usr.stat || usr.restrained() || !in_range(loc, usr))
|
||||
usr << browse(null, "window=infra")
|
||||
onclose(usr, "infra")
|
||||
/obj/item/device/assembly/infra/process()//Old code
|
||||
if(!on)
|
||||
if(first)
|
||||
qdel(first)
|
||||
return
|
||||
|
||||
if(href_list["state"])
|
||||
on = !(on)
|
||||
update_icon()
|
||||
|
||||
if(href_list["visible"])
|
||||
visible = !(visible)
|
||||
if((!(first) && (secured && (istype(loc, /turf) || (holder && istype(holder.loc, /turf))))))
|
||||
var/obj/effect/beam/i_beam/I = new /obj/effect/beam/i_beam((holder ? holder.loc : loc) )
|
||||
I.master = src
|
||||
I.density = 1
|
||||
I.set_dir(dir)
|
||||
step(I, I.dir)
|
||||
if(I)
|
||||
I.density = 0
|
||||
first = I
|
||||
I.vis_spread(visible)
|
||||
spawn(0)
|
||||
if(first)
|
||||
first.vis_spread(visible)
|
||||
if(I)
|
||||
//world << "infra: setting limit"
|
||||
I.limit = 8
|
||||
//world << "infra: processing beam \ref[I]"
|
||||
I.process()
|
||||
return
|
||||
return
|
||||
|
||||
if(href_list["close"])
|
||||
usr << browse(null, "window=infra")
|
||||
return
|
||||
|
||||
if(usr)
|
||||
attack_self(usr)
|
||||
/obj/item/device/assembly/infra/attack_hand()
|
||||
qdel(first)
|
||||
..()
|
||||
return
|
||||
|
||||
|
||||
/obj/item/device/assembly/infra/Move()
|
||||
var/t = dir
|
||||
..()
|
||||
set_dir(t)
|
||||
qdel(first)
|
||||
return
|
||||
|
||||
|
||||
/obj/item/device/assembly/infra/holder_movement()
|
||||
if(!holder) return 0
|
||||
// set_dir(holder.dir)
|
||||
qdel(first)
|
||||
return 1
|
||||
|
||||
|
||||
/obj/item/device/assembly/infra/proc/trigger_beam()
|
||||
if((!secured)||(!on)||(cooldown > 0)) return 0
|
||||
pulse(0)
|
||||
if(!holder)
|
||||
visible_message("\icon[src] *beep* *beep*")
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
process_cooldown()
|
||||
return
|
||||
|
||||
|
||||
/obj/item/device/assembly/infra/interact(mob/user as mob)//TODO: change this this to the wire control panel
|
||||
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")
|
||||
return
|
||||
|
||||
|
||||
/obj/item/device/assembly/infra/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=infra")
|
||||
onclose(usr, "infra")
|
||||
return
|
||||
|
||||
if(href_list["state"])
|
||||
on = !(on)
|
||||
update_icon()
|
||||
|
||||
verb/rotate()//This could likely be better
|
||||
set name = "Rotate Infrared Laser"
|
||||
set category = "Object"
|
||||
set src in usr
|
||||
if(href_list["visible"])
|
||||
visible = !(visible)
|
||||
spawn(0)
|
||||
if(first)
|
||||
first.vis_spread(visible)
|
||||
|
||||
set_dir(turn(dir, 90))
|
||||
if(href_list["close"])
|
||||
usr << browse(null, "window=infra")
|
||||
return
|
||||
|
||||
if(usr)
|
||||
attack_self(usr)
|
||||
|
||||
return
|
||||
|
||||
|
||||
/obj/item/device/assembly/infra/verb/rotate()//This could likely be better
|
||||
set name = "Rotate Infrared Laser"
|
||||
set category = "Object"
|
||||
set src in usr
|
||||
|
||||
set_dir(turn(dir, 90))
|
||||
return
|
||||
|
||||
|
||||
|
||||
/***************************IBeam*********************************/
|
||||
|
||||
@@ -7,107 +7,107 @@
|
||||
var/armed = 0
|
||||
|
||||
|
||||
examine(mob/user)
|
||||
..(user)
|
||||
if(armed)
|
||||
user << "It looks like it's armed."
|
||||
/obj/item/device/assembly/mousetrap/examine(mob/user)
|
||||
..(user)
|
||||
if(armed)
|
||||
to_chat(user, "It looks like it's armed.")
|
||||
|
||||
/obj/item/device/assembly/mousetrap/update_icon()
|
||||
if(armed)
|
||||
icon_state = "mousetraparmed"
|
||||
else
|
||||
icon_state = "mousetrap"
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
|
||||
/obj/item/device/assembly/mousetrap/proc/triggered(mob/target as mob, var/type = "feet")
|
||||
if(!armed)
|
||||
return
|
||||
var/obj/item/organ/external/affecting = null
|
||||
if(ishuman(target))
|
||||
var/mob/living/carbon/human/H = target
|
||||
switch(type)
|
||||
if("feet")
|
||||
if(!H.shoes)
|
||||
affecting = H.get_organ(pick("l_leg", "r_leg"))
|
||||
H.Weaken(3)
|
||||
if("l_hand", "r_hand")
|
||||
if(!H.gloves)
|
||||
affecting = H.get_organ(type)
|
||||
H.Stun(3)
|
||||
if(affecting)
|
||||
if(affecting.take_damage(1, 0))
|
||||
H.UpdateDamageIcon()
|
||||
H.updatehealth()
|
||||
else if(ismouse(target))
|
||||
var/mob/living/simple_animal/mouse/M = target
|
||||
visible_message("\red <b>SPLAT!</b>")
|
||||
M.splat()
|
||||
playsound(target.loc, 'sound/effects/snap.ogg', 50, 1)
|
||||
layer = MOB_LAYER - 0.2
|
||||
armed = 0
|
||||
update_icon()
|
||||
if(armed)
|
||||
icon_state = "mousetraparmed"
|
||||
else
|
||||
icon_state = "mousetrap"
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
pulse(0)
|
||||
|
||||
proc/triggered(mob/target as mob, var/type = "feet")
|
||||
if(!armed)
|
||||
|
||||
/obj/item/device/assembly/mousetrap/attack_self(mob/living/user as mob)
|
||||
if(!armed)
|
||||
user << "<span class='notice'>You arm [src].</span>"
|
||||
else
|
||||
if((CLUMSY in user.mutations) && prob(50))
|
||||
var/which_hand = "l_hand"
|
||||
if(!user.hand)
|
||||
which_hand = "r_hand"
|
||||
triggered(user, which_hand)
|
||||
user.visible_message("<span class='warning'>[user] accidentally sets off [src], breaking their fingers.</span>", \
|
||||
"<span class='warning'>You accidentally trigger [src]!</span>")
|
||||
return
|
||||
var/obj/item/organ/external/affecting = null
|
||||
if(ishuman(target))
|
||||
var/mob/living/carbon/human/H = target
|
||||
switch(type)
|
||||
if("feet")
|
||||
if(!H.shoes)
|
||||
affecting = H.get_organ(pick("l_leg", "r_leg"))
|
||||
H.Weaken(3)
|
||||
if("l_hand", "r_hand")
|
||||
if(!H.gloves)
|
||||
affecting = H.get_organ(type)
|
||||
H.Stun(3)
|
||||
if(affecting)
|
||||
if(affecting.take_damage(1, 0))
|
||||
H.UpdateDamageIcon()
|
||||
H.updatehealth()
|
||||
else if(ismouse(target))
|
||||
var/mob/living/simple_animal/mouse/M = target
|
||||
visible_message("\red <b>SPLAT!</b>")
|
||||
M.splat()
|
||||
playsound(target.loc, 'sound/effects/snap.ogg', 50, 1)
|
||||
layer = MOB_LAYER - 0.2
|
||||
armed = 0
|
||||
update_icon()
|
||||
pulse(0)
|
||||
to_chat(user, "<span class='notice'>You disarm [src].</span>")
|
||||
armed = !armed
|
||||
update_icon()
|
||||
playsound(user.loc, 'sound/weapons/handcuffs.ogg', 30, 1, -3)
|
||||
|
||||
|
||||
attack_self(mob/living/user as mob)
|
||||
if(!armed)
|
||||
user << "<span class='notice'>You arm [src].</span>"
|
||||
else
|
||||
if((CLUMSY in user.mutations) && prob(50))
|
||||
var/which_hand = "l_hand"
|
||||
if(!user.hand)
|
||||
which_hand = "r_hand"
|
||||
triggered(user, which_hand)
|
||||
user.visible_message("<span class='warning'>[user] accidentally sets off [src], breaking their fingers.</span>", \
|
||||
"<span class='warning'>You accidentally trigger [src]!</span>")
|
||||
return
|
||||
user << "<span class='notice'>You disarm [src].</span>"
|
||||
armed = !armed
|
||||
update_icon()
|
||||
playsound(user.loc, 'sound/weapons/handcuffs.ogg', 30, 1, -3)
|
||||
/obj/item/device/assembly/mousetrap/attack_hand(mob/living/user as mob)
|
||||
if(armed)
|
||||
if((CLUMSY in user.mutations) && prob(50))
|
||||
var/which_hand = "l_hand"
|
||||
if(!user.hand)
|
||||
which_hand = "r_hand"
|
||||
triggered(user, which_hand)
|
||||
user.visible_message("<span class='warning'>[user] accidentally sets off [src], breaking their fingers.</span>", \
|
||||
"<span class='warning'>You accidentally trigger [src]!</span>")
|
||||
return
|
||||
..()
|
||||
|
||||
|
||||
attack_hand(mob/living/user as mob)
|
||||
if(armed)
|
||||
if((CLUMSY in user.mutations) && prob(50))
|
||||
var/which_hand = "l_hand"
|
||||
if(!user.hand)
|
||||
which_hand = "r_hand"
|
||||
triggered(user, which_hand)
|
||||
user.visible_message("<span class='warning'>[user] accidentally sets off [src], breaking their fingers.</span>", \
|
||||
"<span class='warning'>You accidentally trigger [src]!</span>")
|
||||
return
|
||||
..()
|
||||
/obj/item/device/assembly/mousetrap/Crossed(AM as mob|obj)
|
||||
if(armed)
|
||||
if(ishuman(AM))
|
||||
var/mob/living/carbon/H = AM
|
||||
if(H.m_intent == "run")
|
||||
triggered(H)
|
||||
H.visible_message("<span class='warning'>[H] accidentally steps on [src].</span>", \
|
||||
"<span class='warning'>You accidentally step on [src]</span>")
|
||||
if(ismouse(AM))
|
||||
triggered(AM)
|
||||
..()
|
||||
|
||||
|
||||
Crossed(AM as mob|obj)
|
||||
if(armed)
|
||||
if(ishuman(AM))
|
||||
var/mob/living/carbon/H = AM
|
||||
if(H.m_intent == "run")
|
||||
triggered(H)
|
||||
H.visible_message("<span class='warning'>[H] accidentally steps on [src].</span>", \
|
||||
"<span class='warning'>You accidentally step on [src]</span>")
|
||||
if(ismouse(AM))
|
||||
triggered(AM)
|
||||
..()
|
||||
/obj/item/device/assembly/mousetrap/on_found(mob/living/finder as mob)
|
||||
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>")
|
||||
triggered(finder, finder.hand ? "l_hand" : "r_hand")
|
||||
return 1 //end the search!
|
||||
return 0
|
||||
|
||||
|
||||
on_found(mob/living/finder as mob)
|
||||
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>")
|
||||
triggered(finder, finder.hand ? "l_hand" : "r_hand")
|
||||
return 1 //end the search!
|
||||
return 0
|
||||
|
||||
|
||||
hitby(A as mob|obj)
|
||||
if(!armed)
|
||||
return ..()
|
||||
visible_message("<span class='warning'>[src] is triggered by [A].</span>")
|
||||
triggered(null)
|
||||
/obj/item/device/assembly/mousetrap/hitby(A as mob|obj)
|
||||
if(!armed)
|
||||
return ..()
|
||||
visible_message("<span class='warning'>[src] is triggered by [A].</span>")
|
||||
triggered(null)
|
||||
|
||||
|
||||
/obj/item/device/assembly/mousetrap/armed
|
||||
@@ -124,4 +124,4 @@
|
||||
return
|
||||
|
||||
layer = TURF_LAYER+0.2
|
||||
usr << "<span class='notice'>You hide [src].</span>"
|
||||
to_chat(usr, "<span class='notice'>You hide [src].</span>")
|
||||
@@ -15,152 +15,147 @@
|
||||
|
||||
var/range = 2
|
||||
|
||||
proc
|
||||
toggle_scan()
|
||||
sense()
|
||||
/obj/item/device/assembly/prox_sensor/activate()
|
||||
if(!..()) return 0//Cooldown check
|
||||
timing = !timing
|
||||
update_icon()
|
||||
return 0
|
||||
|
||||
|
||||
activate()
|
||||
if(!..()) return 0//Cooldown check
|
||||
timing = !timing
|
||||
update_icon()
|
||||
return 0
|
||||
/obj/item/device/assembly/prox_sensor/toggle_secure()
|
||||
secured = !secured
|
||||
if(secured)
|
||||
processing_objects.Add(src)
|
||||
else
|
||||
scanning = 0
|
||||
timing = 0
|
||||
processing_objects.Remove(src)
|
||||
update_icon()
|
||||
return secured
|
||||
|
||||
|
||||
toggle_secure()
|
||||
secured = !secured
|
||||
if(secured)
|
||||
processing_objects.Add(src)
|
||||
else
|
||||
scanning = 0
|
||||
timing = 0
|
||||
processing_objects.Remove(src)
|
||||
update_icon()
|
||||
return secured
|
||||
|
||||
|
||||
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 (AM.move_speed < 12) sense()
|
||||
/obj/item/device/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 (AM.move_speed < 12) sense()
|
||||
return
|
||||
|
||||
|
||||
sense()
|
||||
var/turf/mainloc = get_turf(src)
|
||||
/obj/item/device/assembly/prox_sensor/proc/sense()
|
||||
var/turf/mainloc = get_turf(src)
|
||||
// if(scanning && cooldown <= 0)
|
||||
// mainloc.visible_message("\icon[src] *boop* *boop*", "*boop* *boop*")
|
||||
if((!holder && !secured)||(!scanning)||(cooldown > 0)) return 0
|
||||
pulse(0)
|
||||
if(!holder)
|
||||
mainloc.visible_message("\icon[src] *beep* *beep*", "*beep* *beep*")
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
process_cooldown()
|
||||
return
|
||||
if((!holder && !secured)||(!scanning)||(cooldown > 0)) return 0
|
||||
pulse(0)
|
||||
if(!holder)
|
||||
mainloc.visible_message("\icon[src] *beep* *beep*", "*beep* *beep*")
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
process_cooldown()
|
||||
return
|
||||
|
||||
|
||||
process()
|
||||
if(scanning)
|
||||
var/turf/mainloc = get_turf(src)
|
||||
for(var/mob/living/A in range(range,mainloc))
|
||||
if (A.move_speed < 12)
|
||||
sense()
|
||||
/obj/item/device/assembly/prox_sensor/process()
|
||||
if(scanning)
|
||||
var/turf/mainloc = get_turf(src)
|
||||
for(var/mob/living/A in range(range,mainloc))
|
||||
if (A.move_speed < 12)
|
||||
sense()
|
||||
|
||||
if(timing && (time >= 0))
|
||||
time--
|
||||
if(timing && time <= 0)
|
||||
timing = 0
|
||||
toggle_scan()
|
||||
time = 10
|
||||
return
|
||||
if(timing && (time >= 0))
|
||||
time--
|
||||
if(timing && time <= 0)
|
||||
timing = 0
|
||||
toggle_scan()
|
||||
time = 10
|
||||
return
|
||||
|
||||
|
||||
dropped()
|
||||
spawn(0)
|
||||
sense()
|
||||
return
|
||||
return
|
||||
|
||||
|
||||
toggle_scan()
|
||||
if(!secured) return 0
|
||||
scanning = !scanning
|
||||
update_icon()
|
||||
return
|
||||
|
||||
|
||||
update_icon()
|
||||
overlays.Cut()
|
||||
attached_overlays = list()
|
||||
if(timing)
|
||||
overlays += "prox_timing"
|
||||
attached_overlays += "prox_timing"
|
||||
if(scanning)
|
||||
overlays += "prox_scanning"
|
||||
attached_overlays += "prox_scanning"
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
if(holder && istype(holder.loc,/obj/item/weapon/grenade/chem_grenade))
|
||||
var/obj/item/weapon/grenade/chem_grenade/grenade = holder.loc
|
||||
grenade.primed(scanning)
|
||||
return
|
||||
|
||||
|
||||
Move()
|
||||
..()
|
||||
/obj/item/device/assembly/prox_sensor/dropped()
|
||||
spawn(0)
|
||||
sense()
|
||||
return
|
||||
return
|
||||
|
||||
|
||||
interact(mob/user as mob)//TODO: Change this to the wires thingy
|
||||
if(!secured)
|
||||
user.show_message("\red The [name] is unsecured!")
|
||||
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")
|
||||
/obj/item/device/assembly/prox_sensor/proc/toggle_scan()
|
||||
if(!secured) return 0
|
||||
scanning = !scanning
|
||||
update_icon()
|
||||
return
|
||||
|
||||
|
||||
/obj/item/device/assembly/prox_sensor/update_icon()
|
||||
overlays.Cut()
|
||||
attached_overlays = list()
|
||||
if(timing)
|
||||
overlays += "prox_timing"
|
||||
attached_overlays += "prox_timing"
|
||||
if(scanning)
|
||||
overlays += "prox_scanning"
|
||||
attached_overlays += "prox_scanning"
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
if(holder && istype(holder.loc,/obj/item/weapon/grenade/chem_grenade))
|
||||
var/obj/item/weapon/grenade/chem_grenade/grenade = holder.loc
|
||||
grenade.primed(scanning)
|
||||
return
|
||||
|
||||
|
||||
/obj/item/device/assembly/prox_sensor/Move()
|
||||
..()
|
||||
sense()
|
||||
return
|
||||
|
||||
|
||||
/obj/item/device/assembly/prox_sensor/interact(mob/user as mob)//TODO: Change this to the wires thingy
|
||||
if(!secured)
|
||||
user.show_message("\red The [name] is unsecured!")
|
||||
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
|
||||
|
||||
|
||||
/obj/item/device/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
|
||||
|
||||
if(href_list["scanning"])
|
||||
toggle_scan()
|
||||
|
||||
Topic(href, href_list)
|
||||
if(..()) return 1
|
||||
if(!usr.canmove || usr.stat || usr.restrained() || !in_range(loc, usr))
|
||||
usr << browse(null, "window=prox")
|
||||
onclose(usr, "prox")
|
||||
return
|
||||
if(href_list["time"])
|
||||
timing = text2num(href_list["time"])
|
||||
update_icon()
|
||||
|
||||
if(href_list["scanning"])
|
||||
toggle_scan()
|
||||
|
||||
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["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)
|
||||
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
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
return
|
||||
if(istype(W, /obj/item/weapon/screwdriver))
|
||||
status = !status
|
||||
user << "<span class='notice'>[src] is now [status ? "secured" : "unsecured"]!</span>"
|
||||
to_chat(user, "<span class='notice'>[src] is now [status ? "secured" : "unsecured"]!</span>")
|
||||
add_fingerprint(user)
|
||||
return
|
||||
|
||||
|
||||
@@ -17,171 +17,171 @@
|
||||
var/datum/radio_frequency/radio_connection
|
||||
var/deadman = 0
|
||||
|
||||
New()
|
||||
..()
|
||||
spawn(40)
|
||||
set_frequency(frequency)
|
||||
return
|
||||
/obj/item/device/assembly/signaler/New()
|
||||
..()
|
||||
spawn(40)
|
||||
set_frequency(frequency)
|
||||
return
|
||||
|
||||
|
||||
activate()
|
||||
if(cooldown > 0) return 0
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
process_cooldown()
|
||||
/obj/item/device/assembly/signaler/activate()
|
||||
if(cooldown > 0) return 0
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
process_cooldown()
|
||||
|
||||
signal()
|
||||
return 1
|
||||
signal()
|
||||
return 1
|
||||
|
||||
update_icon()
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
return
|
||||
/obj/item/device/assembly/signaler/update_icon()
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
return
|
||||
|
||||
interact(mob/user as mob, flag1)
|
||||
var/t1 = "-------"
|
||||
/obj/item/device/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>
|
||||
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>
|
||||
<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")
|
||||
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/device/assembly/signaler/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=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)
|
||||
|
||||
Topic(href, href_list)
|
||||
if(..()) return 1
|
||||
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(!usr.canmove || usr.stat || usr.restrained() || !in_range(loc, usr))
|
||||
usr << browse(null, "window=radio")
|
||||
onclose(usr, "radio")
|
||||
return
|
||||
if(href_list["send"])
|
||||
spawn( 0 )
|
||||
signal()
|
||||
|
||||
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(usr)
|
||||
attack_self(usr)
|
||||
|
||||
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)
|
||||
return
|
||||
|
||||
if(href_list["send"])
|
||||
spawn( 0 )
|
||||
signal()
|
||||
/obj/item/device/assembly/signaler/attackby(obj/item/weapon/W, mob/user, params)
|
||||
if(issignaler(W))
|
||||
var/obj/item/device/assembly/signaler/signaler2 = W
|
||||
if(secured && signaler2.secured)
|
||||
code = signaler2.code
|
||||
frequency = signaler2.frequency
|
||||
to_chat(user, "You transfer the frequency and code of [signaler2] to [src].")
|
||||
else
|
||||
..()
|
||||
|
||||
if(usr)
|
||||
attack_self(usr)
|
||||
/obj/item/device/assembly/signaler/proc/signal()
|
||||
if(!radio_connection) return
|
||||
|
||||
return
|
||||
|
||||
attackby(obj/item/weapon/W, mob/user, params)
|
||||
if(issignaler(W))
|
||||
var/obj/item/device/assembly/signaler/signaler2 = W
|
||||
if(secured && signaler2.secured)
|
||||
code = signaler2.code
|
||||
frequency = signaler2.frequency
|
||||
user << "You transfer the frequency and code of [signaler2] to [src]"
|
||||
else
|
||||
..()
|
||||
|
||||
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
|
||||
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*/
|
||||
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
|
||||
/obj/item/device/assembly/signaler/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)
|
||||
/obj/item/device/assembly/signaler/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)
|
||||
if(!holder)
|
||||
for(var/mob/O in hearers(1, src.loc))
|
||||
O.show_message(text("\icon[] *beep* *beep*", src), 3, "*beep* *beep*", 2)
|
||||
return
|
||||
|
||||
|
||||
/obj/item/device/assembly/signaler/proc/set_frequency(new_frequency)
|
||||
if(!frequency)
|
||||
return
|
||||
|
||||
|
||||
proc/set_frequency(new_frequency)
|
||||
if(!frequency)
|
||||
return
|
||||
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)
|
||||
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
|
||||
/obj/item/device/assembly/signaler/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)
|
||||
log_and_message_admins("is threatening to trigger a signaler deadman's switch")
|
||||
usr.visible_message("\red [usr] moves their finger over [src]'s signal button...")
|
||||
/obj/item/device/assembly/signaler/verb/deadman_it()
|
||||
set src in usr
|
||||
set name = "Threaten to push the button!"
|
||||
set desc = "BOOOOM!"
|
||||
deadman = 1
|
||||
processing_objects.Add(src)
|
||||
log_and_message_admins("is threatening to trigger a signaler deadman's switch")
|
||||
usr.visible_message("\red [usr] moves their finger over [src]'s signal button...")
|
||||
|
||||
/obj/item/device/assembly/signaler/Destroy()
|
||||
if(radio_controller)
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
name = "timer"
|
||||
desc = "Used to time things. Works well with contraptions which has to count down. Tick tock."
|
||||
icon_state = "timer"
|
||||
origin_tech = list(TECH_MAGNET = 1)
|
||||
matter = list(DEFAULT_WALL_MATERIAL = 500, "glass" = 50, "waste" = 10)
|
||||
origin_tech = list(TECH_MAGNET = 1)
|
||||
matter = list(DEFAULT_WALL_MATERIAL = 500, "glass" = 50, "waste" = 10)
|
||||
|
||||
wires = WIRE_PULSE
|
||||
|
||||
@@ -12,97 +12,94 @@
|
||||
var/timing = 0
|
||||
var/time = 10
|
||||
|
||||
proc
|
||||
timer_end()
|
||||
|
||||
/obj/item/device/assembly/timer/activate()
|
||||
if(!..()) return 0//Cooldown check
|
||||
|
||||
activate()
|
||||
if(!..()) return 0//Cooldown check
|
||||
|
||||
timing = !timing
|
||||
|
||||
update_icon()
|
||||
return 0
|
||||
|
||||
|
||||
toggle_secure()
|
||||
secured = !secured
|
||||
if(secured)
|
||||
processing_objects.Add(src)
|
||||
else
|
||||
timing = 0
|
||||
processing_objects.Remove(src)
|
||||
update_icon()
|
||||
return secured
|
||||
|
||||
|
||||
timer_end()
|
||||
if(!secured) return 0
|
||||
pulse(0)
|
||||
if(!holder)
|
||||
visible_message("\icon[src] *beep* *beep*", "*beep* *beep*")
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
process_cooldown()
|
||||
return
|
||||
|
||||
|
||||
process()
|
||||
if(timing && (time > 0))
|
||||
time--
|
||||
if(timing && time <= 0)
|
||||
timing = 0
|
||||
timer_end()
|
||||
time = 10
|
||||
return
|
||||
|
||||
timing = !timing
|
||||
|
||||
update_icon()
|
||||
overlays.Cut()
|
||||
attached_overlays = list()
|
||||
if(timing)
|
||||
overlays += "timer_timing"
|
||||
attached_overlays += "timer_timing"
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
return 0
|
||||
|
||||
|
||||
/obj/item/device/assembly/timer/toggle_secure()
|
||||
secured = !secured
|
||||
if(secured)
|
||||
processing_objects.Add(src)
|
||||
else
|
||||
timing = 0
|
||||
processing_objects.Remove(src)
|
||||
update_icon()
|
||||
return secured
|
||||
|
||||
|
||||
/obj/item/device/assembly/timer/proc/timer_end()
|
||||
if(!secured) return 0
|
||||
pulse(0)
|
||||
if(!holder)
|
||||
visible_message("\icon[src] *beep* *beep*", "*beep* *beep*")
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
process_cooldown()
|
||||
return
|
||||
|
||||
|
||||
/obj/item/device/assembly/timer/process()
|
||||
if(timing && (time > 0))
|
||||
time--
|
||||
if(timing && time <= 0)
|
||||
timing = 0
|
||||
timer_end()
|
||||
time = 10
|
||||
return
|
||||
|
||||
|
||||
/obj/item/device/assembly/timer/update_icon()
|
||||
overlays.Cut()
|
||||
attached_overlays = list()
|
||||
if(timing)
|
||||
overlays += "timer_timing"
|
||||
attached_overlays += "timer_timing"
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
return
|
||||
|
||||
|
||||
/obj/item/device/assembly/timer/interact(mob/user as mob)//TODO: Have this use the wires
|
||||
if(!secured)
|
||||
user.show_message("\red The [name] is unsecured!")
|
||||
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
|
||||
|
||||
|
||||
/obj/item/device/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
|
||||
|
||||
if(href_list["time"])
|
||||
timing = text2num(href_list["time"])
|
||||
update_icon()
|
||||
|
||||
interact(mob/user as mob)//TODO: Have this use the wires
|
||||
if(!secured)
|
||||
user.show_message("\red The [name] is unsecured!")
|
||||
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")
|
||||
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)
|
||||
|
||||
Topic(href, href_list)
|
||||
if(..()) return 1
|
||||
if(!usr.canmove || usr.stat || usr.restrained() || !in_range(loc, usr))
|
||||
usr << browse(null, "window=timer")
|
||||
onclose(usr, "timer")
|
||||
return
|
||||
|
||||
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
|
||||
return
|
||||
|
||||
@@ -19,4 +19,14 @@
|
||||
up to 18,446,744,073,709,551,616 unique addresses, one of which is assigned to this device."
|
||||
|
||||
description_antag = "Electromagnetic pulses will cause the device to disconnect all linked communicators. Turning off the Exonet node at the Telecomms \
|
||||
satellite will also accomplish this, but for all communicators on and near the station. This may be needed to allow for a quiet kill or capture."
|
||||
satellite will also accomplish this, but for all communicators on and near the station. This may be needed to allow for a quiet kill or capture."
|
||||
|
||||
/obj/item/device/electronic_assembly/device
|
||||
description_info = "This is the guts of a 'device' type electronic assembly, and can either be used in this form or can be used inside of the assembly to \
|
||||
allow it to interact with other assembly type devices (igniter, signaler, proximity sensor, etc). This device has unique inputs that allow it to either send \
|
||||
or receive pulsed signals from an attached items when inside an electronic assembly device frame (looks not unlike a signaler). Ensure the assembly is closed \
|
||||
before placing it inside the frame."
|
||||
|
||||
/obj/item/device/assembly/electronic_assembly
|
||||
description_info = "This is the casing for the 'device' type of electronic assembly. It behaves like any other 'assembly' type device such as an igniter or signaler \
|
||||
and can be attached to others in the same way. Use the 'toggle-open' verb (right click) or a crowbar to pop the electronic device open to add components and close when finished."
|
||||
@@ -31,9 +31,10 @@ var/list/all_integrated_circuits = list()
|
||||
var/extended_desc = null
|
||||
var/list/inputs = list()
|
||||
var/list/outputs = list()
|
||||
var/list/activators = list()
|
||||
var/list/activators = list() //associated_list, = 1 for inbound, = 0 for outbound
|
||||
var/next_use = 0 //Uses world.time
|
||||
var/complexity = 1 //This acts as a limitation on building machines, more resource-intensive components cost more 'space'.
|
||||
var/size = null //This acts as a limitation on building machines, bigger components cost more 'space'. -1 for size 0
|
||||
var/cooldown_per_use = 1 SECOND // Circuits are limited in how many times they can be work()'d by this variable.
|
||||
var/power_draw_per_use = 0 // How much power is drawn when work()'d.
|
||||
var/power_draw_idle = 0 // How much power is drawn when doing nothing.
|
||||
@@ -41,5 +42,6 @@ var/list/all_integrated_circuits = list()
|
||||
var/category_text = "NO CATEGORY THIS IS A BUG" // To show up on circuit printer, and perhaps other places.
|
||||
var/autopulse = -1 // When input is received, the circuit will pulse itself if set to 1. 0 means it won't. -1 means it is permanently off.
|
||||
var/removable = TRUE // Determines if a circuit is removable from the assembly.
|
||||
|
||||
|
||||
var/displayed_name = ""
|
||||
var/allow_multitool = 1 // Allows additional multitool functionality
|
||||
// Used as a global var, (Do not set manually in children).
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#define IC_COMPONENTS_BASE 20
|
||||
#define IC_COMPLEXITY_BASE 80
|
||||
#define IC_COMPLEXITY_BASE 60
|
||||
|
||||
/obj/item/device/electronic_assembly
|
||||
name = "electronic assembly"
|
||||
@@ -13,6 +13,7 @@
|
||||
var/opened = 0
|
||||
var/obj/item/weapon/cell/device/battery = null // Internal cell which most circuits need to work.
|
||||
|
||||
|
||||
/obj/item/device/electronic_assembly/medium
|
||||
name = "electronic mechanism"
|
||||
icon_state = "setup_medium"
|
||||
@@ -38,8 +39,8 @@
|
||||
name = "electronic implant"
|
||||
icon_state = "setup_implant"
|
||||
w_class = ITEMSIZE_TINY
|
||||
max_components = IC_COMPONENTS_BASE / 2
|
||||
max_complexity = IC_COMPLEXITY_BASE / 2
|
||||
max_components = IC_COMPONENTS_BASE / 4
|
||||
max_complexity = IC_COMPLEXITY_BASE / 4
|
||||
var/obj/item/weapon/implant/integrated_circuit/implant = null
|
||||
|
||||
/obj/item/device/electronic_assembly/New()
|
||||
@@ -82,14 +83,19 @@
|
||||
/obj/item/device/electronic_assembly/implant/resolve_nano_host()
|
||||
return implant
|
||||
|
||||
/obj/item/device/electronic_assembly/interact(mob/user)
|
||||
/obj/item/device/electronic_assembly/proc/check_interactivity(mob/user)
|
||||
if(!CanInteract(user, physical_state))
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/obj/item/device/electronic_assembly/interact(mob/user)
|
||||
if(!check_interactivity(user))
|
||||
return
|
||||
|
||||
var/total_parts = 0
|
||||
var/total_complexity = 0
|
||||
for(var/obj/item/integrated_circuit/part in contents)
|
||||
total_parts++
|
||||
total_parts += part.size
|
||||
total_complexity = total_complexity + part.complexity
|
||||
var/HTML = list()
|
||||
|
||||
@@ -103,14 +109,30 @@
|
||||
else
|
||||
HTML += "<span class='danger'>No powercell detected!</span>"
|
||||
HTML += "<br><br>"
|
||||
HTML += "Components;<br>"
|
||||
HTML += "Components:<hr>"
|
||||
HTML += "Built in:<br>"
|
||||
|
||||
|
||||
//Put removable circuits in separate categories from non-removable
|
||||
for(var/obj/item/integrated_circuit/circuit in contents)
|
||||
if(!circuit.removable)
|
||||
HTML += "<a href=?src=\ref[circuit];examine=1;from_assembly=1>[circuit.displayed_name]</a> | "
|
||||
HTML += "<a href=?src=\ref[circuit];rename=1;from_assembly=1>\[Rename\]</a> | "
|
||||
HTML += "<a href=?src=\ref[circuit];scan=1;from_assembly=1>\[Scan with Debugger\]</a> | "
|
||||
HTML += "<a href=?src=\ref[circuit];bottom=\ref[circuit];from_assembly=1>\[Move to Bottom\]</a>"
|
||||
HTML += "<br>"
|
||||
|
||||
HTML += "<hr>"
|
||||
HTML += "Removable:<br>"
|
||||
|
||||
for(var/obj/item/integrated_circuit/circuit in contents)
|
||||
HTML += "<a href=?src=\ref[circuit];examine=1>[circuit.name]</a> | "
|
||||
HTML += "<a href=?src=\ref[circuit];rename=1>\[Rename\]</a> | "
|
||||
HTML += "<a href=?src=\ref[circuit];scan=1>\[Scan with Debugger\]</a> | "
|
||||
if(circuit.removable)
|
||||
HTML += "<a href=?src=\ref[circuit];remove=1>\[Remove\]</a>"
|
||||
HTML += "<br>"
|
||||
HTML += "<a href=?src=\ref[circuit];examine=1;from_assembly=1>[circuit.displayed_name]</a> | "
|
||||
HTML += "<a href=?src=\ref[circuit];rename=1;from_assembly=1>\[Rename\]</a> | "
|
||||
HTML += "<a href=?src=\ref[circuit];scan=1;from_assembly=1>\[Scan with Debugger\]</a> | "
|
||||
HTML += "<a href=?src=\ref[circuit];remove=1;from_assembly=1>\[Remove\]</a> | "
|
||||
HTML += "<a href=?src=\ref[circuit];bottom=\ref[circuit];from_assembly=1>\[Move to Bottom\]</a>"
|
||||
HTML += "<br>"
|
||||
|
||||
HTML += "</body></html>"
|
||||
user << browse(jointext(HTML,null), "window=assembly-\ref[src];size=600x350;border=1;can_resize=1;can_close=1;can_minimize=1")
|
||||
@@ -140,11 +162,11 @@
|
||||
set desc = "Rename your circuit, useful to stay organized."
|
||||
|
||||
var/mob/M = usr
|
||||
if(!CanInteract(M, physical_state))
|
||||
if(!check_interactivity(M))
|
||||
return
|
||||
|
||||
var/input = sanitizeSafe(input("What do you want to name this?", "Rename", src.name) as null|text, MAX_NAME_LEN)
|
||||
if(src && input && CanInteract(M, physical_state))
|
||||
if(src && input)
|
||||
to_chat(M, "<span class='notice'>The machine now has a label reading '[input]'.</span>")
|
||||
name = input
|
||||
|
||||
@@ -191,7 +213,7 @@
|
||||
/obj/item/device/electronic_assembly/proc/get_part_size()
|
||||
. = 0
|
||||
for(var/obj/item/integrated_circuit/part in contents)
|
||||
. += part.w_class
|
||||
. += part.size
|
||||
|
||||
// Returns true if the circuit made it inside.
|
||||
/obj/item/device/electronic_assembly/proc/add_circuit(var/obj/item/integrated_circuit/IC, var/mob/user)
|
||||
@@ -206,7 +228,7 @@
|
||||
var/total_part_size = get_part_size()
|
||||
var/total_complexity = get_part_complexity()
|
||||
|
||||
if((total_part_size + IC.w_class) > max_components)
|
||||
if((total_part_size + IC.size) > max_components)
|
||||
to_chat(user, "<span class='warning'>You can't seem to add the '[IC.name]', as there's insufficient space.</span>")
|
||||
return FALSE
|
||||
if((total_complexity + IC.complexity) > max_complexity)
|
||||
@@ -234,16 +256,18 @@
|
||||
/obj/item/device/electronic_assembly/attackby(var/obj/item/I, var/mob/user)
|
||||
if(istype(I, /obj/item/integrated_circuit))
|
||||
if(!user.unEquip(I))
|
||||
return 0
|
||||
return FALSE
|
||||
if(add_circuit(I, user))
|
||||
to_chat(user, "<span class='notice'>You slide \the [I] inside \the [src].</span>")
|
||||
playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 50, 1)
|
||||
interact(user)
|
||||
return TRUE
|
||||
else if(istype(I, /obj/item/weapon/crowbar))
|
||||
playsound(get_turf(src), 'sound/items/Crowbar.ogg', 50, 1)
|
||||
opened = !opened
|
||||
to_chat(user, "<span class='notice'>You [opened ? "opened" : "closed"] \the [src].</span>")
|
||||
update_icon()
|
||||
return TRUE
|
||||
else if(istype(I, /obj/item/device/integrated_electronics/wirer) || istype(I, /obj/item/device/integrated_electronics/debugger) || istype(I, /obj/item/weapon/screwdriver))
|
||||
if(opened)
|
||||
interact(user)
|
||||
@@ -264,20 +288,38 @@
|
||||
playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 50, 1)
|
||||
to_chat(user, "<span class='notice'>You slot \the [cell] inside \the [src]'s power supplier.</span>")
|
||||
interact(user)
|
||||
|
||||
return TRUE
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/device/electronic_assembly/attack_self(mob/user)
|
||||
if(!check_interactivity(user))
|
||||
return
|
||||
if(opened)
|
||||
interact(user)
|
||||
|
||||
var/list/input_selection = list()
|
||||
var/list/available_inputs = list()
|
||||
for(var/obj/item/integrated_circuit/input/input in contents)
|
||||
if(input.can_be_asked_input)
|
||||
available_inputs.Add(input)
|
||||
var/obj/item/integrated_circuit/input/choice = input(user, "What do you want to interact with?", "Interaction") as null|anything in available_inputs
|
||||
if(choice && CanInteract(user, physical_state))
|
||||
var/i = 0
|
||||
for(var/obj/item/integrated_circuit/s in available_inputs)
|
||||
if(s.name == input.name && s.displayed_name == input.displayed_name && s != input)
|
||||
i++
|
||||
var/disp_name= "[input.displayed_name] \[[input.name]\]"
|
||||
if(i)
|
||||
disp_name += " ([i+1])"
|
||||
input_selection.Add(disp_name)
|
||||
|
||||
var/obj/item/integrated_circuit/input/choice
|
||||
if(available_inputs)
|
||||
var/selection = input(user, "What do you want to interact with?", "Interaction") as null|anything in input_selection
|
||||
if(selection)
|
||||
var/index = input_selection.Find(selection)
|
||||
choice = available_inputs[index]
|
||||
|
||||
if(choice)
|
||||
choice.ask_for_input(user)
|
||||
|
||||
/obj/item/device/electronic_assembly/emp_act(severity)
|
||||
@@ -295,4 +337,5 @@
|
||||
/obj/item/device/electronic_assembly/proc/give_power(amount)
|
||||
if(battery && battery.give(amount * CELLRATE))
|
||||
return TRUE
|
||||
return FALSE
|
||||
return FALSE
|
||||
|
||||
|
||||
84
code/modules/integrated_electronics/core/device.dm
Normal file
84
code/modules/integrated_electronics/core/device.dm
Normal file
@@ -0,0 +1,84 @@
|
||||
/obj/item/device/assembly/electronic_assembly
|
||||
name = "electronic device"
|
||||
desc = "It's a case for building electronics with. It can be attached to other small devices."
|
||||
icon_state = "setup_device"
|
||||
var/opened = 0
|
||||
|
||||
var/obj/item/device/electronic_assembly/device/EA
|
||||
|
||||
/obj/item/device/assembly/electronic_assembly/New()
|
||||
EA = new(src)
|
||||
EA.holder = src
|
||||
..()
|
||||
|
||||
/obj/item/device/assembly/electronic_assembly/attackby(obj/item/I as obj, mob/user as mob)
|
||||
if (iscrowbar(I) )
|
||||
toggle_open(user)
|
||||
else if (opened)
|
||||
EA.attackby(I, user)
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/item/device/assembly/electronic_assembly/proc/toggle_open(mob/user)
|
||||
playsound(get_turf(src), 'sound/items/Crowbar.ogg', 50, 1)
|
||||
opened = !opened
|
||||
EA.opened = opened
|
||||
to_chat(user, "<span class='notice'>You [opened ? "opened" : "closed"] \the [src].</span>")
|
||||
secured = 1
|
||||
update_icon()
|
||||
|
||||
/obj/item/device/assembly/electronic_assembly/update_icon()
|
||||
if(EA)
|
||||
icon_state = initial(icon_state)
|
||||
else
|
||||
icon_state = initial(icon_state)+"0"
|
||||
if(opened)
|
||||
icon_state = icon_state + "-open"
|
||||
|
||||
/obj/item/device/assembly/electronic_assembly/attack_self(mob/user as mob)
|
||||
if(EA)
|
||||
EA.attack_self(user)
|
||||
|
||||
/obj/item/device/assembly/electronic_assembly/pulsed(var/radio = 0) //Called when another assembly acts on this one, var/radio will determine where it came from for wire calcs
|
||||
if(EA)
|
||||
for(var/obj/item/integrated_circuit/built_in/device_input/I in EA.contents)
|
||||
I.do_work()
|
||||
return
|
||||
|
||||
/obj/item/device/assembly/electronic_assembly/examine(mob/user)
|
||||
.=..(user, 1)
|
||||
if(EA)
|
||||
for(var/obj/item/integrated_circuit/IC in EA.contents)
|
||||
IC.external_examine(user)
|
||||
|
||||
/obj/item/device/assembly/electronic_assembly/verb/toggle()
|
||||
set src in usr
|
||||
set category = "Object"
|
||||
set name = "Open/Close Device Assembly"
|
||||
set desc = "Open or close device assembly!"
|
||||
|
||||
toggle_open(usr)
|
||||
|
||||
|
||||
/obj/item/device/electronic_assembly/device
|
||||
name = "electronic device"
|
||||
icon_state = "setup_device"
|
||||
desc = "It's a tiny electronic device with specific use for attaching to other devices."
|
||||
var/obj/item/device/assembly/electronic_assembly/holder
|
||||
w_class = ITEMSIZE_TINY
|
||||
max_components = IC_COMPONENTS_BASE * 3/4
|
||||
max_complexity = IC_COMPLEXITY_BASE * 3/4
|
||||
|
||||
|
||||
/obj/item/device/electronic_assembly/device/New()
|
||||
..()
|
||||
var/obj/item/integrated_circuit/built_in/device_input/input = new(src)
|
||||
var/obj/item/integrated_circuit/built_in/device_output/output = new(src)
|
||||
input.assembly = src
|
||||
output.assembly = src
|
||||
|
||||
/obj/item/device/electronic_assembly/device/check_interactivity(mob/user)
|
||||
if(!CanInteract(user, state = deep_inventory_state))
|
||||
return 0
|
||||
return 1
|
||||
|
||||
@@ -42,3 +42,17 @@
|
||||
return null
|
||||
return activators[pin_number]
|
||||
return null
|
||||
|
||||
/obj/item/integrated_circuit/proc/handle_wire(var/datum/integrated_io/pin, var/obj/item/device/integrated_electronics/tool)
|
||||
if(istype(tool, /obj/item/device/integrated_electronics/wirer))
|
||||
var/obj/item/device/integrated_electronics/wirer/wirer = tool
|
||||
if(pin)
|
||||
wirer.wire(pin, usr)
|
||||
return 1
|
||||
|
||||
else if(istype(tool, /obj/item/device/integrated_electronics/debugger))
|
||||
var/obj/item/device/integrated_electronics/debugger/debugger = tool
|
||||
if(pin)
|
||||
debugger.write_data(pin, usr)
|
||||
return 1
|
||||
return 0
|
||||
@@ -4,9 +4,9 @@ a creative player the means to solve many problems. Circuits are held inside an
|
||||
*/
|
||||
|
||||
/obj/item/integrated_circuit/examine(mob/user)
|
||||
. = ..()
|
||||
external_examine(user)
|
||||
interact(user)
|
||||
external_examine(user)
|
||||
. = ..()
|
||||
|
||||
// This should be used when someone is examining while the case is opened.
|
||||
/obj/item/integrated_circuit/proc/internal_examine(mob/user)
|
||||
@@ -31,6 +31,9 @@ a creative player the means to solve many problems. Circuits are held inside an
|
||||
return
|
||||
|
||||
/obj/item/integrated_circuit/New()
|
||||
displayed_name = name
|
||||
if(!size) size = w_class
|
||||
if(size == -1) size = 0
|
||||
setup_io(inputs, /datum/integrated_io/input)
|
||||
setup_io(outputs, /datum/integrated_io/output)
|
||||
setup_io(activators, /datum/integrated_io/activate)
|
||||
@@ -58,22 +61,31 @@ a creative player the means to solve many problems. Circuits are held inside an
|
||||
for(var/datum/integrated_io/io in inputs + outputs + activators)
|
||||
io.scramble()
|
||||
|
||||
/obj/item/integrated_circuit/proc/check_interactivity(mob/user)
|
||||
if(assembly)
|
||||
return assembly.check_interactivity(user)
|
||||
else if(!CanInteract(user, physical_state))
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/obj/item/integrated_circuit/verb/rename_component()
|
||||
set name = "Rename Circuit"
|
||||
set category = "Object"
|
||||
set desc = "Rename your circuit, useful to stay organized."
|
||||
|
||||
var/mob/M = usr
|
||||
if(!CanInteract(M, physical_state))
|
||||
if(!check_interactivity(M))
|
||||
return
|
||||
|
||||
var/input = sanitizeSafe(input("What do you want to name the circuit?", "Rename", src.name) as null|text, MAX_NAME_LEN)
|
||||
if(src && input && CanInteract(M, physical_state))
|
||||
if(src && input && assembly.check_interactivity(M))
|
||||
to_chat(M, "<span class='notice'>The circuit '[src.name]' is now labeled '[input]'.</span>")
|
||||
name = input
|
||||
displayed_name = input
|
||||
|
||||
/obj/item/integrated_circuit/interact(mob/user)
|
||||
if(!CanInteract(user, physical_state))
|
||||
if(!check_interactivity(user))
|
||||
return
|
||||
if(!assembly)
|
||||
return
|
||||
|
||||
var/window_height = 350
|
||||
@@ -85,14 +97,17 @@ a creative player the means to solve many problems. Circuits are held inside an
|
||||
var/table_middle_width = "40%"
|
||||
|
||||
var/HTML = list()
|
||||
HTML += "<html><head><title>[src.name]</title></head><body>"
|
||||
HTML += "<html><head><title>[src.displayed_name]</title></head><body>"
|
||||
HTML += "<div align='center'>"
|
||||
HTML += "<table border='1' style='undefined;table-layout: fixed; width: 80%'>"
|
||||
|
||||
HTML += "<br><a href='?src=\ref[src];return=1'>\[Return to Assembly\]</a>"
|
||||
|
||||
HTML += "<br><a href='?src=\ref[src];'>\[Refresh\]</a> | "
|
||||
HTML += "<a href='?src=\ref[src];rename=1'>\[Rename\]</a> | "
|
||||
HTML += "<a href='?src=\ref[src];scan=1'>\[Scan with Debugger\]</a> | "
|
||||
HTML += "<a href='?src=\ref[src];remove=1'>\[Remove\]</a><br>"
|
||||
HTML += "<a href='?src=\ref[src];scan=1'>\[Scan with Device\]</a> | "
|
||||
if(src.removable)
|
||||
HTML += "<a href='?src=\ref[src];remove=1'>\[Remove\]</a><br>"
|
||||
|
||||
HTML += "<colgroup>"
|
||||
HTML += "<col style='width: [table_edge_width]'>"
|
||||
@@ -113,37 +128,31 @@ a creative player the means to solve many problems. Circuits are held inside an
|
||||
if(1)
|
||||
io = get_pin_ref(IC_INPUT, i)
|
||||
if(io)
|
||||
words += "<b><a href=?src=\ref[src];pin_name=1;pin=\ref[io]>[io.name]</a> <a href=?src=\ref[src];pin_data=1;pin=\ref[io]>[io.display_data()]</a></b><br>"
|
||||
if(io.linked.len)
|
||||
words += "<a href=?src=\ref[src];wire=1;pin=\ref[io]><b>[io.name] [io.display_data()]</b></a><br>"
|
||||
for(var/datum/integrated_io/linked in io.linked)
|
||||
words += "<a href=?src=\ref[src];wire=1;pin=\ref[io]>\[[linked.name]\]</a> \
|
||||
@ <a href=?src=\ref[linked.holder];examine=1;>[linked.holder]</a><br>"
|
||||
else
|
||||
words += "<a href=?src=\ref[src];wire=1;pin=\ref[io]>[io.name] [io.display_data()]</a><br>"
|
||||
for(var/datum/integrated_io/linked in io.linked)
|
||||
words += "<a href=?src=\ref[src];wire=1;pin=\ref[io]>\[[linked.name]\]</a> \
|
||||
@ <a href=?src=\ref[linked.holder];examine=1;>[linked.holder]</a><br>"
|
||||
// words += "<a href=?src=\ref[linked.holder];pin_name=1;pin=\ref[linked];link=\ref[io]>\[[linked.name]\]</a>
|
||||
words += "<a href=?src=\ref[src];pin_unwire=1;pin=\ref[io];link=\ref[linked]>[linked.name]</a> \
|
||||
@ <a href=?src=\ref[linked.holder];examine=1;>[linked.holder.displayed_name]</a><br>"
|
||||
|
||||
if(outputs.len > inputs.len)
|
||||
height = 1
|
||||
if(2)
|
||||
if(i == 1)
|
||||
words += "[src.name]<br><br>[src.desc]"
|
||||
words += "[src.displayed_name]<br>([src.name])<hr>[src.desc]"
|
||||
height = row_height
|
||||
else
|
||||
continue
|
||||
if(3)
|
||||
io = get_pin_ref(IC_OUTPUT, i)
|
||||
if(io)
|
||||
words += "<b><a href=?src=\ref[src];pin_name=1;pin=\ref[io]>[io.name]</a> <a href=?src=\ref[src];pin_data=1;pin=\ref[io]>[io.display_data()]</a></b><br>"
|
||||
if(io.linked.len)
|
||||
words += "<a href=?src=\ref[src];wire=1;pin=\ref[io]><b>[io.name] [io.display_data()]</b></a><br>"
|
||||
for(var/datum/integrated_io/linked in io.linked)
|
||||
words += "<a href=?src=\ref[src];wire=1;pin=\ref[io]>\[[linked.name]\]</a> \
|
||||
@ <a href=?src=\ref[linked.holder];examine=1;user=\ref[user]>[linked.holder]</a><br>"
|
||||
else
|
||||
words += "<a href=?src=\ref[src];wire=1;pin=\ref[io]>[io.name] [io.display_data()]</a><br>"
|
||||
for(var/datum/integrated_io/linked in io.linked)
|
||||
words += "<a href=?src=\ref[src];wire=1;pin=\ref[io]>\[[linked.name]\]</a> \
|
||||
@ <a href=?src=\ref[linked.holder];examine=1;>[linked.holder]</a><br>"
|
||||
// words += "<a href=?src=\ref[linked.holder];pin_name=1;pin=\ref[linked];link=\ref[io]>\[[linked.name]\]</a>
|
||||
words += "<a href=?src=\ref[src];pin_unwire=1;pin=\ref[io];link=\ref[linked]>[linked.name]</a> \
|
||||
@ <a href=?src=\ref[linked.holder];examine=1;>[linked.holder.displayed_name]</a><br>"
|
||||
|
||||
if(inputs.len > outputs.len)
|
||||
height = 1
|
||||
HTML += "<td align='center' rowspan='[height]'>[jointext(words, null)]</td>"
|
||||
@@ -152,16 +161,14 @@ a creative player the means to solve many problems. Circuits are held inside an
|
||||
for(var/activator in activators)
|
||||
var/datum/integrated_io/io = activator
|
||||
var/words = list()
|
||||
|
||||
words += "<b><a href=?src=\ref[src];pin_name=1;pin=\ref[io]><font color='FF0000'>[io.name]</font></a> <a href=?src=\ref[src];pin_data=1;pin=\ref[io]><font color='FF0000'>[io.data?"\<PULSE IN\>":"\<PULSE OUT\>"]</font></a></b><br>"
|
||||
if(io.linked.len)
|
||||
words += "<a href=?src=\ref[src];wire=1;pin=\ref[io]><font color='FF0000'><b>[io.name]</b></font></a><br>"
|
||||
for(var/datum/integrated_io/linked in io.linked)
|
||||
words += "<a href=?src=\ref[src];wire=1;pin=\ref[io]>\[[linked.name]\]</a> \
|
||||
@ <a href=?src[src];examine=1;user=\ref[user]>[linked.holder]</a><br>"
|
||||
else
|
||||
words += "<a href=?src=\ref[src];wire=1;pin=\ref[io]><font color='FF0000'>[io.name]</font></a><br>"
|
||||
for(var/datum/integrated_io/linked in io.linked)
|
||||
words += "<a href=?src=\ref[src];wire=1;pin=\ref[io]>\[[linked.name]\]</a> \
|
||||
@ <a href=?src=\ref[linked.holder];examine=1;>[linked.holder]</a><br>"
|
||||
// words += "<a href=?src=\ref[linked.holder];pin_name=1;pin=\ref[linked];link=\ref[io]>\[[linked.name]\]</a>
|
||||
words += "<a href=?src=\ref[src];pin_unwire=1;pin=\ref[io];link=\ref[linked]><font color='FF0000'>[linked.name]</font></a> \
|
||||
@ <a href=?src=\ref[linked.holder];examine=1;><font color='FF0000'>[linked.holder.displayed_name]</font></a><br>"
|
||||
|
||||
HTML += "<tr>"
|
||||
HTML += "<td colspan='3' align='center'>[jointext(words, null)]</td>"
|
||||
HTML += "</tr>"
|
||||
@@ -182,20 +189,92 @@ a creative player the means to solve many problems. Circuits are held inside an
|
||||
HTML += "<br><font color='0000AA'>[extended_desc]</font>"
|
||||
|
||||
HTML += "</body></html>"
|
||||
user << browse(jointext(HTML, null), "window=circuit-\ref[src];size=[window_width]x[window_height];border=1;can_resize=1;can_close=1;can_minimize=1")
|
||||
if(src.assembly)
|
||||
user << browse(jointext(HTML, null), "window=assembly-\ref[src.assembly];size=[window_width]x[window_height];border=1;can_resize=1;can_close=1;can_minimize=1")
|
||||
else
|
||||
user << browse(jointext(HTML, null), "window=circuit-\ref[src];size=[window_width]x[window_height];border=1;can_resize=1;can_close=1;can_minimize=1")
|
||||
|
||||
onclose(user, "circuit-\ref[src]")
|
||||
onclose(user, "assembly-\ref[src.assembly]")
|
||||
|
||||
/obj/item/integrated_circuit/Topic(href, href_list, state = physical_state)
|
||||
/obj/item/integrated_circuit/Topic(href, href_list, state = interactive_state)
|
||||
if(!check_interactivity(usr))
|
||||
return
|
||||
if(..())
|
||||
return 1
|
||||
var/pin = locate(href_list["pin"]) in inputs + outputs + activators
|
||||
|
||||
var/update = 1
|
||||
var/obj/item/device/electronic_assembly/A = src.assembly
|
||||
var/update_to_assembly = 0
|
||||
var/datum/integrated_io/pin = locate(href_list["pin"]) in inputs + outputs + activators
|
||||
var/datum/integrated_io/linked = null
|
||||
if(href_list["link"])
|
||||
linked = locate(href_list["link"]) in pin.linked
|
||||
|
||||
var/obj/held_item = usr.get_active_hand()
|
||||
|
||||
if(href_list["rename"])
|
||||
rename_component(usr)
|
||||
if(href_list["from_assembly"])
|
||||
update = 0
|
||||
var/obj/item/device/electronic_assembly/ea = loc
|
||||
if(istype(ea))
|
||||
ea.interact(usr)
|
||||
|
||||
if(href_list["pin_name"])
|
||||
if (!istype(held_item, /obj/item/device/multitool) || !allow_multitool)
|
||||
href_list["wire"] = 1
|
||||
else
|
||||
var/obj/item/device/multitool/M = held_item
|
||||
M.wire(pin,usr)
|
||||
|
||||
|
||||
|
||||
if(href_list["pin_data"])
|
||||
if (!istype(held_item, /obj/item/device/multitool) || !allow_multitool)
|
||||
href_list["wire"] = 1
|
||||
|
||||
else
|
||||
var/datum/integrated_io/io = pin
|
||||
if(io.io_type == DATA_CHANNEL)
|
||||
|
||||
var/type_to_use = input("Please choose a type to use.","[src] type setting") as null|anything in list("string","number", "null")
|
||||
if(!check_interactivity(usr))
|
||||
return
|
||||
|
||||
var/new_data = null
|
||||
switch(type_to_use)
|
||||
if("string")
|
||||
new_data = input("Now type in a string.","[src] string writing") as null|text
|
||||
to_chat(usr, "<span class='notice'>You input [new_data] into the pin.</span>")
|
||||
//to_chat(user, "<span class='notice'>You write '[new_data]' to the '[io]' pin of \the [io.holder].</span>")
|
||||
if("number")
|
||||
new_data = input("Now type in a number.","[src] number writing") as null|num
|
||||
if(isnum(new_data) && check_interactivity(usr) )
|
||||
to_chat(usr, "<span class='notice'>You input [new_data] into the pin.</span>")
|
||||
if("null")
|
||||
if(check_interactivity(usr))
|
||||
to_chat(usr, "<span class='notice'>You clear the pin's memory.</span>")
|
||||
|
||||
io.write_data_to_pin(new_data)
|
||||
|
||||
else if(io.io_type == PULSE_CHANNEL)
|
||||
io.holder.check_then_do_work(ignore_power = TRUE)
|
||||
to_chat(usr, "<span class='notice'>You pulse \the [io.holder]'s [io] pin.</span>")
|
||||
|
||||
|
||||
if(href_list["pin_unwire"])
|
||||
if (!istype(held_item, /obj/item/device/multitool) || !allow_multitool)
|
||||
href_list["wire"] = 1
|
||||
else
|
||||
var/obj/item/device/multitool/M = held_item
|
||||
M.unwire(pin, linked, usr)
|
||||
|
||||
if(href_list["wire"])
|
||||
if(istype(held_item, /obj/item/device/integrated_electronics/wirer))
|
||||
var/obj/item/device/integrated_electronics/wirer/wirer = held_item
|
||||
if(pin)
|
||||
if(linked)
|
||||
wirer.wire(linked, usr)
|
||||
else if(pin)
|
||||
wirer.wire(pin, usr)
|
||||
|
||||
else if(istype(held_item, /obj/item/device/integrated_electronics/debugger))
|
||||
@@ -206,10 +285,23 @@ a creative player the means to solve many problems. Circuits are held inside an
|
||||
to_chat(usr, "<span class='warning'>You can't do a whole lot without the proper tools.</span>")
|
||||
|
||||
if(href_list["examine"])
|
||||
examine(usr)
|
||||
var/obj/item/integrated_circuit/examined
|
||||
if(href_list["examined"])
|
||||
examined = href_list["examined"]
|
||||
else
|
||||
examined = src
|
||||
examined.interact(usr)
|
||||
update = 0
|
||||
|
||||
if(href_list["rename"])
|
||||
rename_component(usr)
|
||||
if(href_list["bottom"])
|
||||
var/obj/item/integrated_circuit/circuit = locate(href_list["bottom"]) in src.assembly.contents
|
||||
var/assy = circuit.assembly
|
||||
if(!circuit)
|
||||
return
|
||||
circuit.loc = null
|
||||
circuit.loc = assy
|
||||
. = 1
|
||||
update_to_assembly = 1
|
||||
|
||||
if(href_list["scan"])
|
||||
if(istype(held_item, /obj/item/device/integrated_electronics/debugger))
|
||||
@@ -219,31 +311,47 @@ a creative player the means to solve many problems. Circuits are held inside an
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>The Debugger's 'ref scanner' needs to be on.</span>")
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>You need a Debugger set to 'ref' mode to do that.</span>")
|
||||
to_chat(usr, "<span class='warning'>You need a multitool/debugger set to 'ref' mode to do that.</span>")
|
||||
|
||||
if(href_list["autopulse"])
|
||||
if(autopulse != -1)
|
||||
autopulse = !autopulse
|
||||
|
||||
if(href_list["remove"])
|
||||
if(istype(held_item, /obj/item/weapon/screwdriver))
|
||||
if(!removable)
|
||||
to_chat(usr, "<span class='warning'>\The [src] seems to be permanently attached to the case.</span>")
|
||||
return
|
||||
disconnect_all()
|
||||
var/turf/T = get_turf(src)
|
||||
forceMove(T)
|
||||
assembly = null
|
||||
playsound(T, 'sound/items/Crowbar.ogg', 50, 1)
|
||||
to_chat(usr, "<span class='notice'>You pop \the [src] out of the case, and slide it out.</span>")
|
||||
if(href_list["return"])
|
||||
if(A)
|
||||
update_to_assembly = 1
|
||||
usr << browse(null, "window=circuit-\ref[src];border=1;can_resize=1;can_close=1;can_minimize=1")
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>You need a screwdriver to remove components.</span>")
|
||||
to_chat(usr, "<span class='warning'>This circuit is not in an assembly!</span>")
|
||||
|
||||
|
||||
if(href_list["remove"])
|
||||
if(!A)
|
||||
to_chat(usr, "<span class='warning'>This circuit is not in an assembly!</span>")
|
||||
return
|
||||
if(!removable)
|
||||
to_chat(usr, "<span class='warning'>\The [src] seems to be permanently attached to the case.</span>")
|
||||
return
|
||||
var/obj/item/device/electronic_assembly/ea = loc
|
||||
disconnect_all()
|
||||
var/turf/T = get_turf(src)
|
||||
forceMove(T)
|
||||
assembly = null
|
||||
playsound(T, 'sound/items/Crowbar.ogg', 50, 1)
|
||||
to_chat(usr, "<span class='notice'>You pop \the [src] out of the case, and slide it out.</span>")
|
||||
|
||||
if(istype(ea))
|
||||
ea.interact(usr)
|
||||
update = 0
|
||||
return
|
||||
|
||||
interact(usr) // To refresh the UI.
|
||||
if(update)
|
||||
if(A && istype(A) && update_to_assembly)
|
||||
A.interact(usr)
|
||||
else
|
||||
interact(usr) // To refresh the UI.
|
||||
|
||||
|
||||
|
||||
/obj/item/integrated_circuit/proc/push_data()
|
||||
for(var/datum/integrated_io/output/O in outputs)
|
||||
|
||||
@@ -165,6 +165,89 @@
|
||||
|
||||
io.holder.interact(user) // This is to update the UI.
|
||||
|
||||
|
||||
|
||||
|
||||
/obj/item/device/multitool
|
||||
var/datum/integrated_io/selected_io = null
|
||||
var/mode = 0
|
||||
|
||||
/obj/item/device/multitool/attack_self(mob/user)
|
||||
if(selected_io)
|
||||
selected_io = null
|
||||
to_chat(user, "<span class='notice'>You clear the wired connection from the multitool.</span>")
|
||||
else
|
||||
..()
|
||||
update_icon()
|
||||
|
||||
/obj/item/device/multitool/update_icon()
|
||||
if(selected_io)
|
||||
if(buffer || connecting || connectable)
|
||||
icon_state = "multitool_tracking"
|
||||
else
|
||||
icon_state = "multitool_red"
|
||||
else
|
||||
if(buffer || connecting || connectable)
|
||||
icon_state = "multitool_tracking_fail"
|
||||
else
|
||||
icon_state = "multitool"
|
||||
|
||||
/obj/item/device/multitool/proc/wire(var/datum/integrated_io/io, mob/user)
|
||||
if(!io.holder.assembly)
|
||||
to_chat(user, "<span class='warning'>\The [io.holder] needs to be secured inside an assembly first.</span>")
|
||||
return
|
||||
|
||||
if(selected_io)
|
||||
if(io == selected_io)
|
||||
to_chat(user, "<span class='warning'>Wiring \the [selected_io.holder]'s [selected_io.name] into itself is rather pointless.</span>")
|
||||
return
|
||||
if(io.io_type != selected_io.io_type)
|
||||
to_chat(user, "<span class='warning'>Those two types of channels are incompatable. The first is a [selected_io.io_type], \
|
||||
while the second is a [io.io_type].</span>")
|
||||
return
|
||||
if(io.holder.assembly && io.holder.assembly != selected_io.holder.assembly)
|
||||
to_chat(user, "<span class='warning'>Both \the [io.holder] and \the [selected_io.holder] need to be inside the same assembly.</span>")
|
||||
return
|
||||
selected_io.linked |= io
|
||||
io.linked |= selected_io
|
||||
|
||||
to_chat(user, "<span class='notice'>You connect \the [selected_io.holder]'s [selected_io.name] to \the [io.holder]'s [io.name].</span>")
|
||||
selected_io.holder.interact(user) // This is to update the UI.
|
||||
selected_io = null
|
||||
|
||||
else
|
||||
selected_io = io
|
||||
to_chat(user, "<span class='notice'>You link \the multitool to \the [selected_io.holder]'s [selected_io.name] data channel.</span>")
|
||||
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/item/device/multitool/proc/unwire(var/datum/integrated_io/io1, var/datum/integrated_io/io2, mob/user)
|
||||
if(!io1.linked.len || !io2.linked.len)
|
||||
to_chat(user, "<span class='warning'>There is nothing connected to the data channel.</span>")
|
||||
return
|
||||
|
||||
if(!(io1 in io2.linked) || !(io2 in io1.linked) )
|
||||
to_chat(user, "<span class='warning'>These data pins aren't connected!</span>")
|
||||
return
|
||||
else
|
||||
io1.linked.Remove(io2)
|
||||
io2.linked.Remove(io1)
|
||||
to_chat(user, "<span class='notice'>You clip the data connection between the [io1.holder.displayed_name]'s \
|
||||
[io1.name] and the [io2.holder.displayed_name]'s [io2.name].</span>")
|
||||
io1.holder.interact(user) // This is to update the UI.
|
||||
update_icon()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/obj/item/weapon/storage/bag/circuits
|
||||
name = "circuit kit"
|
||||
desc = "This kit's essential for any circuitry projects."
|
||||
@@ -178,7 +261,8 @@
|
||||
/obj/item/device/electronic_assembly,
|
||||
/obj/item/device/integrated_electronics,
|
||||
/obj/item/weapon/crowbar,
|
||||
/obj/item/weapon/screwdriver
|
||||
/obj/item/weapon/screwdriver,
|
||||
/obj/item/device/multitool
|
||||
)
|
||||
|
||||
/obj/item/weapon/storage/bag/circuits/basic/New()
|
||||
@@ -186,7 +270,7 @@
|
||||
spawn(2 SECONDS) // So the list has time to initialize.
|
||||
// for(var/obj/item/integrated_circuit/IC in all_integrated_circuits)
|
||||
// if(IC.spawn_flags & IC_SPAWN_DEFAULT)
|
||||
// for(var/i = 1 to 3)
|
||||
// for(var/i = 1 to 4)
|
||||
// new IC.type(src)
|
||||
new /obj/item/weapon/storage/bag/circuits/mini/arithmetic(src)
|
||||
new /obj/item/weapon/storage/bag/circuits/mini/trig(src)
|
||||
@@ -201,10 +285,11 @@
|
||||
new /obj/item/weapon/storage/bag/circuits/mini/power(src)
|
||||
|
||||
new /obj/item/device/electronic_assembly(src)
|
||||
new /obj/item/device/integrated_electronics/wirer(src)
|
||||
new /obj/item/device/integrated_electronics/debugger(src)
|
||||
new /obj/item/weapon/crowbar(src)
|
||||
new /obj/item/device/assembly/electronic_assembly(src)
|
||||
new /obj/item/device/assembly/electronic_assembly(src)
|
||||
new /obj/item/device/multitool(src)
|
||||
new /obj/item/weapon/screwdriver(src)
|
||||
new /obj/item/weapon/crowbar(src)
|
||||
make_exact_fit()
|
||||
|
||||
/obj/item/weapon/storage/bag/circuits/all/New()
|
||||
@@ -231,7 +316,6 @@
|
||||
new /obj/item/device/integrated_electronics/wirer(src)
|
||||
new /obj/item/device/integrated_electronics/debugger(src)
|
||||
new /obj/item/weapon/crowbar(src)
|
||||
new /obj/item/weapon/screwdriver(src)
|
||||
make_exact_fit()
|
||||
|
||||
/obj/item/weapon/storage/bag/circuits/mini/
|
||||
@@ -254,7 +338,7 @@
|
||||
..()
|
||||
for(var/obj/item/integrated_circuit/arithmetic/IC in all_integrated_circuits)
|
||||
if(IC.spawn_flags & spawn_flags_to_use)
|
||||
for(var/i = 1 to 3)
|
||||
for(var/i = 1 to 4)
|
||||
new IC.type(src)
|
||||
make_exact_fit()
|
||||
|
||||
@@ -271,7 +355,7 @@
|
||||
..()
|
||||
for(var/obj/item/integrated_circuit/trig/IC in all_integrated_circuits)
|
||||
if(IC.spawn_flags & spawn_flags_to_use)
|
||||
for(var/i = 1 to 3)
|
||||
for(var/i = 1 to 4)
|
||||
new IC.type(src)
|
||||
make_exact_fit()
|
||||
|
||||
@@ -288,7 +372,7 @@
|
||||
..()
|
||||
for(var/obj/item/integrated_circuit/input/IC in all_integrated_circuits)
|
||||
if(IC.spawn_flags & spawn_flags_to_use)
|
||||
for(var/i = 1 to 3)
|
||||
for(var/i = 1 to 4)
|
||||
new IC.type(src)
|
||||
make_exact_fit()
|
||||
|
||||
@@ -305,7 +389,7 @@
|
||||
..()
|
||||
for(var/obj/item/integrated_circuit/output/IC in all_integrated_circuits)
|
||||
if(IC.spawn_flags & spawn_flags_to_use)
|
||||
for(var/i = 1 to 3)
|
||||
for(var/i = 1 to 4)
|
||||
new IC.type(src)
|
||||
make_exact_fit()
|
||||
|
||||
@@ -322,7 +406,7 @@
|
||||
..()
|
||||
for(var/obj/item/integrated_circuit/memory/IC in all_integrated_circuits)
|
||||
if(IC.spawn_flags & spawn_flags_to_use)
|
||||
for(var/i = 1 to 3)
|
||||
for(var/i = 1 to 4)
|
||||
new IC.type(src)
|
||||
make_exact_fit()
|
||||
|
||||
@@ -339,7 +423,7 @@
|
||||
..()
|
||||
for(var/obj/item/integrated_circuit/logic/IC in all_integrated_circuits)
|
||||
if(IC.spawn_flags & spawn_flags_to_use)
|
||||
for(var/i = 1 to 3)
|
||||
for(var/i = 1 to 4)
|
||||
new IC.type(src)
|
||||
make_exact_fit()
|
||||
|
||||
@@ -356,7 +440,7 @@
|
||||
..()
|
||||
for(var/obj/item/integrated_circuit/time/IC in all_integrated_circuits)
|
||||
if(IC.spawn_flags & spawn_flags_to_use)
|
||||
for(var/i = 1 to 3)
|
||||
for(var/i = 1 to 4)
|
||||
new IC.type(src)
|
||||
make_exact_fit()
|
||||
|
||||
@@ -373,7 +457,7 @@
|
||||
..()
|
||||
for(var/obj/item/integrated_circuit/reagent/IC in all_integrated_circuits)
|
||||
if(IC.spawn_flags & spawn_flags_to_use)
|
||||
for(var/i = 1 to 3)
|
||||
for(var/i = 1 to 4)
|
||||
new IC.type(src)
|
||||
make_exact_fit()
|
||||
|
||||
@@ -390,7 +474,7 @@
|
||||
..()
|
||||
for(var/obj/item/integrated_circuit/transfer/IC in all_integrated_circuits)
|
||||
if(IC.spawn_flags & spawn_flags_to_use)
|
||||
for(var/i = 1 to 3)
|
||||
for(var/i = 1 to 4)
|
||||
new IC.type(src)
|
||||
make_exact_fit()
|
||||
|
||||
@@ -407,7 +491,7 @@
|
||||
..()
|
||||
for(var/obj/item/integrated_circuit/converter/IC in all_integrated_circuits)
|
||||
if(IC.spawn_flags & spawn_flags_to_use)
|
||||
for(var/i = 1 to 3)
|
||||
for(var/i = 1 to 4)
|
||||
new IC.type(src)
|
||||
make_exact_fit()
|
||||
|
||||
@@ -423,7 +507,7 @@
|
||||
..()
|
||||
for(var/obj/item/integrated_circuit/smart/IC in all_integrated_circuits)
|
||||
if(IC.spawn_flags & spawn_flags_to_use)
|
||||
for(var/i = 1 to 3)
|
||||
for(var/i = 1 to 4)
|
||||
new IC.type(src)
|
||||
make_exact_fit()
|
||||
|
||||
@@ -439,7 +523,7 @@
|
||||
..()
|
||||
for(var/obj/item/integrated_circuit/manipulation/IC in all_integrated_circuits)
|
||||
if(IC.spawn_flags & spawn_flags_to_use)
|
||||
for(var/i = 1 to 3)
|
||||
for(var/i = 1 to 4)
|
||||
new IC.type(src)
|
||||
make_exact_fit()
|
||||
|
||||
@@ -456,10 +540,10 @@
|
||||
..()
|
||||
for(var/obj/item/integrated_circuit/passive/power/IC in all_integrated_circuits)
|
||||
if(IC.spawn_flags & spawn_flags_to_use)
|
||||
for(var/i = 1 to 3)
|
||||
for(var/i = 1 to 4)
|
||||
new IC.type(src)
|
||||
for(var/obj/item/integrated_circuit/power/IC in all_integrated_circuits)
|
||||
if(IC.spawn_flags & spawn_flags_to_use)
|
||||
for(var/i = 1 to 3)
|
||||
for(var/i = 1 to 4)
|
||||
new IC.type(src)
|
||||
make_exact_fit()
|
||||
@@ -12,7 +12,7 @@
|
||||
"\<NUM\> H"
|
||||
)
|
||||
outputs = list("\<NUM\> result")
|
||||
activators = list("\<PULSE IN\> compute", "\<PULSE OUT\> on computed")
|
||||
activators = list("compute" = 1, "on computed" = 0)
|
||||
category_text = "Arithmetic"
|
||||
autopulse = 1
|
||||
power_draw_per_use = 5 // Math is pretty cheap.
|
||||
|
||||
28
code/modules/integrated_electronics/subtypes/built_in.dm
Normal file
28
code/modules/integrated_electronics/subtypes/built_in.dm
Normal file
@@ -0,0 +1,28 @@
|
||||
/obj/item/integrated_circuit/built_in
|
||||
name = "integrated circuit"
|
||||
desc = "It's a tiny chip! This one doesn't seem to do much, however."
|
||||
icon = 'icons/obj/electronic_assemblies.dmi'
|
||||
icon_state = "template"
|
||||
size = -1
|
||||
w_class = ITEMSIZE_TINY
|
||||
removable = FALSE // Determines if a circuit is removable from the assembly.
|
||||
|
||||
/obj/item/integrated_circuit/built_in/device_input
|
||||
name = "assembly input"
|
||||
desc = "A built in chip for handling pulses from attached assembly items."
|
||||
complexity = 0 //This acts as a limitation on building machines, more resource-intensive components cost more 'space'.
|
||||
activators = list("on pulsed" = 0)
|
||||
|
||||
/obj/item/integrated_circuit/built_in/device_input/do_work()
|
||||
activate_pin(1)
|
||||
|
||||
/obj/item/integrated_circuit/built_in/device_output
|
||||
name = "assembly out"
|
||||
desc = "A built in chip for pulsing attached assembly items."
|
||||
complexity = 0 //This acts as a limitation on building machines, more resource-intensive components cost more 'space'.
|
||||
activators = list("pulse attached" = 1)
|
||||
|
||||
/obj/item/integrated_circuit/built_in/device_output/do_work()
|
||||
if(istype(assembly, /obj/item/device/electronic_assembly/device))
|
||||
var/obj/item/device/electronic_assembly/device/device = assembly
|
||||
device.holder.pulse()
|
||||
@@ -3,7 +3,7 @@
|
||||
complexity = 2
|
||||
inputs = list("input")
|
||||
outputs = list("output")
|
||||
activators = list("\<PULSE IN\> convert", "\<PULSE OUT\> on convert")
|
||||
activators = list("convert" = 1, "on convert" = 0)
|
||||
category_text = "Converter"
|
||||
autopulse = 1
|
||||
power_draw_per_use = 10
|
||||
@@ -15,6 +15,7 @@
|
||||
/obj/item/integrated_circuit/converter/num2text
|
||||
name = "number to string"
|
||||
desc = "This circuit can convert a number variable into a string."
|
||||
extended_desc = "Because of game limitations null/false variables will output a '0' string."
|
||||
icon_state = "num-string"
|
||||
inputs = list("\<NUM\> input")
|
||||
outputs = list("\<TEXT\> output")
|
||||
@@ -26,6 +27,8 @@
|
||||
var/incoming = get_pin_data(IC_INPUT, 1)
|
||||
if(incoming && isnum(incoming))
|
||||
result = num2text(incoming)
|
||||
else if(!incoming)
|
||||
result = "0"
|
||||
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
@@ -107,8 +110,8 @@
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
/obj/item/integrated_circuit/converter/concatenatior
|
||||
name = "concatenatior"
|
||||
/obj/item/integrated_circuit/converter/concatenator
|
||||
name = "concatenator"
|
||||
desc = "This joins many strings or numbers together to get one big string."
|
||||
complexity = 4
|
||||
inputs = list(
|
||||
@@ -122,10 +125,10 @@
|
||||
"\<TEXT/NUM\> H"
|
||||
)
|
||||
outputs = list("\<TEXT\> result")
|
||||
activators = list("\<PULSE IN\> concatenate", "\<PULSE OUT\> on concatenated")
|
||||
activators = list("concatenate" = 1, "on concatenated" = 0)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/converter/concatenatior/do_work()
|
||||
/obj/item/integrated_circuit/converter/concatenator/do_work()
|
||||
var/result = null
|
||||
for(var/datum/integrated_io/input/I in inputs)
|
||||
I.pull_data()
|
||||
@@ -139,6 +142,44 @@
|
||||
outgoing.push_data()
|
||||
activate_pin(2)
|
||||
|
||||
/obj/item/integrated_circuit/converter/separator
|
||||
name = "separator"
|
||||
desc = "This splits as single string into two at the relative split point."
|
||||
extended_desc = "This circuits splits a given string into two, based on the string, and the index value. \
|
||||
The index splits the string <b>after</b> the given index, including spaces. So 'a person' with an index of '3' \
|
||||
will split into 'a p' and 'erson'."
|
||||
complexity = 4
|
||||
inputs = list(
|
||||
"\<TEXT\> string",
|
||||
"\<NUM\> index",
|
||||
)
|
||||
outputs = list(
|
||||
"\<TEXT\> before split",
|
||||
"\<TEXT\> after split"
|
||||
)
|
||||
activators = list("separate" = 1, "on separated" = 0)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
|
||||
/obj/item/integrated_circuit/converter/separator/do_work()
|
||||
var/text = get_pin_data(IC_INPUT, 1)
|
||||
var/index = get_pin_data(IC_INPUT, 2)
|
||||
|
||||
var/split = min(index+1, length(text))
|
||||
|
||||
var/before_text = copytext(text, 1, split)
|
||||
var/after_text = copytext(text, split, 0)
|
||||
|
||||
var/datum/integrated_io/outgoing1 = outputs[1]
|
||||
var/datum/integrated_io/outgoing2 = outputs[2]
|
||||
outgoing1.data = before_text
|
||||
outgoing2.data = after_text
|
||||
outgoing1.push_data()
|
||||
outgoing2.push_data()
|
||||
|
||||
activate_pin(2)
|
||||
|
||||
|
||||
/obj/item/integrated_circuit/converter/radians2degrees
|
||||
name = "radians to degrees converter"
|
||||
desc = "Converts radians to degrees."
|
||||
@@ -182,7 +223,7 @@
|
||||
complexity = 4
|
||||
inputs = list("\<NUM\> X1", "\<NUM\> Y1", "\<NUM\> X2", "\<NUM\> Y2")
|
||||
outputs = list("\<NUM\> X", "\<NUM\> Y")
|
||||
activators = list("\<PULSE IN\> compute rel coordinates", "\<PULSE OUT\> on convert")
|
||||
activators = list("compute rel coordinates" = 1, "on convert" = 0)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/converter/abs_to_rel_coords/do_work()
|
||||
|
||||
@@ -44,9 +44,9 @@
|
||||
icon_state = "splitter"
|
||||
complexity = 3
|
||||
activators = list(
|
||||
"incoming pulse",
|
||||
"outgoing pulse A",
|
||||
"outgoing pulse B"
|
||||
"pulse" = 1,
|
||||
"pulse A" = 0,
|
||||
"pulse B" = 0
|
||||
)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 2
|
||||
@@ -64,11 +64,11 @@
|
||||
icon_state = "splitter4"
|
||||
complexity = 5
|
||||
activators = list(
|
||||
"incoming pulse",
|
||||
"outgoing pulse A",
|
||||
"outgoing pulse B",
|
||||
"outgoing pulse C",
|
||||
"outgoing pulse D"
|
||||
"pulse" = 1,
|
||||
"pulse A" = 0,
|
||||
"pulse B" = 0,
|
||||
"pulse C" = 0,
|
||||
"pulse D" = 0
|
||||
)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 4
|
||||
@@ -79,15 +79,15 @@
|
||||
w_class = ITEMSIZE_SMALL
|
||||
complexity = 9
|
||||
activators = list(
|
||||
"incoming pulse",
|
||||
"outgoing pulse A",
|
||||
"outgoing pulse B",
|
||||
"outgoing pulse C",
|
||||
"outgoing pulse D",
|
||||
"outgoing pulse E",
|
||||
"outgoing pulse F",
|
||||
"outgoing pulse G",
|
||||
"outgoing pulse H"
|
||||
"incoming pulse" = 1,
|
||||
"outgoing pulse A" = 0,
|
||||
"outgoing pulse B" = 0,
|
||||
"outgoing pulse C" = 0,
|
||||
"outgoing pulse D" = 0,
|
||||
"outgoing pulse E" = 0,
|
||||
"outgoing pulse F" = 0,
|
||||
"outgoing pulse G" = 0,
|
||||
"outgoing pulse H" = 0
|
||||
)
|
||||
spawn_flags = IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 8
|
||||
@@ -101,7 +101,7 @@
|
||||
icon_state = "mux2"
|
||||
inputs = list("input selection")
|
||||
outputs = list("output")
|
||||
activators = list("select")
|
||||
activators = list("select" = 1, "on select" = 0)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 4
|
||||
var/number_of_inputs = 2
|
||||
@@ -120,7 +120,10 @@
|
||||
|
||||
if(isnum(input_index) && (input_index >= 1 && input_index < inputs.len))
|
||||
output = get_pin_data(IC_INPUT, input_index + 1)
|
||||
|
||||
set_pin_data(IC_OUTPUT, 1, output)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
/obj/item/integrated_circuit/transfer/multiplexer/medium
|
||||
name = "four multiplexer"
|
||||
@@ -147,7 +150,7 @@
|
||||
icon_state = "dmux2"
|
||||
inputs = list("output selection","input")
|
||||
outputs = list()
|
||||
activators = list("select")
|
||||
activators = list("select" = 1)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 4
|
||||
var/number_of_outputs = 2
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
can_be_asked_input = 1
|
||||
inputs = list()
|
||||
outputs = list()
|
||||
activators = list("\<PULSE OUT\> on pressed")
|
||||
activators = list("on pressed" = 0)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/input/button/ask_for_input(mob/user) //Bit misleading name for this specific use.
|
||||
@@ -29,7 +29,7 @@
|
||||
can_be_asked_input = 1
|
||||
inputs = list()
|
||||
outputs = list("\<NUM\> on" = 0)
|
||||
activators = list("\<PULSE OUT\> on toggle")
|
||||
activators = list("on toggle" = 0)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/input/toggle_button/ask_for_input(mob/user) // Ditto.
|
||||
@@ -46,7 +46,7 @@
|
||||
can_be_asked_input = 1
|
||||
inputs = list()
|
||||
outputs = list("\<NUM\> number entered")
|
||||
activators = list("\<PULSE OUT\> on entered")
|
||||
activators = list("on entered" = 0)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 4
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
can_be_asked_input = 1
|
||||
inputs = list()
|
||||
outputs = list("\<TEXT\> string entered")
|
||||
activators = list("\<PULSE OUT\> on entered")
|
||||
activators = list("on entered" = 0)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 4
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
complexity = 4
|
||||
inputs = list("\<REF\> target")
|
||||
outputs = list("\<NUM\> total health %", "\<NUM\> total missing health")
|
||||
activators = list("\<PULSE IN\> scan", "\<PULSE OUT\> on scanned")
|
||||
activators = list("scan" = 1, "on scanned" = 0)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
origin_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_BIO = 2)
|
||||
power_draw_per_use = 40
|
||||
@@ -118,7 +118,7 @@
|
||||
"\<NUM\> oxy damage",
|
||||
"\<NUM\> clone damage"
|
||||
)
|
||||
activators = list("\<PULSE IN\> scan", "\<PULSE OUT\> on scanned")
|
||||
activators = list("scan" = 1, "on scanned" = 0)
|
||||
spawn_flags = IC_SPAWN_RESEARCH
|
||||
origin_tech = list(TECH_ENGINEERING = 3, TECH_DATA = 3, TECH_BIO = 4)
|
||||
power_draw_per_use = 80
|
||||
@@ -148,7 +148,7 @@
|
||||
that is holding the machine containing it."
|
||||
inputs = list()
|
||||
outputs = list("located ref")
|
||||
activators = list("locate")
|
||||
activators = list("locate" = 1)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 20
|
||||
|
||||
@@ -170,7 +170,7 @@
|
||||
random."
|
||||
inputs = list("desired type ref")
|
||||
outputs = list("located ref")
|
||||
activators = list("locate")
|
||||
activators = list("locate" = 1)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 30
|
||||
|
||||
@@ -206,7 +206,7 @@
|
||||
complexity = 4
|
||||
inputs = list("\<NUM\> frequency","\<NUM\> code")
|
||||
outputs = list()
|
||||
activators = list("\<PULSE IN\> send signal","\<PULSE OUT\> on signal sent", "\<PULSE OUT\> on signal received")
|
||||
activators = list("send signal" = 1,"on signal sent" = 0, "on signal received" = 0)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
origin_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_MAGNET = 2)
|
||||
power_draw_idle = 5
|
||||
@@ -288,7 +288,7 @@
|
||||
complexity = 4
|
||||
inputs = list("\<TEXT\> target EPv2 address", "\<TEXT\> data to send", "\<TEXT\> secondary text")
|
||||
outputs = list("\<TEXT\> address received", "\<TEXT\> data received", "\<TEXT\> secondary text received")
|
||||
activators = list("\<PULSE IN\> send data", "\<PULSE OUT\> on data received")
|
||||
activators = list("send data" = 1, "on data received" = 0)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
origin_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_MAGNET = 2, TECH_BLUESPACE = 2)
|
||||
power_draw_per_use = 50
|
||||
@@ -332,7 +332,7 @@
|
||||
complexity = 4
|
||||
inputs = list()
|
||||
outputs = list("\<NUM\> X", "\<NUM\> Y")
|
||||
activators = list("\<PULSE IN\> get coordinates", "\<PULSE OUT\> on get coordinates")
|
||||
activators = list("get coordinates" = 1, "on get coordinates" = 0)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 30
|
||||
|
||||
@@ -361,7 +361,7 @@
|
||||
complexity = 8
|
||||
inputs = list()
|
||||
outputs = list("\<TEXT\> speaker", "\<TEXT\> message")
|
||||
activators = list("\<PULSE OUT\> on message received", "\<PULSE OUT\> on translation")
|
||||
activators = list("on message received" = 1, "on translation" = 0)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 15
|
||||
|
||||
@@ -399,7 +399,7 @@
|
||||
complexity = 12
|
||||
inputs = list("\<NUM\> ignore storage" = 1)
|
||||
outputs = list("\<REF\> scanned")
|
||||
activators = list("\<PULSE OUT\> on scanned")
|
||||
activators = list("on scanned" = 0)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 120
|
||||
|
||||
@@ -423,7 +423,7 @@
|
||||
icon_state = "screen"
|
||||
inputs = list("\<TEXT/NUM\> displayed data")
|
||||
outputs = list()
|
||||
activators = list("\<PULSE IN\> load data")
|
||||
activators = list("load data" = 1)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 10
|
||||
autopulse = 1
|
||||
@@ -477,7 +477,7 @@
|
||||
complexity = 4
|
||||
inputs = list()
|
||||
outputs = list()
|
||||
activators = list("\<PULSE IN\> toggle light")
|
||||
activators = list("toggle light" = 1)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
var/light_toggled = 0
|
||||
var/light_brightness = 3
|
||||
@@ -545,7 +545,7 @@
|
||||
"\<NUM\> frequency"
|
||||
)
|
||||
outputs = list()
|
||||
activators = list("play sound")
|
||||
activators = list("play sound" = 1)
|
||||
power_draw_per_use = 20
|
||||
var/list/sounds = list()
|
||||
|
||||
@@ -558,7 +558,7 @@
|
||||
cooldown_per_use = 4 SECONDS
|
||||
inputs = list("text")
|
||||
outputs = list()
|
||||
activators = list("to speech")
|
||||
activators = list("to speech" = 1)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 60
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
extended_desc = "Logic circuits will treat a null, 0, and a \"\" string value as FALSE and anything else as TRUE."
|
||||
complexity = 3
|
||||
outputs = list("result")
|
||||
activators = list("\<PULSE IN\> compare")
|
||||
activators = list("compare" = 1)
|
||||
category_text = "Logic"
|
||||
autopulse = 1
|
||||
power_draw_per_use = 1
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
/obj/item/integrated_circuit/logic/binary
|
||||
inputs = list("\<ANY\> A","\<ANY\> B")
|
||||
activators = list("\<PULSE IN\> compare", "\<PULSE OUT\> on true result", "\<PULSE OUT\> on false result")
|
||||
activators = list("compare" = 1, "on true result" = 0, "on false result" = 0)
|
||||
|
||||
/obj/item/integrated_circuit/logic/binary/do_work()
|
||||
pull_data()
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
/obj/item/integrated_circuit/logic/unary
|
||||
inputs = list("\<ANY\> A")
|
||||
activators = list("\<PULSE IN\> compare", "\<PULSE OUT\> on compare")
|
||||
activators = list("compare" = 1, "on compare" = 0)
|
||||
|
||||
/obj/item/integrated_circuit/logic/unary/do_work()
|
||||
pull_data()
|
||||
@@ -128,7 +128,7 @@
|
||||
desc = "This gate inverts what's fed into it."
|
||||
icon_state = "not"
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
activators = list("\<PULSE IN\> invert", "\<PULSE OUT\> on inverted")
|
||||
activators = list("invert" = 1, "on inverted" = 0)
|
||||
|
||||
/obj/item/integrated_circuit/logic/unary/not/do_check(var/datum/integrated_io/A)
|
||||
return !A.data
|
||||
|
||||
@@ -10,13 +10,14 @@
|
||||
normal limitations to firearms, such as ammunition requirements and firing delays, still hold true if fired by the mechanism."
|
||||
complexity = 20
|
||||
w_class = ITEMSIZE_NORMAL
|
||||
size = 3
|
||||
inputs = list(
|
||||
"\<NUM\> target X rel",
|
||||
"\<NUM\> target Y rel"
|
||||
)
|
||||
outputs = list()
|
||||
activators = list(
|
||||
"\<PULSE IN\> fire"
|
||||
"fire" = 1
|
||||
)
|
||||
var/obj/item/weapon/gun/installed_gun = null
|
||||
spawn_flags = IC_SPAWN_RESEARCH
|
||||
@@ -35,6 +36,7 @@
|
||||
return
|
||||
user.drop_from_inventory(gun)
|
||||
installed_gun = gun
|
||||
size += gun.w_class
|
||||
gun.forceMove(src)
|
||||
user << "<span class='notice'>You slide \the [gun] into the firing mechanism.</span>"
|
||||
playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1)
|
||||
@@ -45,52 +47,58 @@
|
||||
if(installed_gun)
|
||||
installed_gun.forceMove(get_turf(src))
|
||||
user << "<span class='notice'>You slide \the [installed_gun] out of the firing mechanism.</span>"
|
||||
size = initial(size)
|
||||
playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1)
|
||||
installed_gun = null
|
||||
else
|
||||
user << "<span class='notice'>There's no weapon to remove from the mechanism.</span>"
|
||||
|
||||
/obj/item/integrated_circuit/manipulation/weapon_firing/do_work()
|
||||
if(..())
|
||||
if(!installed_gun)
|
||||
if(!installed_gun)
|
||||
return
|
||||
|
||||
var/datum/integrated_io/target_x = inputs[1]
|
||||
var/datum/integrated_io/target_y = inputs[2]
|
||||
|
||||
if(src.assembly)
|
||||
if(isnum(target_x.data))
|
||||
target_x.data = round(target_x.data)
|
||||
if(isnum(target_y.data))
|
||||
target_y.data = round(target_y.data)
|
||||
|
||||
var/turf/T = get_turf(src.assembly)
|
||||
|
||||
if(target_x.data == 0 && target_y.data == 0) // Don't shoot ourselves.
|
||||
return
|
||||
|
||||
var/datum/integrated_io/target_x = inputs[1]
|
||||
var/datum/integrated_io/target_y = inputs[2]
|
||||
// We need to do this in order to enable relative coordinates, as locate() only works for absolute coordinates.
|
||||
var/i
|
||||
if(target_x.data > 0)
|
||||
i = abs(target_x.data)
|
||||
while(i > 0)
|
||||
T = get_step(T, EAST)
|
||||
i--
|
||||
else
|
||||
i = abs(target_x.data)
|
||||
while(i > 0)
|
||||
T = get_step(T, WEST)
|
||||
i--
|
||||
|
||||
if(target_x.data && target_y.data && isnum(target_x.data) && isnum(target_y.data))
|
||||
var/turf/T = get_turf(src)
|
||||
i = 0
|
||||
if(target_y.data > 0)
|
||||
i = abs(target_y.data)
|
||||
while(i > 0)
|
||||
T = get_step(T, NORTH)
|
||||
i--
|
||||
else if(target_y.data < 0)
|
||||
i = abs(target_y.data)
|
||||
while(i > 0)
|
||||
T = get_step(T, SOUTH)
|
||||
i--
|
||||
|
||||
if(target_x.data == 0 && target_y.data == 0) // Don't shoot ourselves.
|
||||
return
|
||||
|
||||
// We need to do this in order to enable relative coordinates, as locate() only works for absolute coordinates.
|
||||
var/i
|
||||
if(target_x.data > 0)
|
||||
i = abs(target_x.data)
|
||||
while(i)
|
||||
T = get_step(T, EAST)
|
||||
i--
|
||||
else if(target_x.data < 0)
|
||||
i = abs(target_x.data)
|
||||
while(i)
|
||||
T = get_step(T, WEST)
|
||||
i--
|
||||
|
||||
if(target_y.data > 0)
|
||||
i = abs(target_y.data)
|
||||
while(i)
|
||||
T = get_step(T, NORTH)
|
||||
i--
|
||||
else if(target_y.data < 0)
|
||||
i = abs(target_y.data)
|
||||
while(i)
|
||||
T = get_step(T, SOUTH)
|
||||
i--
|
||||
|
||||
if(!T)
|
||||
return
|
||||
installed_gun.Fire_userless(T)
|
||||
if(!T)
|
||||
return
|
||||
installed_gun.Fire_userless(T)
|
||||
|
||||
/obj/item/integrated_circuit/manipulation/locomotion
|
||||
name = "locomotion circuit"
|
||||
@@ -110,9 +118,10 @@
|
||||
being held, or anchored in some way. It should be noted that the ability to move is dependant on the type of assembly that this circuit inhabits."
|
||||
w_class = ITEMSIZE_NORMAL
|
||||
complexity = 20
|
||||
// size = 5
|
||||
inputs = list("dir num")
|
||||
outputs = list()
|
||||
activators = list("step towards dir")
|
||||
activators = list("step towards dir" = 1)
|
||||
spawn_flags = IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 100
|
||||
|
||||
@@ -125,4 +134,82 @@
|
||||
if(assembly.loc == T) // Check if we're held by someone. If the loc is the floor, we're not held.
|
||||
var/datum/integrated_io/wanted_dir = inputs[1]
|
||||
if(isnum(wanted_dir.data))
|
||||
step(assembly, wanted_dir.data)
|
||||
step(assembly, wanted_dir.data)
|
||||
|
||||
|
||||
/obj/item/integrated_circuit/manipulation/grenade
|
||||
name = "grenade primer"
|
||||
desc = "This circuit comes with the ability to attach most types of grenades at prime them at will."
|
||||
extended_desc = "Time between priming and detonation is limited to between 1 to 12 seconds but is optional. \
|
||||
If unset, not a number, or a number less than 1 then the grenade's built-in timing will be used. \
|
||||
Beware: Once primed there is no aborting the process!"
|
||||
icon_state = "grenade"
|
||||
complexity = 30
|
||||
size = 2
|
||||
inputs = list("\<NUM\> detonation time")
|
||||
outputs = list()
|
||||
activators = list("prime grenade" = 1)
|
||||
spawn_flags = IC_SPAWN_RESEARCH
|
||||
origin_tech = list(TECH_ENGINEERING = 3, TECH_DATA = 3, TECH_COMBAT = 4)
|
||||
var/obj/item/weapon/grenade/attached_grenade
|
||||
var/pre_attached_grenade_type
|
||||
|
||||
/obj/item/integrated_circuit/manipulation/grenade/New()
|
||||
..()
|
||||
if(pre_attached_grenade_type)
|
||||
var/grenade = new pre_attached_grenade_type(src)
|
||||
attach_grenade(grenade)
|
||||
|
||||
/obj/item/integrated_circuit/manipulation/grenade/Destroy()
|
||||
if(attached_grenade && !attached_grenade.active)
|
||||
attached_grenade.dropInto(loc)
|
||||
detach_grenade()
|
||||
. =..()
|
||||
|
||||
/obj/item/integrated_circuit/manipulation/grenade/attackby(var/obj/item/weapon/grenade/G, var/mob/user)
|
||||
if(istype(G))
|
||||
if(attached_grenade)
|
||||
to_chat(user, "<span class='warning'>There is already a grenade attached!</span>")
|
||||
else if(user.unEquip(G, force=1))
|
||||
user.visible_message("<span class='warning'>\The [user] attaches \a [G] to \the [src]!</span>", "<span class='notice'>You attach \the [G] to \the [src].</span>")
|
||||
attach_grenade(G)
|
||||
G.forceMove(src)
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/item/integrated_circuit/manipulation/grenade/attack_self(var/mob/user)
|
||||
if(attached_grenade)
|
||||
user.visible_message("<span class='warning'>\The [user] removes \an [attached_grenade] from \the [src]!</span>", "<span class='notice'>You remove \the [attached_grenade] from \the [src].</span>")
|
||||
user.put_in_any_hand_if_possible(attached_grenade) || attached_grenade.dropInto(loc)
|
||||
detach_grenade()
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/item/integrated_circuit/manipulation/grenade/do_work()
|
||||
if(attached_grenade && !attached_grenade.active)
|
||||
var/datum/integrated_io/detonation_time = inputs[1]
|
||||
if(isnum(detonation_time.data) && detonation_time.data > 0)
|
||||
attached_grenade.det_time = between(1, detonation_time.data, 12) SECONDS
|
||||
attached_grenade.activate()
|
||||
var/atom/holder = loc
|
||||
log_and_message_admins("activated a grenade assembly. Last touches: Assembly: [holder.fingerprintslast] Circuit: [fingerprintslast] Grenade: [attached_grenade.fingerprintslast]")
|
||||
|
||||
// These procs do not relocate the grenade, that's the callers responsibility
|
||||
/obj/item/integrated_circuit/manipulation/grenade/proc/attach_grenade(var/obj/item/weapon/grenade/G)
|
||||
attached_grenade = G
|
||||
destroyed_event.register(attached_grenade, src, /obj/item/integrated_circuit/manipulation/grenade/proc/detach_grenade)
|
||||
size += G.w_class
|
||||
desc += " \An [attached_grenade] is attached to it!"
|
||||
|
||||
/obj/item/integrated_circuit/manipulation/grenade/proc/detach_grenade()
|
||||
if(!attached_grenade)
|
||||
return
|
||||
destroyed_event.unregister(attached_grenade, src, /obj/item/integrated_circuit/manipulation/grenade/proc/detach_grenade)
|
||||
attached_grenade = null
|
||||
size = initial(size)
|
||||
desc = initial(desc)
|
||||
|
||||
/obj/item/integrated_circuit/manipulation/grenade/frag
|
||||
pre_attached_grenade_type = /obj/item/weapon/grenade/explosive
|
||||
origin_tech = list(TECH_ENGINEERING = 3, TECH_DATA = 3, TECH_COMBAT = 10)
|
||||
spawn_flags = null // Used for world initializing, see the #defines above.
|
||||
@@ -5,7 +5,7 @@
|
||||
complexity = 1
|
||||
inputs = list("input pin 1")
|
||||
outputs = list("output pin 1")
|
||||
activators = list("set")
|
||||
activators = list("set" = 1, "on set")
|
||||
category_text = "Memory"
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 1
|
||||
@@ -29,12 +29,13 @@
|
||||
var/datum/integrated_io/I = inputs[i]
|
||||
var/datum/integrated_io/O = outputs[i]
|
||||
O.data = I.data
|
||||
O.push_data()
|
||||
activate_pin(2)
|
||||
|
||||
/obj/item/integrated_circuit/memory/medium
|
||||
name = "memory circuit"
|
||||
desc = "This circuit can store four pieces of data."
|
||||
icon_state = "memory4"
|
||||
w_class = ITEMSIZE_SMALL
|
||||
complexity = 4
|
||||
inputs = list("input pin 1","input pin 2","input pin 3","input pin 4")
|
||||
outputs = list("output pin 1","output pin 2","output pin 3","output pin 4")
|
||||
@@ -45,7 +46,6 @@
|
||||
name = "large memory circuit"
|
||||
desc = "This big circuit can hold eight pieces of data."
|
||||
icon_state = "memory8"
|
||||
w_class = ITEMSIZE_SMALL
|
||||
complexity = 8
|
||||
inputs = list(
|
||||
"input pin 1",
|
||||
@@ -121,7 +121,7 @@
|
||||
complexity = 1
|
||||
inputs = list()
|
||||
outputs = list("output pin")
|
||||
activators = list("push data")
|
||||
activators = list("push data" = 0)
|
||||
var/accepting_refs = 0
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
complexity = 16
|
||||
inputs = list("\<REF\> target")
|
||||
outputs = list("\<NUM\> target cell charge", "\<NUM\> target cell max charge", "\<NUM\> target cell percentage")
|
||||
activators = list("\<PULSE IN\> transmit")
|
||||
activators = list("transmit" = 1)
|
||||
spawn_flags = IC_SPAWN_RESEARCH
|
||||
origin_tech = list(TECH_ENGINEERING = 4, TECH_DATA = 4, TECH_POWER = 4, TECH_MAGNET = 3)
|
||||
power_draw_per_use = 500 // Inefficency has to come from somewhere.
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
cooldown_per_use = 30 SECONDS
|
||||
inputs = list()
|
||||
outputs = list()
|
||||
activators = list("create smoke")
|
||||
activators = list("create smoke" = 1)
|
||||
spawn_flags = IC_SPAWN_RESEARCH
|
||||
origin_tech = list(TECH_ENGINEERING = 3, TECH_DATA = 3, TECH_BIO = 3)
|
||||
volume = 100
|
||||
@@ -45,7 +45,7 @@
|
||||
cooldown_per_use = 6 SECONDS
|
||||
inputs = list("\<REF\> target", "\<NUM\> injection amount" = 5)
|
||||
outputs = list()
|
||||
activators = list("\<PULSE IN\> inject")
|
||||
activators = list("inject" = 1)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
volume = 30
|
||||
power_draw_per_use = 15
|
||||
@@ -90,7 +90,7 @@
|
||||
complexity = 8
|
||||
inputs = list("\<REF\> source", "\<REF\> target", "\<NUM\> injection amount" = 10)
|
||||
outputs = list()
|
||||
activators = list("\<PULSE IN\> transfer reagents", "\<PULSE OUT\> on transfer")
|
||||
activators = list("transfer reagents" = 1, "on transfer" = 0)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
origin_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_BIO = 2)
|
||||
var/transfer_amount = 10
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
complexity = 25
|
||||
inputs = list("\<REF\> target")
|
||||
outputs = list("\<NUM\> dir")
|
||||
activators = list("\<PULSE IN\> calculate dir", "\<PULSE OUT\> on calculated")
|
||||
activators = list("calculate dir" = 1, "on calculated" = 0)
|
||||
spawn_flags = IC_SPAWN_RESEARCH
|
||||
origin_tech = list(TECH_ENGINEERING = 4, TECH_DATA = 5)
|
||||
power_draw_per_use = 40
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
This circuit is set to send a pulse after a delay of two seconds."
|
||||
icon_state = "delay-20"
|
||||
var/delay = 2 SECONDS
|
||||
activators = list("\<PULSE IN\> incoming","\<PULSE OUT\> outgoing")
|
||||
activators = list("incoming"= 1,"outgoing" = 0)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 2
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
var/ticks_completed = 0
|
||||
var/is_running = FALSE
|
||||
inputs = list("\<NUM\> enable ticking" = 0)
|
||||
activators = list("\<PULSE OUT\> outgoing pulse")
|
||||
activators = list("outgoing pulse" = 0)
|
||||
spawn_flags = IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 4
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
icon_state = "clock"
|
||||
inputs = list()
|
||||
outputs = list("\<TEXT\> time", "\<NUM\> hours", "\<NUM\> minutes", "\<NUM\> seconds")
|
||||
activators = list("\<PULSE IN\> get time","\<PULSE OUT\> on time got")
|
||||
activators = list("get time" = 1,"on time got" = 0)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 4
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"\<NUM\> H"
|
||||
)
|
||||
outputs = list("\<NUM\> result")
|
||||
activators = list("\<PULSE IN\> compute", "\<PULSE OUT\> on computed")
|
||||
activators = list("compute" = 1, "on computed" = 0)
|
||||
category_text = "Trig"
|
||||
extended_desc = "Input and output are in degrees."
|
||||
autopulse = 1
|
||||
|
||||
@@ -1543,7 +1543,7 @@ CIRCUITS BELOW
|
||||
|
||||
/datum/design/item/custom_circuit_assembly
|
||||
name = "Small custom assembly"
|
||||
desc = "An customizable assembly for simple, small devices."
|
||||
desc = "A customizable assembly for simple, small devices."
|
||||
id = "assembly-small"
|
||||
req_tech = list(TECH_MATERIAL = 3, TECH_ENGINEERING = 2, TECH_POWER = 2)
|
||||
materials = list(DEFAULT_WALL_MATERIAL = 10000)
|
||||
@@ -1552,7 +1552,7 @@ CIRCUITS BELOW
|
||||
|
||||
/datum/design/item/custom_circuit_assembly/medium
|
||||
name = "Medium custom assembly"
|
||||
desc = "An customizable assembly suited for more ambitious mechanisms."
|
||||
desc = "A customizable assembly suited for more ambitious mechanisms."
|
||||
id = "assembly-medium"
|
||||
req_tech = list(TECH_MATERIAL = 4, TECH_ENGINEERING = 3, TECH_POWER = 3)
|
||||
materials = list(DEFAULT_WALL_MATERIAL = 20000)
|
||||
@@ -1561,7 +1561,7 @@ CIRCUITS BELOW
|
||||
|
||||
/datum/design/item/custom_circuit_assembly/drone
|
||||
name = "Drone custom assembly"
|
||||
desc = "An customizable assembly optimized for autonomous devices."
|
||||
desc = "A customizable assembly optimized for autonomous devices."
|
||||
id = "assembly-drone"
|
||||
req_tech = list(TECH_MATERIAL = 4, TECH_ENGINEERING = 4, TECH_POWER = 4)
|
||||
materials = list(DEFAULT_WALL_MATERIAL = 30000)
|
||||
@@ -1570,7 +1570,7 @@ CIRCUITS BELOW
|
||||
|
||||
/datum/design/item/custom_circuit_assembly/large
|
||||
name = "Large custom assembly"
|
||||
desc = "An customizable assembly for large machines."
|
||||
desc = "A customizable assembly for large machines."
|
||||
id = "assembly-large"
|
||||
req_tech = list(TECH_MATERIAL = 5, TECH_ENGINEERING = 4, TECH_POWER = 4)
|
||||
materials = list(DEFAULT_WALL_MATERIAL = 40000)
|
||||
@@ -1586,6 +1586,15 @@ CIRCUITS BELOW
|
||||
build_path = /obj/item/weapon/implant/integrated_circuit
|
||||
sort_string = "VCAAE"
|
||||
|
||||
/datum/design/item/custom_circuit_assembly/device
|
||||
name = "Device custom assembly"
|
||||
desc = "An customizable assembly designed to interface with other devices."
|
||||
id = "assembly-implant"
|
||||
req_tech = list(TECH_MATERIAL = 2, TECH_ENGINEERING = 2, TECH_POWER = 2)
|
||||
materials = list(DEFAULT_WALL_MATERIAL = 5000)
|
||||
build_path = /obj/item/weapon/implant/integrated_circuit
|
||||
sort_string = "VCAAF"
|
||||
|
||||
/datum/design/item/translator
|
||||
name = "handheld translator"
|
||||
id = "translator"
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
|
||||
|
||||
|
||||
/datum/unit_test/integrated_circuits/concatenatior
|
||||
name = "Converter Circuits: Concatenatior"
|
||||
circuit_type = /obj/item/integrated_circuit/converter/concatenatior
|
||||
/datum/unit_test/integrated_circuits/concatenator
|
||||
name = "Converter Circuits: concatenator"
|
||||
circuit_type = /obj/item/integrated_circuit/converter/concatenator
|
||||
inputs_to_give = list("Lorem", " ", "ipsum", "...")
|
||||
expected_outputs = list("Lorem ipsum...")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user