Skip to content

Commit 7d09291

Browse files
Merge pull request NebulaSS13#4832 from MistakeNot4892/devupdate
Updating dev from staging
2 parents 0c5d0a0 + 9fb8057 commit 7d09291

File tree

63 files changed

+465
-468
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+465
-468
lines changed

code/__defines/flags.dm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ The latter will result in a linter warning and will not work correctly.
8686
#define ITEM_FLAG_PADDED BITFLAG(13) // When set on gloves, will act like pulling punches in unarmed combat.
8787
#define ITEM_FLAG_CAN_TAPE BITFLAG(14) // Whether the item can be taped onto something using tape
8888
#define ITEM_FLAG_IS_WEAPON BITFLAG(15) // Item is considered a weapon. Currently only used for force-based worth calculation.
89+
#define ITEM_FLAG_MAGNETISED BITFLAG(16) // When worn on feet and standing on an appropriate spot, will prevent slipping.
8990

9091
// Flags for pass_flags (/atom/var/pass_flags)
9192
#define PASS_FLAG_TABLE BITFLAG(0)

code/__defines/misc.dm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,5 +382,11 @@
382382
#define CRAYON_DRAW_LETTER "letter"
383383
#define CRAYON_DRAW_ARROW "arrow"
384384

385+
// Enum for results of is_space_movement_permitted()
386+
#define SPACE_MOVE_SUPPORTED (-1)
387+
#define SPACE_MOVE_FORBIDDEN 0
388+
#define SPACE_MOVE_PERMITTED 1
389+
385390
// Default UI style applied to client prefs.
386391
#define DEFAULT_UI_STYLE /decl/ui_style/midnight
392+

code/_helpers/mobs.dm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
var/user_loc = user.loc
4141

4242
var/drifting = 0
43-
if(!user.Process_Spacemove(0) && user.inertia_dir)
43+
if(user.is_space_movement_permitted() == SPACE_MOVE_FORBIDDEN && user.inertia_dir)
4444
drifting = 1
4545

4646
var/target_loc = target.loc
@@ -101,7 +101,7 @@
101101
var/atom/original_loc = user.loc
102102

103103
var/drifting = 0
104-
if(!user.Process_Spacemove(0) && user.inertia_dir)
104+
if(user.is_space_movement_permitted() == SPACE_MOVE_FORBIDDEN && user.inertia_dir)
105105
drifting = 1
106106

107107
var/holding = user.get_active_held_item()

code/controllers/subsystems/spacedrift.dm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ SUBSYSTEM_DEF(spacedrift)
3434
return
3535
continue
3636

37-
if (!AM.loc || AM.loc != AM.inertia_last_loc || AM.Process_Spacemove(0))
37+
if (!AM.loc || AM.loc != AM.inertia_last_loc || AM.is_space_movement_permitted() != SPACE_MOVE_FORBIDDEN)
3838
AM.inertia_dir = 0
39-
39+
4040
AM.inertia_ignore = null
4141

4242
if (!AM.inertia_dir)

code/datums/movement/mob.dm

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,28 @@
6262
return (MOVEMENT_PROCEED|MOVEMENT_HANDLED)
6363

6464
/datum/movement_handler/mob/space
65-
var/allow_move
65+
var/last_space_move_result
66+
67+
// Notes on space movement chain:
68+
// - owning mob calls MayMove() via normal movement handler chain
69+
// - MayMove() sets last_space_move_result based on is_space_movement_permitted() (checks for footing, magboots, etc)
70+
// - last_space_move_result is checked in DoMove() and passed to try_space_move() as a param, which returns TRUE/FALSE
71+
// - if the original move result was forbidden, or try_space_move() fails, the handler prevents movement.
72+
// - Otherwise it goes ahead and lets the mob move.
6673

6774
// Space movement
6875
/datum/movement_handler/mob/space/DoMove(direction, mob/mover, is_external)
6976
if(mob.has_gravity() || (IS_NOT_SELF(mover) && is_external))
7077
return
71-
if(!allow_move || !mob.space_do_move(allow_move, direction))
78+
if(last_space_move_result == SPACE_MOVE_FORBIDDEN || !mob.try_space_move(last_space_move_result, direction))
7279
return MOVEMENT_HANDLED
7380

7481
/datum/movement_handler/mob/space/MayMove(mob/mover, is_external)
7582
if(IS_NOT_SELF(mover) && is_external)
7683
return MOVEMENT_PROCEED
7784
if(!mob.has_gravity())
78-
allow_move = mob.Process_Spacemove(1)
79-
if(!allow_move)
85+
last_space_move_result = mob.is_space_movement_permitted(allow_movement = TRUE)
86+
if(last_space_move_result == SPACE_MOVE_FORBIDDEN)
8087
return MOVEMENT_STOP
8188
return MOVEMENT_PROCEED
8289

code/datums/movement/robot.dm

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@
1616
// Use power while moving.
1717
/datum/movement_handler/robot/use_power/DoMove(direction, mob/mover, is_external)
1818
var/datum/robot_component/actuator/A = robot.get_component("actuator")
19-
if(!robot.cell_use_power(A.active_usage * robot.power_efficiency))
19+
if(!is_external && !robot.cell_use_power(A.active_usage * robot.power_efficiency))
2020
return MOVEMENT_HANDLED
21+
return MOVEMENT_PROCEED
2122

2223
/datum/movement_handler/robot/use_power/MayMove(mob/mover, is_external)
23-
return (!robot.lockcharge && robot.is_component_functioning("actuator")) ? MOVEMENT_PROCEED : MOVEMENT_STOP
24+
if(is_external || (!robot.incapacitated() && !robot.lockcharge && robot.is_component_functioning("actuator")))
25+
return MOVEMENT_PROCEED
26+
return MOVEMENT_STOP

code/game/area/areas.dm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ var/global/list/mob/living/forced_ambiance_list = new
422422
if(isspaceturf(get_turf(mob))) // Can't fall onto nothing.
423423
return
424424

425-
if(mob.Check_Shoegrip())
425+
if(!mob.can_slip(magboots_only = TRUE))
426426
return
427427

428428
if(ishuman(mob))

code/game/atoms.dm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,8 +1005,7 @@
10051005
return required_dexterity
10061006

10071007
/atom/proc/immune_to_floor_hazards()
1008-
return !simulated
1009-
1008+
return !simulated || !has_gravity()
10101009
/// The punctuation used for the "That's an X." string.
10111010
/atom/proc/get_examine_punctuation()
10121011
// Could theoretically check if reagents in a coating are 'dangerous' or 'suspicious' (blood, acid, etc)

code/game/atoms_movable.dm

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
//call this proc to start space drifting
5151
/atom/movable/proc/space_drift(direction)//move this down
52-
if(!loc || direction & (UP|DOWN) || Process_Spacemove(0))
52+
if(!loc || direction & (UP|DOWN) || is_space_movement_permitted() != SPACE_MOVE_FORBIDDEN)
5353
inertia_dir = 0
5454
inertia_ignore = null
5555
return 0
@@ -62,29 +62,22 @@
6262
return 1
6363

6464
//return 0 to space drift, 1 to stop, -1 for mobs to handle space slips
65-
/atom/movable/proc/Process_Spacemove(var/allow_movement)
65+
/atom/movable/proc/is_space_movement_permitted(allow_movement = FALSE)
6666
if(!simulated)
67-
return 1
68-
67+
return SPACE_MOVE_PERMITTED
6968
if(has_gravity())
70-
return 1
71-
69+
return SPACE_MOVE_PERMITTED
7270
if(length(grabbed_by))
73-
return 1
74-
71+
return SPACE_MOVE_PERMITTED
7572
if(throwing)
76-
return 1
77-
73+
return SPACE_MOVE_PERMITTED
7874
if(anchored)
79-
return 1
80-
75+
return SPACE_MOVE_PERMITTED
8176
if(!isturf(loc))
82-
return 1
83-
77+
return SPACE_MOVE_PERMITTED
8478
if(locate(/obj/structure/lattice) in range(1, get_turf(src))) //Not realistic but makes pushing things in space easier
85-
return -1
86-
87-
return 0
79+
return SPACE_MOVE_SUPPORTED
80+
return SPACE_MOVE_FORBIDDEN
8881

8982
/atom/movable/attack_hand(mob/user)
9083
// Unbuckle anything buckled to us.

code/game/objects/items/weapons/extinguisher.dm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
return
6161
if(user.buckled && isobj(user.buckled))
6262
addtimer(CALLBACK(src, PROC_REF(propel_object), user.buckled, user, get_dir(A, user)), 0)
63-
else if(!user.check_space_footing())
63+
else if(user.can_slip(magboots_only = TRUE))
6464
var/old_dir = user.dir
6565
step(user, get_dir(A, user))
6666
user.set_dir(old_dir)

0 commit comments

Comments
 (0)