diff --git a/code/game/verbs/suicide.dm b/code/game/verbs/suicide.dm index f207785180f..38629d9d6cb 100644 --- a/code/game/verbs/suicide.dm +++ b/code/game/verbs/suicide.dm @@ -75,7 +75,7 @@ suiciding = 1 //instead of killing them instantly, just put them at -175 health and let 'em gasp for a while viewers(src) << "\red [src] is attempting to bite \his tongue. It looks like \he's trying to commit suicide." - adjustOxyLoss(max(175 - getToxLoss() - getFireLoss() - getBruteLoss() - getOxyLoss(), 0)) + adjustOxyLoss(max(175- getToxLoss() - getFireLoss() - getBruteLoss() - getOxyLoss(), 0)) updatehealth() /mob/living/silicon/ai/verb/suicide() @@ -95,7 +95,7 @@ suiciding = 1 viewers(src) << "\red [src] is powering down. It looks like \he's trying to commit suicide." //put em at -175 - adjustOxyLoss(max(175 - getToxLoss() - getFireLoss() - getBruteLoss() - getOxyLoss(), 0)) + adjustOxyLoss(max(maxHealth * 2 - getToxLoss() - getFireLoss() - getBruteLoss() - getOxyLoss(), 0)) updatehealth() /mob/living/silicon/robot/verb/suicide() @@ -115,7 +115,7 @@ suiciding = 1 viewers(src) << "\red [src] is powering down. It looks like \he's trying to commit suicide." //put em at -175 - adjustOxyLoss(max(475 - getToxLoss() - getFireLoss() - getBruteLoss() - getOxyLoss(), 0)) + adjustOxyLoss(max(maxHealth * 2 - getToxLoss() - getFireLoss() - getBruteLoss() - getOxyLoss(), 0)) updatehealth() /mob/living/silicon/pai/verb/suicide() @@ -150,7 +150,7 @@ suiciding = 1 viewers(src) << "\red [src] is thrashing wildly! It looks like \he's trying to commit suicide." //put em at -175 - adjustOxyLoss(max(100 - getFireLoss() - getBruteLoss() - getOxyLoss(), 0)) + adjustOxyLoss(max(175 - getFireLoss() - getBruteLoss() - getOxyLoss(), 0)) updatehealth() diff --git a/code/modules/mob/living/silicon/ai/freelook/cameranet.dm b/code/modules/mob/living/silicon/ai/freelook/cameranet.dm index 8bba2ed1767..eb38495e641 100644 --- a/code/modules/mob/living/silicon/ai/freelook/cameranet.dm +++ b/code/modules/mob/living/silicon/ai/freelook/cameranet.dm @@ -31,12 +31,12 @@ var/datum/cameranet/cameranet = new() // Updates what the aiEye can see. It is recommended you use this when the aiEye moves or it's location is set. -/datum/cameranet/proc/visibility(mob/aiEye/ai, var/turf/T) +/datum/cameranet/proc/visibility(mob/aiEye/ai) // 0xf = 15 - var/x1 = max(0, T.x - 16) & ~0xf - var/y1 = max(0, T.y - 16) & ~0xf - var/x2 = min(world.maxx, T.x + 16) & ~0xf - var/y2 = min(world.maxy, T.y + 16) & ~0xf + var/x1 = max(0, ai.x - 16) & ~0xf + var/y1 = max(0, ai.y - 16) & ~0xf + var/x2 = min(world.maxx, ai.x + 16) & ~0xf + var/y2 = min(world.maxy, ai.y + 16) & ~0xf var/list/visibleChunks = list() diff --git a/code/modules/mob/living/silicon/ai/freelook/eye.dm b/code/modules/mob/living/silicon/ai/freelook/eye.dm index cc643dc9add..776ef22d8ed 100644 --- a/code/modules/mob/living/silicon/ai/freelook/eye.dm +++ b/code/modules/mob/living/silicon/ai/freelook/eye.dm @@ -11,6 +11,7 @@ density = 0 status_flags = GODMODE // You can't damage it. mouse_opacity = 0 + see_in_dark = 7 // Movement code. Returns 0 to stop air movement from moving it. /mob/aiEye/Move() @@ -41,8 +42,8 @@ if(!isturf(ai.loc)) return T = get_turf(T) - cameranet.visibility(src, T) loc = T + cameranet.visibility(src) if(ai.client) ai.client.eye = src //Holopad diff --git a/code/modules/mob/living/silicon/ai/life.dm b/code/modules/mob/living/silicon/ai/life.dm index 4dc00820b73..37f0fdd1f8b 100644 --- a/code/modules/mob/living/silicon/ai/life.dm +++ b/code/modules/mob/living/silicon/ai/life.dm @@ -17,8 +17,6 @@ src << "\red ERROR: APC access disabled, hack attempt canceled." src.malfhacking = 0 src.malfhack = null - else - if (src.health <= config.health_threshold_dead) @@ -29,146 +27,138 @@ if (!( src.machine.check_eye(src) )) src.reset_view(null) - //var/stage = 0 - if (src.client) - //stage = 1 - if (istype(src, /mob/living/silicon/ai)) - var/blind = 0 - //stage = 2 - var/area/loc = null - if (istype(T, /turf)) - //stage = 3 - loc = T.loc - if (istype(loc, /area)) - //stage = 4 - if (!loc.master.power_equip && !istype(src.loc,/obj/item)) - //stage = 5 - blind = 1 + // Handle power damage (oxy) + if(src:aiRestorePowerRoutine != 0) + // Lost power + adjustOxyLoss(1) + else + // Gain Power + adjustOxyLoss(-1) - if (!blind) //lol? if(!blind) #if(src.blind.layer) <--something here is clearly wrong :P - //I'll get back to this when I find out how this is -supposed- to work ~Carn //removed this shit since it was confusing as all hell --39kk9t - //stage = 4.5 - src.sight |= SEE_TURFS - src.sight |= SEE_MOBS - src.sight |= SEE_OBJS - src.see_in_dark = 8 - src.see_invisible = SEE_INVISIBLE_LEVEL_TWO + //stage = 1 + //if (istype(src, /mob/living/silicon/ai)) // Are we not sure what we are? + var/blind = 0 + //stage = 2 + var/area/loc = null + if (istype(T, /turf)) + //stage = 3 + loc = T.loc + if (istype(loc, /area)) + //stage = 4 + if (!loc.master.power_equip && !istype(src.loc,/obj/item)) + //stage = 5 + blind = 1 - var/area/home = get_area(src) - if(!home) return//something to do with malf fucking things up I guess. <-- aisat is gone. is this still necessary? ~Carn - if(home.powered(EQUIP)) - home.use_power(1000, EQUIP) + if (!blind) //lol? if(!blind) #if(src.blind.layer) <--something here is clearly wrong :P + //I'll get back to this when I find out how this is -supposed- to work ~Carn //removed this shit since it was confusing as all hell --39kk9t + //stage = 4.5 + src.sight |= SEE_TURFS + src.sight |= SEE_MOBS + src.sight |= SEE_OBJS + src.see_in_dark = 8 + src.see_invisible = SEE_INVISIBLE_LEVEL_TWO - if (src:aiRestorePowerRoutine==2) - src << "Alert cancelled. Power has been restored without our assistance." - src:aiRestorePowerRoutine = 0 - src.blind.layer = 0 - spawn(1) - while (src.getOxyLoss()>0 && stat!=2) - sleep(50) - src.adjustOxyLoss(-1) - src.oxyloss = 0 - return - else if (src:aiRestorePowerRoutine==3) - src << "Alert cancelled. Power has been restored." - src:aiRestorePowerRoutine = 0 - src.blind.layer = 0 - spawn(1) - while (src.getOxyLoss()>0 && stat!=2) - sleep(50) - src.adjustOxyLoss(-1) - return - else + var/area/home = get_area(src) + if(!home) return//something to do with malf fucking things up I guess. <-- aisat is gone. is this still necessary? ~Carn + if(home.powered(EQUIP)) + home.use_power(1000, EQUIP) - //stage = 6 - src.blind.screen_loc = "1,1 to 15,15" - if (src.blind.layer!=18) - src.blind.layer = 18 - src.sight = src.sight&~SEE_TURFS - src.sight = src.sight&~SEE_MOBS - src.sight = src.sight&~SEE_OBJS - src.see_in_dark = 0 - src.see_invisible = SEE_INVISIBLE_LIVING + if (src:aiRestorePowerRoutine==2) + src << "Alert cancelled. Power has been restored without our assistance." + src:aiRestorePowerRoutine = 0 + src.blind.layer = 0 + return + else if (src:aiRestorePowerRoutine==3) + src << "Alert cancelled. Power has been restored." + src:aiRestorePowerRoutine = 0 + src.blind.layer = 0 + return + else - if (((!loc.master.power_equip) || istype(T, /turf/space)) && !istype(src.loc,/obj/item)) - if (src:aiRestorePowerRoutine==0) - src:aiRestorePowerRoutine = 1 + //stage = 6 + src.blind.screen_loc = "1,1 to 15,15" + if (src.blind.layer!=18) + src.blind.layer = 18 + src.sight = src.sight&~SEE_TURFS + src.sight = src.sight&~SEE_MOBS + src.sight = src.sight&~SEE_OBJS + src.see_in_dark = 0 + src.see_invisible = SEE_INVISIBLE_LIVING - src << "You've lost power!" + if (((!loc.master.power_equip) || istype(T, /turf/space)) && !istype(src.loc,/obj/item)) + if (src:aiRestorePowerRoutine==0) + src:aiRestorePowerRoutine = 1 + + src << "You've lost power!" // world << "DEBUG CODE TIME! [loc] is the area the AI is sucking power from" - if (!is_special_character(src)) - src.set_zeroth_law("") - //src.clear_supplied_laws() // Don't reset our laws. - //var/time = time2text(world.realtime,"hh:mm:ss") - //lawchanges.Add("[time] : [src.name]'s noncore laws have been reset due to power failure") - spawn(50) - while ((src:aiRestorePowerRoutine!=0) && stat!=2) - src.oxyloss += 2 - sleep(50) - - spawn(20) - src << "Backup battery online. Scanners, camera, and radio interface offline. Beginning fault-detection." - sleep(50) - if (loc.master.power_equip) - if (!istype(T, /turf/space)) - src << "Alert cancelled. Power has been restored without our assistance." - src:aiRestorePowerRoutine = 0 - src.blind.layer = 0 - return - src << "Fault confirmed: missing external power. Shutting down main control system to save power." - sleep(20) - src << "Emergency control system online. Verifying connection to power network." - sleep(50) - if (istype(T, /turf/space)) - src << "Unable to verify! No power connection detected!" - src:aiRestorePowerRoutine = 2 - return - src << "Connection verified. Searching for APC in power network." - sleep(50) - var/obj/machinery/power/apc/theAPC = null + if (!is_special_character(src)) + src.set_zeroth_law("") + //src.clear_supplied_laws() // Don't reset our laws. + //var/time = time2text(world.realtime,"hh:mm:ss") + //lawchanges.Add("[time] : [src.name]'s noncore laws have been reset due to power failure") + spawn(20) + src << "Backup battery online. Scanners, camera, and radio interface offline. Beginning fault-detection." + sleep(50) + if (loc.master.power_equip) + if (!istype(T, /turf/space)) + src << "Alert cancelled. Power has been restored without our assistance." + src:aiRestorePowerRoutine = 0 + src.blind.layer = 0 + return + src << "Fault confirmed: missing external power. Shutting down main control system to save power." + sleep(20) + src << "Emergency control system online. Verifying connection to power network." + sleep(50) + if (istype(T, /turf/space)) + src << "Unable to verify! No power connection detected!" + src:aiRestorePowerRoutine = 2 + return + src << "Connection verified. Searching for APC in power network." + sleep(50) + var/obj/machinery/power/apc/theAPC = null /* - for (var/something in loc) - if (istype(something, /obj/machinery/power/apc)) - if (!(something:stat & BROKEN)) - theAPC = something - break + for (var/something in loc) + if (istype(something, /obj/machinery/power/apc)) + if (!(something:stat & BROKEN)) + theAPC = something + break */ - var/PRP //like ERP with the code, at least this stuff is no more 4x sametext - for (PRP=1, PRP<=4, PRP++) - var/area/AIarea = get_area(src) - for(var/area/A in AIarea.master.related) - for (var/obj/machinery/power/apc/APC in A) - if (!(APC.stat & BROKEN)) - theAPC = APC - break - if (!theAPC) - switch(PRP) - if (1) src << "Unable to locate APC!" - else src << "Lost connection with the APC!" - src:aiRestorePowerRoutine = 2 - return - if (loc.master.power_equip) - if (!istype(T, /turf/space)) - src << "Alert cancelled. Power has been restored without our assistance." - src:aiRestorePowerRoutine = 0 - src.blind.layer = 0 //This, too, is a fix to issue 603 - return - switch(PRP) - if (1) src << "APC located. Optimizing route to APC to avoid needless power waste." - if (2) src << "Best route identified. Hacking offline APC power port." - if (3) src << "Power port upload access confirmed. Loading control program into APC power port software." - if (4) - src << "Transfer complete. Forcing APC to execute program." - sleep(50) - src << "Receiving control information from APC." - sleep(2) - //bring up APC dialog - theAPC.attack_ai(src) - src:aiRestorePowerRoutine = 3 - src << "Here are your current laws:" - src.show_laws() + var/PRP //like ERP with the code, at least this stuff is no more 4x sametext + for (PRP=1, PRP<=4, PRP++) + var/area/AIarea = get_area(src) + for(var/area/A in AIarea.master.related) + for (var/obj/machinery/power/apc/APC in A) + if (!(APC.stat & BROKEN)) + theAPC = APC + break + if (!theAPC) + switch(PRP) + if (1) src << "Unable to locate APC!" + else src << "Lost connection with the APC!" + src:aiRestorePowerRoutine = 2 + return + if (loc.master.power_equip) + if (!istype(T, /turf/space)) + src << "Alert cancelled. Power has been restored without our assistance." + src:aiRestorePowerRoutine = 0 + src.blind.layer = 0 //This, too, is a fix to issue 603 + return + switch(PRP) + if (1) src << "APC located. Optimizing route to APC to avoid needless power waste." + if (2) src << "Best route identified. Hacking offline APC power port." + if (3) src << "Power port upload access confirmed. Loading control program into APC power port software." + if (4) + src << "Transfer complete. Forcing APC to execute program." sleep(50) - theAPC = null + src << "Receiving control information from APC." + sleep(2) + //bring up APC dialog + theAPC.attack_ai(src) + src:aiRestorePowerRoutine = 3 + src << "Here are your current laws:" + src.show_laws() + sleep(50) + theAPC = null /mob/living/silicon/ai/updatehealth() if(status_flags & GODMODE)