Cleaned up metroid/life() and metroid/AIprocess().

- Reduced metroid sight range from 12 to 7.
- Reduced metroid target hunting range from 30 to 7.
- Removed unnecessary loops and checks.
- I didn't do much with AIprocess() but it could really use some more work.

Cleaned out unnecessary checks from porta_turret process() and reduced the range from 12 to 7.

Removed handle_virus_updates from brains, metroids and aliens since there are no viruses that affect them.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4174 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
johnsonmt88@gmail.com
2012-07-25 21:14:28 +00:00
parent 927741ea33
commit 1f1784c2d2
5 changed files with 75 additions and 70 deletions

View File

@@ -23,7 +23,7 @@
req_access = list(access_security)
power_channel = EQUIP // drains power from the EQUIPMENT channel
var/lasercolor = ""
var/lasercolor = "" // Something to do with lasertag turrets, blame Sieve for not adding a comment.
var/raised = 0 // if the turret cover is "open" and the turret is raised
var/raising= 0 // if the turret is currently opening or closing its cover
var/health = 80 // the turret's health
@@ -434,10 +434,12 @@ Status: []<BR>"},
src.cover = new /obj/machinery/porta_turret_cover(src.loc) // if the turret has no cover and is anchored, give it a cover
src.cover.Parent_Turret = src // assign the cover its Parent_Turret, which would be this (src)
if(stat & (NOPOWER|BROKEN))
// if the turret has no power or is broken, make the turret pop down if it hasn't already
popDown()
return
if(!on)
// if the turret is off, make it pop down
popDown()
@@ -447,11 +449,11 @@ Status: []<BR>"},
var/list/secondarytargets = list() // targets that are least important
if(src.check_anomalies) // if its set to check for xenos/carps, check for non-mob "crittersssss"
for (var/obj/effect/critter/L in view(12,src))
for (var/obj/effect/critter/L in view(7,src))
if(L.alive)
targets += L
for (var/mob/living/carbon/C in view(12,src)) // loops through all living carbon-based lifeforms in view(12)
for (var/mob/living/carbon/C in view(7,src)) // loops through all living carbon-based lifeforms in view(12)
if(istype(C, /mob/living/carbon/alien) && src.check_anomalies) // git those fukken xenos
if(!C.stat) // if it's dead/dying, there's no need to keep shooting at it.
targets += C
@@ -464,10 +466,10 @@ Status: []<BR>"},
continue // move onto next potential victim!
var/dst = get_dist(src, C) // if it's too far away, why bother?
if (dst > 12)
if (dst > 7)
continue
if(!istype(C, /mob/living/silicon) && ai) // If it's set to attack all nonsilicons, target them!
if(ai) // If it's set to attack all nonsilicons, target them!
if(C.lying)
if(lasercolor)
continue
@@ -482,7 +484,7 @@ Status: []<BR>"},
if(src.assess_perp(C)<4)
continue // if threat level < 4, keep going
else if (istype(C, /mob/living/carbon/monkey) || istype(C, /mob/living/silicon))
else if (istype(C, /mob/living/carbon/monkey))
continue // Don't target monkeys or borgs/AIs you dumb shit
if (C.lying) // if the perp is lying down, it's still a target but a less-important target

View File

@@ -37,7 +37,7 @@
blinded = null
//Disease Check
handle_virus_updates()
//handle_virus_updates() There is no disease that affects aliens
//Update mind
update_mind()

View File

@@ -37,7 +37,7 @@
update_mind()
//Disease Check
handle_virus_updates()
//handle_virus_updates() There is no disease that affects larva
//Handle temperature/pressure differences between body and environment
handle_environment()

View File

@@ -14,7 +14,7 @@
blinded = null
//Disease Check
handle_virus_updates()
//handle_virus_updates() There is no disease that affects brains
//Handle temperature/pressure differences between body and environment
if(environment) // More error checking -- TLE

View File

@@ -19,7 +19,7 @@
src.blinded = null
//Disease Check
handle_virus_updates()
//handle_virus_updates() There is no disease that affects metroids
// Basically just deletes any screen objects :<
@@ -100,7 +100,7 @@
if(starving && !client) // if a metroid is starving, it starts losing its friends
if(prob(1) && Friends.len > 0)
if(Friends.len > 0 && prob(1))
var/friendnum = 0
for(var/mob/M in Friends)
friendnum++
@@ -112,88 +112,91 @@
if(!Target)
var/list/targets = list()
for(var/mob/living/carbon/C in view(12,src))
if(!istype(C, /mob/living/carbon/metroid)) // does not eat his bros! BROSBROSBROSBROS
if(C.stat != 2 && C.health > 0) // chooses only healthy targets
var/notarget = 0
if(istype(C, /mob/living/carbon/human))
var/mob/living/carbon/human/H = C
if(H.mutantrace == "metroid")
notarget = 1 // don't hurt metroidmen!
if(hungry || starving) //Only add to the list if we need to
for(var/mob/living/L in view(7,src))
if(!istype(src, /mob/living/carbon/metroid/adult))
//Ignore other metroids, dead mobs and simple_animals
if(ismetroid(L) \
|| L.stat == DEAD\
|| isanimal(L))
continue
if(issilicon(L))
if(!istype(src, /mob/living/carbon/metroid/adult)) //Non-starving diciplined adult metroids wont eat things
if(!starving && Discipline > 0)
notarget = 1
break
continue
if(!C.canmove)
for(var/mob/living/carbon/metroid/M in view(1,C))
if(M.Victim == C)
if(tame) //Tame metroids ignore electronic life
continue
targets += L //Possible target found!
else if(iscarbon(L))
if(istype(L, /mob/living/carbon/human)) //Ignore metroid(wo)men
var/mob/living/carbon/human/H = L
if(H.mutantrace == "metroid")
continue
if(!istype(src, /mob/living/carbon/metroid/adult)) //Non-starving diciplined adult metroids wont eat things
if(!starving && Discipline > 0)
continue
if(L in Friends) //No eating friends!
continue
if(tame && ishuman(L)) //Tame metroids dont eat people.
continue
if(!L.canmove) //Only one metroid can latch on at a time.
var/notarget = 0
for(var/mob/living/carbon/metroid/M in view(1,L))
if(M.Victim == L)
notarget = 1
if(notarget)
continue
if(C in Friends)
notarget = 1
if(tame && istype(C, /mob/living/carbon/human))
notarget = 1
if(!notarget) targets += C
for(var/mob/living/silicon/C in view(12,src))
if(C.stat != 2)
var/notarget = 0
if(!istype(src, /mob/living/carbon/metroid/adult))
if(!starving && Discipline > 0)
notarget = 1
break
if(tame)
notarget = 1
if(!notarget) targets += C
targets += L //Possible target found!
if((hungry || starving) && targets.len > 0)
if(!istype(src, /mob/living/carbon/metroid/adult))
if(!starving)
for(var/mob/living/carbon/monkey/M in targets)
Target = M
break
for(var/mob/living/carbon/alien/larva/L in targets)
Target = L
break
if(prob(5) && !Discipline)
for(var/mob/living/carbon/alien/humanoid/H in targets)
Target = H
break
for(var/mob/living/carbon/human/H in targets)
Target = H
break
for(var/mob/living/carbon/C in targets)
if(!Discipline && prob(5))
if(ishuman(C))
Target = C
break
if(isalienadult(C))
Target = C
break
if(islarva(C))
Target = C
break
if(ismonkey(C))
Target = C
break
else
Target = targets[1]
else
Target = targets[1] // closest target
if(targets.len > 0)
if(attacked > 0 || rabid)
Target = targets[1]
Target = targets[1] //closest mob probably attacked it, so override Target and attack the nearest!
if(!Target)
if(hungry || starving)
if(prob(50) && canmove && isturf(loc))
if(canmove && isturf(loc) && prob(50))
step(src, pick(cardinal))
else
if(prob(33) && canmove && isturf(loc))
if(canmove && isturf(loc) && prob(33))
step(src, pick(cardinal))
else
if(!AIproc)
spawn() AIprocess()
@@ -214,7 +217,7 @@
AIprocess() // the master AI process
if(AIproc || stat == 2 || client) return
if(AIproc || stat == DEAD || client) return
var/hungry = 0
var/starving = 0
@@ -262,9 +265,9 @@
if(get_obstacle_ok(Target))
Target.attack_metroid(src)
return
if(prob(80) && !Target.lying)
if(!Target.lying && prob(80))
if(Target.client && Target.health >= rand(10,30))
if(Target.client && Target.health >= 20)
if(!Atkcool)
spawn()
Atkcool = 1
@@ -287,7 +290,7 @@
Feedon(Target)
else
if(Target in view(30, src))
if(Target in view(7, src))
if(get_obstacle_ok(Target))
step_to(src, Target)