Skip to content

Commit 92c84ba

Browse files
authored
Merge pull request #8 from AEV-Oxyd/move-fixes
Fix movement duplication
2 parents 58499cf + 3a7641d commit 92c84ba

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

code/_compile_options.dm

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
#define UNIT_TESTS
7777
#endif
7878

79+
#define CITESTING
7980
#ifdef CITESTING
8081
#define TESTING
8182
#endif

code/game/atoms_movable.dm

+3-2
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,10 @@ GLOBAL_VAR_INIT(Debug,0)
398398
else
399399
var/atom/oldloc = src.loc
400400
var/olddir = dir //we can't override this without sacrificing the rest of movable/New()
401-
401+
/// parent failed to enter ,movement wasn't succesfull.
402402
. = ..()
403+
if(!. || loc != NewLoc)
404+
return FALSE
403405

404406
if(oldloc)
405407
oldloc.recalculateWeights(-weight,src)
@@ -422,7 +424,6 @@ GLOBAL_VAR_INIT(Debug,0)
422424
// if we wasn't on map OR our Z coord was changed
423425
if( !isturf(oldloc) || (get_z(loc) != get_z(oldloc)) )
424426
update_plane()
425-
426427
if(get_z(oldloc) != get_z(loc))
427428
SEND_SIGNAL(src, COMSIG_MOVABLE_Z_CHANGED, get_z(oldloc), get_z(NewLoc))
428429

code/modules/unit_tests/step_override.dm

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@
1111
/datum/unit_test/step_override/proc/TestStep(type_to_test)
1212
var/atom/movable/AM = allocate(type_to_test) // alloc spawns them at 20,20,1||20,21,1
1313
var/turf/T = get_turf(AM)
14+
var/turf/D = locate(T.x, T.y + 1, T.z)
15+
T.ChangeTurf(/turf/simulated/floor)
16+
D.ChangeTurf(/turf/simulated/floor)
1417

1518
. = step(AM, NORTH)
1619
. = . && T.x == AM.x
17-
. = . && T.y + 1 == AM.y // eh?
20+
. = . && (T.y + 1) == AM.y // eh?
1821
. = . && T.z == AM.z

0 commit comments

Comments
 (0)