From bf7bb3e9434ac796dedf6588bd89b50d4b85fd12 Mon Sep 17 00:00:00 2001 From: Git-Nivrak <59925169+Git-Nivrak@users.noreply.github.com> Date: Mon, 17 Jun 2024 21:22:09 +0300 Subject: [PATCH 1/2] Update mob_movement.dm --- code/modules/mob/mob_movement.dm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index ab5aa898a848..eb8074606692 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -215,9 +215,11 @@ mob.life_steps_total++ if(mob.clone != null) mob.update_clone() + + next_movement = world.time + move_delay mob.move_intentionally = FALSE moving = FALSE - next_movement = world.time + move_delay + return ///Process_Spacemove From 46c6368fbb1b521c3b397d92fd6c81a468c23a60 Mon Sep 17 00:00:00 2001 From: Git-Nivrak <59925169+Git-Nivrak@users.noreply.github.com> Date: Tue, 18 Jun 2024 01:20:11 +0300 Subject: [PATCH 2/2] Makes it better + Handle shrapnel --- code/__DEFINES/dcs/signals/atom/mob/signals_mob.dm | 3 +++ code/modules/mob/living/carbon/human/human.dm | 9 +++++++++ code/modules/mob/living/carbon/human/human_movement.dm | 3 --- code/modules/mob/mob_movement.dm | 5 ++++- 4 files changed, 16 insertions(+), 4 deletions(-) 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 eb8074606692..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,13 +212,14 @@ 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