-
-
Notifications
You must be signed in to change notification settings - Fork 444
/
Copy pathliving_movement.dm
113 lines (102 loc) · 4.68 KB
/
living_movement.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/mob/living/Moved(atom/old_loc, movement_dir, forced, list/old_locs, momentum_change = TRUE)
. = ..()
update_turf_movespeed(loc)
if(is_shifted)
is_shifted = FALSE
pixel_x = get_standard_pixel_x_offset(lying)
pixel_y = get_standard_pixel_y_offset(lying)
update_looking_move()
/mob/living/on_changed_z_level(turf/old_turf, turf/new_turf, same_z_layer, notify_contents)
. = ..()
// if(!old_turf || !new_turf || SSmapping.gravity_by_z_level[old_turf.z] != SSmapping.gravity_by_z_level[new_turf.z])
// refresh_gravity()
/mob/living/CanAllowThrough(atom/movable/mover, turf/target)
. = ..()
if((mover.pass_flags & PASSMOB))
return TRUE
if(istype(mover, /obj/projectile))
var/obj/projectile/P = mover
return !P.can_hit_target(src, P.impacted, src == P.original, TRUE)
if(mover.throwing)
return (!density || !(mobility_flags & MOBILITY_STAND) || (mover.throwing.thrower == src && !ismob(mover)))
if(buckled == mover)
return TRUE
if(ismob(mover) && (mover in buckled_mobs))
return TRUE
return (!mover.density || . || !(mobility_flags & MOBILITY_STAND))
/mob/living/toggle_move_intent()
. = ..()
update_move_intent_slowdown()
/mob/living/update_config_movespeed()
update_move_intent_slowdown()
return ..()
/mob/living/proc/update_move_intent_slowdown()
var/mod = 0
if(m_intent == MOVE_INTENT_WALK)
mod = CONFIG_GET(number/movedelay/walk_delay)
else
mod = CONFIG_GET(number/movedelay/run_delay)
if(!isnum(mod))
mod = 1
add_movespeed_modifier(MOVESPEED_ID_MOB_WALK_RUN_CONFIG_SPEED, TRUE, 100, override = TRUE, multiplicative_slowdown = mod)
/mob/living/proc/update_turf_movespeed(turf/open/T)
if(isopenturf(T) && !is_flying())
add_movespeed_modifier(MOVESPEED_ID_LIVING_TURF_SPEEDMOD, TRUE, 100, override = TRUE, multiplicative_slowdown = T.slowdown)
else
remove_movespeed_modifier(MOVESPEED_ID_LIVING_TURF_SPEEDMOD)
update_move_intent_slowdown()
/mob/living/proc/update_pull_movespeed()
if(pulling && isliving(pulling))
var/mob/living/L = pulling
if(drag_slowdown && !(L.mobility_flags & MOBILITY_STAND) && !L.buckled && grab_state < GRAB_AGGRESSIVE && !istype(L, /mob/living/simple_animal))
add_movespeed_modifier(MOVESPEED_ID_PRONE_DRAGGING, multiplicative_slowdown = PULL_PRONE_SLOWDOWN)
return
else if(drag_slowdown && istype(L, /mob/living/simple_animal/bot/secbot))//snowflake proc to stop sec from dragging beepsky everywhere
add_movespeed_modifier(MOVESPEED_ID_PRONE_DRAGGING, multiplicative_slowdown = PULL_PRONE_SLOWDOWN)
return
remove_movespeed_modifier(MOVESPEED_ID_PRONE_DRAGGING)
/**
* We want to relay the zmovement to the buckled atom when possible
* and only run what we can't have on buckled.zMove() or buckled.can_z_move() here.
* This way we can avoid esoteric bugs, copypasta and inconsistencies.
*/
/mob/living/zMove(dir, turf/target, z_move_flags = ZMOVE_FLIGHT_FLAGS)
if(buckled)
if(buckled.currently_z_moving)
return FALSE
if(!(z_move_flags & ZMOVE_ALLOW_BUCKLED))
buckled.unbuckle_mob(src, force = TRUE, can_fall = FALSE)
else
if(!target)
target = can_z_move(dir, get_turf(src), null, z_move_flags, src)
if(!target)
return FALSE
return buckled.zMove(dir, target, z_move_flags) // Return value is a loc.
return ..()
/mob/living/can_z_move(direction, turf/start, turf/destination, z_move_flags = ZMOVE_FLIGHT_FLAGS, mob/living/rider)
if(z_move_flags & ZMOVE_INCAPACITATED_CHECKS && incapacitated())
if(z_move_flags & ZMOVE_FEEDBACK)
to_chat(rider || src, span_warning("[rider ? src : "You"] can't do that right now!"))
return FALSE
if(!buckled || !(z_move_flags & ZMOVE_ALLOW_BUCKLED))
if(!(z_move_flags & ZMOVE_FALL_CHECKS) && incorporeal_move && (!rider || rider.incorporeal_move))
//An incorporeal mob will ignore obstacles unless it's a potential fall (it'd suck hard) or is carrying corporeal mobs.
//Coupled with flying/floating, this allows the mob to move up and down freely.
//By itself, it only allows the mob to move down.
z_move_flags |= ZMOVE_IGNORE_OBSTACLES
return ..()
switch(SEND_SIGNAL(buckled, COMSIG_BUCKLED_CAN_Z_MOVE, direction, start, destination, z_move_flags, src))
if(COMPONENT_RIDDEN_ALLOW_Z_MOVE) // Can be ridden.
return buckled.can_z_move(direction, start, destination, z_move_flags, src)
if(COMPONENT_RIDDEN_STOP_Z_MOVE) // Is a ridable but can't be ridden right now. Feedback messages already done.
return FALSE
else
if(!(z_move_flags & ZMOVE_CAN_FLY_CHECKS) && !buckled.anchored)
return buckled.can_z_move(direction, start, destination, z_move_flags, src)
if(z_move_flags & ZMOVE_FEEDBACK)
to_chat(src, span_warning("Unbuckle from [buckled] first."))
return FALSE
/mob/set_currently_z_moving(value)
if(buckled)
return buckled.set_currently_z_moving(value)
return ..()