Merge branch 'master' of https://github.com/Citadel-Station-13/Citadel-Station-13 into upstream-merge-33829

# Conflicts:
#	code/modules/events/alien_infestation.dm
#	code/modules/events/spider_infestation.dm
#	code/modules/events/vent_clog.dm
#	code/modules/mob/living/simple_animal/hostile/hostile.dm
This commit is contained in:
LetterJay
2018-01-02 05:16:13 -06:00
74 changed files with 370 additions and 338 deletions

View File

@@ -28,9 +28,6 @@
var/ranged_message = "fires" //Fluff text for ranged mobs
var/ranged_cooldown = 0 //What the current cooldown on ranged attacks is, generally world.time + ranged_cooldown_time
var/ranged_cooldown_time = 30 //How long, in deciseconds, the cooldown of ranged attacks is
var/ranged_telegraph = "prepares to fire at *TARGET*!" //A message shown when the mob prepares to fire; use *TARGET* if you want to show the target's name
var/ranged_telegraph_sound //A sound played when the mob prepares to fire
var/ranged_telegraph_time = 0 //In deciseconds, how long between the telegraph and ranged shot
var/ranged_ignores_vision = FALSE //if it'll fire ranged attacks even if it lacks vision on its target, only works with environment smash
var/check_friendly_fire = 0 // Should the ranged mob check for friendlies when shooting
var/retreat_distance = null //If our mob runs from players when they're too close, set in tile distance. By default, mobs do not retreat.
@@ -231,9 +228,6 @@
if(!target || !CanAttack(target))
LoseTarget()
return 0
if(ismob(target.loc))
LoseTarget()
return 0
if(target in possible_targets)
var/turf/T = get_turf(src)
if(target.z != T.z)
@@ -242,14 +236,7 @@
var/target_distance = get_dist(targets_from,target)
if(ranged) //We ranged? Shoot at em
if(!target.Adjacent(targets_from) && ranged_cooldown <= world.time) //But make sure they're not in range for a melee attack and our range attack is off cooldown
if(!ranged_telegraph_time || client)
OpenFire(target)
else
if(ranged_telegraph)
visible_message("<span class='danger'>[src] [replacetext(ranged_telegraph, "*TARGET*", "[target]")]</span>")
if(ranged_telegraph_sound)
playsound(src, ranged_telegraph_sound, 75, FALSE)
addtimer(CALLBACK(src, .proc/OpenFire, target), ranged_telegraph_time)
OpenFire(target)
if(!Process_Spacemove()) //Drifting
walk(src,0)
return 1
@@ -289,7 +276,7 @@
if(search_objects)//Turn off item searching and ignore whatever item we were looking at, we're more concerned with fight or flight
target = null
LoseSearchObjects()
if(AIStatus == AI_IDLE)
if(AIStatus != AI_ON && AIStatus != AI_OFF)
toggle_ai(AI_ON)
FindTarget()
else if(target != null && prob(40))//No more pulling a mob forever and having a second player attack it, it can switch targets now if it finds a more suitable one
@@ -413,7 +400,6 @@ mob/living/simple_animal/hostile/proc/DestroySurroundings() // for use with mega
DestroyObjectsInDirection(dir)
/mob/living/simple_animal/hostile/proc/EscapeConfinement()
if(buckled)
buckled.attack_animal(src)
@@ -498,3 +484,14 @@ mob/living/simple_animal/hostile/proc/DestroySurroundings() // for use with mega
if(AIStatus == AI_IDLE && FindTarget(tlist, 1))
toggle_ai(AI_ON)
/mob/living/simple_animal/hostile/proc/ListTargetsLazy(var/_Z)//Step 1, find out what we can see
var/static/hostile_machines = typecacheof(list(/obj/machinery/porta_turret, /obj/mecha, /obj/structure/destructible/clockwork/ocular_warden))
. = list()
for (var/I in SSmobs.clients_by_zlevel[_Z])
var/mob/M = I
if (get_dist(M, src) < vision_range)
if (isturf(M.loc))
. += M
else if (M.loc.type in hostile_machines)
. += M.loc