Files
Paradise/code/game/machinery/ai_slipper.dm
mport2004@gmail.com 17ed3899c4 Fixed the map/code issues that the body bags caused.
/obj/effects is now /obj/effect.
/obj/station_objects is now /obj/structure.
Did a bit of minor blob work. 
The Bay 12 body bags were replaced with closets because having two sets of code that do almost the same thing is silly.
Changed back a few of the last jobproc edits as the remove from list before assign was a check to see if the mob was fucked up and if it was remove it so we did not check it again as it would still be fucked up.
The medbay/tox monkeys names are random once more.  More random name monkeys will help with changeling and clean up the observe/mob menus.


git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2324 316c924e-a436-60f5-8080-3fe189b3f50e
2011-10-03 10:28:57 +00:00

124 lines
3.0 KiB
Plaintext

/obj/machinery/ai_slipper
name = "AI Liquid Dispenser"
icon = 'device.dmi'
icon_state = "motion3"
layer = 3
anchored = 1.0
var/uses = 20
var/disabled = 1
var/lethal = 0
var/locked = 1
var/cooldown_time = 0
var/cooldown_timeleft = 0
var/cooldown_on = 0
req_access = list(access_ai_upload)
/obj/machinery/ai_slipper/power_change()
if(stat & BROKEN)
return
else
if( powered() )
stat &= ~NOPOWER
else
icon_state = "motion0"
stat |= NOPOWER
/obj/machinery/ai_slipper/proc/setState(var/enabled, var/uses)
src.disabled = disabled
src.uses = uses
src.power_change()
/obj/machinery/ai_slipper/attackby(obj/item/weapon/W, mob/user)
if(stat & (NOPOWER|BROKEN))
return
if (istype(user, /mob/living/silicon))
return src.attack_hand(user)
else // trying to unlock the interface
if (src.allowed(usr))
locked = !locked
user << "You [ locked ? "lock" : "unlock"] the device."
if (locked)
if (user.machine==src)
user.machine = null
user << browse(null, "window=ai_slipper")
else
if (user.machine==src)
src.attack_hand(usr)
else
user << "\red Access denied."
return
return
/obj/machinery/ai_slipper/attack_ai(mob/user as mob)
return attack_hand(user)
/obj/machinery/ai_slipper/attack_hand(mob/user as mob)
if(stat & (NOPOWER|BROKEN))
return
if ( (get_dist(src, user) > 1 ))
if (!istype(user, /mob/living/silicon))
user << text("Too far away.")
user.machine = null
user << browse(null, "window=ai_slipper")
return
user.machine = src
var/loc = src.loc
if (istype(loc, /turf))
loc = loc:loc
if (!istype(loc, /area))
user << text("Turret badly positioned - loc.loc is [].", loc)
return
var/area/area = loc
var/t = "<TT><B>AI Liquid Dispenser</B> ([area.name])<HR>"
if(src.locked && (!istype(user, /mob/living/silicon)))
t += "<I>(Swipe ID card to unlock control panel.)</I><BR>"
else
t += text("Dispenser [] - <A href='?src=\ref[];toggleOn=1'>[]?</a><br>\n", src.disabled?"deactivated":"activated", src, src.disabled?"Enable":"Disable")
t += text("Uses Left: [uses]. <A href='?src=\ref[src];toggleUse=1'>Activate the dispenser?</A><br>\n")
user << browse(t, "window=computer;size=575x450")
onclose(user, "computer")
return
/obj/machinery/ai_slipper/Topic(href, href_list)
..()
if (src.locked)
if (!istype(usr, /mob/living/silicon))
usr << "Control panel is locked!"
return
if (href_list["toggleOn"])
src.disabled = !src.disabled
icon_state = src.disabled? "motion0":"motion3"
if (href_list["toggleUse"])
if(cooldown_on || disabled)
return
else
new /obj/effect/foam(src.loc)
src.uses--
cooldown_on = 1
cooldown_time = world.timeofday + 100
slip_process()
return
src.attack_hand(usr)
return
/obj/machinery/ai_slipper/proc/slip_process()
while(cooldown_time - world.timeofday > 0)
var/ticksleft = cooldown_time - world.timeofday
if(ticksleft > 1e5)
cooldown_time = world.timeofday + 10 // midnight rollover
cooldown_timeleft = (ticksleft / 10)
sleep(5)
if (uses <= 0)
return
if (uses >= 0)
cooldown_on = 0
src.power_change()
return