From f348a108e2bbbcd836b42f27dfd1a8f1c3ca6ed7 Mon Sep 17 00:00:00 2001 From: Kashargul <144968721+Kashargul@users.noreply.github.com> Date: Wed, 18 Dec 2024 11:26:29 +0100 Subject: [PATCH] prvents ghosts from leaving / getting tossed out bellies in areas with BLOCK ghosts flag (#16726) * prevents ghosts from getting instantly removed form a belly or leaving it in no ghost areas * add belly leave popup * . * . --- code/modules/mob/dead/observer/observer.dm | 4 ++-- code/modules/mob/mob_movement.dm | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index b67cf1ed9d..83bfa07de9 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -207,7 +207,7 @@ Works together with spawning an observer, noted above. if(!isturf(loc)) return var/area/A = get_area(src) - if(A.flag_check(AREA_BLOCK_GHOSTS)) + if(A.flag_check(AREA_BLOCK_GHOSTS) && !isbelly(loc)) to_chat(src, span_warning("Ghosts can't enter this location.")) return_to_spawn() @@ -463,7 +463,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp //RS Port #658 Start var/area/A = get_area(destination) - if(A?.flag_check(AREA_BLOCK_GHOSTS)) + if(A?.flag_check(AREA_BLOCK_GHOSTS) && !isbelly(destination)) to_chat(src,span_warning("Sorry, that area does not allow ghosts.")) if(following) stop_following() diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 91736a5257..0b10dc2c2a 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -341,10 +341,21 @@ /mob/proc/SelfMove(turf/n, direct, movetime) return Move(n, direct, movetime) +/client + var/is_leaving_belly = FALSE + ///Process_Incorpmove ///Called by client/Move() ///Allows mobs to run though walls /client/proc/Process_Incorpmove(direct) + if(isbelly(mob.loc) && isobserver(mob)) + if(is_leaving_belly) + return + is_leaving_belly = TRUE + if(tgui_alert(mob, "Do you want to leave your predator's belly?", "Leave belly?", list("Yes", "No")) != "Yes") + is_leaving_belly = FALSE + return + is_leaving_belly = FALSE var/turf/mobloc = get_turf(mob) switch(mob.incorporeal_move) @@ -361,10 +372,10 @@ if(isliving(mob) && A.flag_check(AREA_BLOCK_PHASE_SHIFT)) to_chat(mob, span_warning("Something blocks you from entering this location while phased out.")) return - if(isobserver(mob) && A.flag_check(AREA_BLOCK_GHOSTS)) + if(isobserver(mob) && A.flag_check(AREA_BLOCK_GHOSTS) && !isbelly(mob.loc)) to_chat(mob, span_warning("Ghosts can't enter this location.")) var/area/our_area = mobloc.loc - if(our_area.flag_check(AREA_BLOCK_GHOSTS)) + if(our_area.flag_check(AREA_BLOCK_GHOSTS) && !isbelly(mob.loc)) var/mob/observer/dead/D = mob D.return_to_spawn() return