Fixes several bugs with AI mobs

This commit is contained in:
Neerti
2018-12-04 19:00:21 -05:00
parent 08665794e0
commit ac5fdfcd9e
5 changed files with 54 additions and 21 deletions
@@ -16,9 +16,9 @@
can_flee = TRUE
violent_breakthrough = FALSE
// Won't wander away, ideal for event-spawned mobs like carp or drones.
// Won't wander away as quickly, ideal for event-spawned mobs like carp or drones.
/datum/ai_holder/simple_mob/event
wander = FALSE
base_wander_delay = 8
// Doesn't really act until told to by something on the outside.
/datum/ai_holder/simple_mob/inert
@@ -60,7 +60,7 @@
// For event-spawned malf drones.
/datum/ai_holder/simple_mob/ranged/kiting/threatening/event
wander = FALSE
base_wander_delay = 8
/datum/ai_holder/simple_mob/ranged/kiting/no_moonwalk
moonwalk = FALSE
@@ -96,6 +96,11 @@
/datum/ai_holder/simple_mob/restrained
violent_breakthrough = FALSE
conserve_ammo = TRUE
destructive = FALSE
// This does the opposite of the above subtype.
/datum/ai_holder/simple_mob/destructive
destructive = TRUE
// Melee mobs.
@@ -12,13 +12,16 @@
var/always_stun = FALSE // If true, the slime will elect to attempt to permastun the target.
var/last_discipline_decay = null // Last world.time discipline was reduced from decay.
var/discipline_decay_time = 5 SECONDS // Earliest that one discipline can decay.
/datum/ai_holder/simple_mob/xenobio_slime/sapphire
always_stun = TRUE // They know that stuns are godly.
intelligence_level = AI_SMART // Also knows not to walk while confused if it risks death.
/datum/ai_holder/simple_mob/xenobio_slime/light_pink
discipline = 5
obedience = 5
discipline = 10
obedience = 10
/datum/ai_holder/simple_mob/xenobio_slime/passive/New() // For Kendrick.
..()
@@ -89,9 +92,10 @@
// Handles decay of discipline.
/datum/ai_holder/simple_mob/xenobio_slime/proc/discipline_decay()
if(discipline > 0)
if(discipline > 0 && last_discipline_decay + discipline_decay_time < world.time)
if(!prob(75 + (obedience * 5)))
adjust_discipline(-1)
last_discipline_decay = world.time
/datum/ai_holder/simple_mob/xenobio_slime/handle_special_tactic()
evolve_and_reproduce()
+4 -2
View File
@@ -15,8 +15,9 @@
var/lose_target_time = 0 // world.time when a target was lost.
var/lose_target_timeout = 5 SECONDS // How long until a mob 'times out' and stops trying to find the mob that disappeared.
var/list/attackers = list() // List of strings of names of people who attacked us before in our life.
// This uses strings and not refs to allow for disguises, and to avoid needing to use weakrefs.
var/list/attackers = list() // List of strings of names of people who attacked us before in our life.
// This uses strings and not refs to allow for disguises, and to avoid needing to use weakrefs.
var/destructive = FALSE // Will target 'neutral' structures/objects and not just 'hostile' ones.
// A lot of this is based off of /TG/'s AI code.
@@ -111,6 +112,7 @@
var/obj/mecha/M = the_target
if(M.occupant)
return can_attack(M.occupant)
return destructive // Empty mechs are 'neutral'.
if(istype(the_target, /obj/machinery/porta_turret))
var/obj/machinery/porta_turret/P = the_target