diff --git a/code/datums/ai/basic_mobs/base_basic_controller.dm b/code/datums/ai/basic_mobs/base_basic_controller.dm index eb1c38437e3..d222cc1ef6d 100644 --- a/code/datums/ai/basic_mobs/base_basic_controller.dm +++ b/code/datums/ai/basic_mobs/base_basic_controller.dm @@ -35,7 +35,7 @@ var/mob/living/living_pawn = pawn if(!(ai_traits & CAN_ACT_WHILE_DEAD)) // Unroll for flags here - if (ai_traits & CAN_ACT_IN_STASIS && (living_pawn.stat || INCAPACITATED_IGNORING(living_pawn, INCAPABLE_STASIS))) + if((ai_traits & CAN_ACT_IN_STASIS) && (living_pawn.stat || INCAPACITATED_IGNORING(living_pawn, INCAPABLE_STASIS))) return AI_UNABLE_TO_RUN if(IS_DEAD_OR_INCAP(living_pawn)) return AI_UNABLE_TO_RUN diff --git a/code/datums/ai/movement/_ai_movement.dm b/code/datums/ai/movement/_ai_movement.dm index 33b7e4e214f..1e27b33b2db 100644 --- a/code/datums/ai/movement/_ai_movement.dm +++ b/code/datums/ai/movement/_ai_movement.dm @@ -28,29 +28,32 @@ /datum/ai_movement/proc/reset_pathing_failures(datum/ai_controller/controller) controller.consecutive_pathing_attempts = 0 -///Should the movement be allowed to happen? return TRUE if it can, FALSE otherwise /datum/ai_movement/proc/allowed_to_move(datum/move_loop/source) SHOULD_BE_PURE(TRUE) var/atom/movable/pawn = source.moving var/datum/ai_controller/controller = source.extra_info - var/can_move = TRUE if((controller.ai_traits & STOP_MOVING_WHEN_PULLED) && pawn.pulledby) //Need to store more state. Annoying. - can_move = FALSE + return FALSE if(!isturf(pawn.loc)) //No moving if not on a turf - can_move = FALSE + return FALSE if(isliving(pawn)) var/mob/living/pawn_mob = pawn if(!(pawn_mob.mobility_flags & MOBILITY_MOVE)) - can_move = FALSE + return FALSE + // Bandaid fix: AI controllers don't call /Process_Grab because it's a client proc, + // and thus, we need to check that grabbed mobs cuffed/crit can't move + // That proc should probably be moved onto the mob instead of clients + if(INCAPACITATED_IGNORING(pawn_mob, INCAPABLE_STASIS) && pawn.pulledby) + return FALSE if(HAS_TRAIT(pawn, TRAIT_NO_TRANSFORM)) - can_move = FALSE + return FALSE - return can_move + return TRUE ///Anything to do before moving; any checks if the pawn should be able to move should be placed in allowed_to_move() and called by this proc /datum/ai_movement/proc/pre_move(datum/move_loop/source) diff --git a/code/datums/ai/movement/ai_movement_basic_avoidance.dm b/code/datums/ai/movement/ai_movement_basic_avoidance.dm index ac231e075ed..6659da244f3 100644 --- a/code/datums/ai/movement/ai_movement_basic_avoidance.dm +++ b/code/datums/ai/movement/ai_movement_basic_avoidance.dm @@ -14,10 +14,10 @@ RegisterSignal(loop, COMSIG_MOVELOOP_POSTPROCESS, PROC_REF(post_move)) /datum/ai_movement/basic_avoidance/allowed_to_move(datum/move_loop/has_target/dist_bound/source) - . = ..() var/turf/target_turf = get_step_towards(source.moving, source.target) if(!target_turf?.can_cross_safely(source.moving)) return FALSE + return ..() /// Move immediately and don't update our facing /datum/ai_movement/basic_avoidance/backstep diff --git a/code/datums/ai/movement/ai_movement_dumb.dm b/code/datums/ai/movement/ai_movement_dumb.dm index 2de85046a94..001501bcbd9 100644 --- a/code/datums/ai/movement/ai_movement_dumb.dm +++ b/code/datums/ai/movement/ai_movement_dumb.dm @@ -12,7 +12,7 @@ RegisterSignal(loop, COMSIG_MOVELOOP_POSTPROCESS, PROC_REF(post_move)) /datum/ai_movement/dumb/allowed_to_move(datum/move_loop/has_target/source) - . = ..() var/turf/target_turf = get_step_towards(source.moving, source.target) if(!target_turf?.can_cross_safely(source.moving)) return FALSE + return ..()