Ported the last of the critters to simple_animal.

Removed all critter code/replaced it with their simple animal paths where applicable.

Replaced the critters on the maps with simple_animal versions.

If I missed any vars/icons/etc when I ported them over, let me know.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@5210 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
Kortgstation@gmail.com
2012-11-27 19:06:15 +00:00
parent c243250daa
commit a55b8b6ad7
21 changed files with 104 additions and 701 deletions

View File

@@ -1,129 +0,0 @@
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:32
/obj/effect/critter
name = "Critter"
desc = "Generic critter."
icon = 'icons/mob/critter.dmi'
icon_state = "basic"
layer = 5.0
density = 1
anchored = 0
var/alive = 1
var/health = 10
var/max_health = 10
var/list/access_list = list()//accesses go here
//AI things
var/task = "thinking"
//Attacks at will
var/aggressive = 1
//Will target an attacker
var/defensive = 0
//Will randomly move about
var/wanderer = 1
//Will open doors it bumps ignoring access
var/opensdoors = 0
//Will randomly travel through vents
var/ventcrawl = 0
//Internal tracking ignore
var/frustration = 0
var/max_frustration = 8
var/attack = 0
var/attacking = 0
var/steps = 0
var/last_found = null
var/target = null
var/oldtarget_name = null
var/target_lastloc = null
var/thinkspeed = 15
var/chasespeed = 4
var/wanderspeed = 10
//The last guy who attacked it
var/attacker = null
//Will not attack this thing
var/friend = null
//How far to look for things dont set this overly high
var/seekrange = 7
//If true will attack these things
var/atkcarbon = 1
var/atksilicon = 0
var/atkcritter = 0
//Attacks critters of the same type
var/atksame = 0
var/atkmech = 0
//Attacks syndies/traitors (distinguishes via mind)
var/atksynd = 1
//Attacks things NOT in its obj/req_access list
var/atkreq = 0
//Damage multipliers
var/brutevuln = 1
var/firevuln = 1
//DR
var/armor = 0
//How much damage it does it melee
var/melee_damage_lower = 1
var/melee_damage_upper = 2
//Basic attack message when they move to attack and attack
var/angertext = "charges at"
var/attacktext = "attacks"
var/deathtext = "dies!"
var/chasestate = null // the icon state to use when attacking or chasing a target
var/attackflick = null // the icon state to flick when it attacks
var/attack_sound = null // the sound it makes when it attacks!
var/attack_speed = 25 // delay of attack
proc/AfterAttack(var/mob/living/target)
return
/* TODO:Go over these and see how/if to add them
proc/set_attack()
state = 1
if(path_idle.len) path_idle = new/list()
trg_idle = null
proc/set_idle()
state = 2
if (path_target.len) path_target = new/list()
target = null
frustration = 0
proc/set_null()
state = 0
if (path_target.len) path_target = new/list()
if (path_idle.len) path_idle = new/list()
target = null
trg_idle = null
frustration = 0
proc/path_idle(var/atom/trg)
path_idle = AStar(src.loc, get_turf(trg), /turf/proc/CardinalTurfsWithAccess, /turf/proc/Distance, 0, 250, anicard, null)
path_idle = reverselist(path_idle)
proc/path_attack(var/atom/trg)
path_target = AStar(src.loc, trg.loc, /turf/proc/CardinalTurfsWithAccess, /turf/proc/Distance, 0, 250, anicard, null)
path_target = reverselist(path_target)
//Look these over
var/list/path = new/list()
var/patience = 35 //The maximum time it'll chase a target.
var/list/mob/living/carbon/flee_from = new/list()
var/list/path_target = new/list() //The path to the combat target.
var/turf/trg_idle //It's idle target, the one it's following but not attacking.
var/list/path_idle = new/list() //The path to the idle target.
*/

View File

@@ -1,241 +0,0 @@
/obj/effect/critter
New(loc)
spawn(0) process()//I really dont like this much but it seems to work well
..(loc)
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)
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
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.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 < 0)
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)
spawn(8)
process()
return
proc/patrol_step()
var/moveto = locate(src.x + rand(-1,1),src.y + rand(-1, 1),src.z)
if (istype(moveto, /turf/simulated/floor) || istype(moveto, /turf/simulated/shuttle/floor) || istype(moveto, /turf/unsimulated/floor)) step_towards(src, moveto)
if(src.aggressive) seek_target()
steps += 1
if (steps == rand(5,20)) src.task = "thinking"
Bump(M as mob|obj)//TODO: Add access levels here
spawn(0)
if((istype(M, /obj/machinery/door)))
if(src.opensdoors)
M:open()
src.frustration = 0
else src.frustration ++
if((istype(M, /mob/living/)) && (!src.anchored))
src.loc = M:loc
src.frustration = 0
return
return
Bumped(M as mob|obj)
spawn(0)
var/turf/T = get_turf(src)
M:loc = T
proc/seek_target()
src.anchored = 0
var/T = null
for(var/mob/living/C in view(src.seekrange,src))//TODO: mess with this
if (src.target)
src.task = "chasing"
break
// Ignore syndicates and traitors if specified
if(!atksynd && C.mind)
var/datum/mind/synd_mind = C.mind
if( synd_mind.special_role == "Syndicate" || synd_mind.special_role == "traitor" )
continue
if((C.name == src.oldtarget_name) && (world.time < src.last_found + 100)) continue
if(istype(C, /mob/living/carbon/) && !src.atkcarbon) continue
if(istype(C, /mob/living/silicon/) && !src.atksilicon) continue
if(atkreq)
if(src.allowed(C)) continue
if(C.health < 0) continue
if(istype(C, /mob/living/carbon/) && src.atkcarbon) src.attack = 1
if(istype(C, /mob/living/silicon/) && src.atksilicon) src.attack = 1
if(atkreq)
if(!src.allowed(C)) src.attack = 1
if(src.attack)
T = C
break
if(!src.attack)
for(var/obj/effect/critter/C in view(src.seekrange,src))
if(!src.atkcritter) continue
if(C.health <= 0) continue
if(src.atkcritter)
if((istype(C, src.type) && !src.atksame) || (C == src)) continue
src.attack = 1
if(src.attack)
T = C
break
if(!src.attack)
for(var/obj/mecha/C in view(src.seekrange,src))
if(!C.occupant) continue
if(atkreq && C.occupant)
if(src.allowed(C.occupant)) continue
if(!atksynd && C.occupant)
if(C.occupant.mind)
var/datum/mind/synd_mind = C.occupant.mind
if( synd_mind.special_role == "Syndicate" || synd_mind.special_role == "traitor" )
continue
if(!src.atkmech) continue
if(C.health <= 0) continue
if(src.atkmech) src.attack = 1
if(src.attack)
T = C
break
if(src.attack)
src.target = T
src.oldtarget_name = T:name
src.task = "chasing"
return
proc/ChaseAttack()
for(var/mob/O in viewers(src, null))
O.show_message("\red <B>[src]</B> [src.angertext] at [src.target]!", 1)
return
proc/RunAttack()
src.attacking = 1
if(ismob(src.target))
for(var/mob/O in viewers(src, null))
O.show_message("\red <B>[src]</B> [src.attacktext] [src.target]!", 1)
var/damage = rand(melee_damage_lower, melee_damage_upper)
if(ishuman(target))
var/mob/living/carbon/human/H = target
var/dam_zone = pick("chest", "l_hand", "r_hand", "l_leg", "r_leg")
var/datum/organ/external/affecting = H.get_organ(ran_zone(dam_zone))
H.apply_damage(damage, BRUTE, affecting, H.run_armor_check(affecting, "melee"))
else if(isliving(target))
var/mob/living/L = target
L.adjustBruteLoss(damage)
if(attack_sound)
playsound(loc, attack_sound, 50, 1, -1)
AfterAttack(target)
if(isobj(src.target))
if(istype(target, /obj/mecha))
//src.target:take_damage(rand(melee_damage_lower,melee_damage_upper))
src.target:attack_critter(src)
else
src.target:TakeDamage(rand(melee_damage_lower,melee_damage_upper))
spawn(attack_speed)
src.attacking = 0
return
/*TODO: Figure out how to handle special things like this dont really want to give it to every critter
/obj/effect/critter/proc/CritterTeleport(var/telerange, var/dospark, var/dosmoke)
if (!src.alive) return
var/list/randomturfs = new/list()
for(var/turf/T in orange(src, telerange))
if(istype(T, /turf/space) || T.density) continue
randomturfs.Add(T)
src.loc = pick(randomturfs)
if (dospark)
var/datum/effect/system/spark_spread/s = new /datum/effect/system/spark_spread
s.set_up(5, 1, src)
s.start()
if (dosmoke)
var/datum/effect/system/harmless_smoke_spread/smoke = new /datum/effect/system/harmless_smoke_spread()
smoke.set_up(10, 0, src.loc)
smoke.start()
src.task = "thinking"
*/

View File

@@ -1,128 +0,0 @@
/*
Contains the procs that control attacking critters
*/
/obj/effect/critter
attackby(obj/item/weapon/W as obj, mob/living/user as mob)
..()
if(!src.alive)
Harvest(W,user)
return
var/damage = 0
switch(W.damtype)
if("fire") damage = W.force * firevuln
if("brute") damage = W.force * brutevuln
TakeDamage(damage)
if(src.defensive && alive) Target_Attacker(user)
return
attack_hand(var/mob/user as mob)
if (!src.alive) ..()
if (user.a_intent == "hurt")
TakeDamage(rand(1,2) * brutevuln)
if(istype(user, /mob/living/carbon/human))
for(var/mob/O in viewers(src, null))
O.show_message("\red <B>[user] has punched [src]!</B>", 1)
playsound(src.loc, pick('sound/weapons/punch1.ogg','sound/weapons/punch2.ogg','sound/weapons/punch3.ogg','sound/weapons/punch4.ogg'), 100, 1)
else if(istype(user, /mob/living/carbon/alien/humanoid))
for(var/mob/O in viewers(src, null))
O.show_message("\red <B>[user] has slashed at [src]!</B>", 1)
playsound(src.loc, 'sound/weapons/slice.ogg', 25, 1, -1)
else
for(var/mob/O in viewers(src, null))
O.show_message("\red <B>[user] has bit [src]!</B>", 1)
if(src.defensive) Target_Attacker(user)
else
for(var/mob/O in viewers(src, null))
O.show_message("\blue [user] touches [src]!", 1)
proc/Target_Attacker(var/target)
if(!target) return
src.target = target
src.oldtarget_name = target:name
if(task != "chasing" && task != "attacking")
if(angertext && angertext != "")
for(var/mob/O in viewers(src, null))
O.show_message("\red <b>[src]</b> [src.angertext] at [target:name]!", 1)
src.task = "chasing"
return
proc/TakeDamage(var/damage = 0)
var/tempdamage = (damage-armor)
if(tempdamage > 0)
src.health -= tempdamage
else
src.health--
if(src.health <= 0)
src.Die()
proc/Die()
if (!src.alive) return
src.icon_state += "-dead"
src.alive = 0
src.anchored = 0
src.density = 0
walk_to(src,0)
src.visible_message("<b>[src]</b> [deathtext]")
proc/Harvest(var/obj/item/weapon/W, var/mob/living/user)
if((!W) || (!user)) return 0
if(src.alive) return 0
return 1
bullet_act(var/obj/item/projectile/Proj)
TakeDamage(Proj.damage)
..()
ex_act(severity)
switch(severity)
if(1.0)
src.Die()
return
if(2.0)
TakeDamage(20)
return
return
emp_act(serverity)
switch(serverity)
if(1.0)
src.Die()
return
if(2.0)
TakeDamage(20)
return
return
meteorhit()
src.Die()
return
blob_act()
if(prob(25))
src.Die()
return
attack_animal(mob/living/simple_animal/M as mob)
if(M.melee_damage_upper == 0)
M.emote("[M.friendly] [src]")
else
for(var/mob/O in viewers(src, null))
O.show_message("\red <B>[M]</B> [M.attacktext] [src]!", 1)
var/damage = rand(M.melee_damage_lower, M.melee_damage_upper)
TakeDamage(damage)
return

View File

@@ -1,127 +0,0 @@
/obj/effect/critter/creature
name = "creature"
desc = "A sanity-destroying otherthing."
icon_state = "otherthing"
health = 80
max_health = 80
aggressive = 1
defensive = 1
wanderer = 1
opensdoors = 1
atkcarbon = 1
atksilicon = 1
atkcritter = 1
atkmech = 1
atksame = 1
firevuln = 1
brutevuln = 1
melee_damage_lower = 25
melee_damage_upper = 50
angertext = "runs"
attacktext = "chomps"
attack_sound = 'sound/weapons/bite.ogg'
/obj/effect/critter/roach
name = "cockroach"
desc = "An unpleasant insect that lives in filthy places."
icon_state = "roach"
health = 5
max_health = 5
aggressive = 0
defensive = 1
wanderer = 1
atkcarbon = 1
atksilicon = 0
attacktext = "bites"
Die()
..()
del(src)
/obj/effect/critter/spore
name = "plasma spore"
desc = "A barely intelligent colony of organisms. Very volatile."
icon_state = "spore"
density = 1
health = 1
max_health = 1
aggressive = 0
defensive = 0
wanderer = 1
atkcarbon = 0
atksilicon = 0
firevuln = 2
brutevuln = 2
/* process()
if(prob(50))
TakeDamage(1)
..()*/
Die()
src.visible_message("<b>[src]</b> ruptures and explodes!")
src.alive = 0
var/turf/T = get_turf(src.loc)
if(T)
T.hotspot_expose(700,125)
explosion(T, -1, -1, 2, 3)
del src
ex_act(severity)
src.Die()
/obj/effect/critter/blob
name = "blob"
desc = "Some blob thing."
icon_state = "blob"
pass_flags = PASSBLOB
health = 20
max_health = 20
aggressive = 1
defensive = 0
wanderer = 1
atkcarbon = 1
atksilicon = 1
firevuln = 2
brutevuln = 0.5
melee_damage_lower = 2
melee_damage_upper = 8
angertext = "charges"
attacktext = "hits"
attack_sound = 'sound/weapons/genhit1.ogg'
var/obj/effect/blob/factory/factory = null
New(loc, var/obj/effect/blob/factory/linked_node)
if(istype(linked_node))
factory = linked_node
factory.spores += src
..(loc)
return
Die()
if(factory)
factory.spores -= src
..()
del(src)
/obj/effect/critter/lizard
name = "Lizard"
desc = "A cute tiny lizard."
icon_state = "lizard"
health = 5
max_health = 5
aggressive = 0
defensive = 1
wanderer = 1
opensdoors = 0
atkcarbon = 1
atksilicon = 1
attacktext = "bites"

View File

@@ -8,6 +8,7 @@
see_invisible = SEE_INVISIBLE_LEVEL_TWO
var/ghost_name = "Unknown"
var/creating_blob = 0
faction = "blob"
New()
@@ -251,3 +252,7 @@
B << "Check your Blob verbs and hit Create Node to build a node."
spawn(10)
del(G_found)

View File

@@ -438,10 +438,6 @@ Radar-related things
if(M.stat == 2) continue
found_targets.Add(M)
for(var/obj/effect/critter/C in orange(max_dist, distance_ref))
if(!C.alive) continue
found_targets.Add(C)
for(var/obj/mecha/M in orange(max_dist, distance_ref))
if(!M.occupant) continue
found_targets.Add(M)
@@ -495,10 +491,6 @@ Radar-related things
blip.icon_state = "unknownblip"
blip.name = "Unknown Organism"
else if(istype(A, /obj/effect/critter))
blip.icon_state = "unknownblip"
blip.name = "Unknown Organism"
else if(istype(A, /obj/mecha))
blip.icon_state = "roboblip"
blip.name = "Robotic Organism"

View File

@@ -0,0 +1,17 @@
/mob/living/simple_animal/lizard
name = "Lizard"
desc = "A cute tiny lizard."
icon = 'icons/mob/critter.dmi'
icon_state = "lizard"
icon_living = "lizard"
icon_dead = "lizard-dead"
speak_emote = list("hisses")
health = 5
maxHealth = 5
attacktext = "bites"
attacktext = "bites"
melee_damage_lower = 1
melee_damage_upper = 2
response_help = "pets"
response_disarm = "shoos"
response_harm = "stomps on"

View File

@@ -12,6 +12,4 @@
response_help = "prods the"
response_disarm = "pushes aside the"
response_harm = "smacks the"
harm_intent_damage = 5
/mob/living/simple_animal/tomato
harm_intent_damage = 5

View File

@@ -0,0 +1,15 @@
/mob/living/simple_animal/hostile/creature
name = "creature"
desc = "A sanity-destroying otherthing."
icon = 'icons/mob/critter.dmi'
speak_emote = list("gibbers")
icon_state = "otherthing"
icon_living = "otherthing"
icon_dead = "otherthing-dead"
health = 80
maxHealth = 80
melee_damage_lower = 25
melee_damage_upper = 50
attacktext = "chomps"
attack_sound = 'sound/weapons/bite.ogg'
faction = "creature"

View File

@@ -136,8 +136,9 @@
/mob/living/simple_animal/hostile/viscerator
name = "viscerator"
desc = "A small, twin-bladed machine capable of inflicting very deadly lacerations."
icon_state = "viscerator"
icon_living = "viscerator"
icon = 'icons/mob/critter.dmi'
icon_state = "viscerator_attack"
icon_living = "viscerator_attack"
pass_flags = PASSTABLE
health = 15
maxHealth = 15

View File

@@ -789,7 +789,7 @@ datum
required_other = 4
on_reaction(var/datum/reagents/holder, var/created_volume)
var/list/critters = typesof(/obj/effect/critter) - /obj/effect/critter // list of possible critters
var/list/critters = typesof(/mob/living/simple_animal/hostile) - /mob/living/simple_animal/hostile // list of possible hostile mobs
playsound(get_turf_loc(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1)
@@ -799,7 +799,7 @@ datum
for(var/i = 1, i <= created_volume, i++)
var/chosen = pick(critters)
var/obj/effect/critter/C = new chosen
var/mob/living/simple_animal/hostile/C = new chosen
C.loc = get_turf_loc(holder.my_atom)
if(prob(50))
for(var/j = 1, j <= rand(1, 3), j++)