diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm
index 85ea7fbcf12..43ac5d9a439 100644
--- a/code/modules/mob/living/simple_animal/hostile/hostile.dm
+++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm
@@ -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 [src] fires at [src.target]!", 1)
+ var/target = target_mob
+ visible_message("\red [src] 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
\ No newline at end of file
+ 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)
\ No newline at end of file
diff --git a/code/modules/mob/living/simple_animal/hostile/pirate.dm b/code/modules/mob/living/simple_animal/hostile/pirate.dm
index bc7b6f29359..41f89fd5148 100644
--- a/code/modules/mob/living/simple_animal/hostile/pirate.dm
+++ b/code/modules/mob/living/simple_animal/hostile/pirate.dm
@@ -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
\ No newline at end of file
+ if(weapon1)
+ new weapon1 (src.loc)
+ del src
+ return
\ No newline at end of file
diff --git a/code/modules/mob/living/simple_animal/hostile/syndicate.dm b/code/modules/mob/living/simple_animal/hostile/syndicate.dm
index 6bf3fb8697a..cfa6d2ba0b3 100644
--- a/code/modules/mob/living/simple_animal/hostile/syndicate.dm
+++ b/code/modules/mob/living/simple_animal/hostile/syndicate.dm
@@ -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
\ No newline at end of file
+ return
\ No newline at end of file