diff --git a/code/__DEFINES/dcs/signals/atom/mob/signals_mob.dm b/code/__DEFINES/dcs/signals/atom/mob/signals_mob.dm index f4df347c62db..ed6a8a64c791 100644 --- a/code/__DEFINES/dcs/signals/atom/mob/signals_mob.dm +++ b/code/__DEFINES/dcs/signals/atom/mob/signals_mob.dm @@ -185,3 +185,6 @@ #define COMSIG_MOB_END_TUTORIAL "mob_end_tutorial" #define COMSIG_MOB_NESTED "mob_nested" + +/// When a mob successfully moves to a different tile (wasn't blocked) : (client/Move(n, direct)) +#define COMSIG_MOB_MOVE_SUCCESS "mob_move_success" diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index eb19593bde46..b137a66abebc 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -21,6 +21,13 @@ if(SSticker?.mode?.hardcore) hardcore = TRUE //For WO disposing of corpses + RegisterSignal(src, COMSIG_MOB_MOVE_SUCCESS, PROC_REF(on_move_success)) + +/mob/living/carbon/human/proc/on_move_success() + SIGNAL_HANDLER + if(embedded_items.len > 0) + handle_embedded_objects() //Moving with objects stuck in you can cause bad times. + /mob/living/carbon/human/initialize_pass_flags(datum/pass_flags_container/PF) ..() if (PF) @@ -91,6 +98,8 @@ selected_ability = null remembered_dropped_objects = null + UnregisterSignal(src, COMSIG_MOB_MOVE_SUCCESS) + /mob/living/carbon/human/get_status_tab_items() . = ..() diff --git a/code/modules/mob/living/carbon/human/human_movement.dm b/code/modules/mob/living/carbon/human/human_movement.dm index 7183d6c802b9..c66373fe83f2 100644 --- a/code/modules/mob/living/carbon/human/human_movement.dm +++ b/code/modules/mob/living/carbon/human/human_movement.dm @@ -10,9 +10,6 @@ if(species.slowdown) . += species.slowdown - if(embedded_items.len > 0) - handle_embedded_objects() //Moving with objects stuck in you can cause bad times. - var/reducible_tally = 0 //Tally elements that can be reduced are put here, then we apply MST effects var/wear_slowdown_reduction = 0 diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index ab5aa898a848..6e1ac0640bc1 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -100,6 +100,8 @@ if(living_mob && living_mob.body_position == LYING_DOWN && mob.crawling) return + var/turf/old_turf = get_turf(mob) + next_move_dir_add = 0 next_move_dir_sub = 0 @@ -210,14 +212,17 @@ if (mob.tile_contents) mob.tile_contents = list() - if(.) + if(get_turf(mob) != old_turf) // If we actually moved mob.track_steps_walked() mob.life_steps_total++ if(mob.clone != null) mob.update_clone() + + next_movement = world.time + move_delay + SEND_SIGNAL(mob, COMSIG_MOB_MOVE_SUCCESS) mob.move_intentionally = FALSE moving = FALSE - next_movement = world.time + move_delay + return ///Process_Spacemove