Merge pull request #3077 from Citadel-Station-13/upstream-merge-31192

[MIRROR] ismecha define
This commit is contained in:
LetterJay
2017-10-02 21:11:59 -04:00
committed by GitHub
30 changed files with 1166 additions and 1172 deletions

View File

@@ -48,7 +48,7 @@
if(pockets && over_object == M)
return pockets.MouseDrop(over_object)
if(istype(usr.loc, /obj/mecha)) // stops inventory actions in a mech
if(ismecha(M.loc)) // stops inventory actions in a mech
return
if(!M.incapacitated() && loc == M && istype(over_object, /obj/screen/inventory/hand))

View File

@@ -58,7 +58,7 @@
if(istype(M, /obj/effect)) //sparks don't teleport
return
if(M.anchored)
if(!(istype(M, /obj/mecha) && mech_sized))
if(!(ismecha(M) && mech_sized))
return
if(ismovableatom(M))

View File

@@ -94,7 +94,7 @@
if(!ismob(M) && !isobj(M)) //No don't teleport lighting and effects!
return
if(M.anchored && (!ismob(M) || (istype(M, /obj/mecha) && !mech_sized)))
if(M.anchored && (!ismob(M) || (ismecha(M) && !mech_sized)))
return
if(do_teleport(M, hard_target, 6))

View File

@@ -435,7 +435,7 @@
if(!over_object)
return
if (istype(usr.loc, /obj/mecha))
if(ismecha(usr.loc))
return
if(!M.incapacitated())

View File

@@ -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()

View File

@@ -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))

View File

@@ -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))

View File

@@ -1,47 +1,47 @@
/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(istype(A, /obj/mecha))
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(istype(A, /obj/mecha))
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()
/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()

View File

@@ -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

View File

@@ -386,7 +386,7 @@
set category = "Object"
set src = usr
if(istype(loc, /obj/mecha))
if(ismecha(loc))
return
if(incapacitated())

View File

@@ -278,7 +278,7 @@
//dist_check - set to only shock mobs within 1 of source (vendors, airlocks, etc.)
//No animations will be performed by this proc.
/proc/electrocute_mob(mob/living/carbon/M, power_source, obj/source, siemens_coeff = 1, dist_check = FALSE)
if(istype(M.loc, /obj/mecha))
if(ismecha(M.loc))
return 0 //feckin mechs are dumb
if(dist_check)
if(!in_range(source,M))

View File

@@ -58,7 +58,7 @@
if(isliving(mover))
shock(mover)
if(istype(mover, /obj/machinery) || isstructure(mover) || istype(mover, /obj/mecha))
if(istype(mover, /obj/machinery) || isstructure(mover) || ismecha(mover))
bump_field(mover)
/obj/machinery/field/containment/proc/set_master(master1,master2)
@@ -90,13 +90,13 @@
if(isliving(mover))
shock(mover)
return
if(istype(mover, /obj/machinery) || isstructure(mover) || istype(mover, /obj/mecha))
if(istype(mover, /obj/machinery) || isstructure(mover) || ismecha(mover))
bump_field(mover)
return
/obj/machinery/field/CanPass(atom/movable/mover, turf/target)
if(hasShocked || isliving(mover) || istype(mover, /obj/machinery) || isstructure(mover) || istype(mover, /obj/mecha))
if(hasShocked || isliving(mover) || istype(mover, /obj/machinery) || isstructure(mover) || ismecha(mover))
return FALSE
return ..()

View File

@@ -144,7 +144,7 @@
ignore_source_check = TRUE
return FALSE
if(firer && !ignore_source_check)
if(A == firer || (A == firer.loc && istype(A, /obj/mecha))) //cannot shoot yourself or your mech
if(A == firer || (A == firer.loc && ismecha(A))) //cannot shoot yourself or your mech
loc = A.loc
return FALSE

View File

@@ -45,7 +45,7 @@
..()
explosion(target, -1, 1, 3, 1, 0, flame_range = 4)
if(istype(target, /obj/mecha))
if(ismecha(target))
var/obj/mecha/M = target
M.take_damage(anti_armour_damage)
if(issilicon(target))