-Small cleanup for hostile mobs.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@5179 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
giacomand@gmail.com
2012-11-24 16:11:01 +00:00
parent 5ee5d21004
commit 1ba52ad43c
3 changed files with 32 additions and 36 deletions

View File

@@ -8,8 +8,6 @@
var/projectiletype
var/projectilesound
var/casingtype
var/target //used for shooting
var/incombat = 0 //if they're attacking stuff
/mob/living/simple_animal/hostile/proc/FindTarget()
@@ -19,7 +17,7 @@
if(isliving(A))
var/mob/living/L = A
if(L.faction == src.faction)
if(L.faction == src.faction && !attack_same)
continue
else
if(!L.stat)
@@ -42,11 +40,9 @@
if(ranged)
if(get_dist(src, target_mob) <= 6)
OpenFire(target_mob)
else
walk_to(src, target_mob, 1, 2)
else
walk_to(src, target_mob, 1, 2)
stance = HOSTILE_STANCE_ATTACKING
walk_to(src, target_mob, 1, 2)
/mob/living/simple_animal/hostile/proc/AttackTarget()
@@ -96,30 +92,24 @@
if(client)
return 0
if(incombat)
for(dir in list(NORTH,EAST,SOUTH,WEST))
var/obj/structure/obstacle = locate(/obj/structure, get_step(src, dir))
if(istype(obstacle, /obj/structure/window) || istype(obstacle, /obj/structure/closet) || istype(obstacle, /obj/structure/table) || istype(obstacle, /obj/structure/grille))
obstacle.attack_animal(src)
if(!stat)
switch(stance)
if(HOSTILE_STANCE_IDLE)
incombat = 0
target_mob = FindTarget()
if(HOSTILE_STANCE_ATTACK)
incombat = 1
DestroySurroundings()
MoveToTarget()
if(HOSTILE_STANCE_ATTACKING)
incombat = 1
DestroySurroundings()
AttackTarget()
/mob/living/simple_animal/hostile/proc/OpenFire(target_mob)
src.target = target_mob
visible_message("\red <b>[src]</b> fires at [src.target]!", 1)
var/target = target_mob
visible_message("\red <b>[src]</b> fires at [target]!", 1)
var/tturf = get_turf(target)
if(rapid)
@@ -161,4 +151,10 @@
A.xo = target:x - start:x
spawn( 0 )
A.process()
return
return
/mob/living/simple_animal/hostile/proc/DestroySurroundings()
for(var/dir in cardinal) // North, South, East, West
var/obj/structure/obstacle = locate(/obj/structure, get_step(src, dir))
if(istype(obstacle, /obj/structure/window) || istype(obstacle, /obj/structure/closet) || istype(obstacle, /obj/structure/table) || istype(obstacle, /obj/structure/grille))
obstacle.attack_animal(src)

View File

@@ -47,11 +47,11 @@
weapon1 = /obj/item/weapon/gun/energy/laser
/mob/living/simple_animal/hostile/pirate/Life()
/mob/living/simple_animal/hostile/pirate/Die()
..()
if(stat == 2)
if(corpse)
new corpse (src.loc)
if(weapon1)
new weapon1 (src.loc)
del src
return
if(weapon1)
new weapon1 (src.loc)
del src
return

View File

@@ -34,6 +34,18 @@
wall_smash = 1
faction = "syndicate"
/mob/living/simple_animal/hostile/syndicate/Die()
..()
if(corpse)
new corpse (src.loc)
if(weapon1)
new weapon1 (src.loc)
if(weapon2)
new weapon2 (src.loc)
del src
return
///////////////Sword and shield////////////
/mob/living/simple_animal/hostile/syndicate/melee
@@ -117,16 +129,4 @@
speed = 0
/mob/living/simple_animal/hostile/syndicate/ranged/space/Process_Spacemove(var/check_drift = 0)
return
/mob/living/simple_animal/hostile/syndicate/Life()
..()
if(stat == 2)
new corpse (src.loc)
if(weapon1)
new weapon1 (src.loc)
if(weapon2)
new weapon2 (src.loc)
del src
return
return