mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-21 04:57:57 +01:00
Basic Mobs: the cooler simple mobs that run on datum AI. (With reworked cockroach AI as proof of concept) (#7867)
Co-authored-by: AMonkeyThatCodes <20987591+AMonkeyThatCodes@users.noreply.github.com> Co-authored-by: Gandalf <jzo123@hotmail.com>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
/datum/ai_controller/basic_controller
|
||||
movement_delay = 0.4 SECONDS
|
||||
|
||||
/datum/ai_controller/basic_controller/TryPossessPawn(atom/new_pawn)
|
||||
if(!isbasicmob(new_pawn))
|
||||
return AI_CONTROLLER_INCOMPATIBLE
|
||||
var/mob/living/basic/basic_mob = new_pawn
|
||||
|
||||
update_speed(basic_mob)
|
||||
|
||||
RegisterSignal(basic_mob, POST_BASIC_MOB_UPDATE_VARSPEED, .proc/update_speed)
|
||||
|
||||
return ..() //Run parent at end
|
||||
|
||||
|
||||
/datum/ai_controller/basic_controller/able_to_run()
|
||||
. = ..()
|
||||
if(isliving(pawn))
|
||||
var/mob/living/living_pawn = pawn
|
||||
if(IS_DEAD_OR_INCAP(living_pawn))
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/datum/ai_controller/basic_controller/proc/update_speed(mob/living/basic/basic_mob)
|
||||
SIGNAL_HANDLER
|
||||
movement_delay = basic_mob.cached_multiplicative_slowdown
|
||||
Reference in New Issue
Block a user