-Potentially fixed Metroids not going after food. They kept targeting unconscious food.

-Removed metroid core flushing. There doesn't seem to be a point of it.
-Badly made metroids unelectrutable. I'll change this later.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4947 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
giacomand@gmail.com
2012-10-24 02:23:17 +00:00
parent 2fe846065a
commit 92d0367c17
3 changed files with 396 additions and 387 deletions

View File

@@ -50,10 +50,10 @@
var/Tempstun = 0 // temporary temperature stuns
var/Discipline = 0 // if a metroid has been hit with a freeze gun, or wrestled/attacked off a human, they become disciplined and don't attack anymore for a while
var/SStun = 0 // stun variable
proc
AIprocess() // the master AI process
/mob/living/carbon/metroid/proc/AIprocess() // the master AI process
//world << "AI proc started."
if(AIproc || stat == DEAD || client) return
var/hungry = 0
@@ -68,26 +68,33 @@
if(150 to 900) hungry = 1
if(0 to 149) starving = 1
AIproc = 1
//world << "AIproc [AIproc] && stat != 2 [stat] && (attacked > 0 [attacked] || starving [starving] || hungry [hungry] || rabid [rabid] || Victim [Victim] || Target [Target]"
while(AIproc && stat != 2 && (attacked > 0 || starving || hungry || rabid || Victim))
if(Victim) // can't eat AND have this little process at the same time
//world << "break 1"
break
if(!Target || client)
//world << "break 2"
break
if(Target.health <= -70 || Target.stat == 2)
Target = null
AIproc = 0
//world << "break 3"
break
if(Target)
//world << "[Target] Target Found"
for(var/mob/living/carbon/metroid/M in view(1,Target))
if(M.Victim == Target)
Target = null
AIproc = 0
//world << "break 4"
break
if(!AIproc)
//world << "break 5"
break
if(Target in view(1,src))
@@ -101,6 +108,7 @@
if(get_obstacle_ok(Target))
Target.attack_metroid(src)
//world << "retrun 1"
return
if(!Target.lying && prob(80))
@@ -134,6 +142,7 @@
else
Target = null
AIproc = 0
//world << "break 6"
break
var/sleeptime = movement_delay()
@@ -142,8 +151,9 @@
sleep(sleeptime + 2) // this is about as fast as a player Metroid can go
AIproc = 0
//world << "AI proc ended."
handle_environment(datum/gas_mixture/environment)
/mob/living/carbon/metroid/proc/handle_environment(datum/gas_mixture/environment)
if(!environment)
adjustFireLoss(rand(10,20))
return
@@ -201,7 +211,7 @@
return //TODO: DEFERRED
adjust_body_temperature(current, loc_temp, boost)
/mob/living/carbon/metroid/proc/adjust_body_temperature(current, loc_temp, boost)
var/temperature = current
var/difference = abs(current-loc_temp) //get difference
var/increments// = difference/10 //find how many increments apart they are
@@ -218,7 +228,7 @@
temp_change = (temperature - current)
return temp_change
handle_chemicals_in_body()
/mob/living/carbon/metroid/proc/handle_chemicals_in_body()
if(reagents) reagents.metabolize(src)
@@ -228,7 +238,7 @@
return //TODO: DEFERRED
handle_regular_status_updates()
/mob/living/carbon/metroid/proc/handle_regular_status_updates()
if(istype(src, /mob/living/carbon/metroid/adult))
health = 200 - (getOxyLoss() + getToxLoss() + getFireLoss() + getBruteLoss() + getCloneLoss())
@@ -308,7 +318,7 @@
return 1
handle_nutrition()
/mob/living/carbon/metroid/proc/handle_nutrition()
if(prob(20))
if(istype(src, /mob/living/carbon/metroid/adult)) nutrition-=rand(4,6)
@@ -351,14 +361,13 @@
A.rabid = rabid
del(src)
handle_virus_updates()
/mob/living/carbon/metroid/proc/handle_virus_updates()
if(bodytemperature > 406)
for(var/datum/disease/D in viruses)
D.cure()
return
handle_targets()
/mob/living/carbon/metroid/proc/handle_targets()
if(Tempstun)
if(!Victim) // not while they're eating!
canmove = 0
@@ -429,7 +438,7 @@
for(var/mob/living/L in view(7,src))
//Ignore other metroids, dead mobs and simple_animals
if(ismetroid(L) || L.stat == DEAD || isanimal(L))
if(ismetroid(L) || L.stat != CONSCIOUS || isanimal(L))
continue
if(issilicon(L))

View File

@@ -790,7 +790,7 @@ mob/living/carbon/metroid/var/temperature_resistance = T0C+75
var/Flush = 30
var/Uses = 5 // uses before it goes inert
New()
/obj/item/metroid_core/New()
..()
var/datum/reagents/R = new/datum/reagents(100)
reagents = R
@@ -798,7 +798,7 @@ mob/living/carbon/metroid/var/temperature_resistance = T0C+75
POWERFLAG = rand(1,10)
Uses = rand(7, 25)
//flags |= NOREACT
/*
spawn()
Life()
@@ -809,6 +809,7 @@ mob/living/carbon/metroid/var/temperature_resistance = T0C+75
if(Flush <= 0)
reagents.clear_reagents()
Flush = 30
*/
/obj/item/weapon/reagent_containers/food/snacks/roro_egg
name = "roro egg"
@@ -819,26 +820,24 @@ mob/living/carbon/metroid/var/temperature_resistance = T0C+75
origin_tech = "biotech=4"
var/grown = 0
New()
/obj/item/weapon/reagent_containers/food/snacks/roro_egg/New()
..()
reagents.add_reagent("nutriment", 5)
spawn(rand(1200,1500))//the egg takes a while to "ripen"
Grow()
proc/Grow()
/obj/item/weapon/reagent_containers/food/snacks/roro_egg/proc/Grow()
grown = 1
icon_state = "roro egg-grown"
processing_objects.Add(src)
return
proc/Hatch()
/obj/item/weapon/reagent_containers/food/snacks/roro_egg/proc/Hatch()
processing_objects.Remove(src)
var/turf/T = get_turf(src)
for(var/mob/O in hearers(T))
O.show_message("\blue The [name] pulsates and quivers!")
src.visible_message("\blue The [name] pulsates and quivers!")
spawn(rand(50,100))
for(var/mob/O in hearers(T))
O.show_message("\blue The [name] bursts open!")
src.visible_message("\blue The [name] bursts open!")
new/mob/living/carbon/metroid(T)
del(src)

View File

@@ -409,6 +409,7 @@
if(H.gloves)
var/obj/item/clothing/gloves/G = H.gloves
if(G.siemens_coefficient == 0) return 0 //to avoid spamming with insulated glvoes on
else if(ismetroid(M)) return 0
var/area/source_area
if(istype(power_source,/area))