mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Organs:
Moved into their own folder and got split into three files. Damage zones have been regrouped slightly to make it easier to deal with them. Currently the organ groups are head, l/r leg, l/r arm, and head. Attacking: Armor is properly checked. Currently aiming for the chest gives a higher chance to stun whereas the head will stun for longer. Stungloves/Disarm now show up in the attack log. Stungloves ignore intent. Silicon: AI units can now move between cams that are not on the ss13 network. Cyborg's alert screen should not longer pop up every time they get an alert if they have opened it once during the round. Robot vision now uses the standard amount of energy. Gamemodes: Added Deuryn's unrev message. Runes can only be examined if you are close to them. Moved the Loyalty implants to the HoS' locker at the request of HerpA. Nuke agents now come with explosive implants that will activate upon death. Projectiles: Once again went though the gun code and cleaned things up, it is much better now. Bullet_act fixed up and most mobs now use the one in living, just overload it if they need to do something diff. Freeze /caplaser/xbow no longer have an infinite loop. Shotguns have to be pumped manually. Went though the latest runtime log. Power cells now use return on their give/use procs Assemblies have been reworked and are nearly finished, just need to finish up the special assembly code, redo the signalers, and add one or two new assembly items. Laying down will now only take 3 ticks to get up, from 5. You can no longer punch people on the spawn screen. This is a big one and was cleared by two heads, TK will only allow you to pick up items. If you have an item in your hand it will act normal. This revision got much larger than originally intended my tests show everything is working fine, but you never know. Ill likely do more mob teaks in the next few days. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2333 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -1,97 +1,167 @@
|
||||
/*
|
||||
Desc: Sorta a hack/workaround to get interfaceish things into this engine.
|
||||
To use an interface just override the proc in your object and set it to return true.
|
||||
If an object returns true for one of these it should have ALL of the commented out procs and vars defined in its class.
|
||||
There may be some example code in procs below the defines to help explain things, but you don't have to use it.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Name: IsAssembly
|
||||
Desc: If true is an assembly that can work with the holder
|
||||
*/
|
||||
/obj/proc/IsAssembly()
|
||||
/proc/isassembly(O)
|
||||
if(istype(O, /obj/item/device/assembly))
|
||||
return 1
|
||||
return 0
|
||||
/*
|
||||
|
||||
/proc/isigniter(O)
|
||||
if(istype(O, /obj/item/device/assembly/igniter))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/proc/isinfared(O)
|
||||
if(istype(O, /obj/item/device/assembly/infra))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/proc/isprox(O)
|
||||
if(istype(O, /obj/item/device/assembly/prox_sensor))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/proc/issignaler(O)
|
||||
if(istype(O, /obj/item/device/assembly/signaler))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/proc/istimer(O)
|
||||
if(istype(O, /obj/item/device/assembly/timer))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
/obj/item/device/assembly
|
||||
name = "assembly"
|
||||
desc = "A small electronic device that should never exist."
|
||||
icon = 'new_assemblies.dmi'
|
||||
icon_state = ""
|
||||
flags = FPRINT | TABLEPASS| CONDUCT
|
||||
item_state = "electronic"
|
||||
w_class = 2.0
|
||||
m_amt = 100
|
||||
g_amt = 0
|
||||
w_amt = 0
|
||||
throwforce = 2
|
||||
throw_speed = 3
|
||||
throw_range = 10
|
||||
origin_tech = "magnets=1"
|
||||
|
||||
var
|
||||
secured = 1
|
||||
small_icon_state_left = null
|
||||
small_icon_state_right = null
|
||||
list/small_icon_state_overlays = null
|
||||
obj/holder = null
|
||||
obj/item/device/assembly_holder/holder = null
|
||||
cooldown = 0//To prevent spam
|
||||
wires = WIRE_RECEIVE | WIRE_PULSE
|
||||
|
||||
var/const
|
||||
WIRE_RECEIVE = 1 //Allows Pulsed(0) to call Activate()
|
||||
WIRE_PULSE = 2 //Allows Pulse(0) to act on the holder
|
||||
WIRE_PULSE_SPECIAL = 4 //Allows Pulse(0) to act on the holders special assembly
|
||||
WIRE_RADIO_RECEIVE = 8 //Allows Pulsed(1) to call Activate()
|
||||
WIRE_RADIO_PULSE = 16 //Allows Pulse(1) to send a radio message
|
||||
|
||||
proc
|
||||
Activate()//Called when this assembly is pulsed by another one
|
||||
Secure()//Code that has to happen when the assembly is ready goes here
|
||||
Unsecure()//Code that has to happen when the assembly is taken off of the ready state goes here
|
||||
Attach_Assembly(var/obj/A, var/mob/user)//Called when an assembly is attacked by another
|
||||
Process_cooldown()//Call this via spawn(10) to have it count down the cooldown var
|
||||
Holder_Movement()//Called when the holder is moved
|
||||
|
||||
IsAssembly()
|
||||
return 1
|
||||
activate() //What the device does when turned on
|
||||
pulsed(var/radio = 0) //Called when another assembly acts on this one, var/radio will determine where it came from for wire calcs
|
||||
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
|
||||
toggle_secure() //Code that has to happen when the assembly is un\secured goes here
|
||||
attach_assembly(var/obj/A, var/mob/user) //Called when an assembly is attacked by another
|
||||
process_cooldown() //Called via spawn(10) to have it count down the cooldown var
|
||||
holder_movement() //Called when the holder is moved
|
||||
interact(mob/user as mob) //Called when attack_self is called
|
||||
|
||||
|
||||
Process_cooldown()
|
||||
process_cooldown()
|
||||
cooldown--
|
||||
if(cooldown <= 0) return 0
|
||||
spawn(10)
|
||||
Process_cooldown()
|
||||
process_cooldown()
|
||||
return 1
|
||||
|
||||
|
||||
Activate()
|
||||
if((!secured) || (cooldown > 0))//Make sure to add something using cooldown or such to prevent spam
|
||||
return 0
|
||||
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)
|
||||
// if(radio && (wires & WIRE_RADIO_PULSE))
|
||||
//Not sure what goes here quite yet send signal?
|
||||
return 1
|
||||
|
||||
|
||||
activate()
|
||||
if(!secured || (cooldown > 0)) return 0
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
Process_cooldown()
|
||||
return 0
|
||||
|
||||
|
||||
Secure()
|
||||
if(secured)
|
||||
return 0
|
||||
secured = 1
|
||||
process_cooldown()
|
||||
return 1
|
||||
|
||||
|
||||
Unsecure()
|
||||
if(!secured)
|
||||
return 0
|
||||
secured = 0
|
||||
return 1
|
||||
toggle_secure()
|
||||
secured = !secured
|
||||
update_icon()
|
||||
return secured
|
||||
|
||||
|
||||
Attach_Assembly(var/obj/A, var/mob/user)
|
||||
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.show_message("\blue You attach the [A.name] to the [src.name]!")
|
||||
if(holder.attach(A,src,user))
|
||||
user.show_message("\blue You attach the [A.name] to the [name]!")
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(W.IsAssembly())
|
||||
var/obj/item/device/D = W
|
||||
if((!D:secured) && (!src.secured))
|
||||
Attach_Assembly(D,user)
|
||||
if(isassembly(W))
|
||||
var/obj/item/device/assembly/A = W
|
||||
if((!A.secured) && (!secured))
|
||||
attach_assembly(A,user)
|
||||
return
|
||||
if(isscrewdriver(W))
|
||||
if(src.secured)
|
||||
Unsecure()
|
||||
user.show_message("\blue The [src.name] can now be attached!")
|
||||
if(toggle_secure())
|
||||
user.show_message("\blue The [name] is ready!")
|
||||
else
|
||||
Secure()
|
||||
user.show_message("\blue The [src.name] is ready!")
|
||||
user.show_message("\blue The [name] can now be attached!")
|
||||
return
|
||||
else
|
||||
..()
|
||||
..()
|
||||
return
|
||||
*/
|
||||
|
||||
|
||||
process()
|
||||
processing_objects.Remove(src)
|
||||
return
|
||||
|
||||
|
||||
examine()
|
||||
set src in view()
|
||||
..()
|
||||
if((in_range(src, usr) || loc == usr))
|
||||
if(secured)
|
||||
usr.show_message("The [name] is ready!")
|
||||
else
|
||||
usr.show_message("The [name] can be attached!")
|
||||
return
|
||||
|
||||
|
||||
attack_self(mob/user as mob)
|
||||
if(!user) return 0
|
||||
user.machine = src
|
||||
interact(user)
|
||||
return 1
|
||||
|
||||
|
||||
interact(mob/user as mob)
|
||||
return //HTML MENU FOR WIRES GOES HERE
|
||||
|
||||
/*
|
||||
Name: IsAssemblyHolder
|
||||
|
||||
@@ -6,22 +6,21 @@
|
||||
item_state = "assembly"
|
||||
flags = FPRINT | TABLEPASS| CONDUCT
|
||||
item_state = "electronic"
|
||||
m_amt = 100
|
||||
throwforce = 5
|
||||
w_class = 1.0
|
||||
w_class = 2.0
|
||||
throw_speed = 3
|
||||
throw_range = 10
|
||||
|
||||
var
|
||||
secured = 0
|
||||
obj/item/device/assembly_left = null
|
||||
obj/item/device/assembly_right = null
|
||||
obj/assembly_special = null
|
||||
obj/item/device/assembly/a_left = null
|
||||
obj/item/device/assembly/a_right = null
|
||||
obj/special_assembly = null
|
||||
|
||||
proc
|
||||
attach(var/obj/item/device/D, var/obj/item/device/D2, var/mob/user)
|
||||
attach_special(var/obj/O, var/mob/user)
|
||||
Process_Activation(var/obj/item/device/D)
|
||||
process_activation(var/obj/item/device/D)
|
||||
|
||||
|
||||
IsAssemblyHolder()
|
||||
@@ -30,7 +29,7 @@
|
||||
|
||||
attach(var/obj/item/device/D, var/obj/item/device/D2, var/mob/user)
|
||||
if((!D)||(!D2)) return 0
|
||||
if((!D.IsAssembly())||(!D2.IsAssembly())) return 0
|
||||
if((!isassembly(D))||(!isassembly(D2))) return 0
|
||||
if((D:secured)||(D2:secured)) return 0
|
||||
if(user)
|
||||
user.remove_from_mob(D)
|
||||
@@ -39,8 +38,8 @@
|
||||
D2:holder = src
|
||||
D.loc = src
|
||||
D2.loc = src
|
||||
assembly_left = D
|
||||
assembly_right = D2
|
||||
a_left = D
|
||||
a_right = D2
|
||||
src.name = "[D.name] [D2.name] assembly"
|
||||
update_icon()
|
||||
return 1
|
||||
@@ -51,28 +50,28 @@
|
||||
if(!O.IsSpecialAssembly()) return 0
|
||||
/*
|
||||
if(O:Attach_Holder())
|
||||
assembly_special = O
|
||||
special_assembly = O
|
||||
update_icon()
|
||||
src.name = "[assembly_left.name] [assembly_right.name] [assembly_special.name] assembly"
|
||||
src.name = "[a_left.name] [a_right.name] [special_assembly.name] assembly"
|
||||
*/
|
||||
return
|
||||
|
||||
|
||||
update_icon()
|
||||
src.overlays = null
|
||||
if(assembly_left)
|
||||
src.overlays += assembly_left:small_icon_state_left
|
||||
for(var/O in assembly_left:small_icon_state_overlays)
|
||||
if(a_left)
|
||||
src.overlays += a_left:small_icon_state_left
|
||||
for(var/O in a_left:small_icon_state_overlays)
|
||||
src.overlays += text("[]_l", O)
|
||||
if(assembly_right)
|
||||
src.overlays += assembly_right:small_icon_state_right
|
||||
for(var/O in assembly_right:small_icon_state_overlays)
|
||||
if(a_right)
|
||||
src.overlays += a_right:small_icon_state_right
|
||||
for(var/O in a_right:small_icon_state_overlays)
|
||||
src.overlays += text("[]_r", O)
|
||||
/* if(assembly_special)
|
||||
assembly_special.update_icon()
|
||||
if(assembly_special:small_icon_state)
|
||||
src.overlays += assembly_special:small_icon_state
|
||||
for(var/O in assembly_special:small_icon_state_overlays)
|
||||
/* 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
|
||||
*/
|
||||
|
||||
@@ -88,52 +87,47 @@
|
||||
|
||||
|
||||
HasProximity(atom/movable/AM as mob|obj)
|
||||
if(assembly_left)
|
||||
assembly_left.HasProximity(AM)
|
||||
if(assembly_right)
|
||||
assembly_right.HasProximity(AM)
|
||||
if(assembly_special)
|
||||
assembly_special.HasProximity(AM)
|
||||
if(a_left)
|
||||
a_left.HasProximity(AM)
|
||||
if(a_right)
|
||||
a_right.HasProximity(AM)
|
||||
if(special_assembly)
|
||||
special_assembly.HasProximity(AM)
|
||||
return
|
||||
|
||||
|
||||
Move()
|
||||
..()
|
||||
if(assembly_left)
|
||||
assembly_left:Holder_Movement()
|
||||
if(assembly_right)
|
||||
assembly_right:Holder_Movement()
|
||||
if(assembly_special)
|
||||
assembly_special:Holder_Movement()
|
||||
if(a_left && a_right)
|
||||
a_left.holder_movement()
|
||||
a_right.holder_movement()
|
||||
// if(special_assembly)
|
||||
// special_assembly:holder_movement()
|
||||
return
|
||||
|
||||
|
||||
attack_hand()//Perhapse this should be a holder_pickup proc instead, can add if needbe I guess
|
||||
if(assembly_left)
|
||||
assembly_left:Holder_Movement()
|
||||
if(assembly_right)
|
||||
assembly_right:Holder_Movement()
|
||||
if(assembly_special)
|
||||
assembly_special:Holder_Movement()
|
||||
if(a_left && a_right)
|
||||
a_left.holder_movement()
|
||||
a_right.holder_movement()
|
||||
// if(special_assembly)
|
||||
// special_assembly:Holder_Movement()
|
||||
..()
|
||||
return
|
||||
|
||||
|
||||
attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(isscrewdriver(W))
|
||||
if(!assembly_left || !assembly_right)
|
||||
if(!a_left || !a_right)
|
||||
user.show_message("\red BUG:Assembly part missing, please report this!")
|
||||
return
|
||||
if(src.secured)
|
||||
src.secured = 0
|
||||
assembly_left:Unsecure()
|
||||
assembly_right:Unsecure()
|
||||
user.show_message("\blue The [src.name] can now be taken apart!")
|
||||
else
|
||||
src.secured = 1
|
||||
assembly_left:Secure()
|
||||
assembly_right:Secure()
|
||||
a_left.toggle_secure()
|
||||
a_right.toggle_secure()
|
||||
secured = !secured
|
||||
if(secured)
|
||||
user.show_message("\blue The [src.name] is ready!")
|
||||
else
|
||||
user.show_message("\blue The [src.name] can now be taken apart!")
|
||||
update_icon()
|
||||
return
|
||||
else if(W.IsSpecialAssembly())
|
||||
@@ -146,44 +140,41 @@
|
||||
attack_self(mob/user as mob)
|
||||
src.add_fingerprint(user)
|
||||
if(src.secured)
|
||||
if(!assembly_left || !assembly_right)
|
||||
if(!a_left || !a_right)
|
||||
user.show_message("\red Assembly part missing!")
|
||||
return
|
||||
if(istype(assembly_left,assembly_right.type))//If they are the same type it causes issues due to window code
|
||||
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")
|
||||
assembly_left.attack_self(user)
|
||||
if("Right")
|
||||
assembly_right.attack_self(user)
|
||||
if("Left") a_left.attack_self(user)
|
||||
if("Right") a_right.attack_self(user)
|
||||
return
|
||||
else
|
||||
assembly_left.attack_self(user)
|
||||
assembly_right.attack_self(user)
|
||||
a_left.attack_self(user)
|
||||
a_right.attack_self(user)
|
||||
else
|
||||
var/turf/T = get_turf(src)
|
||||
if(!T) return 0
|
||||
if(assembly_left)
|
||||
assembly_left:holder = null
|
||||
assembly_left.loc = T
|
||||
if(assembly_right)
|
||||
assembly_right:holder = null
|
||||
assembly_right.loc = T
|
||||
if(a_left)
|
||||
a_left:holder = null
|
||||
a_left.loc = T
|
||||
if(a_right)
|
||||
a_right:holder = null
|
||||
a_right.loc = T
|
||||
spawn(0)
|
||||
del(src)
|
||||
return
|
||||
|
||||
|
||||
Process_Activation(var/obj/D, var/normal = 1, var/special = 1)
|
||||
process_activation(var/obj/D, var/normal = 1, var/special = 1)
|
||||
if(!D) return 0
|
||||
if((normal) && (assembly_right) && (assembly_left))
|
||||
if(assembly_right != D)
|
||||
assembly_right:Activate()
|
||||
if(assembly_left != D)
|
||||
assembly_left:Activate()
|
||||
if((special) && (assembly_special))
|
||||
if(!assembly_special == D)
|
||||
assembly_left:Activate()
|
||||
assembly_right:Activate()
|
||||
if((normal) && (a_right) && (a_left))
|
||||
if(a_right != D)
|
||||
a_right.pulsed(0)
|
||||
if(a_left != D)
|
||||
a_left.pulsed(0)
|
||||
// if(special && special_assembly)
|
||||
// if(!special_assembly == D)
|
||||
// special_assembly.dothings()
|
||||
return 1
|
||||
|
||||
|
||||
|
||||
@@ -1,111 +1,27 @@
|
||||
/obj/item/device/igniter
|
||||
/obj/item/device/assembly/igniter
|
||||
name = "igniter"
|
||||
desc = "A small electronic device able to ignite combustable substances. Does not function well as a lighter."
|
||||
icon = 'new_assemblies.dmi'
|
||||
icon_state = "igniter"
|
||||
flags = FPRINT | TABLEPASS| CONDUCT
|
||||
item_state = "electronic"
|
||||
m_amt = 100
|
||||
throwforce = 5
|
||||
w_class = 1.0
|
||||
throw_speed = 3
|
||||
throw_range = 10
|
||||
m_amt = 500
|
||||
g_amt = 50
|
||||
w_amt = 10
|
||||
origin_tech = "magnets=1"
|
||||
|
||||
var
|
||||
secured = 1
|
||||
small_icon_state_left = "igniter_left"
|
||||
small_icon_state_right = "igniter_right"
|
||||
list/small_icon_state_overlays = null
|
||||
obj/holder = null
|
||||
cooldown = 0
|
||||
|
||||
proc
|
||||
Activate()//Called when this assembly is pulsed by another one
|
||||
Secure()
|
||||
Unsecure()
|
||||
Attach_Assembly(var/obj/A, var/mob/user)
|
||||
Process_cooldown()
|
||||
Holder_Movement()
|
||||
secured = 1
|
||||
small_icon_state_left = "igniter_left"
|
||||
small_icon_state_right = "igniter_right"
|
||||
|
||||
|
||||
IsAssembly()
|
||||
activate()
|
||||
if(!..()) return 0//Cooldown check
|
||||
var/turf/location = get_turf(loc)
|
||||
if(location) location.hotspot_expose(1000,1000)
|
||||
return 1
|
||||
|
||||
|
||||
Process_cooldown()
|
||||
src.cooldown--
|
||||
if(src.cooldown <= 0) return 0
|
||||
spawn(10)
|
||||
src.Process_cooldown()
|
||||
return 1
|
||||
|
||||
|
||||
Activate()
|
||||
if((!secured) || (cooldown > 0))
|
||||
return 0
|
||||
var/turf/location = get_turf(src.loc)
|
||||
if(location)
|
||||
location.hotspot_expose(1000,1000)
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
Process_cooldown()
|
||||
return 1
|
||||
|
||||
|
||||
Secure()
|
||||
if(secured)
|
||||
return 0
|
||||
secured = 1
|
||||
return 1
|
||||
|
||||
|
||||
Unsecure()
|
||||
if(!secured)
|
||||
return 0
|
||||
secured = 0
|
||||
return 1
|
||||
|
||||
|
||||
Attach_Assembly(var/obj/A, var/mob/user)
|
||||
holder = new/obj/item/device/assembly_holder(get_turf(src))
|
||||
if(holder:attach(A,src,user))
|
||||
user.show_message("\blue You attach the [A.name] to the [src.name]!")
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(W.IsAssembly())
|
||||
var/obj/item/device/D = W
|
||||
if((!D:secured) && (!src.secured))
|
||||
Attach_Assembly(D,user)
|
||||
if(isscrewdriver(W))
|
||||
if(src.secured)
|
||||
Unsecure()
|
||||
user.show_message("\blue The [src.name] can now be attached!")
|
||||
else
|
||||
Secure()
|
||||
user.show_message("\blue The [src.name] is ready!")
|
||||
return
|
||||
else
|
||||
..()
|
||||
return
|
||||
|
||||
|
||||
attack_self(mob/user as mob)
|
||||
src.add_fingerprint(user)
|
||||
add_fingerprint(user)
|
||||
spawn( 5 )
|
||||
Activate()
|
||||
activate()
|
||||
return
|
||||
return
|
||||
|
||||
|
||||
examine()
|
||||
set src in view()
|
||||
..()
|
||||
if ((in_range(src, usr) || src.loc == usr))
|
||||
if (src.secured)
|
||||
usr.show_message("The [src.name] is ready!")
|
||||
else
|
||||
usr.show_message("The [src.name] can be attached!")
|
||||
return
|
||||
@@ -1,96 +1,42 @@
|
||||
/obj/item/device/infra
|
||||
/obj/item/device/assembly/infra
|
||||
name = "Infrared Beam"
|
||||
desc = "Emits a visible or invisible beam and is triggered when the beam is interrupted."
|
||||
icon = 'new_assemblies.dmi'
|
||||
icon_state = "infrared_old"
|
||||
flags = FPRINT | TABLEPASS| CONDUCT
|
||||
w_class = 2.0
|
||||
item_state = "electronic"
|
||||
m_amt = 150
|
||||
m_amt = 1000
|
||||
g_amt = 500
|
||||
w_amt = 100
|
||||
origin_tech = "magnets=2"
|
||||
|
||||
secured = 0
|
||||
small_icon_state_left = "infrared_left"
|
||||
small_icon_state_right = "infrared_right"
|
||||
|
||||
var
|
||||
secured = 0
|
||||
small_icon_state_left = "infrared_left"
|
||||
small_icon_state_right = "infrared_right"
|
||||
list/small_icon_state_overlays = null
|
||||
obj/holder = null
|
||||
cooldown = 0//To prevent spam
|
||||
scanning = 0
|
||||
visible = 0
|
||||
obj/effect/beam/i_beam/first = null
|
||||
|
||||
proc
|
||||
Activate()//Called when this assembly is pulsed by another one
|
||||
Secure()//Code that has to happen when the assembly is ready goes here
|
||||
Unsecure()//Code that has to happen when the assembly is taken off of the ready state goes here
|
||||
Attach_Assembly(var/obj/A, var/mob/user)//Called when an assembly is attacked by another
|
||||
Process_cooldown()//Call this via spawn(10) to have it count down the cooldown var
|
||||
Holder_Movement()//Called when the holder is moved
|
||||
beam_trigger()
|
||||
trigger_beam()
|
||||
|
||||
|
||||
IsAssembly()
|
||||
return 1
|
||||
|
||||
|
||||
Process_cooldown()
|
||||
cooldown--
|
||||
if(cooldown <= 0) return 0
|
||||
spawn(10)
|
||||
Process_cooldown()
|
||||
return 1
|
||||
|
||||
|
||||
Activate()
|
||||
if((!secured) || (cooldown > 0))
|
||||
return 0
|
||||
cooldown = 2
|
||||
activate()
|
||||
if(!..()) return 0//Cooldown check
|
||||
src.scanning = !src.scanning
|
||||
update_icon()
|
||||
spawn(10)
|
||||
Process_cooldown()
|
||||
return 0
|
||||
return 1
|
||||
|
||||
|
||||
Secure()
|
||||
toggle_secure()
|
||||
secured = !secured
|
||||
if(secured)
|
||||
return 0
|
||||
secured = 1
|
||||
processing_objects.Add(src)//removal is taken care of it process()
|
||||
return 1
|
||||
|
||||
|
||||
Unsecure()
|
||||
if(!secured)
|
||||
return 0
|
||||
secured = 0
|
||||
return 1
|
||||
|
||||
|
||||
Attach_Assembly(var/obj/A, var/mob/user)
|
||||
holder = new/obj/item/device/assembly_holder(get_turf(src))
|
||||
if(holder:attach(A,src,user))
|
||||
user.show_message("\blue You attach the [A.name] to the [src.name]!")
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(W.IsAssembly())
|
||||
var/obj/item/device/D = W
|
||||
if((!D:secured) && (!src.secured))
|
||||
Attach_Assembly(D,user)
|
||||
if(isscrewdriver(W))
|
||||
if(src.secured)
|
||||
Unsecure()
|
||||
user.show_message("\blue The [src.name] can now be attached!")
|
||||
else
|
||||
Secure()
|
||||
user.show_message("\blue The [src.name] is ready!")
|
||||
return
|
||||
processing_objects.Add(src)
|
||||
else
|
||||
..()
|
||||
return
|
||||
scanning = 0
|
||||
if(src.first) del(src.first)
|
||||
processing_objects.Remove(src)
|
||||
update_icon()
|
||||
return secured
|
||||
|
||||
|
||||
update_icon()
|
||||
@@ -105,12 +51,13 @@
|
||||
return
|
||||
|
||||
|
||||
process()
|
||||
process()//Old code
|
||||
if(!scanning)
|
||||
if(!src.first)
|
||||
if(src.first)
|
||||
del(src.first)
|
||||
return
|
||||
|
||||
if ((!( src.first ) && (src.secured && (istype(src.loc, /turf) || (src.holder && istype(src.holder.loc, /turf))))))
|
||||
if((!( src.first ) && (src.secured && (istype(src.loc, /turf) || (src.holder && istype(src.holder.loc, /turf))))))
|
||||
var/obj/effect/beam/i_beam/I = new /obj/effect/beam/i_beam( (src.holder ? src.holder.loc : src.loc) )
|
||||
I.master = src
|
||||
I.density = 1
|
||||
@@ -127,9 +74,6 @@
|
||||
//world << "infra: processing beam \ref[I]"
|
||||
I.process()
|
||||
return
|
||||
|
||||
if(!secured)
|
||||
processing_objects.Remove(src)
|
||||
return
|
||||
|
||||
|
||||
@@ -147,27 +91,25 @@
|
||||
return
|
||||
|
||||
|
||||
Holder_Movement()
|
||||
holder_movement()
|
||||
if(!holder) return 0
|
||||
src.dir = holder.dir
|
||||
// src.dir = holder.dir
|
||||
del(src.first)
|
||||
return 1
|
||||
|
||||
|
||||
beam_trigger()
|
||||
trigger_beam()
|
||||
if((!secured)||(!scanning)||(cooldown > 0)) return 0
|
||||
if((holder)&&(holder.IsAssemblyHolder()))
|
||||
spawn(0)
|
||||
holder:Process_Activation(src)
|
||||
return
|
||||
pulse(0)
|
||||
for(var/mob/O in hearers(null, null))
|
||||
O.show_message(text("\icon[] *beep* *beep*", src), 3, "*beep* *beep*", 2)
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
Process_cooldown()
|
||||
process_cooldown()
|
||||
return
|
||||
|
||||
|
||||
attack_self(mob/user as mob)
|
||||
interact(mob/user as mob)//TODO: change this this to the wire control panel
|
||||
if(!secured) return
|
||||
user.machine = src
|
||||
var/dat = text("<TT><B>Infrared Laser</B>\n<B>Status</B>: []<BR>\n<B>Visibility</B>: []<BR>\n</TT>", (src.scanning ? 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)))
|
||||
@@ -180,32 +122,32 @@
|
||||
|
||||
Topic(href, href_list)
|
||||
..()
|
||||
if(get_dist(src, usr) <= 1)
|
||||
if (href_list["state"])
|
||||
src.scanning = !(src.scanning)
|
||||
update_icon()
|
||||
|
||||
if (href_list["visible"])
|
||||
src.visible = !(src.visible)
|
||||
spawn( 0 )
|
||||
if (src.first)
|
||||
src.first.vis_spread(src.visible)
|
||||
|
||||
if (href_list["close"])
|
||||
usr << browse(null, "window=infra")
|
||||
return
|
||||
|
||||
if(usr)
|
||||
src.attack_self(usr)
|
||||
|
||||
else
|
||||
if(get_dist(src, usr) > 1)
|
||||
usr << browse(null, "window=infra")
|
||||
onclose(usr, "infra")
|
||||
return
|
||||
|
||||
if (href_list["state"])
|
||||
src.scanning = !(src.scanning)
|
||||
update_icon()
|
||||
|
||||
if (href_list["visible"])
|
||||
src.visible = !(src.visible)
|
||||
spawn( 0 )
|
||||
if(src.first)
|
||||
src.first.vis_spread(src.visible)
|
||||
|
||||
if (href_list["close"])
|
||||
usr << browse(null, "window=infra")
|
||||
return
|
||||
|
||||
if(usr)
|
||||
src.attack_self(usr)
|
||||
|
||||
return
|
||||
|
||||
|
||||
verb/rotate()//This really could be better but I dont want to redo it right now
|
||||
verb/rotate()//This could likely be better
|
||||
set name = "Rotate Infrared Laser"
|
||||
set category = "Object"
|
||||
set src in usr
|
||||
@@ -214,22 +156,6 @@
|
||||
return
|
||||
|
||||
|
||||
examine()
|
||||
set src in view()
|
||||
..()
|
||||
if ((in_range(src, usr) || src.loc == usr))
|
||||
if (src.secured)
|
||||
usr.show_message("The [src.name] is ready!")
|
||||
else
|
||||
usr.show_message("The [src.name] can be attached!")
|
||||
return
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/***************************IBeam*********************************/
|
||||
|
||||
@@ -238,29 +164,27 @@
|
||||
icon = 'projectiles.dmi'
|
||||
icon_state = "ibeam"
|
||||
var/obj/effect/beam/i_beam/next = null
|
||||
var/obj/item/device/infra/master = null
|
||||
var/obj/item/device/assembly/infra/master = null
|
||||
var/limit = null
|
||||
var/visible = 0.0
|
||||
var/left = null
|
||||
// var/master = null
|
||||
anchored = 1.0
|
||||
flags = TABLEPASS
|
||||
|
||||
|
||||
/obj/effect/beam/i_beam/proc/hit()
|
||||
//world << "beam \ref[src]: hit"
|
||||
if (src.master)
|
||||
if(src.master)
|
||||
//world << "beam hit \ref[src]: calling master \ref[master].hit"
|
||||
src.master.beam_trigger()
|
||||
//SN src = null
|
||||
src.master.trigger_beam()
|
||||
del(src)
|
||||
return
|
||||
|
||||
/obj/effect/beam/i_beam/proc/vis_spread(v)
|
||||
//world << "i_beam \ref[src] : vis_spread"
|
||||
src.visible = v
|
||||
spawn( 0 )
|
||||
if (src.next)
|
||||
spawn(0)
|
||||
if(src.next)
|
||||
//world << "i_beam \ref[src] : is next [next.type] \ref[next], calling spread"
|
||||
src.next.vis_spread(v)
|
||||
return
|
||||
@@ -269,17 +193,17 @@
|
||||
/obj/effect/beam/i_beam/process()
|
||||
//world << "i_beam \ref[src] : process"
|
||||
|
||||
if ((src.loc.density || !( src.master )))
|
||||
if((src.loc.density || !( src.master )))
|
||||
//SN src = null
|
||||
// world << "beam hit loc [loc] or no master [master], deleting"
|
||||
del(src)
|
||||
return
|
||||
//world << "proccess: [src.left] left"
|
||||
|
||||
if (src.left > 0)
|
||||
if(src.left > 0)
|
||||
src.left--
|
||||
if (src.left < 1)
|
||||
if (!( src.visible ))
|
||||
if(src.left < 1)
|
||||
if(!( src.visible ))
|
||||
src.invisibility = 101
|
||||
else
|
||||
src.invisibility = 0
|
||||
@@ -295,7 +219,7 @@
|
||||
//world << "created new beam \ref[I] at [I.x] [I.y] [I.z]"
|
||||
step(I, I.dir)
|
||||
|
||||
if (I)
|
||||
if(I)
|
||||
//world << "step worked, now at [I.x] [I.y] [I.z]"
|
||||
if (!( src.next ))
|
||||
//world << "no src.next"
|
||||
@@ -312,13 +236,11 @@
|
||||
return
|
||||
else
|
||||
//world << "is a next: \ref[next], deleting beam \ref[I]"
|
||||
//I = null
|
||||
del(I)
|
||||
else
|
||||
//src.next = null
|
||||
//world << "step failed, deleting \ref[src.next]"
|
||||
del(src.next)
|
||||
spawn( 10 )
|
||||
spawn(10)
|
||||
src.process()
|
||||
return
|
||||
return
|
||||
@@ -332,7 +254,7 @@
|
||||
return
|
||||
|
||||
/obj/effect/beam/i_beam/HasEntered(atom/movable/AM as mob|obj)
|
||||
if (istype(AM, /obj/effect/beam))
|
||||
if(istype(AM, /obj/effect/beam))
|
||||
return
|
||||
spawn( 0 )
|
||||
src.hit()
|
||||
|
||||
@@ -1,140 +1,75 @@
|
||||
/obj/item/device/prox_sensor
|
||||
/obj/item/device/assembly/prox_sensor
|
||||
name = "proximity sensor"
|
||||
desc = "Used for scanning and alerting when someone enters a certain proximity."
|
||||
icon = 'new_assemblies.dmi'
|
||||
icon_state = "prox"
|
||||
flags = FPRINT | TABLEPASS| CONDUCT
|
||||
w_class = 2.0
|
||||
item_state = "electronic"
|
||||
m_amt = 300
|
||||
m_amt = 800
|
||||
g_amt = 200
|
||||
w_amt = 50
|
||||
origin_tech = "magnets=1"
|
||||
|
||||
secured = 0
|
||||
small_icon_state_left = "prox_left"
|
||||
small_icon_state_right = "prox_right"
|
||||
|
||||
var
|
||||
secured = 0
|
||||
small_icon_state_left = "prox_left"
|
||||
small_icon_state_right = "prox_right"
|
||||
list/small_icon_state_overlays = null
|
||||
obj/holder = null
|
||||
scanning = 0
|
||||
cooldown = 0//To prevent spam
|
||||
timing = 0
|
||||
time = 0
|
||||
time = 10
|
||||
|
||||
proc
|
||||
Activate()//Called when this assembly is pulsed by another one
|
||||
Secure()//Code that has to happen when the assembly is ready goes here
|
||||
Unsecure()//Code that has to happen when the assembly is taken off of the ready state goes here
|
||||
Attach_Assembly(var/obj/A, var/mob/user)//Called when an assembly is attacked by another
|
||||
Process_cooldown()//Call this via spawn(10) to have it count down the cooldown var
|
||||
Holder_Movement()
|
||||
toggle_scan()
|
||||
sense()
|
||||
|
||||
|
||||
IsAssembly()
|
||||
return 1
|
||||
|
||||
|
||||
Process_cooldown()
|
||||
src.cooldown--
|
||||
if(src.cooldown <= 0) return 0
|
||||
spawn(10)
|
||||
src.Process_cooldown()
|
||||
return 1
|
||||
|
||||
|
||||
Activate()
|
||||
if((!secured) || (cooldown > 0))
|
||||
return 0
|
||||
cooldown = 2
|
||||
src.timing = !src.timing
|
||||
activate()
|
||||
if(!..()) return 0//Cooldown check
|
||||
timing = !timing
|
||||
update_icon()
|
||||
spawn(10)
|
||||
Process_cooldown()
|
||||
return 0
|
||||
|
||||
|
||||
Secure()
|
||||
if(secured) return 0
|
||||
secured = 1
|
||||
processing_objects.Add(src)//removal is taken care of it process()
|
||||
return 1
|
||||
|
||||
|
||||
Unsecure()
|
||||
if(!secured) return 0
|
||||
secured = 0
|
||||
return 1
|
||||
|
||||
|
||||
Attach_Assembly(var/obj/A, var/mob/user)
|
||||
holder = new/obj/item/device/assembly_holder(get_turf(src))
|
||||
if(holder:attach(A,src,user))
|
||||
user.show_message("\blue You attach the [A.name] to the [src.name]!")
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(W.IsAssembly())
|
||||
var/obj/item/device/D = W
|
||||
if((!D:secured) && (!src.secured))
|
||||
Attach_Assembly(D,user)
|
||||
if(isscrewdriver(W))
|
||||
if(src.secured)
|
||||
Unsecure()
|
||||
user.show_message("\blue The [src.name] can now be attached!")
|
||||
else
|
||||
Secure()
|
||||
user.show_message("\blue The [src.name] is ready!")
|
||||
return
|
||||
toggle_secure()
|
||||
secured = !secured
|
||||
if(secured)
|
||||
processing_objects.Add(src)
|
||||
else
|
||||
..()
|
||||
return
|
||||
scanning = 0
|
||||
timing = 0
|
||||
processing_objects.Remove(src)
|
||||
update_icon()
|
||||
return secured
|
||||
|
||||
|
||||
HasProximity(atom/movable/AM as mob|obj)
|
||||
if (istype(AM, /obj/effect/beam))
|
||||
return
|
||||
if (AM.move_speed < 12)
|
||||
src.sense()
|
||||
if (istype(AM, /obj/effect/beam)) return
|
||||
if (AM.move_speed < 12) sense()
|
||||
return
|
||||
|
||||
|
||||
sense()
|
||||
if((!secured)||(!scanning)||(cooldown > 0)) return 0
|
||||
if((holder)&&(holder.IsAssemblyHolder()))
|
||||
spawn(0)
|
||||
holder:Process_Activation(src)
|
||||
return
|
||||
pulse(0)
|
||||
for(var/mob/O in hearers(null, null))
|
||||
O.show_message(text("\icon[] *beep* *beep*", src), 3, "*beep* *beep*", 2)
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
Process_cooldown()
|
||||
process_cooldown()
|
||||
return
|
||||
|
||||
|
||||
process()
|
||||
if((src.timing) && (src.time >= 0))
|
||||
src.time--
|
||||
if(src.time <= 0)
|
||||
src.timing = 0
|
||||
src.time = 0
|
||||
toggle_scan()
|
||||
|
||||
if(!secured)
|
||||
if(scanning)
|
||||
scanning = 0
|
||||
src.timing = 0
|
||||
processing_objects.Remove(src)
|
||||
update_icon()
|
||||
if(timing && (time >= 0))
|
||||
time--
|
||||
if(time <= 0)
|
||||
timing = 0
|
||||
toggle_scan()
|
||||
time = 10
|
||||
return
|
||||
|
||||
|
||||
dropped()
|
||||
spawn(0)
|
||||
src.sense()
|
||||
sense()
|
||||
return
|
||||
return
|
||||
|
||||
@@ -143,17 +78,18 @@
|
||||
if(!secured) return 0
|
||||
scanning = !scanning
|
||||
update_icon()
|
||||
return
|
||||
|
||||
|
||||
update_icon()
|
||||
src.overlays = null
|
||||
src.small_icon_state_overlays = list()
|
||||
overlays = null
|
||||
small_icon_state_overlays = list()
|
||||
if(timing)
|
||||
src.overlays += text("prox_timing")
|
||||
src.small_icon_state_overlays += text("prox_timing")
|
||||
overlays += text("prox_timing")
|
||||
small_icon_state_overlays += text("prox_timing")
|
||||
if(scanning)
|
||||
src.overlays += text("prox_scanning")
|
||||
src.small_icon_state_overlays += text("prox_scanning")
|
||||
overlays += text("prox_scanning")
|
||||
small_icon_state_overlays += text("prox_scanning")
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
return
|
||||
@@ -161,28 +97,17 @@
|
||||
|
||||
Move()
|
||||
..()
|
||||
src.sense()
|
||||
sense()
|
||||
return
|
||||
|
||||
|
||||
examine()
|
||||
set src in view()
|
||||
..()
|
||||
if ((in_range(src, usr) || src.loc == usr))
|
||||
if (src.secured)
|
||||
usr.show_message("The [src.name] is ready!")
|
||||
else
|
||||
usr.show_message("The [src.name] can be attached!")
|
||||
return
|
||||
|
||||
|
||||
attack_self(mob/user as mob)
|
||||
interact(mob/user as mob)//TODO: Change this to the wires thingy
|
||||
if(!secured)
|
||||
user.show_message("\red The [src.name] is unsecured!")
|
||||
user.show_message("\red The [name] is unsecured!")
|
||||
return 0
|
||||
var/second = src.time % 60
|
||||
var/minute = (src.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>", (src.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)
|
||||
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 += "<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>"
|
||||
@@ -193,26 +118,29 @@
|
||||
|
||||
Topic(href, href_list)
|
||||
..()
|
||||
if(get_dist(src, usr) <= 1)
|
||||
if (href_list["scanning"])
|
||||
toggle_scan()
|
||||
|
||||
if (href_list["time"])
|
||||
src.timing = text2num(href_list["time"])
|
||||
update_icon()
|
||||
|
||||
if (href_list["tp"])
|
||||
var/tp = text2num(href_list["tp"])
|
||||
src.time += tp
|
||||
src.time = min(max(round(src.time), 0), 600)
|
||||
|
||||
if (href_list["close"])
|
||||
usr << browse(null, "window=prox")
|
||||
return
|
||||
|
||||
if(usr)
|
||||
src.attack_self(usr)
|
||||
|
||||
else
|
||||
if(get_dist(src, usr) > 1)
|
||||
usr << browse(null, "window=prox")
|
||||
onclose(usr, "prox")
|
||||
return
|
||||
|
||||
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["close"])
|
||||
usr << browse(null, "window=prox")
|
||||
return
|
||||
|
||||
if(usr)
|
||||
attack_self(usr)
|
||||
|
||||
|
||||
return
|
||||
@@ -1,2 +1,107 @@
|
||||
//Signalers are now an assembly item, not sure if I should put it in here.
|
||||
//Currently in game/objects/radio/signaler.dm
|
||||
/obj/item/device/assembly/signaler
|
||||
name = "Remote Signaling Device"
|
||||
desc = "Used to remotely activate devices."
|
||||
icon_state = "signaller"
|
||||
item_state = "signaler"
|
||||
m_amt = 1000
|
||||
g_amt = 200
|
||||
w_amt = 100
|
||||
origin_tech = "magnets=1"
|
||||
wires = WIRE_RECEIVE | WIRE_PULSE | WIRE_RADIO_PULSE | WIRE_RADIO_RECEIVE
|
||||
|
||||
secured = 1
|
||||
small_icon_state_left = "signaller_left"
|
||||
small_icon_state_right = "signaller_right"
|
||||
|
||||
var
|
||||
code = 30
|
||||
frequency = 100
|
||||
delay = 0
|
||||
airlock_wire = null
|
||||
|
||||
proc
|
||||
send_signal()
|
||||
|
||||
|
||||
activate()
|
||||
if(!..()) return 0//Cooldown check
|
||||
signal()
|
||||
pulse(0)
|
||||
if(istype(src.loc, /obj/machinery/door/airlock) && src.airlock_wire && src.wires)
|
||||
var/obj/machinery/door/airlock/A = src.loc
|
||||
A.pulse(src.airlock_wire)
|
||||
// pulse(1)//?
|
||||
return 1
|
||||
|
||||
|
||||
interact(mob/user as mob, flag1)
|
||||
|
||||
var/t1 = "-------"
|
||||
// if ((src.b_stat && !( flag1 )))
|
||||
// t1 = text("-------<BR>\nGreen Wire: []<BR>\nRed Wire: []<BR>\nBlue Wire: []<BR>\n", (src.wires & 4 ? text("<A href='?src=\ref[];wires=4'>Cut Wire</A>", src) : text("<A href='?src=\ref[];wires=4'>Mend Wire</A>", src)), (src.wires & 2 ? text("<A href='?src=\ref[];wires=2'>Cut Wire</A>", src) : text("<A href='?src=\ref[];wires=2'>Mend Wire</A>", src)), (src.wires & 1 ? text("<A href='?src=\ref[];wires=1'>Cut Wire</A>", src) : text("<A href='?src=\ref[];wires=1'>Mend Wire</A>", src)))
|
||||
// else
|
||||
// t1 = "-------" Speaker: [src.listening ? "<A href='byond://?src=\ref[src];listen=0'>Engaged</A>" : "<A href='byond://?src=\ref[src];listen=1'>Disengaged</A>"]<BR>
|
||||
var/dat = {"
|
||||
<TT>
|
||||
|
||||
<A href='byond://?src=\ref[src];send=1'>Send Signal</A><BR>
|
||||
<B>Frequency/Code</B> for signaler:<BR>
|
||||
Frequency:
|
||||
<A href='byond://?src=\ref[src];freq=-10'>-</A>
|
||||
<A href='byond://?src=\ref[src];freq=-2'>-</A>
|
||||
[src.frequency]
|
||||
<A href='byond://?src=\ref[src];freq=2'>+</A>
|
||||
<A href='byond://?src=\ref[src];freq=10'>+</A><BR>
|
||||
|
||||
Code:
|
||||
<A href='byond://?src=\ref[src];code=-5'>-</A>
|
||||
<A href='byond://?src=\ref[src];code=-1'>-</A>
|
||||
[src.code]
|
||||
<A href='byond://?src=\ref[src];code=1'>+</A>
|
||||
<A href='byond://?src=\ref[src];code=5'>+</A><BR>
|
||||
[t1]
|
||||
</TT>"}
|
||||
user << browse(dat, "window=radio")
|
||||
onclose(user, "radio")
|
||||
return
|
||||
|
||||
|
||||
Topic(href, href_list)
|
||||
//..()
|
||||
if(usr.stat)
|
||||
return
|
||||
if ((usr.contents.Find(src) || (usr.contents.Find(src.holder) || (in_range(src, usr) && istype(src.loc, /turf)))))
|
||||
usr.machine = src
|
||||
if (href_list["freq"])
|
||||
src.frequency += text2num(href_list["freq"])
|
||||
src.frequency = round(src.frequency)
|
||||
src.frequency = min(100, src.frequency)
|
||||
src.frequency = max(1, src.frequency)
|
||||
return
|
||||
|
||||
if(href_list["code"])
|
||||
src.code += text2num(href_list["code"])
|
||||
src.code = round(src.code)
|
||||
src.code = min(100, src.code)
|
||||
src.code = max(1, src.code)
|
||||
|
||||
if(href_list["send"])
|
||||
spawn( 0 )
|
||||
send_signal()
|
||||
return
|
||||
|
||||
// if(href_list["listen"])
|
||||
// src.listening = text2num(href_list["listen"])
|
||||
else
|
||||
usr << browse(null, "window=radio")
|
||||
return
|
||||
return
|
||||
|
||||
proc/signal()//will have to do for now
|
||||
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))
|
||||
S.pulsed(1)
|
||||
return 1
|
||||
return 0
|
||||
@@ -1,154 +1,81 @@
|
||||
/obj/item/device/timer
|
||||
/obj/item/device/assembly/timer
|
||||
name = "timer"
|
||||
desc = "Used to time things. Works well with contraptions which has to count down. Tick tock."
|
||||
icon = 'new_assemblies.dmi'
|
||||
icon_state = "timer"
|
||||
item_state = "electronic"
|
||||
flags = FPRINT | TABLEPASS| CONDUCT
|
||||
w_class = 2.0
|
||||
m_amt = 100
|
||||
m_amt = 500
|
||||
g_amt = 50
|
||||
w_amt = 10
|
||||
origin_tech = "magnets=1"
|
||||
|
||||
secured = 0
|
||||
small_icon_state_left = "timer_left"
|
||||
small_icon_state_right = "timer_right"
|
||||
|
||||
var
|
||||
secured = 0
|
||||
small_icon_state_left = "timer_left"
|
||||
small_icon_state_right = "timer_right"
|
||||
list/small_icon_state_overlays = null
|
||||
obj/holder = null
|
||||
cooldown = 0//To prevent spam
|
||||
timing = 0
|
||||
time = 0
|
||||
time = 10
|
||||
|
||||
proc
|
||||
Activate()//Called when this assembly is pulsed by another one
|
||||
Secure()//Code that has to happen when the assembly is ready goes here
|
||||
Unsecure()//Code that has to happen when the assembly is taken off of the ready state goes here
|
||||
Attach_Assembly(var/obj/A, var/mob/user)//Called when an assembly is attacked by another
|
||||
Process_cooldown()//Call this via spawn(10) to have it count down the cooldown var
|
||||
Holder_Movement()
|
||||
timer_end()
|
||||
|
||||
IsAssembly()
|
||||
return 1
|
||||
|
||||
|
||||
Process_cooldown()
|
||||
cooldown--
|
||||
if(cooldown <= 0) return 0
|
||||
spawn(10)
|
||||
Process_cooldown()
|
||||
return 1
|
||||
|
||||
|
||||
Activate()
|
||||
if((!secured) || (cooldown > 0))
|
||||
return 0
|
||||
cooldown = 2
|
||||
src.timing = !src.timing
|
||||
activate()
|
||||
if(!..()) return 0//Cooldown check
|
||||
timing = !timing
|
||||
update_icon()
|
||||
spawn(10)
|
||||
Process_cooldown()
|
||||
return 0
|
||||
|
||||
|
||||
Secure()
|
||||
toggle_secure()
|
||||
secured = !secured
|
||||
if(secured)
|
||||
return 0
|
||||
processing_objects.Add(src)//removal is taken care of it process()
|
||||
secured = 1
|
||||
return 1
|
||||
|
||||
|
||||
Unsecure()
|
||||
if(!secured)
|
||||
return 0
|
||||
secured = 0
|
||||
return 1
|
||||
|
||||
|
||||
Attach_Assembly(var/obj/A, var/mob/user)
|
||||
holder = new/obj/item/device/assembly_holder(get_turf(src))
|
||||
if(holder:attach(A,src,user))
|
||||
user.show_message("\blue You attach the [A.name] to the [src.name]!")
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(W.IsAssembly())
|
||||
var/obj/item/device/D = W
|
||||
if((!D:secured) && (!src.secured))
|
||||
Attach_Assembly(D,user)
|
||||
if(isscrewdriver(W))
|
||||
if(src.secured)
|
||||
Unsecure()
|
||||
user.show_message("\blue The [src.name] can now be attached!")
|
||||
else
|
||||
Secure()
|
||||
user.show_message("\blue The [src.name] is ready!")
|
||||
return
|
||||
processing_objects.Add(src)
|
||||
else
|
||||
..()
|
||||
return
|
||||
timing = 0
|
||||
processing_objects.Remove(src)
|
||||
update_icon()
|
||||
return secured
|
||||
|
||||
|
||||
timer_end()
|
||||
if((!secured)||(cooldown > 0)) return 0
|
||||
if((holder)&&(holder.IsAssemblyHolder()))
|
||||
spawn(0)
|
||||
holder:Process_Activation(src)
|
||||
return
|
||||
pulse(0)
|
||||
for(var/mob/O in hearers(null, null))
|
||||
O.show_message(text("\icon[] *beep* *beep*", src), 3, "*beep* *beep*", 2)
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
Process_cooldown()
|
||||
process_cooldown()
|
||||
return
|
||||
|
||||
|
||||
process()
|
||||
if((src.timing) && (src.time >= 0))
|
||||
src.time--
|
||||
if(src.time <= 0)
|
||||
src.timing = 0
|
||||
src.time = 0
|
||||
timer_end()
|
||||
update_icon()
|
||||
|
||||
if(!secured)
|
||||
src.timing = 0
|
||||
processing_objects.Remove(src)
|
||||
update_icon()
|
||||
if(timing && (time >= 0))
|
||||
time--
|
||||
if(time <= 0)
|
||||
timing = 0
|
||||
timer_end()
|
||||
time = 10
|
||||
return
|
||||
|
||||
|
||||
update_icon()
|
||||
src.overlays = null
|
||||
src.small_icon_state_overlays = list()
|
||||
overlays = null
|
||||
small_icon_state_overlays = list()
|
||||
if(timing)
|
||||
src.overlays += text("timer_timing")
|
||||
src.small_icon_state_overlays += text("timer_timing")
|
||||
overlays += text("timer_timing")
|
||||
small_icon_state_overlays += text("timer_timing")
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
return
|
||||
|
||||
|
||||
examine()
|
||||
set src in view()
|
||||
..()
|
||||
if ((in_range(src, usr) || src.loc == usr))
|
||||
if (src.secured)
|
||||
usr.show_message("The [src.name] is ready!")
|
||||
else
|
||||
usr.show_message("The [src.name] can be attached!")
|
||||
return
|
||||
|
||||
|
||||
attack_self(mob/user as mob)
|
||||
interact(mob/user as mob)//TODO: Have this use the wires
|
||||
if(!secured)
|
||||
user.show_message("\red The [src.name] is unsecured!")
|
||||
user.show_message("\red The [name] is unsecured!")
|
||||
return 0
|
||||
var/second = src.time % 60
|
||||
var/minute = (src.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>", (src.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)
|
||||
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")
|
||||
@@ -158,24 +85,25 @@
|
||||
|
||||
Topic(href, href_list)
|
||||
..()
|
||||
if(get_dist(src, usr) <= 1)
|
||||
|
||||
if (href_list["time"])
|
||||
src.timing = text2num(href_list["time"])
|
||||
update_icon()
|
||||
|
||||
if (href_list["tp"])
|
||||
var/tp = text2num(href_list["tp"])
|
||||
src.time += tp
|
||||
src.time = min(max(round(src.time), 0), 600)
|
||||
|
||||
if (href_list["close"])
|
||||
usr << browse(null, "window=timer")
|
||||
return
|
||||
|
||||
if(usr)
|
||||
src.attack_self(usr)
|
||||
|
||||
else
|
||||
if(get_dist(src, usr) > 1)
|
||||
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
|
||||
Reference in New Issue
Block a user