mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
machine.process() now uses a return value to remove itself from the processing machines list. This is more efficient and will help reduce costs especially at round start where some 5000+ machines were removed from the list using first-find. Now there is no searching involved. Instead of machines.Remove(src) just do .=PROCESS_KILL that will return the flag to the proc which called it (the MC) and trigger its removal from the list. If you're deleting something don't even bother removing it from the machines list, there is no need to. Simplified the last_processed stuff for the MC. It's now a single variable rather than 3. It is simply a typepath rather than a reference to an object (this is so it works even if said object is deleted) MC stats in admin status_panels now show the length of the processing lists (indicated by #). I've just realised I forgot to mention what the abbreviations are: The less obvious ones are: Dis=diseases; Net=pipes; Pnet=powernets; Mch=Machines; Tick=the game-mode ticker. Beach-water now uses an overlay image rather than a separate object. Fixed a typo in the shuttle console. Hydroponics trays no longer use first-find within their process() for checking the plant is in the tray (why is that even there anyway? talk about lazy) Removed some junk/placeholder procs like organ/proc/process() return Removed newscasters from the processing machines lists. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4603 316c924e-a436-60f5-8080-3fe189b3f50e
225 lines
7.4 KiB
Plaintext
225 lines
7.4 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 = 'icons/obj/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 mob_list)
|
|
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
|
|
|
|
/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 mob_list)
|
|
if(!R.scrambledcodes)
|
|
R.self_destruct()
|
|
|
|
return
|
|
|