From d5251640e0181acd71f86a1775686417c3356a68 Mon Sep 17 00:00:00 2001 From: uporotiy Date: Sat, 28 May 2011 14:17:09 +0000 Subject: [PATCH] Fixed the three remaining gotos in the code. Here's hoping it doesn't break anything. Also removed AI bleeding at 50% integrity. We'll see how it affects the balance. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@1625 316c924e-a436-60f5-8080-3fe189b3f50e --- code/defines/procs/helpers.dm | 4 +--- code/modules/admin/verbs/striketeam.dm | 10 ++++++---- code/modules/mob/living/silicon/ai/ai.dm | 18 ++++++++++++------ code/modules/mob/living/silicon/ai/life.dm | 18 +++++++++--------- 4 files changed, 28 insertions(+), 22 deletions(-) diff --git a/code/defines/procs/helpers.dm b/code/defines/procs/helpers.dm index ebbdf538cb1..b5ab1daa1d5 100644 --- a/code/defines/procs/helpers.dm +++ b/code/defines/procs/helpers.dm @@ -11,8 +11,7 @@ var/char = copytext(hex, i, i + 1) switch(char) if("0") - power++ - goto Label_290 + //Apparently, switch works with empty statements, yay! If that doesn't work, blame me, though. -- Urist if("9", "8", "7", "6", "5", "4", "3", "2", "1") num += text2num(char) * 16 ** power if("a", "A") @@ -31,7 +30,6 @@ CRASH("hex2num given non-hexadecimal string (user error)") return power++ - Label_290: i-- return num diff --git a/code/modules/admin/verbs/striketeam.dm b/code/modules/admin/verbs/striketeam.dm index 6f10b2fcbbc..d17301330da 100644 --- a/code/modules/admin/verbs/striketeam.dm +++ b/code/modules/admin/verbs/striketeam.dm @@ -22,11 +22,13 @@ var/global/sent_strike_team = 0 return alert("This 'mode' will go on until everyone is dead or the station is destroyed. You may also admin-call the evac shuttle when appropriate. Spawned commandos have internals cameras which are viewable through a monitor inside the Spec. Ops. Office. Assigning the team's detailed task is recommended from there. While you will be able to manually pick the candidates from active ghosts, their assignment in the squad will be random.") - TRYAGAIN + var/input = null + while(!input) + input = input(src, "Please specify which mission the death commando squad shall undertake.", "Specify Mission", "") + if(!input) + if(alert("Error, no mission set. Do you want to exit the setup process?",,"Yes","No")=="Yes") + return - var/input = input(usr, "Please specify which mission the death commando squad shall undertake.", "Specify Mission", "") - if(!input) - goto TRYAGAIN sent_strike_team = 1 if (emergency_shuttle.direction == 1 && emergency_shuttle.online == 1) diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index d67629b2dde..e5f609acb51 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -1,10 +1,16 @@ /mob/living/silicon/ai/New(loc, var/datum/ai_laws/L, var/obj/item/device/mmi/B, var/safety = 0) - PickName - name = pick(ai_names) - for (var/mob/living/silicon/ai/A in world) - if (A.real_name == name) - goto PickName//It'll get stuck in an infinite loop if all default names are chosen but that's... a remote possibility. - real_name = name + var/list/possibleNames = ai_names + + var/pickedName = null + while(!pickedName) + pickedName = pick(ai_names) + for (var/mob/living/silicon/ai/A in world) + if (A.real_name == pickedName && possibleNames.len > 1) //fixing the theoretically possible infinite loop + possibleNames -= pickedName + pickedName = null + + real_name = pickedName + name = real_name anchored = 1 canmove = 0 loc = loc diff --git a/code/modules/mob/living/silicon/ai/life.dm b/code/modules/mob/living/silicon/ai/life.dm index 2ba14470fc5..b25c8c12923 100644 --- a/code/modules/mob/living/silicon/ai/life.dm +++ b/code/modules/mob/living/silicon/ai/life.dm @@ -1,13 +1,13 @@ /mob/living/silicon/ai/Life() - //Being dead doesn't mean your temperature never changes - var/turf/T = get_turf(src) - -// if (isturf(T)) //let cryo/sleeper handle adjusting body temp in their respective alter_health procs -// src.bodytemperature = adjustBodyTemp(src.bodytemperature, (shuttlefloor ? shuttlefloor.temp : T.temp), 1.0) //TODO: DEFERRED - if (src.stat == 2) return - else + else //I'm not removing that shitton of tabs, unneeded as they are. -- Urist + //Being dead doesn't mean your temperature never changes + var/turf/T = get_turf(src) + + // if (isturf(T)) //let cryo/sleeper handle adjusting body temp in their respective alter_health procs + // src.bodytemperature = adjustBodyTemp(src.bodytemperature, (shuttlefloor ? shuttlefloor.temp : T.temp), 1.0) //TODO: DEFERRED + if (src.stat!=0) src:cameraFollow = null src:current = null @@ -37,8 +37,8 @@ if (src.health <= -100.0) death() return - else if (src.health < 0 && !istype(src.loc, /obj/machinery/computer/aifixer)) - src.oxyloss++ +// else if (src.health < 0 && !istype(src.loc, /obj/machinery/computer/aifixer)) //Removing this for now, as it's bloody annoying. We'll see how it works -- Urist +// src.oxyloss++ if (src.machine) if (!( src.machine.check_eye(src) ))