mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-11 15:14:27 +01:00
Fixes issue 1005. Bears, Carps, Clown NPCs and syndicate NPCs will now attack mechs. Only if the mech has a driver.
git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4919 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -68,33 +68,40 @@
|
||||
|
||||
switch(stance)
|
||||
if(BEAR_STANCE_IDLE)
|
||||
var/obj/mecha/M = null
|
||||
var/mob/living/L = null
|
||||
stop_automated_movement = 0
|
||||
stance_step++
|
||||
if(stance_step > 5)
|
||||
stance_step = 0
|
||||
for( var/mob/living/L in viewers(7,src) )
|
||||
for(L in viewers(7,src))
|
||||
if(isbear(L)) continue
|
||||
if(!L.stat)
|
||||
emote("stares alertly at [L]")
|
||||
stance = BEAR_STANCE_ALERT
|
||||
target_mob = L
|
||||
break
|
||||
for(M in view(7,src))
|
||||
if (M.occupant)
|
||||
stance = BEAR_STANCE_ALERT
|
||||
target_mob = M
|
||||
break
|
||||
if (target_mob)
|
||||
emote("stares alertly at [target_mob]")
|
||||
|
||||
if(BEAR_STANCE_ALERT)
|
||||
stop_automated_movement = 1
|
||||
var/found_mob = 0
|
||||
for( var/mob/living/L in viewers(7,src) )
|
||||
if(isbear(L)) continue
|
||||
if(!L.stat)
|
||||
if(target_mob in SA_search(target_mob))
|
||||
if(target_mob && !(SA_attackable(target_mob)))
|
||||
stance_step = max(0, stance_step) //If we have not seen a mob in a while, the stance_step will be negative, we need to reset it to 0 as soon as we see a mob again.
|
||||
stance_step++
|
||||
found_mob = 1
|
||||
target_mob = L
|
||||
src.dir = get_dir(src,target_mob) //Keep staring at the mob
|
||||
|
||||
if(stance_step in list(1,4,7)) //every 3 ticks
|
||||
var/action = pick( list( "growls at [L]", "stares angrily at [L]", "prepares to attack [L]", "closely watches [L]" ) )
|
||||
var/action = pick( list( "growls at [target_mob]", "stares angrily at [target_mob]", "prepares to attack [target_mob]", "closely watches [target_mob]" ) )
|
||||
if(action)
|
||||
emote(action)
|
||||
break
|
||||
if(!found_mob)
|
||||
stance_step--
|
||||
|
||||
@@ -104,10 +111,10 @@
|
||||
stance = BEAR_STANCE_ATTACK
|
||||
if(BEAR_STANCE_ATTACK) //This one should only be active for one tick,
|
||||
stop_automated_movement = 1
|
||||
if(!target_mob || target_mob.stat)
|
||||
if(!target_mob || SA_attackable(target_mob))
|
||||
stance = BEAR_STANCE_ALERT
|
||||
stance_step = 5 //Make it very alert, so it quickly attacks again if a mob returns
|
||||
if(target_mob in viewers(7,src))
|
||||
if(target_mob in SA_search(target_mob))
|
||||
walk_to(src, target_mob, 1, 3)
|
||||
stance = BEAR_STANCE_ATTACKING
|
||||
stance_step = 0
|
||||
@@ -115,11 +122,11 @@
|
||||
|
||||
stop_automated_movement = 1
|
||||
stance_step++
|
||||
if(!target_mob || target_mob.stat)
|
||||
if(!target_mob || SA_attackable(target_mob))
|
||||
stance = BEAR_STANCE_ALERT
|
||||
stance_step = 5 //Make it very alert, so it quickly attacks again if a mob returns
|
||||
return
|
||||
if(!(target_mob in viewers(7,src)))
|
||||
if(!(target_mob in SA_search(target_mob)))
|
||||
stance = BEAR_STANCE_ALERT
|
||||
stance_step = 5 //Make it very alert, so it quickly attacks again if a mob returns
|
||||
target_mob = null
|
||||
@@ -137,6 +144,9 @@
|
||||
else if(isliving(target_mob))
|
||||
var/mob/living/L = target_mob
|
||||
L.adjustBruteLoss(damage)
|
||||
else if(istype(target_mob,/obj/mecha))
|
||||
var/obj/mecha/M = target_mob
|
||||
M.attack_animal(src)
|
||||
|
||||
if(stance_step >= 20) //attacks for 20 ticks, then it gets tired and needs to rest
|
||||
emote( "is worn out and needs to rest" )
|
||||
@@ -148,7 +158,7 @@
|
||||
stop_automated_movement = 1
|
||||
stance_step++
|
||||
if(stance_step >= 10) //rests for 10 ticks
|
||||
if(target_mob && target_mob in viewers(7,src))
|
||||
if(target_mob && target_mob in SA_search(target_mob))
|
||||
stance = BEAR_STANCE_ATTACK //If the mob he was chasing is still nearby, resume the attack, otherwise go idle.
|
||||
else
|
||||
stance = BEAR_STANCE_IDLE
|
||||
|
||||
@@ -70,24 +70,32 @@
|
||||
if(!stat)
|
||||
switch(stance)
|
||||
if(CARP_STANCE_IDLE)
|
||||
var/obj/mecha/M = null
|
||||
var/mob/living/L = null
|
||||
stop_automated_movement = 0
|
||||
stance_step++
|
||||
if(stance_step > 5)
|
||||
stance_step = 0
|
||||
for( var/mob/living/L in viewers(7,src) )
|
||||
for(L in viewers(7,src))
|
||||
if(iscarp(L)) continue
|
||||
if(!L.stat)
|
||||
emote("gnashes at [L]")
|
||||
stance = CARP_STANCE_ATTACK
|
||||
target_mob = L
|
||||
break
|
||||
for(M in view(7,src))
|
||||
if (M.occupant)
|
||||
stance = CARP_STANCE_ATTACK
|
||||
target_mob = M
|
||||
break
|
||||
if (target_mob)
|
||||
emote("nashes at [target_mob]")
|
||||
|
||||
if(CARP_STANCE_ATTACK) //This one should only be active for one tick
|
||||
stop_automated_movement = 1
|
||||
if(!target_mob || target_mob.stat)
|
||||
if(!target_mob || SA_attackable(target_mob))
|
||||
stance = CARP_STANCE_IDLE
|
||||
stance_step = 5 //Make it very alert, so it quickly attacks again if a mob returns
|
||||
if(target_mob in viewers(7,src))
|
||||
if(target_mob in SA_search(target_mob))
|
||||
walk_to(src, target_mob, 1, 3)
|
||||
stance = CARP_STANCE_ATTACKING
|
||||
stance_step = 0
|
||||
@@ -95,12 +103,12 @@
|
||||
if(CARP_STANCE_ATTACKING)
|
||||
stop_automated_movement = 1
|
||||
stance_step++
|
||||
if(!target_mob || target_mob.stat)
|
||||
if(!target_mob || SA_attackable(target_mob))
|
||||
stance = CARP_STANCE_IDLE
|
||||
stance_step = 3 //Make it very alert, so it quickly attacks again if a mob returns
|
||||
target_mob = null
|
||||
return
|
||||
if(!(target_mob in viewers(7,src)))
|
||||
if(!(target_mob in SA_search(target_mob)))
|
||||
stance = CARP_STANCE_IDLE
|
||||
stance_step = 1
|
||||
target_mob = null
|
||||
@@ -112,6 +120,9 @@
|
||||
if(prob(10))
|
||||
L.Weaken(5)
|
||||
L.visible_message("<span class='danger'>\the [src] knocks down \the [L]!</span>")
|
||||
if(istype(target_mob,/obj/mecha))
|
||||
var/obj/mecha/M = target_mob
|
||||
M.attack_animal(src)
|
||||
|
||||
/mob/living/simple_animal/carp/Process_Spacemove(var/check_drift = 0)
|
||||
return //No drifting in space for space carp! //original comments do not steal
|
||||
@@ -69,29 +69,37 @@
|
||||
switch(stance)
|
||||
if(CLOWN_STANCE_IDLE)
|
||||
if (src.hostile == 0) return
|
||||
for( var/mob/living/L in viewers(7,src) )
|
||||
var/obj/mecha/M = null
|
||||
var/mob/living/L = null
|
||||
for(L in viewers(7,src))
|
||||
if(isclown(L)) continue
|
||||
if(!L.stat)
|
||||
emote("honks menacingly at [L]")
|
||||
stance = CLOWN_STANCE_ATTACK
|
||||
target_mob = L
|
||||
break
|
||||
for(M in view(7,src))
|
||||
if (M.occupant)
|
||||
stance = CLOWN_STANCE_ATTACK
|
||||
target_mob = M
|
||||
break
|
||||
if (target_mob)
|
||||
emote("honks menacingly at [target_mob]")
|
||||
|
||||
if(CLOWN_STANCE_ATTACK) //This one should only be active for one tick
|
||||
stop_automated_movement = 1
|
||||
if(!target_mob || target_mob.stat)
|
||||
if(!target_mob || SA_attackable(target_mob))
|
||||
stance = CLOWN_STANCE_IDLE
|
||||
if(target_mob in viewers(7,src))
|
||||
if(target_mob in SA_search(target_mob))
|
||||
walk_to(src, target_mob, 1, 3)
|
||||
stance = CLOWN_STANCE_ATTACKING
|
||||
|
||||
if(CLOWN_STANCE_ATTACKING)
|
||||
stop_automated_movement = 1
|
||||
if(!target_mob || target_mob.stat)
|
||||
if(!target_mob || SA_attackable(target_mob))
|
||||
stance = CLOWN_STANCE_IDLE
|
||||
target_mob = null
|
||||
return
|
||||
if(!(target_mob in viewers(7,src)))
|
||||
if(!(target_mob in SA_search(target_mob)))
|
||||
stance = CLOWN_STANCE_IDLE
|
||||
target_mob = null
|
||||
return
|
||||
@@ -102,9 +110,16 @@
|
||||
if(prob(10))
|
||||
L.Weaken(5)
|
||||
L.visible_message("<span class='danger'>\the [src] slips \the [L]!</span>")
|
||||
for(var/mob/M in viewers(src, null))
|
||||
if(istype(M, /mob/living/simple_animal/clown))
|
||||
var/mob/living/simple_animal/clown/C = M
|
||||
for(var/mob/H in viewers(src, null))
|
||||
if(istype(H, /mob/living/simple_animal/clown))
|
||||
var/mob/living/simple_animal/clown/C = H
|
||||
C.hostile = 1
|
||||
if(istype(target_mob,/obj/mecha))
|
||||
var/obj/mecha/M = target_mob
|
||||
M.attack_animal(src)
|
||||
for(var/mob/H in viewers(src, null))
|
||||
if(istype(H, /mob/living/simple_animal/clown))
|
||||
var/mob/living/simple_animal/clown/C = H
|
||||
C.hostile = 1
|
||||
|
||||
/mob/living/simple_animal/clown/bullet_act(var/obj/item/projectile/Proj)
|
||||
|
||||
@@ -414,4 +414,22 @@
|
||||
health -= 30
|
||||
|
||||
/mob/living/simple_animal/adjustBruteLoss(damage)
|
||||
health -= damage
|
||||
health -= damage
|
||||
|
||||
|
||||
/mob/living/simple_animal/proc/SA_search(target_mob)
|
||||
if(isliving(target_mob))
|
||||
return (viewers(7,src))
|
||||
if(istype(target_mob,/obj))
|
||||
return (view(7,src))
|
||||
|
||||
/mob/living/simple_animal/proc/SA_attackable(target_mob)
|
||||
if (isliving(target_mob))
|
||||
var/mob/living/L = target_mob
|
||||
if(!L.stat)
|
||||
return (0)
|
||||
if (istype(target_mob,/obj/mecha))
|
||||
var/obj/mecha/M = target_mob
|
||||
if (M.occupant)
|
||||
return (0)
|
||||
return (1)
|
||||
@@ -71,19 +71,26 @@
|
||||
if(!stat)
|
||||
switch(stance)
|
||||
if(SYNDICATE_STANCE_IDLE)
|
||||
var/obj/mecha/M = null
|
||||
var/mob/living/L = null
|
||||
stop_automated_movement = 0
|
||||
for( var/mob/living/L in viewers(7,src) )
|
||||
for(L in viewers(7,src))
|
||||
if(isSyndicate(L)) continue
|
||||
if(!L.stat)
|
||||
stance = SYNDICATE_STANCE_ATTACK
|
||||
target_mob = L
|
||||
break
|
||||
for(M in view(7,src))
|
||||
if (M.occupant)
|
||||
stance = SYNDICATE_STANCE_ATTACK
|
||||
target_mob = M
|
||||
break
|
||||
|
||||
if(SYNDICATE_STANCE_ATTACK) //This one should only be active for one tick
|
||||
stop_automated_movement = 1
|
||||
if(!target_mob || target_mob.stat)
|
||||
if(!target_mob || SA_attackable(target_mob))
|
||||
stance = SYNDICATE_STANCE_IDLE
|
||||
if(target_mob in viewers(10,src))
|
||||
if(target_mob in SA_search(target_mob))
|
||||
if(ranged)
|
||||
if(get_dist(src, target_mob) <= 6)
|
||||
OpenFire(target_mob)
|
||||
@@ -95,11 +102,11 @@
|
||||
|
||||
if(SYNDICATE_STANCE_ATTACKING)
|
||||
stop_automated_movement = 1
|
||||
if(!target_mob || target_mob.stat)
|
||||
if(!target_mob || SA_attackable(target_mob))
|
||||
stance = SYNDICATE_STANCE_IDLE
|
||||
target_mob = null
|
||||
return
|
||||
if(!(target_mob in viewers(7,src)))
|
||||
if(!(target_mob in SA_search(target_mob)))
|
||||
stance = SYNDICATE_STANCE_IDLE
|
||||
target_mob = null
|
||||
return
|
||||
@@ -107,8 +114,9 @@
|
||||
if(isliving(target_mob))
|
||||
var/mob/living/L = target_mob
|
||||
L.attack_animal(src)
|
||||
|
||||
|
||||
if(istype(target_mob,/obj/mecha))
|
||||
var/obj/mecha/M = target_mob
|
||||
M.attack_animal(src)
|
||||
|
||||
/mob/living/simple_animal/syndicate/proc/OpenFire(target_mob)
|
||||
src.target = target_mob
|
||||
|
||||
Reference in New Issue
Block a user