ismecha define

This commit is contained in:
KorPhaeron
2017-10-02 01:03:40 -05:00
committed by CitadelStationBot
parent cc93f1e546
commit 3e26e09db8
30 changed files with 825 additions and 34 deletions
@@ -29,7 +29,7 @@
dizziness = 0
jitteriness = 0
if(istype(loc, /obj/mecha))
if(ismecha(loc))
var/obj/mecha/M = loc
if(M.occupant == src)
M.go_out()
@@ -165,7 +165,7 @@
return chosen_target
// Please do not add one-off mob AIs here, but override this function for your mob
/mob/living/simple_animal/hostile/CanAttack(atom/the_target)//Can we actually attack a possible target?
/mob/living/simple_animal/hostile/CanAttack(atom/the_target)//Can we actually attack a possible target?
if(isturf(the_target) || !the_target || the_target.type == /atom/movable/lighting_object) // bail out on invalids
return FALSE
@@ -187,7 +187,7 @@
return FALSE
return TRUE
if(istype(the_target, /obj/mecha))
if(ismecha(the_target))
var/obj/mecha/M = the_target
if(M.occupant)//Just so we don't attack empty mechs
if(CanAttack(M.occupant))
@@ -184,7 +184,7 @@
mecha_face_target(target)
target.mech_melee_attack(mecha)
else
if(istype(target, /obj/mecha))
if(ismecha(target))
var/obj/mecha/M = target
if(is_valid_mecha(M))
enter_mecha(M)
@@ -259,7 +259,7 @@
//Yes they actually try and pull this shit
//~simple animals~
/mob/living/simple_animal/hostile/syndicate/mecha_pilot/CanAttack(atom/the_target)
if(istype(the_target, /obj/mecha))
if(ismecha(the_target))
var/obj/mecha/M = the_target
if(mecha)
if(M == mecha || !CanAttack(M.occupant))
@@ -1,3 +1,4 @@
<<<<<<< HEAD
/mob/living/simple_animal/hostile/retaliate
var/list/enemies = list()
@@ -45,3 +46,52 @@
. = ..()
if(. > 0 && stat == CONSCIOUS)
Retaliate()
=======
/mob/living/simple_animal/hostile/retaliate
var/list/enemies = list()
/mob/living/simple_animal/hostile/retaliate/Found(atom/A)
if(isliving(A))
var/mob/living/L = A
if(!L.stat)
return L
else
enemies -= L
else if(ismecha(A))
var/obj/mecha/M = A
if(M.occupant)
return A
/mob/living/simple_animal/hostile/retaliate/ListTargets()
if(!enemies.len)
return list()
var/list/see = ..()
see &= enemies // Remove all entries that aren't in enemies
return see
/mob/living/simple_animal/hostile/retaliate/proc/Retaliate()
var/list/around = view(src, vision_range)
for(var/atom/movable/A in around)
if(A == src)
continue
if(isliving(A))
var/mob/living/M = A
if(faction_check_mob(M) && attack_same || !faction_check_mob(M))
enemies |= M
else if(ismecha(A))
var/obj/mecha/M = A
if(M.occupant)
enemies |= M
enemies |= M.occupant
for(var/mob/living/simple_animal/hostile/retaliate/H in around)
if(faction_check_mob(H) && !attack_same && !H.attack_same)
H.enemies |= enemies
return 0
/mob/living/simple_animal/hostile/retaliate/adjustHealth(amount, updating_health = TRUE, forced = FALSE)
. = ..()
if(. > 0 && stat == CONSCIOUS)
Retaliate()
>>>>>>> cc30923... ismecha define (#31192)
@@ -317,7 +317,7 @@
var/mob/living/L = the_target
if(L.stat != CONSCIOUS)
return 0
if (istype(the_target, /obj/mecha))
if (ismecha(the_target))
var/obj/mecha/M = the_target
if (M.occupant)
return 0
+1 -1
View File
@@ -386,7 +386,7 @@
set category = "Object"
set src = usr
if(istype(loc, /obj/mecha))
if(ismecha(loc))
return
if(incapacitated())