From db14f56740e264c601fbe6ef5b3eb7c74a614a9a Mon Sep 17 00:00:00 2001 From: kalazus <30507262+kalazus@users.noreply.github.com> Date: Sun, 25 Aug 2024 10:23:15 +0300 Subject: [PATCH] fix reflect (#13428) * fix? * fix explicit .Enter calls * add tmp (or not) failsafe * remove failsafe, allow any in/out of object moving * better types for proc/can_enter_turf --- code/datums/helper_datums/teleport.dm | 7 +++---- .../game/gamemodes/modes_gameplays/blob/theblob.dm | 2 +- code/game/objects/effects/effect_system.dm | 2 +- code/game/turfs/turf.dm | 14 +++++++++++--- code/modules/events/cellular_biomass/biomass.dm | 2 +- code/modules/events/cellular_biomass/spacevines.dm | 2 +- code/modules/mob/living/simple_animal/bees.dm | 4 +--- 7 files changed, 19 insertions(+), 14 deletions(-) diff --git a/code/datums/helper_datums/teleport.dm b/code/datums/helper_datums/teleport.dm index e92011503504..6e483f10d3ee 100644 --- a/code/datums/helper_datums/teleport.dm +++ b/code/datums/helper_datums/teleport.dm @@ -177,10 +177,9 @@ if(T.density) return FALSE if(dest_checkdensity == TELE_CHECK_ALL) - T.Enter(teleatom) //We want do normal bumping/checks with teleatom first (maybe we got access to that door or to push the atom on the other side), - var/obj/effect/E = new(center) //then we do the real check (if we can enter from destination turf onto target turf). - E.invisibility = INVISIBILITY_ABSTRACT //Because, checking this with teleatom - won't give us accurate data, since teleatom is far away at this time. - if(!T.Enter(E)) //That's why we test this with the "fake dummy". + var/obj/effect/E = new(center) //Because checking this with teleatom won't give us accurate data, since teleatom is far away at this time. + E.invisibility = INVISIBILITY_ABSTRACT //That's why we test this with the "fake dummy". + if(!can_enter_turf(E, T)) qdel(E) return FALSE qdel(E) diff --git a/code/game/gamemodes/modes_gameplays/blob/theblob.dm b/code/game/gamemodes/modes_gameplays/blob/theblob.dm index 0f7f2e899f1b..61afb88c7352 100644 --- a/code/game/gamemodes/modes_gameplays/blob/theblob.dm +++ b/code/game/gamemodes/modes_gameplays/blob/theblob.dm @@ -143,7 +143,7 @@ return var/obj/structure/blob/normal/B = new /obj/structure/blob/normal(src.loc) B.density = TRUE - if(T.Enter(B))//Attempt to move into the tile + if(can_enter_turf(B, T))//Attempt to move into the tile B.density = initial(B.density) B.loc = T else diff --git a/code/game/objects/effects/effect_system.dm b/code/game/objects/effects/effect_system.dm index 9bda7509fdc7..5a288e516f2e 100644 --- a/code/game/objects/effects/effect_system.dm +++ b/code/game/objects/effects/effect_system.dm @@ -535,7 +535,7 @@ steam.start() -- spawns the effect if(!T) continue - if(!T.Enter(src)) + if(!can_enter_turf(src, T)) continue var/obj/effect/effect/foam/F = locate() in T diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index e5bd8e0d136b..7d68189a2f8f 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -210,7 +210,7 @@ // Obstacle not on border or null return rollback_obstacle -/turf/Enter(atom/movable/mover as mob|obj, atom/old_loc as mob|obj|turf) +/proc/can_enter_turf(atom/movable/mover as mob|obj, turf/new_loc, turf/old_loc) if(movement_disabled && usr.ckey != movement_disabled_exception) to_chat(usr, "Передвижение отключено администрацией.")//This is to identify lag problems return FALSE @@ -218,9 +218,9 @@ var/atom/bump_target if(istype(mover, /obj/item/projectile)) - bump_target = get_projectile_bump_target(src, mover) + bump_target = get_projectile_bump_target(new_loc, mover) else - bump_target = get_bump_target(src, mover) + bump_target = get_bump_target(new_loc, mover) if(bump_target) mover.Bump(bump_target, TRUE) @@ -228,6 +228,14 @@ return TRUE +/turf/Exit(atom/movable/mover as mob|obj, atom/new_loc as mob|obj|turf) + if(!isturf(new_loc)) + return TRUE + return can_enter_turf(mover, new_loc, src) + +/turf/Enter(atom/movable/mover as mob|obj, atom/old_loc as mob|obj|turf) + return TRUE + /turf/proc/is_mob_placeable(mob/M) // todo: maybe rewrite as COMSIG_ATOM_INTERCEPT_TELEPORT if(density) return FALSE diff --git a/code/modules/events/cellular_biomass/biomass.dm b/code/modules/events/cellular_biomass/biomass.dm index 5b2a5a2ecd5d..2cdad92bd63c 100644 --- a/code/modules/events/cellular_biomass/biomass.dm +++ b/code/modules/events/cellular_biomass/biomass.dm @@ -114,7 +114,7 @@ if(isfloorturf(step)) var/turf/simulated/floor/F = step if(!locate(/obj/effect/biomass,F)) - if(F.Enter(src)) + if(can_enter_turf(src, F)) if(master) master.spawn_biomass_piece( F ) return 1 diff --git a/code/modules/events/cellular_biomass/spacevines.dm b/code/modules/events/cellular_biomass/spacevines.dm index f477f040f5e7..dce232f1e8c9 100644 --- a/code/modules/events/cellular_biomass/spacevines.dm +++ b/code/modules/events/cellular_biomass/spacevines.dm @@ -169,7 +169,7 @@ if(isfloorturf(step)) var/turf/simulated/floor/F = step if(!locate(/obj/structure/spacevine,F)) - if(F.Enter(src)) + if(can_enter_turf(src, F)) if(master) master.spawn_spacevine_piece( F ) diff --git a/code/modules/mob/living/simple_animal/bees.dm b/code/modules/mob/living/simple_animal/bees.dm index 630373509b18..5db70dede246 100644 --- a/code/modules/mob/living/simple_animal/bees.dm +++ b/code/modules/mob/living/simple_animal/bees.dm @@ -126,10 +126,8 @@ qdel(src) return src.icon_state = "bees[B.strength]" - var/turf/simulated/floor/T = get_turf(get_step(src, pick(1,2,4,8))) density = TRUE - if(T.Enter(src, get_turf(src))) - src.loc = T + step(src, pick(NORTH,SOUTH,EAST,WEST)) density = FALSE break