Files
vgstation13/code/modules/assembly/proximity.dm
mport2004@gmail.com fbd0a5a9b5 Timers will no longer go off when you set them to 0 unless they are on.
Unsimulated turfs can be climbed on once more.
Small blobs can use the blob to move around in space.
Jetpacks now have a toggle for the stabilization.
Jetpack fuel use has been reset to .01.
Moved most of the tanks over to a new folder and files so they are not all crammed into one.
The meteor event actually spawns more than one wave worth of meteors.


git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2488 316c924e-a436-60f5-8080-3fe189b3f50e
2011-11-05 05:25:22 +00:00

146 lines
3.2 KiB
Plaintext

/obj/item/device/assembly/prox_sensor
name = "proximity sensor"
desc = "Used for scanning and alerting when someone enters a certain proximity."
icon_state = "prox"
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
scanning = 0
timing = 0
time = 10
proc
toggle_scan()
sense()
activate()
if(!..()) return 0//Cooldown check
timing = !timing
update_icon()
return 0
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, /obj/effect/beam)) return
if (AM.move_speed < 12) sense()
return
sense()
if((!secured)||(!scanning)||(cooldown > 0)) return 0
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()
return
process()
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 = null
small_icon_state_overlays = list()
if(timing)
overlays += text("prox_timing")
small_icon_state_overlays += text("prox_timing")
if(scanning)
overlays += text("prox_scanning")
small_icon_state_overlays += text("prox_scanning")
if(holder)
holder.update_icon()
return
Move()
..()
sense()
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 += "<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
Topic(href, href_list)
..()
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