- Parrots now have absolutely gorgeous sprites thanks to Pewtershmitz
- Removed a few "world <<"s that I missed
- Fixed parrots picking up their own headset (and duplicating it)
- Fixed parrots not properly running away from carbon mobs

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4704 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
johnsonmt88@gmail.com
2012-09-16 18:34:39 +00:00
parent 2717517f17
commit caa3f8055d
3 changed files with 19 additions and 42 deletions

View File

@@ -33,9 +33,9 @@
name = "\improper Parrot"
desc = "The parrot squacks, \"It's a Parrot! BAWWK!\""
icon = 'icons/mob/animal.dmi'
icon_state = "chick"
icon_living = "chick"
icon_dead = "chick_dead"
icon_state = "parrot_fly"
icon_living = "parrot_fly"
icon_dead = "parrot_sit "
pass_flags = PASSTABLE
speak = list("Hi","Hello!","Cracker?","BAWWWWK george mellons griffing me")
@@ -181,13 +181,16 @@
..()
if(client) return
if(!stat && M.a_intent == "hurt")
icon_state = "parrot_fly" //It is going to be flying regardless of whether it flees or attacks
if(parrot_state == PARROT_PERCH)
parrot_sleep_dur = parrot_sleep_max //Reset it's sleep timer if it was perched
parrot_interest = M
parrot_state = PARROT_SWOOP //The parrot just got hit, it WILL move, now to pick a direction..
if(M.getMaxHealth() - M.health < 50) //Weakened mob? Fight back!
if(M.health < 50) //Weakened mob? Fight back!
parrot_state |= PARROT_ATTACK
else
parrot_state |= PARROT_FLEE //Otherwise, fly like a bat out of hell!
@@ -204,12 +207,14 @@
/mob/living/simple_animal/parrot/attack_animal(mob/living/simple_animal/M as mob)
if(client) return
if(parrot_state == PARROT_PERCH)
parrot_sleep_dur = parrot_sleep_max //Reset it's sleep timer if it was perched
if(M.melee_damage_upper > 0)
parrot_interest = M
parrot_state = PARROT_SWOOP | PARROT_ATTACK //Attack other animals regardless
icon_state = "parrot_fly"
//Mobs with objects
/mob/living/simple_animal/parrot/attackby(var/obj/item/O as obj, var/mob/user as mob)
@@ -221,6 +226,7 @@
parrot_interest = user
parrot_state = PARROT_SWOOP | PARROT_FLEE
icon_state = "parrot_fly"
drop_held_item(0)
return
@@ -233,6 +239,7 @@
parrot_interest = null
parrot_state = PARROT_WANDER //OWFUCK, Been shot! RUN LIKE HELL!
icon_state = "parrot_fly"
drop_held_item(0)
return
@@ -253,44 +260,41 @@
//Every once in a while, the parrot picks one of the lines from the buffer and replaces an element of the 'speech' list.
//Then it clears the buffer to make sure they dont magically remember something from hours ago.
if(speech_buffer.len && prob(10))
// world << "New speech being added!"
if(speak.len)
speak.Remove(pick(speak))
speak.Add(pick(speech_buffer))
clearlist(speech_buffer)
// world << "State: [parrot_state]"
//Alright, here we go... down the slope
//-----SLEEPING
if(parrot_state == PARROT_PERCH)
// world << "Perched"
if(parrot_perch.loc != src.loc) //Make sure someone hasnt moved our perch on us
if(parrot_perch in view(src))
parrot_state = PARROT_SWOOP | PARROT_RETURN
icon_state = "parrot_fly"
return
else
parrot_state = PARROT_WANDER
icon_state = "parrot_fly"
return
if(--parrot_sleep_dur) //Zzz
// world << "Perched: sleeping"
return
else
// world << "Perched: looking around"
parrot_sleep_dur = parrot_sleep_max //This way we only call the loop below once every [sleep_max] ticks.
parrot_interest = search_for_item()
if(parrot_interest)
emote("[src] looks in [parrot_interest]'s direction and takes flight.")
parrot_state = PARROT_SWOOP | PARROT_STEAL
icon_state = "parrot_fly"
return
//-----WANDERING - This is basically a 'I dont know what to do yet' state
else if(parrot_state == PARROT_WANDER)
// world << "Wander"
//Stop movement, we'll set it later
walk(src, 0)
parrot_interest = null
@@ -298,25 +302,20 @@
//Wander around aimlessly. This will help keep the loops from searches down
//and possibly move the mob into a new are in view of something they can use
if(prob(90))
// world << "Wander: randomly"
step(src, pick(cardinal))
return
if(!held_item && !parrot_perch) //If we've got nothing to do.. look for something to do.
// world << "Wander: looking for perch or item"
// world << parrot_interest
var/atom/movable/AM = search_for_perch_and_item() //This handles checking through lists so we know it's either a perch or stealable item
if(AM)
if(istype(AM, /obj/item) || isliving(AM)) //If stealable item
parrot_interest = AM
emote("[src] turns and flies towards [parrot_interest].")
parrot_state = PARROT_SWOOP | PARROT_STEAL
world << parrot_interest
return
else //Else it's a perch
parrot_perch = AM
parrot_state = PARROT_SWOOP | PARROT_RETURN
world << parrot_interest
return
return
@@ -325,32 +324,26 @@
return
if(parrot_perch && parrot_perch in view(src))
// world << "Wander: returning to perch"
parrot_state = PARROT_SWOOP | PARROT_RETURN
return
else //Have an item but no perch? Find one!
// world << "Wander: looking for perch, holding item"
parrot_perch = search_for_perch()
if(parrot_perch)
parrot_state = PARROT_SWOOP | PARROT_RETURN
return
//-----STEALING
else if(parrot_state == (PARROT_SWOOP | PARROT_STEAL))
// world << "Steal"
walk(src,0)
if(!parrot_interest || held_item)
// world << "Steal: lost interest or holding an item"
parrot_state = PARROT_SWOOP | PARROT_RETURN
return
if(!(parrot_interest in view(src)))
// world << "Steal: interest not in view"
parrot_state = PARROT_SWOOP | PARROT_RETURN
return
if(in_range(src, parrot_interest))
// world << "Steal: stealing item"
if(isliving(parrot_interest))
steal_from_mob()
else
@@ -360,7 +353,6 @@
parrot_state = PARROT_SWOOP | PARROT_RETURN
return
// world << "Steal: swooping closer to target"
var/oldloc = src.loc
step_towards(src, get_step_towards(src,parrot_interest))
if(src.loc == oldloc) //Check if the mob is stuck
@@ -370,22 +362,19 @@
//-----RETURNING TO PERCH
else if(parrot_state == (PARROT_SWOOP | PARROT_RETURN))
// world << "Return"
walk(src, 0)
if(!parrot_perch || !isturf(parrot_perch.loc)) //Make sure the perch exists and somehow isnt inside of something else.
world << "Return: no perch?"
parrot_perch = null
parrot_state = PARROT_WANDER
return
if(in_range(src, parrot_perch))
// world << "Return: landing"
src.loc = parrot_perch.loc
drop_held_item()
parrot_state = PARROT_PERCH
icon_state = "parrot_sit"
return
// world << "Return: returning to perch"
var/oldloc = src.loc
step_towards(src, get_step_towards(src,parrot_perch))
if(src.loc == oldloc) //Check if the mob is stuck
@@ -394,13 +383,10 @@
//-----FLEEING
else if(parrot_state == (PARROT_SWOOP | PARROT_FLEE))
// world << "Flee"
walk(src,0)
if(!parrot_interest || !isliving(parrot_interest)) //Sanity
world << "Flee: lost interest"
parrot_state = PARROT_WANDER
// world << "Flee: fleeing"
var/oldloc = src.loc
step(src, get_step_away(src, parrot_interest))
if(src.loc == oldloc) //Check if the mob is stuck
@@ -408,11 +394,9 @@
//-----ATTACKING
else if(parrot_state == (PARROT_SWOOP | PARROT_ATTACK))
// world << "Attack"
//If we're attacking a nothing, an object, a turf or a ghost for some stupid reason, switch to wander
if(!parrot_interest || !isliving(parrot_interest))
// world << "Attack: lost interest"
parrot_interest = null
parrot_state = PARROT_WANDER
return
@@ -424,7 +408,6 @@
//If the mob we've been chasing/attacking dies or falls into crit, check for loot!
if(L.stat)
// world << "Attack: looting body"
parrot_interest = null
if(!held_item)
held_item = steal_from_ground()
@@ -440,7 +423,6 @@
var/damage = rand(5,10)
if(ishuman(parrot_interest))
// world << "Attack: attacking human"
var/mob/living/carbon/human/H = parrot_interest
var/datum/organ/external/affecting = H.get_organ(ran_zone(pick(parrot_dam_zone)))
@@ -448,14 +430,12 @@
emote(pick("pecks [H]'s [affecting]", "cuts [H]'s [affecting] with its talons"))
else
// world << "Attack: attacking non-human"
L.adjustBruteLoss(damage)
emote(pick("pecks at [L]", "claws [L]"))
return
//Otherwise, fly towards the mob!
else
// world << "Attack: swooping towards the mob"
var/oldloc = src.loc
step_towards(src, get_step_towards(src,parrot_interest))
if(src.loc == oldloc) //Check if the mob is stuck
@@ -463,7 +443,6 @@
//-----STATE MISHAP
else //This should not happen. If it does lets reset everything and try again
// world << "Unknown state: resetting to wander"
walk(src,0)
parrot_interest = null
parrot_perch = null
@@ -478,7 +457,7 @@
/mob/living/simple_animal/parrot/proc/search_for_item()
for(var/atom/movable/AM in view(src))
for(var/path in desired_items)
if(parrot_perch && AM.loc == parrot_perch.loc) //Skip items we already stole
if(parrot_perch && AM.loc == parrot_perch.loc || AM.loc == src) //Skip items we already stole or are wearing
continue
if(istype(AM, path))
@@ -505,7 +484,7 @@
return AM
for(var/item_path in desired_items)
if(parrot_perch && AM.loc == parrot_perch.loc) //Skip items we already stole
if(parrot_perch && AM.loc == parrot_perch.loc || AM.loc == src) //Skip items we already stole or are wearing
continue
if(istype(AM, item_path))
@@ -535,7 +514,7 @@
for(var/obj/item/I in view(1,src))
for(var/path in desired_items)
if(istype(I, path))
if(istype(I, path) && I.loc != src)
held_item = I
I.loc = src
visible_message("[src] grabs the [held_item]!", "\blue You grab the [held_item]!", "You hear the sounds of wings flapping furiously.")