Merge pull request #975 from CIB/master

Lagfix and update to epidemic
This commit is contained in:
Albert Iordache
2012-05-04 09:52:38 -07:00
3 changed files with 80 additions and 72 deletions
+4 -1
View File
@@ -187,15 +187,18 @@ proc/countJob(rank)
return equipped
/proc/AutoUpdateAI(obj/subject)
/*
if (subject!=null)
for(var/mob/living/silicon/ai/M in world)
if ((M.client && M.machine == subject))
subject.attack_ai(M)
*/
/proc/AutoUpdateTK(obj/subject)
if (subject!=null)
/* if (subject!=null)
for(var/obj/item/tk_grab/T in world)
if (T.host)
var/mob/M = T.host
if(M.client && M.machine == subject)
subject.attack_hand(M)
*/
+5 -2
View File
@@ -126,9 +126,12 @@
if(stage == 1 && cruiser_seconds() < 60 * 30)
announce_to_kill_crew()
stage = 2
else if(stage == 2 && cruiser_seconds() <= 0)
crew_lose()
else if(stage == 2 && cruiser_seconds() <= 60 * 5)
command_alert("Inbound cruiser detected on collision course. Scans indicate the ship to be armed and ready to fire. Estimated time of arrival: 5 minutes.", "[station_name()] Early Warning System")
stage = 3
else if(stage == 3 && cruiser_seconds() <= 0)
crew_lose()
stage = 4
checkwin_counter++
if(checkwin_counter >= 20)
+71 -69
View File
@@ -8,81 +8,83 @@
process()
set background = 1
if (!src.alive) return
switch(task)
if("thinking")
src.attack = 0
src.target = null
sleep(thinkspeed)
walk_to(src,0)
if (src.aggressive) seek_target()
if (src.wanderer && !src.target) src.task = "wandering"
if("chasing")
if (src.frustration >= max_frustration)
// use a loop to avoid weird benchmarking phenomenons caused by
// recursion
while(1)
switch(task)
if("thinking")
src.attack = 0
src.target = null
src.last_found = world.time
src.frustration = 0
src.task = "thinking"
sleep(thinkspeed)
walk_to(src,0)
if (target)
if (get_dist(src, src.target) <= 1)
var/mob/living/carbon/M = src.target
ChaseAttack()
src.task = "attacking"
if(chasestate)
icon_state = chasestate
src.anchored = 1
src.target_lastloc = M.loc
else
var/turf/olddist = get_dist(src, src.target)
walk_to(src, src.target,1,chasespeed)
if ((get_dist(src, src.target)) >= (olddist))
src.frustration++
if (src.aggressive) seek_target()
if (src.wanderer && !src.target) src.task = "wandering"
if("chasing")
if (src.frustration >= max_frustration)
src.target = null
src.last_found = world.time
src.frustration = 0
src.task = "thinking"
walk_to(src,0)
if (target)
if (get_dist(src, src.target) <= 1)
var/mob/living/carbon/M = src.target
ChaseAttack()
src.task = "attacking"
if(chasestate)
icon_state = chasestate
src.anchored = 1
src.target_lastloc = M.loc
else
src.frustration = 0
sleep(5)
else src.task = "thinking"
if("attacking")
// see if he got away
if ((get_dist(src, src.target) > 1) || ((src.target:loc != src.target_lastloc)))
src.anchored = 0
src.task = "chasing"
if(chasestate)
icon_state = chasestate
else
if (get_dist(src, src.target) <= 1)
var/mob/living/carbon/M = src.target
if(!src.attacking) RunAttack()
if(!src.aggressive)
src.task = "thinking"
src.target = null
src.anchored = 0
src.last_found = world.time
src.frustration = 0
src.attacking = 0
else
if(M!=null)
if(ismob(src.target))
if(M.health < config.health_threshold_crit)
src.task = "thinking"
src.target = null
src.anchored = 0
src.last_found = world.time
src.frustration = 0
src.attacking = 0
else
var/turf/olddist = get_dist(src, src.target)
walk_to(src, src.target,1,chasespeed)
if ((get_dist(src, src.target)) >= (olddist))
src.frustration++
else
src.frustration = 0
sleep(5)
else src.task = "thinking"
if("attacking")
// see if he got away
if ((get_dist(src, src.target) > 1) || ((src.target:loc != src.target_lastloc)))
src.anchored = 0
src.attacking = 0
src.task = "chasing"
if(chasestate)
icon_state = chasestate
if("wandering")
if(chasestate)
icon_state = initial(icon_state)
patrol_step()
sleep(wanderspeed)
spawn(8)
process()
return
else
if (get_dist(src, src.target) <= 1)
var/mob/living/carbon/M = src.target
if(!src.attacking) RunAttack()
if(!src.aggressive)
src.task = "thinking"
src.target = null
src.anchored = 0
src.last_found = world.time
src.frustration = 0
src.attacking = 0
else
if(M!=null)
if(ismob(src.target))
if(M.health < config.health_threshold_crit)
src.task = "thinking"
src.target = null
src.anchored = 0
src.last_found = world.time
src.frustration = 0
src.attacking = 0
else
src.anchored = 0
src.attacking = 0
src.task = "chasing"
if(chasestate)
icon_state = chasestate
if("wandering")
if(chasestate)
icon_state = initial(icon_state)
patrol_step()
sleep(wanderspeed)
sleep(8)
patrol_step()
@@ -115,7 +117,7 @@
seek_target()
if(!prob(aggression)) return // make them attack depending on aggression levels
src.anchored = 0
var/T = null
for(var/mob/living/C in view(src.seekrange,src))//TODO: mess with this