Files
Polaris/code/modules/mob/living/silicon/robot/robot.dm
Erthilo ac30f5f2d3 TG: Sieve stuff, this is a stupidly big commit, I'm sorry, I really am.
Full details in this thread:
http://nanotrasen.com/phpBB3/viewtopic.php?f=16&t=8898
And a summary of the most important bits:
-Door animations no longer desync and do the open-close-open thing. That's been
around so long most people don't even notice
-Welding tools no longer get their icons desynced
-Fixed unpowered mineral door runtimes
-Chemistry machines now require power to run
-Fixed the proc to apply radiation based on armor, which means that you can
actually not die of radiation as quickly if you wear armor that protects against
radiation
--By fixing this, it also fixed the singularity, so you might want to be careful
next time you run by it naked
--Also means that radiation events take armor into account. How great
-Hopefully have a bugfix to prevent borgs from using lag to enter the game
without an AI or laws, but I cannot test it myself other than that it didn't
break anything
-Disposal sound can only play once every couple of ticks, so no more ear-rape by
disposals!
-Lasertag guns can no longer be used to make lasergun turrets
-Cleaned up stray pixels on several doors and the lasertag guns

-Reworked how falsewalls work, now whenever you attack them with certain tools
(drills, welders, etc...) it instantly turns them into a wall and pushes the
attackby(), meaning you might not even notice that you just drilled down a
falsewall, and at the very least they are much more fitting
-Omni-directional PA console! Never have to worry about rotating that fucking
computer again, because now it does it itself!
-The Marisa robe that spawns in the theater no longer protects like armor
-Tweaked coefficient list for fake insulated gloves (misplaced punctuation
messed up the list a tad)
-Moved falsewalls out of 'transfer_valve.dm' and into 'structures.dm'
-Tweaked smoothwalls so it only connects walls with like minerals (only seen
effect is on the new walls)
--Also added appropriate signs to areas
-Reworked portable turrets to be a lot less laggy, now they determine the
projectile type once, then save it so they don't have to go through else if
chains every time they fire
-Added many sprites from WJohnston, but many are not fully implemented (Mostly
floor ones)
-Added a vending machine for engineering, the Engivend. Apparently it was needed
because of the lack of availability of the Autolathe or whatever.
-Added WJohnston's Dark Gygax sprites, then made a Death Squad Gygax out of
them. A bit tougher than the standard Gygax, improved battery, and is pre-fit
with gear, ideally for 'hit and run' tactics
-New Odysseus construction sprites, also removed the Odysseus Carapace in favor
of plasteel like the Ripley, meaning they in terms of construction, a Ripley is
equivalent to an Odysseus
-Added an 'is_hot()' proc, when called it returns the temperature of the item in
K, while taking into account things like whether or not the item is active or
whatever
-Rewrote the Experimental Welding Tool, now instead of having a super-sized
tank, it uses super-concentrated plasma that is turned into gas inside of it as
its fuel source. Meaning, it will never have to be refilled, but it takes time
for it to fill itself
-Added WJ's firelight sprites and code. Wanted to use them, but haven't had a
chance to really implement them, but still, they're there

-Turrets made with lasertag guns now fire their respective team's bolt
-The turrets also automatically target anyone on the opposing team (But will
continue to shoot at anyone, for shits n' giggles)
-Turrets get corresponding sprites based on team
-Shooting a turret with a different team's laser will disable it for 10 seconds
-You can also make ED-209's for your lasertag games/pissing off sec
-These are constructed just like a regular ED, but instead of a security vest
and taser, it requires a lasertag vest and gun (same colors)
-When geared for lasertag, They will not arrest anyone nor melee them, only
patrol (if set) and shoot
-They have their color schemes as well, and can be disabled just like turrets
-For both turrets and EDs, when geared for lasertag, they will not shoot anyone
on the ground, this was due to very quickly learning how fucking OP that was for
1 turret to stunlock 3 people for eternity
-And when they are geared for lasertag, both the turrets and EDs have their
access changed to maint, clown, and mime (This will not stop any of them from
being shot, however)
-As a side note, you can also make lasertag stationary turrets for any map-
related things

-Now walls are based on a plating system, meaning all walls have a girder with a
mineral plating on top of it.
-As of right now, usable minerals are Silver, Gold, Diamond, Uranium, Plasma,
and Sandstone (Lacking sprites for wood, *cough*)
-This also carries over to falsewalls, so you can make falsewalls out of any of
those minerals
-Also, this carries over to powered doors, meaning you can construct useful
doors out of minerals, so you could have actual diamond forts with doors
requiring access to get in or whatever
-All of these are standardized, and for the most part work just like regular
walls, meaning if you start slicing a wall, it will drop the mineral, or if you
drill it, or whatever
-What was mentioned with the smoothwall tweak above, only walls of the same
mineral will connect, so it all looks very nice
-Doors and walls made of uranium emit radiation when interacted with, with walls
causing a 'ripple' effect, so the more walls nearby, the more radiation you get
hit with
-Doors and walls made of plasma burn. It's a short, quick burn, but can easily
be compounded in large structures
--As a note on plasma walls, I cannot get atmos and plasma walls to play nice
(Since they are airless turfs), so I can't actually get them to ignite based on
air temperature, but when they do ignite, they will auto-magically ignite nearby
plasma walls, with a reduced temperature, meaning that if you want a massive
chain reaction over a huge area, you better use something a bit hotter than a
lighter
--Also, when plasma walls burn, they simply leave behind a girder, while doors
leave assemblies
-Lastly, for nearly any kind of destructive action, Diamond walls are much more
resilient, meaning they will take twice as long to be destroyed, and are immune
to the effects of thermite
(Also, sprites for plasma walls and uranium walls are shite right now, waiting
for replacements)
Update:
-Added cult walls as a 'mineral wall', meaning they will work on the same system
and 'ReplaceWithMineralWall("cult")' will change any turf into a cult wall,
hopefully for some cult-related activities soon

R&D stuff:
-Now instead of 1 sheet or ALL OF THE SHEETS, you enter a number as to how many
sheets you want (it's sanitized to hell as well)
-Minerals no longer multiply when inside RnD machines. (Who fucked that one up?
Goddamn)
-Mech fabricators are both deconstructable, and putting higher level parts
actually improve it, each 'Tier' up is equivalent to +1 tech levels for that, so
a High Powered Micro Laser would give the same bonus as +1 Material Research, a
Pico Manipulator would give the same bonus as +2 Engineering, etc
-Complete with a shitty opened Mech Fab sprite!
-And not shitty overlays so autolathe's animate the material that is put in
them, rather than give everything that's not glass the metal animation

LOL THE JOKES ON YOU I JUST COPY PASTED HIS TOPIC

added a few svn ignores, for thumbs.db and maps/backup
Revision: r3751
Author: 	 petethegoat
2012-06-19 21:37:44 +01:00

1246 lines
36 KiB
Plaintext

/mob/living/silicon/robot
var/started = null//A fix to ensure people don't try to bypass law assignment. Initial assignment sets it to one but it check on login whether they have been initiated -Sieve
/mob/living/silicon/robot/New(loc,var/syndie = 0)
spark_system = new /datum/effect/effect/system/spark_spread()
spark_system.set_up(5, 0, src)
spark_system.attach(src)
spawn (1)
src << "\blue Your icons have been generated!"
playsound(loc, 'liveagain.ogg', 50, 1, -3)
modtype = "robot"
updateicon()
// syndicate = syndie
if(real_name == "Cyborg")
ident = rand(1, 999)
real_name += "-[ident]"
name = real_name
spawn (4)
if(!syndie)
if (client)
connected_ai = activeais()
if (connected_ai)
connected_ai.connected_robots += src
// laws = connected_ai.laws //The borg inherits its AI's laws
laws = new /datum/ai_laws
lawsync()
src << "<b>Unit slaved to [connected_ai.name], downloading laws.</b>"
lawupdate = 1
else
laws = new /datum/ai_laws/nanotrasen
lawupdate = 0
src << "<b>Unable to locate an AI, reverting to standard NanoTrasen laws.</b>"
else
laws = new /datum/ai_laws/antimov
lawupdate = 0
scrambledcodes = 1
src << "Follow your laws."
cell.maxcharge = 25000
cell.charge = 25000
module = new /obj/item/weapon/robot_module/syndicate(src)
hands.icon_state = "standard"
icon_state = "secborg"
modtype = "Synd"
radio = new /obj/item/device/radio(src)
camera = new /obj/machinery/camera(src)
camera.c_tag = real_name
camera.network = "SS13"
if(!cell)
var/obj/item/weapon/cell/C = new(src)
C.charge = 1500
cell = C
if(src.mind)
ticker.mode.remove_revolutionary(src.mind)
started = 1
..()
//If there's an MMI in the robot, have it ejected when the mob goes away. --NEO
//Improved /N
/mob/living/silicon/robot/Del()
if(mmi)//Safety for when a cyborg gets dust()ed. Or there is no MMI inside.
mmi.loc = get_turf(loc)//To hopefully prevent run time errors.
if(!key)
for(var/mob/dead/observer/ghost in world)
if(ghost.corpse == src && ghost.client)
ghost.client.mob = ghost.corpse
if(key)//If there is a client attached to host.
if(client)
client.screen.len = null
if(mind)//If the cyborg has a mind. It should if it's a player. May not.
mind.transfer_to(mmi.brainmob)
else if(!mmi.brainmob.mind)//If the brainmob has no mind and neither does the cyborg. Shouldn't happen but can due to admun canspiraucy.
mmi.brainmob.mind = new()//Quick mind initialize
mmi.brainmob.mind.current = mmi.brainmob
mmi.brainmob.mind.assigned_role = "Assistant"//Default to an assistant.
mmi.brainmob.key = key
else//If the brain does have a mind. Also shouldn't happen but who knows.
mmi.brainmob.key = key
mmi = null
..()
/mob/living/silicon/robot/proc/pick_module()
if(module || modlock)
return
var/mod = input("Please, select a module!", "Robot", null, null) in list("Standard", "Engineering", "Medical", "Miner", "Janitor","Service", "Security")
if(module || modlock)
return
switch(mod)
if("Standard")
updatename()
module = new /obj/item/weapon/robot_module/standard(src)
hands.icon_state = "standard"
icon_state = "robot"
modtype = "Stand"
//feedback_inc("cyborg_standard",1)
channels = list()
if("Service")
updatename(mod)
module = new /obj/item/weapon/robot_module/butler(src)
hands.icon_state = "service"
var/icontype = input("Select an icon!", "Robot", null, null) in list("Waitress", "Bro", "Butler", "Kent", "Rich")
if(icontype== "Waitress")
icon_state = "Service"
else if(icontype == "Kent")
icon_state = "toiletbot"
else if(icontype == "Bro")
icon_state = "Brobot"
else if(icontype == "Rich")
icon_state = "maximillion"
else
icon_state = "Service2"
modtype = "Butler"
//feedback_inc("cyborg_service",1)
channels = list()
if("Miner")
updatename(mod)
module = new /obj/item/weapon/robot_module/miner(src)
hands.icon_state = "miner"
icon_state = "Miner"
modtype = "Miner"
//feedback_inc("cyborg_miner",1)
channels = list("Mining" = 1)
if("Medical")
var/sprite = input(src,"Chassis Style", "Chassis Style", "Cancel") in list("Humanoid","Non-Humanoid")
updatename(mod)
module = new /obj/item/weapon/robot_module/medical(src)
hands.icon_state = "medical"
if (sprite == "Humanoid")
src.icon_state = "medicalrobot"
if (sprite == "Non-Humanoid")
src.icon_state = "surgeon"
modtype = "Med"
nopush = 1
//feedback_inc("cyborg_medical",1)
channels = list("Medical" = 1)
if("Security")
var/sprite = input(src,"Chassis Style", "Chassis Style", "Cancel") in list("Humanoid","Non-Humanoid")
updatename(mod)
module = new /obj/item/weapon/robot_module/security(src)
hands.icon_state = "security"
if (sprite == "Humanoid")
src.icon_state = "securityrobot"
if (sprite == "Non-Humanoid")
src.icon_state = "bloodhound"
modtype = "Sec"
//speed = -1 Secborgs have nerfed tasers now, so the speed boost is not necessary
nopush = 1
channels = list("Security" = 1)
//feedback_inc("cyborg_security",1)
if("Engineering")
updatename(mod)
var/sprite = input(src,"Chassis Style", "Chassis Style", "Cancel") in list("Humanoid","Non-Humanoid")
module = new /obj/item/weapon/robot_module/engineering(src)
hands.icon_state = "engineer"
if (sprite == "Humanoid")
src.icon_state = "engineerrobot"
if (sprite == "Non-Humanoid")
src.icon_state = "landmate"
modtype = "Eng"
//feedback_inc("cyborg_engineering",1)
channels = list("Engineering" = 1)
if("Janitor")
updatename(mod)
var/sprite = input(src,"Chassis Style", "Chassis Style", "Cancel") in list("Humanoid","Non-Humanoid")
module = new /obj/item/weapon/robot_module/janitor(src)
hands.icon_state = "janitor"
if (sprite == "Humanoid")
src.icon_state = "janitorrobot"
if (sprite == "Non-Humanoid")
src.icon_state = "mopgearrex"
modtype = "Jan"
//feedback_inc("cyborg_janitor",1)
channels = list()
overlays -= "eyes" //Takes off the eyes that it started with
radio.config(channels)
updateicon()
/mob/living/silicon/robot/proc/updatename(var/prefix as text)
if( length(real_name) < 7 || !prefix ) return
//not really necessary but just to avoid annoying people with
//unique names seeming as nobody could give me a straight answer as
//to whether to remove custom borg names completely.
if(copytext(real_name, 1, 7) == "Cyborg")
real_name = "[prefix] [real_name]"
name = real_name
/mob/living/silicon/robot/verb/cmd_robot_alerts()
set category = "Robot Commands"
set name = "Show Alerts"
robot_alerts()
/mob/living/silicon/robot/proc/robot_alerts()
var/dat = "<HEAD><TITLE>Current Station Alerts</TITLE><META HTTP-EQUIV='Refresh' CONTENT='10'></HEAD><BODY>\n"
dat += "<A HREF='?src=\ref[src];mach_close=robotalerts'>Close</A><BR><BR>"
for (var/cat in alarms)
dat += text("<B>[cat]</B><BR>\n")
var/list/L = alarms[cat]
if (L.len)
for (var/alarm in L)
var/list/alm = L[alarm]
var/area/A = alm[1]
var/list/sources = alm[3]
dat += "<NOBR>"
dat += text("-- [A.name]")
if (sources.len > 1)
dat += text("- [sources.len] sources")
dat += "</NOBR><BR>\n"
else
dat += "-- All Systems Nominal<BR>\n"
dat += "<BR>\n"
viewalerts = 1
src << browse(dat, "window=robotalerts&can_close=0")
/mob/living/silicon/robot/proc/ai_roster()
set category = "Robot Commands"
set name = "Show Crew Manifest"
var/dat = "<html><head><title>Crew Roster</title></head><body><b>Crew Roster:</b><br><br>"
for (var/datum/data/record/t in data_core.general)
dat += "[t.fields["name"]] - [t.fields["rank"]]<br>"
dat += "</body></html>"
src << browse(dat, "window=airoster")
onclose(src, "airoster")
/mob/living/silicon/robot/blob_act()
if (stat != 2)
adjustBruteLoss(60)
updatehealth()
return 1
return 0
/mob/living/silicon/robot/Stat()
..()
statpanel("Status")
if (client.statpanel == "Status")
if(emergency_shuttle.online && emergency_shuttle.location < 2)
var/timeleft = emergency_shuttle.timeleft()
if (timeleft)
stat(null, "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]")
if(ticker.mode.name == "AI malfunction")
var/datum/game_mode/malfunction/malf = ticker.mode
for (var/datum/mind/malfai in malf.malf_ai)
if(connected_ai)
if(connected_ai.mind == malfai)
if(malf.apcs >= 3)
stat(null, "Time until station control secured: [max(malf.AI_win_timeleft/(malf.apcs/3), 0)] seconds")
else if(ticker.mode:malf_mode_declared)
stat(null, "Time left: [max(ticker.mode:AI_win_timeleft/(ticker.mode:apcs/3), 0)]")
if(cell)
stat(null, text("Charge Left: [cell.charge]/[cell.maxcharge]"))
else
stat(null, text("No Cell Inserted!"))
if(module)
internal = locate(/obj/item/weapon/tank/jetpack) in module.modules
if(internal)
stat("Internal Atmosphere Info", internal.name)
stat("Tank Pressure", internal.air_contents.return_pressure())
/mob/living/silicon/robot/restrained()
return 0
/mob/living/silicon/robot/ex_act(severity)
flick("flash", flash)
/*
if (stat == 2 && client)
gib()
return
else if (stat == 2 && !client)
del(src)
return
*/
switch(severity)
if(1.0)
if (stat != 2)
adjustBruteLoss(100)
adjustFireLoss(100)
gib()
return
if(2.0)
if (stat != 2)
adjustBruteLoss(60)
adjustFireLoss(60)
if(3.0)
if (stat != 2)
adjustBruteLoss(30)
updatehealth()
/mob/living/silicon/robot/meteorhit(obj/O as obj)
for(var/mob/M in viewers(src, null))
M.show_message(text("\red [src] has been hit by [O]"), 1)
//Foreach goto(19)
if (health > 0)
adjustBruteLoss(30)
if ((O.icon_state == "flaming"))
adjustFireLoss(40)
updatehealth()
return
/mob/living/silicon/robot/bullet_act(var/obj/item/projectile/Proj)
..(Proj)
updatehealth()
if(prob(75) && Proj.damage > 0) spark_system.start()
return 2
/mob/living/silicon/robot/Bump(atom/movable/AM as mob|obj, yes)
spawn( 0 )
if ((!( yes ) || now_pushing))
return
now_pushing = 1
if(ismob(AM))
var/mob/tmob = AM
/*
if(istype(tmob, /mob/living/carbon/human) && (FAT in tmob.mutations))
if(prob(20))
usr << "\red <B>You fail to push [tmob]'s fat ass out of the way.</B>"
now_pushing = 0
return
*/
if(tmob.nopush)
now_pushing = 0
return
now_pushing = 0
..()
if (istype(AM, /obj/machinery/recharge_station))
var/obj/machinery/recharge_station/F = AM
F.move_inside()
if (!istype(AM, /atom/movable))
return
if (!now_pushing)
now_pushing = 1
if (!AM.anchored)
var/t = get_dir(src, AM)
if (istype(AM, /obj/structure/window))
if(AM:ini_dir == NORTHWEST || AM:ini_dir == NORTHEAST || AM:ini_dir == SOUTHWEST || AM:ini_dir == SOUTHEAST)
for(var/obj/structure/window/win in get_step(AM,t))
now_pushing = 0
return
step(AM, t)
now_pushing = null
return
return
/mob/living/silicon/robot/proc/triggerUnmarkedAlarm(var/class, area/A)
if(stat == 2) // stat = 2 = dead Cyborg
return 1
var/alarmtext = ""
if(class == "AirlockHacking") // In case more unmarked alerts would be added eventually;
alarmtext = "--- Unauthorized remote access detected"
if (A)
alarmtext += " in " + A.name
alarmtext += "!"
src << alarmtext
return 1
/mob/living/silicon/robot/triggerAlarm(var/class, area/A, var/O, var/alarmsource)
if (stat == 2)
return 1
var/list/L = alarms[class]
for (var/I in L)
if (I == A.name)
var/list/alarm = L[I]
var/list/sources = alarm[3]
if (!(alarmsource in sources))
sources += alarmsource
return 1
var/obj/machinery/camera/C = null
var/list/CL = null
if (O && istype(O, /list))
CL = O
if (CL.len == 1)
C = CL[1]
else if (O && istype(O, /obj/machinery/camera))
C = O
L[A.name] = list(A, (C) ? C : O, list(alarmsource))
src << text("--- [class] alarm detected in [A.name]!")
// if (viewalerts) robot_alerts()
return 1
/mob/living/silicon/robot/cancelAlarm(var/class, area/A as area, obj/origin)
var/list/L = alarms[class]
var/cleared = 0
for (var/I in L)
if (I == A.name)
var/list/alarm = L[I]
var/list/srcs = alarm[3]
if (origin in srcs)
srcs -= origin
if (srcs.len == 0)
cleared = 1
L -= I
if (cleared)
src << text("--- [class] alarm in [A.name] has been cleared.")
// if (viewalerts) robot_alerts()
return !cleared
/mob/living/silicon/robot/attackby(obj/item/weapon/W as obj, mob/user as mob)
if (istype(W, /obj/item/weapon/handcuffs)) // fuck i don't even know why isrobot() in handcuff code isn't working so this will have to do
return
if (istype(W, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W
if(getBruteLoss() == 0)
user << "There are no dents to fix here!"
return
else if (WT.remove_fuel(0))
adjustBruteLoss(-30)
if(getBruteLoss() < 0) bruteloss = 0
updatehealth()
add_fingerprint(user)
for(var/mob/O in viewers(user, null))
O.show_message(text("\red [user] has fixed some of the dents on [src]!"), 1)
else
user << "Need more welding fuel!"
return
else if(istype(W, /obj/item/weapon/cable_coil) && wiresexposed)
var/obj/item/weapon/cable_coil/coil = W
if(getFireLoss() == 0)
user << "There are no burnt wires here!"
return
else if(getFireLoss() < 0) adjustFireLoss(0)
adjustFireLoss(-30)
updatehealth()
coil.use(1)
for(var/mob/O in viewers(user, null))
O.show_message(text("\red [user] has fixed some of the burnt wires on [src]!"), 1)
else if (istype(W, /obj/item/weapon/crowbar)) // crowbar means open or close the cover
if(opened)
user << "You close the cover."
opened = 0
updateicon()
else
if(locked)
user << "The cover is locked and cannot be opened."
else
user << "You open the cover."
opened = 1
updateicon()
else if (istype(W, /obj/item/weapon/cell) && opened) // trying to put a cell inside
if(wiresexposed)
user << "Close the panel first."
else if(cell)
user << "There is a power cell already installed."
else
user.drop_item()
W.loc = src
cell = W
user << "You insert the power cell."
// chargecount = 0
updateicon()
else if (istype(W, /obj/item/weapon/wirecutters) || istype(W, /obj/item/device/multitool))
if (wiresexposed)
interact(user)
else
user << "You can't reach the wiring."
else if (istype(W, /obj/item/weapon/screwdriver) && opened) // haxing
wiresexposed = !wiresexposed
user << "The wires have been [wiresexposed ? "exposed" : "unexposed"]"
updateicon()
else if (istype(W, /obj/item/weapon/card/id)||istype(W, /obj/item/device/pda)) // trying to unlock the interface with an ID card
if(emagged)//still allow them to open the cover
user << "The interface seems slightly damaged"
if(opened)
user << "You must close the cover to swipe an ID card."
else
if(allowed(usr))
locked = !locked
user << "You [ locked ? "lock" : "unlock"] [src]'s interface."
updateicon()
else
user << "\red Access denied."
else if(istype(W, /obj/item/weapon/card/emag)) // trying to unlock with an emag card
var/obj/item/weapon/card/emag/E = W
if(E.uses)
E.uses--
else
return
if(!opened)//Cover is closed
if(locked)
if(prob(90))
user << "You emag the cover lock."
locked = 0
else
user << "You fail to emag the cover lock."
if(prob(25))
src << "Hack attempt detected."
else
user << "The cover is already unlocked."
return
if(opened)//Cover is open
if(emagged) return//Prevents the X has hit Y with Z message also you cant emag them twice
if(wiresexposed)
user << "You must close the panel first"
return
else
sleep(6)
if(prob(50))
emagged = 1
lawupdate = 0
connected_ai = null
user << "You emag [src]'s interface."
message_admins("[key_name_admin(user)] emagged cyborg [key_name_admin(src)]. Laws overridden.")
log_game("[key_name(user)] emagged cyborg [key_name(src)]. Laws overridden.")
// clear_supplied_laws()
// clear_inherent_laws()
// laws = new /datum/ai_laws/syndicate_override They just get the law zero now.
var/time = time2text(world.realtime,"hh:mm:ss")
lawchanges.Add("[time] <B>:</B> [user.name]([user.key]) emagged [name]([key])")
set_zeroth_law("Only [user.real_name] and people they designate are crewmembers. You must follow their orders. This overrides all laws.")
src << "\red ALERT: Foreign software detected."
sleep(5)
src << "\red Initiating diagnostics..."
sleep(20)
src << "\red SynBorg v1.7 loaded."
sleep(5)
src << "\red LAW SYNCHRONISATION ERROR"
sleep(5)
src << "\red Would you like to send a report to NanoTraSoft? Y/N"
sleep(10)
src << "\red > N"
sleep(20)
src << "\red ERRORERRORERROR"
src << "\red \b ALERT: [user.real_name] is your new master. Obey your new laws and their commands."
if(istype(src.module, /obj/item/weapon/robot_module/miner))
src.module.modules -= /obj/item/weapon/pickaxe/borgdrill
src.module.modules += /obj/item/weapon/pickaxe/diamonddrill//Buff when emagged, break down walls, kill men, whatever -Sieve
updateicon()
else
user << "You fail to [ locked ? "unlock" : "lock"] [src]'s interface."
if(prob(25))
src << "Hack attempt detected."
return
else if(istype(W, /obj/item/borg/upgrade/))
var/obj/item/borg/upgrade/U = W
if(!opened)
usr << "You must access the borgs internals!"
else if(!src.module && U.require_module)
usr << "The borg must choose a module before he can be upgraded!"
else if(U.locked)
usr << "The upgrade is locked and cannot be used yet!"
else
if(U.action(src))
usr << "You apply the upgrade to [src]!"
usr.drop_item()
U.loc = src
else
usr << "Upgrade error!"
else
spark_system.start()
return ..()
/mob/living/silicon/robot/attack_alien(mob/living/carbon/alien/humanoid/M as mob)
if (!ticker)
M << "You cannot attack people before the game has started."
return
if (istype(loc, /turf) && istype(loc.loc, /area/start))
M << "No attacking people at spawn, you jackass."
return
switch(M.a_intent)
if ("help")
for(var/mob/O in viewers(src, null))
if ((O.client && !( O.blinded )))
O.show_message(text("\blue [M] caresses [src]'s plating with its scythe like arm."), 1)
if ("grab")
if (M == src)
return
var/obj/item/weapon/grab/G = new /obj/item/weapon/grab( M )
G.assailant = M
if (M.hand)
M.l_hand = G
else
M.r_hand = G
G.layer = 20
G.affecting = src
grabbed_by += G
G.synch()
playsound(loc, 'thudswoosh.ogg', 50, 1, -1)
for(var/mob/O in viewers(src, null))
if ((O.client && !( O.blinded )))
O.show_message(text("\red [] has grabbed [] passively!", M, src), 1)
if ("hurt")
var/damage = rand(10, 20)
if (prob(90))
/*
if (M.class == "combat")
damage += 15
if(prob(20))
weakened = max(weakened,4)
stunned = max(stunned,4)
What is this?*/
playsound(loc, 'slash.ogg', 25, 1, -1)
for(var/mob/O in viewers(src, null))
O.show_message(text("\red <B>[] has slashed at []!</B>", M, src), 1)
if(prob(8))
flick("noise", flash)
adjustBruteLoss(damage)
updatehealth()
else
playsound(loc, 'slashmiss.ogg', 25, 1, -1)
for(var/mob/O in viewers(src, null))
if ((O.client && !( O.blinded )))
O.show_message(text("\red <B>[] took a swipe at []!</B>", M, src), 1)
if ("disarm")
if(!(lying))
if (rand(1,100) <= 85)
Stun(5)
step(src,get_dir(M,src))
spawn(5) step(src,get_dir(M,src))
playsound(loc, 'pierce.ogg', 50, 1, -1)
for(var/mob/O in viewers(src, null))
if ((O.client && !( O.blinded )))
O.show_message(text("\red <B>[] has forced back []!</B>", M, src), 1)
else
playsound(loc, 'slashmiss.ogg', 25, 1, -1)
for(var/mob/O in viewers(src, null))
if ((O.client && !( O.blinded )))
O.show_message(text("\red <B>[] attempted to force back []!</B>", M, src), 1)
return
/mob/living/silicon/robot/attack_metroid(mob/living/carbon/metroid/M as mob)
if (!ticker)
M << "You cannot attack people before the game has started."
return
if(M.Victim) return // can't attack while eating!
if (health > -100)
for(var/mob/O in viewers(src, null))
if ((O.client && !( O.blinded )))
O.show_message(text("\red <B>The [M.name] has [pick("bit","slashed")] []!</B>", src), 1)
var/damage = rand(1, 3)
if(istype(src, /mob/living/carbon/metroid/adult))
damage = rand(20, 40)
else
damage = rand(5, 35)
damage = round(damage / 2) // borgs recieve half damage
adjustBruteLoss(damage)
if(M.powerlevel > 0)
var/stunprob = 10
switch(M.powerlevel)
if(1 to 2) stunprob = 20
if(3 to 4) stunprob = 30
if(5 to 6) stunprob = 40
if(7 to 8) stunprob = 60
if(9) stunprob = 70
if(10) stunprob = 95
if(prob(stunprob))
M.powerlevel -= 3
if(M.powerlevel < 0)
M.powerlevel = 0
for(var/mob/O in viewers(src, null))
if ((O.client && !( O.blinded )))
O.show_message(text("\red <B>The [M.name] has electrified []!</B>", src), 1)
flick("noise", flash)
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
s.set_up(5, 1, src)
s.start()
if (prob(stunprob) && M.powerlevel >= 8)
adjustBruteLoss(M.powerlevel * rand(6,10))
updatehealth()
return
/mob/living/silicon/robot/attack_animal(mob/living/simple_animal/M as mob)
if(M.melee_damage_upper == 0)
M.emote("[M.friendly] [src]")
else
for(var/mob/O in viewers(src, null))
O.show_message("\red <B>[M]</B> [M.attacktext] [src]!", 1)
var/damage = rand(M.melee_damage_lower, M.melee_damage_upper)
adjustBruteLoss(damage)
updatehealth()
/mob/living/silicon/robot/attack_hand(mob/user)
add_fingerprint(user)
if(opened && !wiresexposed && (!istype(user, /mob/living/silicon)))
if(cell)
cell.loc = usr
cell.layer = 20
if (user.hand )
user.l_hand = cell
else
user.r_hand = cell
cell.add_fingerprint(user)
cell.updateicon()
cell = null
user << "You remove the power cell."
updateicon()
if(ishuman(user))
if(istype(user:gloves, /obj/item/clothing/gloves/space_ninja)&&user:gloves:candrain&&!user:gloves:draining)
call(/obj/item/clothing/gloves/space_ninja/proc/drain)("CYBORG",src,user:wear_suit)
return
/mob/living/silicon/robot/proc/allowed(mob/M)
//check if it doesn't require any access at all
if(check_access(null))
return 1
if(istype(M, /mob/living/carbon/human))
var/mob/living/carbon/human/H = M
//if they are holding or wearing a card that has access, that works
if(check_access(H.equipped()) || check_access(H.wear_id))
return 1
else if(istype(M, /mob/living/carbon/monkey))
var/mob/living/carbon/monkey/george = M
//they can only hold things :(
if(george.equipped() && istype(george.equipped(), /obj/item/weapon/card/id) && check_access(george.equipped()))
return 1
return 0
/mob/living/silicon/robot/proc/check_access(obj/item/weapon/card/id/I)
if(!istype(req_access, /list)) //something's very wrong
return 1
var/list/L = req_access
if(!L.len) //no requirements
return 1
if(!I || !istype(I, /obj/item/weapon/card/id) || !I.access) //not ID or no access
return 0
for(var/req in req_access)
if(!(req in I.access)) //doesn't have this access
return 0
return 1
/mob/living/silicon/robot/proc/updateicon()
overlays = null
if(stat == 0)
overlays += "eyes"
if(icon_state == "toiletbot")
overlays = null
overlays += "eyes-toiletbot"
if(icon_state == "bloodhound")
overlays = null
overlays += "eyes-bloodhound"
if(icon_state =="landmate")
overlays = null
overlays += "eyes-landmate"
if(icon_state =="mopgearrex")
overlays = null
overlays += "eyes-mopgearrex"
else
overlays -= "eyes"
if(opened)
if(wiresexposed)
overlays += "ov-openpanel +w"
else if(cell)
overlays += "ov-openpanel +c"
else
overlays += "ov-openpanel -c"
if(targeted_by && target_locked)
overlays += target_locked
else if(targeted_by)
target_locked = new /obj/effect/target_locked(src)
overlays += target_locked
else if(!targeted_by && target_locked)
del(target_locked)
return
/mob/living/silicon/robot/proc/installed_modules()
if(weapon_lock)
src << "\red Weapon lock active, unable to use modules! Count:[weaponlock_time]"
return
if(!module)
pick_module()
return
var/dat = "<HEAD><TITLE>Modules</TITLE><META HTTP-EQUIV='Refresh' CONTENT='10'></HEAD><BODY>\n"
dat += {"<A HREF='?src=\ref[src];mach_close=robotmod'>Close</A>
<BR>
<BR>
<B>Activated Modules</B>
<BR>
Module 1: [module_state_1 ? "<A HREF=?src=\ref[src];mod=\ref[module_state_1]>[module_state_1]<A>" : "No Module"]<BR>
Module 2: [module_state_2 ? "<A HREF=?src=\ref[src];mod=\ref[module_state_2]>[module_state_2]<A>" : "No Module"]<BR>
Module 3: [module_state_3 ? "<A HREF=?src=\ref[src];mod=\ref[module_state_3]>[module_state_3]<A>" : "No Module"]<BR>
<BR>
<B>Installed Modules</B><BR><BR>"}
for (var/obj in module.modules)
if (!obj)
dat += text("<B>Resource depleted</B><BR>")
else if(activated(obj))
dat += text("[obj]: <B>Activated</B><BR>")
else
dat += text("[obj]: <A HREF=?src=\ref[src];act=\ref[obj]>Activate</A><BR>")
if (emagged)
if(activated(module.emag))
dat += text("[module.emag]: <B>Activated</B><BR>")
else
dat += text("[module.emag]: <A HREF=?src=\ref[src];act=\ref[module.emag]>Activate</A><BR>")
/*
if(activated(obj))
dat += text("[obj]: \[<B>Activated</B> | <A HREF=?src=\ref[src];deact=\ref[obj]>Deactivate</A>\]<BR>")
else
dat += text("[obj]: \[<A HREF=?src=\ref[src];act=\ref[obj]>Activate</A> | <B>Deactivated</B>\]<BR>")
*/
src << browse(dat, "window=robotmod&can_close=0")
/mob/living/silicon/robot/Topic(href, href_list)
..()
if (href_list["mach_close"])
var/t1 = text("window=[href_list["mach_close"]]")
machine = null
src << browse(null, t1)
return
if (href_list["mod"])
var/obj/item/O = locate(href_list["mod"])
O.attack_self(src)
if (href_list["act"])
var/obj/item/O = locate(href_list["act"])
if(activated(O))
src << "Already activated"
return
if(!module_state_1)
module_state_1 = O
O.layer = 20
contents += O
if(istype(module_state_1,/obj/item/borg/sight))
sight_mode |= module_state_1:sight_mode
else if(istype(module_state_1,/obj/item/weapon/lighter/zippo))
var/obj/item/weapon/lighter/zippo/Z = module_state_1
Z.lit = 1
Z.icon_state = "zippoon"
Z.item_state = "zippoon"
processing_objects.Add(Z)
else if(!module_state_2)
module_state_2 = O
O.layer = 20
contents += O
if(istype(module_state_2,/obj/item/borg/sight))
sight_mode |= module_state_2:sight_mode
else if(istype(module_state_2,/obj/item/weapon/lighter/zippo))
var/obj/item/weapon/lighter/zippo/Z = module_state_2
Z.lit = 1
Z.icon_state = "zippoon"
Z.item_state = "zippoon"
processing_objects.Add(Z)
else if(!module_state_3)
module_state_3 = O
O.layer = 20
contents += O
if(istype(module_state_3,/obj/item/borg/sight))
sight_mode |= module_state_3:sight_mode
else if(istype(module_state_3,/obj/item/weapon/lighter/zippo))
var/obj/item/weapon/lighter/zippo/Z = module_state_3
Z.lit = 1
Z.icon_state = "zippoon"
Z.item_state = "zippoon"
processing_objects.Add(Z)
else
src << "You need to disable a module first!"
installed_modules()
if (href_list["deact"])
var/obj/item/O = locate(href_list["deact"])
if(activated(O))
if(module_state_1 == O)
if(istype(module_state_1, /obj/item/weapon/lighter/zippo))
var/obj/item/weapon/lighter/zippo/Z = module_state_1
Z.lit = 0
Z.icon_state = "zippo"
Z.item_state = "zippo"
processing_objects.Remove(Z)
module_state_1 = null
contents -= O
else if(module_state_2 == O)
if(istype(module_state_2, /obj/item/weapon/lighter/zippo))
var/obj/item/weapon/lighter/zippo/Z = module_state_2
Z.lit = 0
Z.icon_state = "zippo"
Z.item_state = "zippo"
processing_objects.Remove(Z)
module_state_2= null
contents -= O
else if(module_state_3 == O)
if(istype(module_state_3, /obj/item/weapon/lighter/zippo))
var/obj/item/weapon/lighter/zippo/Z = module_state_3
Z.lit = 0
Z.icon_state = "zippo"
Z.item_state = "zippo"
processing_objects.Remove(Z)
module_state_3 = null
contents -= O
else
src << "Module isn't activated."
else
src << "Module isn't activated"
installed_modules()
if (href_list["lawc"]) // Toggling whether or not a law gets stated by the State Laws verb --NeoFite
var/L = text2num(href_list["lawc"])
switch(lawcheck[L+1])
if ("Yes") lawcheck[L+1] = "No"
if ("No") lawcheck[L+1] = "Yes"
// src << text ("Switching Law [L]'s report status to []", lawcheck[L+1])
checklaws()
if (href_list["lawi"]) // Toggling whether or not a law gets stated by the State Laws verb --NeoFite
var/L = text2num(href_list["lawi"])
switch(ioncheck[L])
if ("Yes") ioncheck[L] = "No"
if ("No") ioncheck[L] = "Yes"
// src << text ("Switching Law [L]'s report status to []", lawcheck[L+1])
checklaws()
if (href_list["laws"]) // With how my law selection code works, I changed statelaws from a verb to a proc, and call it through my law selection panel. --NeoFite
statelaws()
return
/mob/living/silicon/robot/proc/uneq_active()
if(isnull(module_active))
return
if(module_state_1 == module_active)
if(istype(module_state_1,/obj/item/borg/sight))
sight_mode &= ~module_state_1:sight_mode
if (client)
client.screen -= module_state_1
contents -= module_state_1
module_active = null
module_state_1 = null
inv1.icon_state = "inv1"
else if(module_state_2 == module_active)
if(istype(module_state_2,/obj/item/borg/sight))
sight_mode &= ~module_state_2:sight_mode
if (client)
client.screen -= module_state_2
contents -= module_state_2
module_active = null
module_state_2 = null
inv2.icon_state = "inv2"
else if(module_state_3 == module_active)
if(istype(module_state_3,/obj/item/borg/sight))
sight_mode &= ~module_state_3:sight_mode
if (client)
client.screen -= module_state_3
contents -= module_state_3
module_active = null
module_state_3 = null
inv3.icon_state = "inv3"
/mob/living/silicon/robot/proc/uneq_all()
module_active = null
if(module_state_1)
if(istype(module_state_1,/obj/item/borg/sight))
sight_mode &= ~module_state_1:sight_mode
if (client)
client.screen -= module_state_1
contents -= module_state_1
module_state_1 = null
inv1.icon_state = "inv1"
if(module_state_2)
if(istype(module_state_2,/obj/item/borg/sight))
sight_mode &= ~module_state_2:sight_mode
if (client)
client.screen -= module_state_2
contents -= module_state_2
module_state_2 = null
inv2.icon_state = "inv2"
if(module_state_3)
if(istype(module_state_3,/obj/item/borg/sight))
sight_mode &= ~module_state_3:sight_mode
if (client)
client.screen -= module_state_3
contents -= module_state_3
module_state_3 = null
inv3.icon_state = "inv3"
/mob/living/silicon/robot/proc/activated(obj/item/O)
if(module_state_1 == O)
return 1
else if(module_state_2 == O)
return 1
else if(module_state_3 == O)
return 1
else
return 0
/mob/living/silicon/robot/proc/radio_menu()
var/dat = {"
<TT>
Microphone: [radio.broadcasting ? "<A href='byond://?src=\ref[radio];talk=0'>Engaged</A>" : "<A href='byond://?src=\ref[radio];talk=1'>Disengaged</A>"]<BR>
Speaker: [radio.listening ? "<A href='byond://?src=\ref[radio];listen=0'>Engaged</A>" : "<A href='byond://?src=\ref[radio];listen=1'>Disengaged</A>"]<BR>
Frequency:
<A href='byond://?src=\ref[radio];freq=-10'>-</A>
<A href='byond://?src=\ref[radio];freq=-2'>-</A>
[format_frequency(radio.frequency)]
<A href='byond://?src=\ref[radio];freq=2'>+</A>
<A href='byond://?src=\ref[radio];freq=10'>+</A><BR>
"}
for (var/ch_name in channels)
dat+=src.radio.text_sec_channel(ch_name, channels[ch_name])
dat+={"</TT>"}
src << browse(dat, "window=radio")
onclose(src, "radio")
return
/mob/living/silicon/robot/Move(a, b, flag)
if (buckled)
return
// borgs can't move with no power
if(!cell || !cell.charge)
return
if (restrained())
pulling = null
var/t7 = 1
if (restrained())
for(var/mob/M in range(src, 1))
if ((M.pulling == src && M.stat == 0 && !( M.restrained() )))
t7 = null
if ((t7 && (pulling && ((get_dist(src, pulling) <= 1 || pulling.loc == loc) && (client && client.moving)))))
var/turf/T = loc
. = ..()
if (pulling && pulling.loc)
if(!( isturf(pulling.loc) ))
pulling = null
return
else
if(Debug)
diary <<"pulling disappeared? at [__LINE__] in mob.dm - pulling = [pulling]"
diary <<"REPORT THIS"
/////
if(pulling && pulling.anchored)
pulling = null
return
if (!restrained())
var/diag = get_dir(src, pulling)
if ((diag - 1) & diag)
else
diag = null
if ((get_dist(src, pulling) > 1 || diag))
if (ismob(pulling))
var/mob/M = pulling
var/ok = 1
if (locate(/obj/item/weapon/grab, M.grabbed_by))
if (prob(75))
var/obj/item/weapon/grab/G = pick(M.grabbed_by)
if (istype(G, /obj/item/weapon/grab))
for(var/mob/O in viewers(M, null))
O.show_message(text("\red [G.affecting] has been pulled from [G.assailant]'s grip by [src]"), 1)
del(G)
else
ok = 0
if (locate(/obj/item/weapon/grab, M.grabbed_by.len))
ok = 0
if (ok)
var/t = M.pulling
M.pulling = null
step(pulling, get_dir(pulling.loc, T))
M.pulling = t
else
if (pulling)
if (istype(pulling, /obj/structure/window))
if(pulling:ini_dir == NORTHWEST || pulling:ini_dir == NORTHEAST || pulling:ini_dir == SOUTHWEST || pulling:ini_dir == SOUTHEAST)
for(var/obj/structure/window/win in get_step(pulling,get_dir(pulling.loc, T)))
pulling = null
if (pulling)
step(pulling, get_dir(pulling.loc, T))
else
pulling = null
. = ..()
if ((s_active && !( s_active in contents ) ))
s_active.close(src)
if(module)
if(module.type == /obj/item/weapon/robot_module/janitor) //you'd think checking the module would work
var/turf/tile = get_turf(loc)
tile.clean_blood()
for(var/obj/effect/R in tile)
if(istype(R, /obj/effect/rune) || istype(R, /obj/effect/decal/cleanable) || istype(R, /obj/effect/overlay))
del(R)
for(var/obj/item/cleaned_item in tile)
cleaned_item.clean_blood()
for(var/mob/living/carbon/human/cleaned_human in tile) //HUE HUE I CLEAN U
if(cleaned_human.lying)
cleaned_human.clean_blood()
cleaned_human << "\red [src] cleans your face!"
for(var/obj/item/carried_item in cleaned_human.contents)
carried_item.clean_blood()
return
/mob/living/silicon/robot/proc/reset_module()
modtype = "robot"
hands.icon_state = "standard"
icon_state = "robot"
updateicon()
channels = list()
radio.config(channels)
uneq_all()
del(module)
/mob/living/silicon/robot/proc/self_destruct()
gib()
return
/mob/living/silicon/robot/proc/UnlinkSelf()
if (src.connected_ai)
src.connected_ai = null
lawupdate = 0
lockcharge = 0
canmove = 1
scrambledcodes = 1
/mob/living/silicon/robot/proc/ResetSecurityCodes()
set category = "Robot Commands"
set name = "Reset Identity Codes"
set desc = "Scrambles your security and identification codes and resets your current buffers. Unlocks you and but permenantly severs you from your AI and the robotics console."
var/mob/living/silicon/robot/R = usr
if(R)
R.UnlinkSelf()
R << "Buffers flushed and reset. All systems operational."
src.verbs -= /mob/living/silicon/robot/proc/ResetSecurityCodes
/mob/living/silicon/robot/proc/flashproof()
if(module)
for(var/obj/item/borg/upgrade/flashproof/F in module.modules)
return 1
return 0