Files
CHOMPStation2/code/game/machinery/computer/robot.dm
johnsonmt88@gmail.com 52dd7b3af5 Cleaning up machine process()s
But first! Unrelated to process():
- Only humans and monkeys can move into sleepers.
- Immovable rods no longer delete themselves if they hit a shuttle. Instead they act as if the shuttle doesn't exist. This should help cut down on rods deleting themselves before going through the station.

And now back to our regularly scheduled programming...

Removed process() that were doing nothing from:
- Dispenser(the one that dispenses O2 and Plasma tanks)
- Robotic Fabricators
- Crew Monitoring computer

Reworked hydroponic's process(). 
- Merged if statements together since most of them lacked "else if"s or were duplicate checks.
- Changed a while loop into a for loop as sloppy coding or an admin var-editing could cause an infinite loop.

Removed a sleep(100) { process() } from the operating table's constructor as the MC will call process() regardless.

Cleaned up shieldgen.dm
- Changed a while loop into an if statement. The loop was unnecessary
- Moved some stuff around so it's not nearly as confusing.
- Standardized the proc and variable definitions.
- These are not currently in-game but they are amazing items. I'll see about sorting out their bugs and getting them in proper working order.

Removed a for(var in world) from
- cleanbot process()
- floorbot process()

Removed computer/engine/process() from robot/computer code
- /obj/machinery/computer/engine does not exist in the first place...

Note: These are only some of the machinery process()s. I didn't want to potentially break too much at once. More to come.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4017 316c924e-a436-60f5-8080-3fe189b3f50e
2012-07-08 19:40:10 +00:00

233 lines
7.6 KiB
Plaintext

//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31
/obj/machinery/computer/robotics
name = "Robotics Control"
desc = "Used to remotely lockdown or detonate linked Cyborgs."
icon = 'computer.dmi'
icon_state = "robot"
req_access = list(access_robotics)
circuit = "/obj/item/weapon/circuitboard/robotics"
var/id = 0.0
var/temp = null
var/status = 0
var/timeleft = 60
var/stop = 0.0
var/screen = 0 // 0 - Main Menu, 1 - Cyborg Status, 2 - Kill 'em All! -- In text
/obj/machinery/computer/robotics/attack_ai(var/mob/user as mob)
return src.attack_hand(user)
/obj/machinery/computer/robotics/attack_paw(var/mob/user as mob)
return src.attack_hand(user)
return
/obj/machinery/computer/robotics/attack_hand(var/mob/user as mob)
if(..())
return
user.machine = src
var/dat
if (src.temp)
dat = "<TT>[src.temp]</TT><BR><BR><A href='?src=\ref[src];temp=1'>Clear Screen</A>"
else
if(screen == 0)
dat += "<h3>Cyborg Control Console</h3><BR>"
dat += "<A href='?src=\ref[src];screen=1'>1. Cyborg Status</A><BR>"
dat += "<A href='?src=\ref[src];screen=2'>2. Emergency Full Destruct</A><BR>"
if(screen == 1)
for(var/mob/living/silicon/robot/R in world)
if(istype(user, /mob/living/silicon/ai))
if (R.connected_ai != user)
continue
if(istype(user, /mob/living/silicon/robot))
if (R != user)
continue
if(R.scrambledcodes)
continue
dat += "[R.name] |"
if(R.stat)
dat += " Not Responding |"
else if (!R.canmove)
dat += " Locked Down |"
else
dat += " Operating Normally |"
if (!R.canmove)
else if(R.cell)
dat += " Battery Installed ([R.cell.charge]/[R.cell.maxcharge]) |"
else
dat += " No Cell Installed |"
if(R.module)
dat += " Module Installed ([R.module.name]) |"
else
dat += " No Module Installed |"
if(R.connected_ai)
dat += " Slaved to [R.connected_ai.name] |"
else
dat += " Independent from AI |"
if (istype(user, /mob/living/silicon))
if((user.mind.special_role && user.mind.original == user) && !R.emagged)
dat += "<A href='?src=\ref[src];magbot=\ref[R]'>(<font color=blue><i>Hack</i></font>)</A> "
dat += "<A href='?src=\ref[src];stopbot=\ref[R]'>(<font color=green><i>[R.canmove ? "Lockdown" : "Release"]</i></font>)</A> "
dat += "<A href='?src=\ref[src];killbot=\ref[R]'>(<font color=red><i>Destroy</i></font>)</A>"
dat += "<BR>"
dat += "<A href='?src=\ref[src];screen=0'>(Return to Main Menu)</A><BR>"
if(screen == 2)
if(!src.status)
dat += {"<BR><B>Emergency Robot Self-Destruct</B><HR>\nStatus: Off<BR>
\n<BR>
\nCountdown: [src.timeleft]/60 <A href='?src=\ref[src];reset=1'>\[Reset\]</A><BR>
\n<BR>
\n<A href='?src=\ref[src];eject=1'>Start Sequence</A><BR>
\n<BR>
\n<A href='?src=\ref[user];mach_close=computer'>Close</A>"}
else
dat = {"<B>Emergency Robot Self-Destruct</B><HR>\nStatus: Activated<BR>
\n<BR>
\nCountdown: [src.timeleft]/60 \[Reset\]<BR>
\n<BR>\n<A href='?src=\ref[src];stop=1'>Stop Sequence</A><BR>
\n<BR>
\n<A href='?src=\ref[user];mach_close=computer'>Close</A>"}
dat += "<A href='?src=\ref[src];screen=0'>(Return to Main Menu)</A><BR>"
user << browse(dat, "window=computer;size=400x500")
onclose(user, "computer")
return
//Why is this in robot/computer and why does it exist when /obj/machinery/computer/engine does not? -Nodrak
/*/obj/machinery/computer/engine/process()
if(stat & (NOPOWER|BROKEN))
return
use_power(500)
src.updateDialog()
return*/
/obj/machinery/computer/robotics/Topic(href, href_list)
if(..())
return
if ((usr.contents.Find(src) || (in_range(src, usr) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon)))
usr.machine = src
if (href_list["eject"])
src.temp = {"Destroy Robots?<BR>
<BR><B><A href='?src=\ref[src];eject2=1'>\[Swipe ID to initiate destruction sequence\]</A></B><BR>
<A href='?src=\ref[src];temp=1'>Cancel</A>"}
else if (href_list["eject2"])
var/obj/item/weapon/card/id/I = usr.get_active_hand()
if (istype(I, /obj/item/device/pda))
var/obj/item/device/pda/pda = I
I = pda.id
if (istype(I))
if(src.check_access(I))
if (!status)
message_admins("\blue [key_name_admin(usr)] has initiated the global cyborg killswitch!")
log_game("\blue [key_name(usr)] has initiated the global cyborg killswitch!")
src.status = 1
src.start_sequence()
src.temp = null
else
usr << "\red Access Denied."
else if (href_list["stop"])
src.temp = {"
Stop Robot Destruction Sequence?<BR>
<BR><A href='?src=\ref[src];stop2=1'>Yes</A><BR>
<A href='?src=\ref[src];temp=1'>No</A>"}
else if (href_list["stop2"])
src.stop = 1
src.temp = null
src.status = 0
else if (href_list["reset"])
src.timeleft = 60
else if (href_list["temp"])
src.temp = null
else if (href_list["screen"])
switch(href_list["screen"])
if("0")
screen = 0
if("1")
screen = 1
if("2")
screen = 2
else if (href_list["killbot"])
if(src.allowed(usr))
var/mob/living/silicon/robot/R = locate(href_list["killbot"])
if(R)
var/choice = input("Are you certain you wish to detonate [R.name]?") in list("Confirm", "Abort")
if(choice == "Confirm")
if(R && istype(R))
if(R.mind && R.mind.special_role && R.emagged)
R << "Extreme danger. Termination codes detected. Scrambling security codes and automatic AI unlink triggered."
R.ResetSecurityCodes()
else
message_admins("\blue [key_name_admin(usr)] detonated [R.name]!")
log_game("\blue [key_name_admin(usr)] detonated [R.name]!")
R.self_destruct()
else
usr << "\red Access Denied."
else if (href_list["stopbot"])
if(src.allowed(usr))
var/mob/living/silicon/robot/R = locate(href_list["stopbot"])
if(R && istype(R)) // Extra sancheck because of input var references
var/choice = input("Are you certain you wish to [R.canmove ? "lock down" : "release"] [R.name]?") in list("Confirm", "Abort")
if(choice == "Confirm")
if(R && istype(R))
message_admins("\blue [key_name_admin(usr)] [R.canmove ? "locked down" : "released"] [R.name]!")
log_game("[key_name(usr)] [R.canmove ? "locked down" : "released"] [R.name]!")
R.canmove = !R.canmove
if (R.lockcharge)
// R.cell.charge = R.lockcharge
R.lockcharge = !R.lockcharge
R << "Your lockdown has been lifted!"
else
R.lockcharge = !R.lockcharge
// R.cell.charge = 0
R << "You have been locked down!"
else
usr << "\red Access Denied."
else if (href_list["magbot"])
if(src.allowed(usr))
var/mob/living/silicon/robot/R = locate(href_list["magbot"])
if(R)
var/choice = input("Are you certain you wish to hack [R.name]?") in list("Confirm", "Abort")
if(choice == "Confirm")
if(R && istype(R))
message_admins("\blue [key_name_admin(usr)] emagged [R.name] using robotic console!")
log_game("[key_name(usr)] emagged [R.name] using robotic console!")
R.emagged = 1
if(R.mind.special_role)
R.verbs += /mob/living/silicon/robot/proc/ResetSecurityCodes
src.add_fingerprint(usr)
src.updateUsrDialog()
return
/obj/machinery/computer/robotics/proc/start_sequence()
do
if(src.stop)
src.stop = 0
return
src.timeleft--
sleep(10)
while(src.timeleft)
for(var/mob/living/silicon/robot/R in world)
if(!R.scrambledcodes)
R.self_destruct()
return