Wire hacking recode from /tg/.

Conflicts:
	baystation12.dme
	code/__HELPERS/mobs.dm
	code/defines/obj/weapon.dm
	code/game/machinery/alarm.dm
	code/game/machinery/doors/airlock.dm
	code/game/machinery/machinery.dm
	code/game/machinery/vending.dm
	code/game/objects/items/devices/paicard.dm
	code/game/objects/items/weapons/explosives.dm
	code/global.dm
	code/modules/assembly/signaler.dm
	code/modules/mob/living/silicon/mommi/life.dm
	code/modules/mob/living/silicon/mommi/mommi.dm
	code/modules/mob/living/silicon/robot/robot.dm
	code/modules/mob/living/silicon/robot/wires.dm
This commit is contained in:
Rob Nelson
2014-01-12 22:37:55 -05:00
committed by ZomgPonies
parent 7fdb4ac503
commit 55e918cc6a
30 changed files with 1354 additions and 935 deletions
+4
View File
@@ -16,6 +16,10 @@
if(hand) return r_hand
else return l_hand
// Because there's several different places it's stored.
/mob/proc/get_multitool(var/if_active=0)
return null
//Puts the item into your l_hand if possible and calls all necessary triggers/updates. returns 1 on success.
/mob/proc/put_in_l_hand(var/obj/item/W)
if(lying) return 0
@@ -0,0 +1,280 @@
/mob/living/silicon/robot/mommi/Life()
set invisibility = 0
set background = 1
if (src.monkeyizing)
return
src.blinded = null
//Status updates, death etc.
clamp_values()
handle_regular_status_updates()
if(client)
handle_regular_hud_updates()
update_items()
if (src.stat != DEAD) //still using power
use_power()
process_killswitch()
process_locks()
update_canmove()
/mob/living/silicon/robot/mommi/clamp_values()
// SetStunned(min(stunned, 30))
SetParalysis(min(paralysis, 30))
// SetWeakened(min(weakened, 20))
sleeping = 0
adjustBruteLoss(0)
adjustToxLoss(0)
adjustOxyLoss(0)
adjustFireLoss(0)
/mob/living/silicon/robot/mommi/use_power()
if (src.cell)
if(src.cell.charge <= 0)
uneq_all()
src.stat = 1
else if (src.cell.charge <= 100)
src.module_active = null
src.sight_state = null
src.tool_state = null
src.sight_mode = 0
src.cell.use(1)
else
if(src.sight_state)
src.cell.use(5)
if(src.tool_state)
src.cell.use(5)
src.cell.use(1)
src.blinded = 0
src.stat = 0
else
uneq_all()
src.stat = 1
/mob/living/silicon/robot/mommi/handle_regular_status_updates()
if(src.camera && !scrambledcodes)
if(src.stat == 2 || wires.IsCameraCut())
src.camera.status = 0
else
src.camera.status = 1
health = maxHealth - (getOxyLoss() + getFireLoss() + getBruteLoss())
if(getOxyLoss() > 50) Paralyse(3)
if(src.sleeping)
Paralyse(3)
src.sleeping--
if(src.resting)
Weaken(5)
if(health <= 0 && src.stat != 2) //die only once
gib()
if (src.stat != 2) //Alive.
if (src.paralysis || src.stunned || src.weakened) //Stunned etc.
src.stat = 1
if (src.stunned > 0)
AdjustStunned(-1)
if (src.weakened > 0)
AdjustWeakened(-1)
if (src.paralysis > 0)
AdjustParalysis(-1)
src.blinded = 1
else
src.blinded = 0
else //Not stunned.
src.stat = 0
else //Dead.
src.blinded = 1
src.stat = 2
if (src.stuttering) src.stuttering--
if (src.eye_blind)
src.eye_blind--
src.blinded = 1
if (src.ear_deaf > 0) src.ear_deaf--
if (src.ear_damage < 25)
src.ear_damage -= 0.05
src.ear_damage = max(src.ear_damage, 0)
src.density = !( src.lying )
if ((src.sdisabilities & BLIND))
src.blinded = 1
if ((src.sdisabilities & DEAF))
src.ear_deaf = 1
if (src.eye_blurry > 0)
src.eye_blurry--
src.eye_blurry = max(0, src.eye_blurry)
if (src.druggy > 0)
src.druggy--
src.druggy = max(0, src.druggy)
return 1
/
/mob/living/silicon/robot/mommi/handle_regular_hud_updates()
if (src.stat == 2 || XRAY in mutations || src.sight_mode & BORGXRAY)
src.sight |= SEE_TURFS
src.sight |= SEE_MOBS
src.sight |= SEE_OBJS
src.see_in_dark = 8
src.see_invisible = SEE_INVISIBLE_LEVEL_TWO
else if (src.sight_mode & BORGMESON && src.sight_mode & BORGTHERM)
src.sight |= SEE_TURFS
src.sight |= SEE_MOBS
src.see_in_dark = 8
see_invisible = SEE_INVISIBLE_MINIMUM
else if (src.sight_mode & BORGMESON)
src.sight |= SEE_TURFS
src.see_in_dark = 8
see_invisible = SEE_INVISIBLE_MINIMUM
else if (src.sight_mode & BORGTHERM)
src.sight |= SEE_MOBS
src.see_in_dark = 8
src.see_invisible = SEE_INVISIBLE_LEVEL_TWO
else if (src.stat != 2)
src.sight &= ~SEE_MOBS
src.sight &= ~SEE_TURFS
src.sight &= ~SEE_OBJS
src.see_in_dark = 8
src.see_invisible = SEE_INVISIBLE_LEVEL_TWO
var/obj/item/borg/sight/hud/hud = (locate(/obj/item/borg/sight/hud) in src)
if(hud && hud.hud) hud.hud.process_hud(src)
if (src.healths)
if (src.stat != 2)
switch(health)
if(60 to INFINITY)
src.healths.icon_state = "health0"
if(40 to 60)
src.healths.icon_state = "health1"
if(30 to 40)
src.healths.icon_state = "health2"
if(10 to 20)
src.healths.icon_state = "health3"
if(0 to 10)
src.healths.icon_state = "health4"
if(config.health_threshold_dead to 0)
src.healths.icon_state = "health5"
else
src.healths.icon_state = "health6"
else
src.healths.icon_state = "health7"
if (src.syndicate && src.client)
if(ticker.mode.name == "traitor")
for(var/datum/mind/tra in ticker.mode.traitors)
if(tra.current)
var/I = image('icons/mob/mob.dmi', loc = tra.current, icon_state = "traitor")
src.client.images += I
if(src.connected_ai)
src.connected_ai.connected_robots -= src
src.connected_ai = null
if(src.mind)
if(!src.mind.special_role)
src.mind.special_role = "traitor"
ticker.mode.traitors += src.mind
if (src.cells)
if (src.cell)
var/cellcharge = src.cell.charge/src.cell.maxcharge
switch(cellcharge)
if(0.75 to INFINITY)
src.cells.icon_state = "charge4"
if(0.5 to 0.75)
src.cells.icon_state = "charge3"
if(0.25 to 0.5)
src.cells.icon_state = "charge2"
if(0 to 0.25)
src.cells.icon_state = "charge1"
else
src.cells.icon_state = "charge0"
else
src.cells.icon_state = "charge-empty"
if(bodytemp)
switch(src.bodytemperature) //310.055 optimal body temp
if(335 to INFINITY)
src.bodytemp.icon_state = "temp2"
if(320 to 335)
src.bodytemp.icon_state = "temp1"
if(300 to 320)
src.bodytemp.icon_state = "temp0"
if(260 to 300)
src.bodytemp.icon_state = "temp-1"
else
src.bodytemp.icon_state = "temp-2"
if(src.pullin) src.pullin.icon_state = "pull[src.pulling ? 1 : 0]"
//Oxygen and fire does nothing yet!!
// if (src.oxygen) src.oxygen.icon_state = "oxy[src.oxygen_alert ? 1 : 0]"
// if (src.fire) src.fire.icon_state = "fire[src.fire_alert ? 1 : 0]"
client.screen.Remove(global_hud.blurry,global_hud.druggy,global_hud.vimpaired)
if ((src.blind && src.stat != 2))
if(src.blinded)
src.blind.layer = 18
else
src.blind.layer = 0
if (src.disabilities & NEARSIGHTED)
src.client.screen += global_hud.vimpaired
if (src.eye_blurry)
src.client.screen += global_hud.blurry
if (src.druggy)
src.client.screen += global_hud.druggy
if (src.stat != 2)
if (src.machine)
if (!( src.machine.check_eye(src) ))
src.reset_view(null)
else
if(!client.adminobs)
reset_view(null)
return 1
// MoMMIs only have one hand.
/mob/living/silicon/robot/mommi/update_items()
if (src.client)
src.client.screen -= src.contents
for(var/obj/I in src.contents)
//if(I && !(istype(I,/obj/item/weapon/cell) || istype(I,/obj/item/device/radio) || istype(I,/obj/machinery/camera) || istype(I,/obj/item/device/mmi)))
if(I)
// Make sure we're not showing any of our internal components, as that would be lewd.
// This way of doing it ensures that shit we pick up will be visible, wheras shit inside of us isn't.
if(I!=src.cell && I!=src.radio && I!=src.camera && I!=src.mmi)
src.client.screen += I
if(src.sight_state)
src.sight_state:screen_loc = ui_inv1
if(src.tool_state)
src.tool_state:screen_loc = ui_inv2
/mob/living/silicon/robot/mommi/update_canmove()
canmove = !(paralysis || stunned || weakened || buckled || lockcharge || anchored)
return canmove
@@ -0,0 +1,539 @@
/* Basically, the concept is this:
You have an MMI. It can't do squat on its own.
Now you put some robot legs and arms on the thing, and POOF! You have a Mobile MMI, or MoMMI.
Why? MoMMIs can do all sorts of shit, like ventcrawl, do shit with their hands, etc.
They can only use one tool at a time, they can't choose modules, and they have 1/6th the HP of a borg.
*/
/mob/living/silicon/robot/mommi
name = "Mobile MMI"
real_name = "Mobile MMI"
icon = 'icons/mob/robots.dmi'//
icon_state = "mommi"
maxHealth = 60
health = 60
pass_flags = PASSTABLE
var/keeper=0 // 0 = No, 1 = Yes (Disables speech and common radio.)
var/picked = 0
var/subtype="keeper"
var/obj/screen/inv_tool = null
var/obj/screen/inv_sight = null
//one tool and one sightmod can be activated at any one time.
var/tool_state = null
var/sight_state = null
modtype = "robot" // Not sure what this is, but might be cool to have seperate loadouts for MoMMIs (e.g. paintjobs and tools)
//Cyborgs will sync their laws with their AI by default, but we may want MoMMIs to be mute independents at some point, kinda like the Keepers in Ass Effect.
lawupdate = 1
/mob/living/carbon/can_use_hands()
return 1
/mob/living/silicon/robot/mommi/New(loc)
spark_system = new /datum/effect/effect/system/spark_spread()
spark_system.set_up(5, 0, src)
spark_system.attach(src)
ident = rand(1, 999)
updatename()
updateicon()
if(!cell)
cell = new /obj/item/weapon/cell(src)
cell.maxcharge = 7500
cell.charge = 7500
..()
module = new /obj/item/weapon/robot_module/mommi(src)
laws = new mommi_base_law_type
// Don't sync if we're a KEEPER.
if(!istype(laws,/datum/ai_laws/keeper))
connected_ai = select_active_ai_with_fewest_borgs()
else
// Enforce silence.
keeper=1
connected_ai = null // Enforce no AI parent
scrambledcodes = 1 // Hide from console because people are fucking idiots
if(connected_ai)
connected_ai.connected_robots += src
lawsync()
lawupdate = 1
else
lawupdate = 0
radio = new /obj/item/device/radio/borg(src)
if(!scrambledcodes && !camera)
camera = new /obj/machinery/camera(src)
camera.c_tag = real_name
camera.network = list("SS13")
if(wires.IsCameraCut()) // 5 = BORG CAMERA
camera.status = 0
// Sanity check
if(connected_ai && keeper)
world << "\red ASSERT FAILURE: connected_ai && keeper in mommi.dm"
//playsound(loc, 'sound/voice/liveagain.ogg', 75, 1)
playsound(loc, 'sound/misc/interference.ogg', 75, 1)
/mob/living/silicon/robot/mommi/choose_icon()
var/icontype = input("Select an icon!", "Mobile MMI", null) in list("Basic", "Keeper")
switch(icontype)
if("Basic") subtype = "mommi"
else subtype = "keeper"
updateicon()
var/answer = input("Is this what you want?", "Mobile MMI", null) in list("Yes", "No")
switch(answer)
if("No")
choose_icon()
return
picked = 1
/mob/living/silicon/robot/mommi/pick_module()
if(module)
return
var/list/modules = list("MoMMI")
if(modules.len)
modtype = input("Please, select a module!", "Robot", null, null) in modules
else:
modtype=modules[0]
var/module_sprites[0] //Used to store the associations between sprite names and sprite index.
var/channels = list()
if(module)
return
switch(modtype)
if("MoMMI")
module = new /obj/item/weapon/robot_module/standard(src)
module_sprites["Basic"] = "mommi"
module_sprites["Keeper"] = "keeper"
//Custom_sprite check and entry
if (custom_sprite == 1)
module_sprites["Custom"] = "[src.ckey]-[modtype]"
hands.icon_state = lowertext(modtype)
feedback_inc("mommi_[lowertext(modtype)]",1)
updatename()
choose_icon(6,module_sprites)
radio.config(channels)
base_icon = icon_state
//If there's an MMI in the robot, have it ejected when the mob goes away. --NEO
//Improved /N
/mob/living/silicon/robot/mommi/Del()
if(mmi)//Safety for when a cyborg gets dust()ed. Or there is no MMI inside.
var/obj/item/device/mmi/nmmi = mmi
var/turf/T = get_turf(loc)//To hopefully prevent run time errors.
if(T) nmmi.loc = T
if(mind) mind.transfer_to(nmmi.brainmob)
mmi = null
nmmi.icon = 'icons/obj/assemblies.dmi'
nmmi.invisibility = 0
..()
/mob/living/silicon/robot/mommi/updatename(var/prefix as text)
var/changed_name = ""
if(custom_name)
changed_name = custom_name
else
changed_name = "Mobile MMI [num2text(ident)]"
real_name = changed_name
name = real_name
/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 (WT.remove_fuel(0))
adjustBruteLoss(-30)
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
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(stat == DEAD)
user << "You pop the MMI off the base."
spawn(0)
del(src)
return
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)
wires.Interact()
else
user << "You can't reach the wiring."
else if(istype(W, /obj/item/weapon/screwdriver) && opened && !cell) // haxing
wiresexposed = !wiresexposed
user << "The wires have been [wiresexposed ? "exposed" : "unexposed"]"
updateicon()
else if(istype(W, /obj/item/weapon/screwdriver) && opened && cell) // radio
if(radio)
radio.attackby(W,user)//Push it to the radio to let it handle everything
else
user << "Unable to locate a radio."
updateicon()
else if(istype(W, /obj/item/device/encryptionkey/) && opened)
if(radio)//sanityyyyyy
radio.attackby(W,user)//GTFO, you have your own procs
else
user << "Unable to locate a radio."
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
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
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 he designates as being such are Syndicate Agents.")
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 << "<b>Obey these laws:</b>"
laws.show_laws(src)
src << "\red \b ALERT: [user.real_name] is your new master. Obey your new laws and his commands."
if(src.module && istype(src.module, /obj/item/weapon/robot_module/miner))
for(var/obj/item/weapon/pickaxe/borgdrill/D in src.module.modules)
del(D)
src.module.modules += new /obj/item/weapon/pickaxe/diamonddrill(src.module)
src.module.rebuild()
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/mommi/attack_hand(mob/user)
add_fingerprint(user)
if(opened && !wiresexposed && (!istype(user, /mob/living/silicon)))
if(cell)
cell.updateicon()
cell.add_fingerprint(user)
user.put_in_active_hand(cell)
user << "You remove \the [cell]."
cell = null
updateicon()
return
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
if(user.a_intent == "help")
user.visible_message("\blue [user.name] pats [src.name] on the head.")
return
if(!istype(user, /mob/living/silicon))
switch(user.a_intent)
if("disarm")
user.attack_log += text("\[[time_stamp()]\] <font color='red'>Disarmed [src.name] ([src.ckey])</font>")
src.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has been disarmed by [user.name] ([user.ckey])</font>")
log_admin("ATTACK: [user.name] ([user.ckey]) disarmed [src.name] ([src.ckey])")
log_attack("<font color='red'>[user.name] ([user.ckey]) disarmed [src.name] ([src.ckey])</font>")
var/randn = rand(1,100)
//var/talked = 0;
if (randn <= 25)
weakened = 3
playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1)
visible_message("\red <B>[user] has pushed [src]!</B>")
var/obj/item/found = locate(tool_state) in src.module.modules
if(!found)
var/obj/item/TS = tool_state
drop_item()
if(TS && TS.loc)
TS.loc = src.loc
visible_message("\red <B>[src]'s robotic arm loses grip on what it was holding")
return
if(randn <= 50)//MoMMI's robot arm is stronger than a human's, but not by much
var/obj/item/found = locate(tool_state) in src.module.modules
if(!found)
var/obj/item/TS = tool_state
drop_item()
if(TS && TS.loc)
TS.loc = src.loc
playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1)
visible_message("\red <B>[user] has disarmed [src]!</B>")
else
playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1)
visible_message("\red <B>[user] attempted to disarm [src]!</B>")
return
playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1)
visible_message("\red <B>[user] attempted to disarm [src]!</B>")
/mob/living/silicon/robot/mommi/updateicon()
icon_state=subtype
// Clear all overlays.
overlays.Cut()
if(opened) // TODO: Open the front "head" panel
if(wiresexposed)
overlays += "ov-openpanel +w"
else if(cell)
overlays += "ov-openpanel +c"
else
overlays += "ov-openpanel -c"
// Put our eyes just on top of the lighting, so it looks emissive in maint tunnels.
if(layer==MOB_LAYER)
overlays+=image(icon,"eyes-[subtype][emagged?"-emagged":""]",LIGHTING_LAYER+1)
if(anchored)
overlays+=image(icon,"[subtype]-park", LIGHTING_LAYER+1)
else
overlays+=image(icon,"eyes-[subtype][emagged?"-emagged":""]",TURF_LAYER+0.2) // Fixes floating eyes
if(anchored)
overlays+=image(icon,"[subtype]-park", TURF_LAYER+0.2)
return
/mob/living/silicon/robot/mommi/installed_modules()
if(weapon_lock)
src << "\red Weapon lock active, unable to use modules! Count:[weaponlock_time]"
return
if(!module)
pick_module()
return
if(!picked)
choose_icon()
return
var/dat = "<HEAD><TITLE>Modules</TITLE><META HTTP-EQUIV='Refresh' CONTENT='10'></HEAD><BODY>\n"
dat += {"<BR>
<BR>
<B>Activated Modules</B>
<BR>
Sight Mode: [sight_state ? "<A HREF=?src=\ref[src];mod=\ref[sight_state]>[sight_state]</A>" : "No module selected"]<BR>
Utility Module: [tool_state ? "<A HREF=?src=\ref[src];mod=\ref[tool_state]>[tool_state]</A>" : "No module selected"]<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>")
src << browse(dat, "window=robotmod")
onclose(src,"robotmod") // Register on-close shit, which unsets machinery.
/mob/living/silicon/robot/mommi/Topic(href, href_list)
..()
if(usr && (src != usr))
return
if (href_list["mach_close"])
var/t1 = text("window=[href_list["mach_close"]]")
unset_machine()
src << browse(null, t1)
return
if (href_list["showalerts"])
robot_alerts()
return
if (href_list["mod"])
var/obj/item/O = locate(href_list["mod"])
if (O)
O.attack_self(src)
if (href_list["act"])
var/obj/item/O = locate(href_list["act"])
var/obj/item/TS
if(!(locate(O) in src.module.modules) && O != src.module.emag)
return
if(istype(O,/obj/item/borg/sight))
TS = sight_state
if(sight_state)
contents -= sight_state
sight_mode &= ~sight_state:sight_mode
if (client)
client.screen -= sight_state
sight_state = O
O.layer = 20
contents += O
sight_mode |= sight_state:sight_mode
inv_sight.icon_state = "sight+a"
inv_tool.icon_state = "inv1"
module_active=sight_state
else
TS = tool_state
if(tool_state)
contents -= tool_state
if (client)
client.screen -= tool_state
tool_state = O
O.layer = 20
contents += O
inv_sight.icon_state = "sight"
inv_tool.icon_state = "inv1 +a"
module_active=tool_state
if(TS && istype(TS))
if(src.is_in_modules(TS))
TS.loc = src.module
else
TS.layer=initial(TS.layer)
TS.loc = src.loc
installed_modules()
return
/mob/living/silicon/robot/mommi/radio_menu()
radio.interact(src)//Just use the radio's Topic() instead of bullshit special-snowflake code
/mob/living/silicon/robot/mommi/Move(a, b, flag)
..()
/mob/living/silicon/robot/mommi/proc/ActivateKeeper()
set category = "Robot Commands"
set name = "Activate KEEPER"
set desc = "Performs a full purge of your laws and disconnects you from AIs and cyborg consoles. However, you lose the ability to speak and must remain neutral, only being permitted to perform station upkeep. You can still be emagged in this state."
if(keeper)
return
var/mob/living/silicon/robot/R = src
if(R)
R.UnlinkSelf()
var/obj/item/weapon/aiModule/keeper/mdl = new
mdl.transmitInstructions(src, src)
src << "These are your laws now:"
src.show_laws()
src.verbs -= /mob/living/silicon/robot/mommi/proc/ActivateKeeper
@@ -62,7 +62,7 @@
/mob/living/silicon/robot/proc/handle_regular_status_updates()
if(src.camera && !scrambledcodes)
if(src.stat == 2 || isWireCut(5))
if(src.stat == 2 || wires.IsCameraCut())
src.camera.status = 0
else
src.camera.status = 1
+26 -7
View File
@@ -40,6 +40,8 @@
var/obj/item/device/pda/ai/rbPDA = null
var/datum/wires/robot/wires = null
var/opened = 0
var/emagged = 0
var/wiresexposed = 0
@@ -55,7 +57,7 @@
var/datum/effect/effect/system/ion_trail_follow/ion_trail = null
var/datum/effect/effect/system/spark_spread/spark_system//So they can initialize sparks whenever/N
var/jeton = 0
var/borgwires = 31 // 0b11111
var/killswitch = 0
var/killswitch_time = 60
var/weapon_lock = 0
@@ -74,13 +76,12 @@
spark_system.set_up(5, 0, src)
spark_system.attach(src)
// wires = new(src)
robot_modules_background = new()
robot_modules_background.icon_state = "block"
robot_modules_background.layer = 19 //Objects that appear on screen are on layer 20, UI should be just below it.
wires = new(src)
ident = rand(1, 999)
updatename("Default")
updateicon()
@@ -119,7 +120,7 @@
camera = new /obj/machinery/camera(src)
camera.c_tag = real_name
camera.network = list("SS13","Robots")
if(isWireCut(5)) // 5 = BORG CAMERA
if(wires.IsCameraCut()) // 5 = BORG CAMERA
camera.status = 0
initialize_components()
@@ -594,7 +595,7 @@
user << "You close the cover."
opened = 0
updateicon()
else if(mmi && wiresexposed && isWireCut(1) && isWireCut(2) && isWireCut(3) && isWireCut(4) && isWireCut(5))
else if(mmi && wiresexposed && wires.IsAllCut())
//Cell is out, wires are exposed, remove MMI, produce damaged chassis, baleet original mob.
user << "You jam the crowbar into the robot and begin levering [mmi]."
sleep(30)
@@ -654,7 +655,7 @@
else if (istype(W, /obj/item/weapon/wirecutters) || istype(W, /obj/item/device/multitool))
if (wiresexposed)
interact(user)
wires.Interact(user)
else
user << "You can't reach the wiring."
@@ -774,6 +775,17 @@
spark_system.start()
return ..()
/mob/living/silicon/robot/verb/unlock_own_cover()
set category = "Robot Commands"
set name = "Unlock Cover"
set desc = "Unlocks your own cover if it is locked. You can not lock it again. A human will have to lock it for you."
if(locked)
switch(alert("You can not lock your cover again, are you sure?\n (You can still ask for a human to lock it)", "Unlock Own Cover", "Yes", "No"))
if("Yes")
locked = 0
updateicon()
usr << "You unlock your cover."
/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."
@@ -1188,6 +1200,13 @@
return
/mob/living/silicon/robot/proc/SetLockdown(var/state = 1)
// They stay locked down if their wire is cut.
if(wires.LockedCut())
state = 1
lockcharge = state
update_canmove()
/mob/living/silicon/robot/verb/pose()
set name = "Set Pose"
set desc = "Sets a description which will be shown when someone examines you."
@@ -1,148 +0,0 @@
#define BORG_WIRE_LAWCHECK 1
#define BORG_WIRE_MAIN_POWER1 2
#define BORG_WIRE_MAIN_POWER2 3
#define BORG_WIRE_AI_CONTROL 4
#define BORG_WIRE_CAMERA 5
/proc/RandomBorgWires()
//to make this not randomize the wires, just set index to 1 and increment it in the flag for loop (after doing everything else).
var/list/Borgwires = list(0, 0, 0, 0, 0)
BorgIndexToFlag = list(0, 0, 0, 0, 0)
BorgIndexToWireColor = list(0, 0, 0, 0, 0)
BorgWireColorToIndex = list(0, 0, 0, 0, 0)
var/flagIndex = 1
//I think it's easier to read this way, also doesn't rely on the random number generator to land on a new wire.
var/list/colorIndexList = list(BORG_WIRE_LAWCHECK, BORG_WIRE_MAIN_POWER1, BORG_WIRE_MAIN_POWER2, BORG_WIRE_AI_CONTROL, BORG_WIRE_CAMERA)
for (var/flag=1, flag<=16, flag+=flag)
var/colorIndex = pick(colorIndexList)
if (Borgwires[colorIndex]==0)
Borgwires[colorIndex] = flag
BorgIndexToFlag[flagIndex] = flag
BorgIndexToWireColor[flagIndex] = colorIndex
BorgWireColorToIndex[colorIndex] = flagIndex
colorIndexList -= colorIndex // Shortens the list.
//world.log << "Flag: [flag], CIndex: [colorIndex], FIndex: [flagIndex]"
flagIndex+=1
return Borgwires
/mob/living/silicon/robot/proc/isWireColorCut(var/wireColor)
var/wireFlag = BorgWireColorToFlag[wireColor]
return ((src.borgwires & wireFlag) == 0)
/mob/living/silicon/robot/proc/isWireCut(var/wireIndex)
var/wireFlag = BorgIndexToFlag[wireIndex]
return ((src.borgwires & wireFlag) == 0)
/mob/living/silicon/robot/proc/cut(var/wireColor)
var/wireFlag = BorgWireColorToFlag[wireColor]
var/wireIndex = BorgWireColorToIndex[wireColor]
borgwires &= ~wireFlag
switch(wireIndex)
if(BORG_WIRE_LAWCHECK) //Cut the law wire, and the borg will no longer receive law updates from its AI
if (src.lawupdate == 1)
src << "LawSync protocol engaged."
src.show_laws()
if (BORG_WIRE_AI_CONTROL) //Cut the AI wire to reset AI control
if (src.connected_ai)
src.connected_ai = null
if (BORG_WIRE_CAMERA)
if(!isnull(src.camera) && !scrambledcodes)
src.camera.status = 0
src.camera.deactivate(usr, 0) // Will kick anyone who is watching the Cyborg's camera.
src.interact(usr)
/mob/living/silicon/robot/proc/mend(var/wireColor)
var/wireFlag = BorgWireColorToFlag[wireColor]
var/wireIndex = BorgWireColorToIndex[wireColor]
borgwires |= wireFlag
switch(wireIndex)
if(BORG_WIRE_LAWCHECK) //turns law updates back on assuming the borg hasn't been emagged
if (src.lawupdate == 0 && !src.emagged)
src.lawupdate = 1
if(BORG_WIRE_CAMERA)
if (!isnull(src.camera) && !scrambledcodes)
src.camera.status = 1
src.camera.deactivate(usr, 0) // Will kick anyone who is watching the Cyborg's camera.
src.interact(usr)
/mob/living/silicon/robot/proc/pulse(var/wireColor)
var/wireIndex = BorgWireColorToIndex[wireColor]
switch(wireIndex)
if(BORG_WIRE_LAWCHECK) //Forces a law update if the borg is set to receive them. Since an update would happen when the borg checks its laws anyway, not much use, but eh
if (src.lawupdate)
src.lawsync()
if (BORG_WIRE_AI_CONTROL) //pulse the AI wire to make the borg reselect an AI
if(!src.emagged)
src.connected_ai = select_active_ai()
if (BORG_WIRE_CAMERA)
if(!isnull(src.camera) && src.camera.status && !scrambledcodes)
src.camera.deactivate(usr, 0) // Kick anyone watching the Cyborg's camera, doesn't display you disconnecting the camera.
usr << "[src]'s camera lens focuses loudly."
src << "Your camera lens focuses loudly."
src.interact(usr)
/mob/living/silicon/robot/proc/interact(mob/user)
if(wiresexposed && (!istype(user, /mob/living/silicon)))
user.set_machine(src)
var/t1 = text("<B>Access Panel</B><br>\n")
var/list/Borgwires = list(
"Orange" = 1,
"Dark red" = 2,
"White" = 3,
"Yellow" = 4,
"Blue" = 5,
)
for(var/wiredesc in Borgwires)
var/is_uncut = src.borgwires & BorgWireColorToFlag[Borgwires[wiredesc]]
t1 += "[wiredesc] wire: "
if(!is_uncut)
t1 += "<a href='?src=\ref[src];borgwires=[Borgwires[wiredesc]]'>Mend</a>"
else
t1 += "<a href='?src=\ref[src];borgwires=[Borgwires[wiredesc]]'>Cut</a> "
t1 += "<a href='?src=\ref[src];pulse=[Borgwires[wiredesc]]'>Pulse</a> "
t1 += "<br>"
t1 += text("<br>\n[(src.lawupdate ? "The LawSync light is on." : "The LawSync light is off.")]<br>\n[(src.connected_ai ? "The AI link light is on." : "The AI link light is off.")]")
t1 += text("<br>\n[((!isnull(src.camera) && src.camera.status == 1) ? "The Camera light is on." : "The Camera light is off.")]<br>\n")
t1 += text("<p><a href='?src=\ref[src];close2=1'>Close</a></p>\n")
user << browse(t1, "window=borgwires")
onclose(user, "borgwires")
/mob/living/silicon/robot/Topic(href, href_list)
..()
if (((in_range(src, usr) && istype(src.loc, /turf))) && !istype(usr, /mob/living/silicon))
usr.set_machine(src)
if (href_list["borgwires"])
var/t1 = text2num(href_list["borgwires"])
if (!( istype(usr.get_active_hand(), /obj/item/weapon/wirecutters) ))
usr << "You need wirecutters!"
return
if (src.isWireColorCut(t1))
src.mend(t1)
else
src.cut(t1)
else if (href_list["pulse"])
var/t1 = text2num(href_list["pulse"])
if (!istype(usr.get_active_hand(), /obj/item/device/multitool))
usr << "You need a multitool!"
return
if (src.isWireColorCut(t1))
usr << "You can't pulse a cut wire."
return
else
src.pulse(t1)
else if (href_list["close2"])
usr << browse(null, "window=borgwires")
usr.unset_machine()
return
#undef BORG_WIRE_LAWCHECK
#undef BORG_WIRE_MAIN_POWER1
#undef BORG_WIRE_MAIN_POWER2
#undef BORG_WIRE_AI_CONTROL
#undef BORG_WIRE_CAMERA
+13 -1
View File
@@ -431,4 +431,16 @@ var/list/intents = list("help","disarm","grab","hurt")
set category = "IC"
resting = !resting
src << "\blue You are now [resting ? "resting" : "getting up"]"
src << "\blue You are now [resting ? "resting" : "getting up"]"
/proc/get_multitool(mob/user as mob)
// Check distance for those that need it.
if(!isAI(user))
if(!in_range(user, src))
return null
// Get tool
var/obj/item/device/multitool/P = user.get_multitool()
if(!istype(P))
return null
return P