Skip to content

Commit

Permalink
fix reflect (#13428)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
kalazus committed Aug 25, 2024
1 parent 8153d38 commit db14f56
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 14 deletions.
7 changes: 3 additions & 4 deletions code/datums/helper_datums/teleport.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/modes_gameplays/blob/theblob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/effects/effect_system.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 11 additions & 3 deletions code/game/turfs/turf.dm
Original file line number Diff line number Diff line change
Expand Up @@ -210,24 +210,32 @@
// 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, "<span class='warning'>Передвижение отключено администрацией.</span>")//This is to identify lag problems
return FALSE

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)
return FALSE

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
Expand Down
2 changes: 1 addition & 1 deletion code/modules/events/cellular_biomass/biomass.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/modules/events/cellular_biomass/spacevines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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 )

Expand Down
4 changes: 1 addition & 3 deletions code/modules/mob/living/simple_animal/bees.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit db14f56

Please sign in to comment.