diff --git a/code/game/atoms.dm b/code/game/atoms.dm
index 9005e43bd25..6761dfde73d 100644
--- a/code/game/atoms.dm
+++ b/code/game/atoms.dm
@@ -650,8 +650,8 @@
else
return FALSE
-///Called when gravity returns after floating I think
-/atom/proc/handle_fall()
+///Used for making a sound when a mob involuntarily falls into the ground.
+/atom/proc/handle_fall(mob/faller)
return
///Respond to the singularity eating this atom
diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm
index 00f0ff1bfed..db7c079f0d9 100755
--- a/code/game/turfs/turf.dm
+++ b/code/game/turfs/turf.dm
@@ -486,9 +486,7 @@
/turf/proc/acid_melt()
return
-/turf/handle_fall(mob/faller, forced)
- if(!forced)
- return
+/turf/handle_fall(mob/faller)
if(has_gravity(src))
playsound(src, "bodyfall", 50, TRUE)
faller.drop_all_held_items()
diff --git a/code/modules/mob/living/carbon/alien/humanoid/update_icons.dm b/code/modules/mob/living/carbon/alien/humanoid/update_icons.dm
index 71d8a21a3bb..2ee8347586a 100644
--- a/code/modules/mob/living/carbon/alien/humanoid/update_icons.dm
+++ b/code/modules/mob/living/carbon/alien/humanoid/update_icons.dm
@@ -52,9 +52,7 @@
update_transform()
/mob/living/carbon/alien/humanoid/update_transform() //The old method of updating lying/standing was update_icons(). Aliens still expect that.
- if(lying)
- lying = 90 //Anything else looks retarded
- ..()
+ . = ..()
update_icons()
/mob/living/carbon/alien/humanoid/update_inv_handcuffed()
diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm
index 3d2f4d4724f..7cb90a22370 100644
--- a/code/modules/mob/living/carbon/carbon.dm
+++ b/code/modules/mob/living/carbon/carbon.dm
@@ -217,8 +217,9 @@
"[usr] [internal ? "opens" : "closes"] the valve on your [ITEM.name].", null, null, usr)
to_chat(usr, "You [internal ? "open" : "close"] the valve on [src]'s [ITEM.name].")
-/mob/living/carbon/fall(forced)
- loc.handle_fall(src, forced)//it's loc so it doesn't call the mob's handle_fall which does nothing
+/mob/living/carbon/on_fall()
+ . = ..()
+ loc.handle_fall(src)//it's loc so it doesn't call the mob's handle_fall which does nothing
/mob/living/carbon/is_muzzled()
return(istype(src.wear_mask, /obj/item/clothing/mask/muzzle))
diff --git a/code/modules/mob/living/carbon/update_icons.dm b/code/modules/mob/living/carbon/update_icons.dm
index 7530be956f3..79051d2207a 100644
--- a/code/modules/mob/living/carbon/update_icons.dm
+++ b/code/modules/mob/living/carbon/update_icons.dm
@@ -4,15 +4,15 @@
var/final_pixel_y = pixel_y
var/final_dir = dir
var/changed = 0
- if(lying != lying_prev && rotate_on_lying)
+ if(lying_angle != lying_prev && rotate_on_lying)
changed++
- ntransform.TurnTo(lying_prev , lying)
- if(!lying) //Lying to standing
+ ntransform.TurnTo(lying_prev , lying_angle)
+ if(!lying_angle) //Lying to standing
final_pixel_y = get_standard_pixel_y_offset()
else //if(lying != 0)
if(lying_prev == 0) //Standing to lying
pixel_y = get_standard_pixel_y_offset()
- final_pixel_y = get_standard_pixel_y_offset(lying)
+ final_pixel_y = get_standard_pixel_y_offset(lying_angle)
if(dir & (EAST|WEST)) //Facing east or west
final_dir = pick(NORTH, SOUTH) //So you fall on your side rather than your face or ass
if(resize != RESIZE_DEFAULT_SIZE)
@@ -21,7 +21,7 @@
resize = RESIZE_DEFAULT_SIZE
if(changed)
- animate(src, transform = ntransform, time = (lying_prev == 0 || !lying) ? 2 : 0, pixel_y = final_pixel_y, dir = final_dir, easing = (EASE_IN|EASE_OUT))
+ animate(src, transform = ntransform, time = (lying_prev == 0 || lying_angle == 0) ? 2 : 0, pixel_y = final_pixel_y, dir = final_dir, easing = (EASE_IN|EASE_OUT))
setMovetype(movement_type & ~FLOATING) // If we were without gravity, the bouncing animation got stopped, so we make sure we restart it in next life().
/mob/living/carbon
diff --git a/code/modules/mob/living/death.dm b/code/modules/mob/living/death.dm
index 04bb8d1d98c..9f3415ed51f 100644
--- a/code/modules/mob/living/death.dm
+++ b/code/modules/mob/living/death.dm
@@ -1,5 +1,5 @@
/mob/living/gib(no_brain, no_organs, no_bodyparts)
- var/prev_lying = lying
+ var/prev_lying = lying_angle
if(stat != DEAD)
death(TRUE)
diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm
index 50dcb19b16a..3861295682c 100644
--- a/code/modules/mob/living/living.dm
+++ b/code/modules/mob/living/living.dm
@@ -335,16 +335,12 @@
if(SOUTH)
animate(M, pixel_x = 0, pixel_y = -offset, 3)
if(EAST)
- if(M.lying == 270) //update the dragged dude's direction if we've turned
- M.lying = 90
- M.update_transform() //force a transformation update, otherwise it'll take a few ticks for update_mobility() to do so
- M.lying_prev = M.lying
+ if(M.lying_angle == 270) //update the dragged dude's direction if we've turned
+ M.set_lying_angle(90)
animate(M, pixel_x = offset, pixel_y = 0, 3)
if(WEST)
- if(M.lying == 90)
- M.lying = 270
- M.update_transform()
- M.lying_prev = M.lying
+ if(M.lying_angle == 90)
+ M.set_lying_angle(270)
animate(M, pixel_x = -offset, pixel_y = 0, 3)
/mob/living/proc/reset_pull_offsets(mob/living/M, override)
@@ -629,13 +625,8 @@
return
/mob/living/Move(atom/newloc, direct)
- if(lying)
- if(direct & EAST)
- lying = 90
- if(direct & WEST)
- lying = 270
- update_transform()
- lying_prev = lying
+ if(lying_angle != 0)
+ lying_angle_on_movement(direct)
if (buckled && buckled.loc != newloc) //not updating position
if (!buckled.anchored)
return buckled.Move(newloc, direct)
@@ -663,6 +654,16 @@
if(!(mobility_flags & MOBILITY_STAND) && !buckled && prob(getBruteLoss()*200/maxHealth))
makeTrail(newloc, T, old_direction)
+///Called by mob Move() when the lying_angle is different than zero, to better visually simulate crawling.
+/mob/living/proc/lying_angle_on_movement(direct)
+ if(direct & EAST)
+ set_lying_angle(90)
+ else if(direct & WEST)
+ set_lying_angle(270)
+
+/mob/living/carbon/alien/humanoid/lying_angle_on_movement(direct)
+ return
+
/mob/living/proc/makeTrail(turf/target_turf, turf/start, direction)
if(!has_gravity())
return
@@ -838,7 +839,7 @@
animate(src, pixel_y = pixel_y - 2, time = 10, loop = -1)
setMovetype(movement_type | FLOATING)
else if(((!on || fixed) && (movement_type & FLOATING)))
- animate(src, pixel_y = get_standard_pixel_y_offset(lying), time = 10)
+ animate(src, pixel_y = get_standard_pixel_y_offset(lying_angle), time = 10)
setMovetype(movement_type & ~FLOATING)
// The src mob is trying to strip an item from someone
@@ -1179,23 +1180,23 @@
var/canstand_involuntary = conscious && !stat_softcrit && !knockdown && !chokehold && !paralyzed && (ignore_legs || has_legs) && !(buckled && buckled.buckle_lying)
var/canstand = canstand_involuntary && !resting
- var/should_be_lying = !canstand
- if(buckled)
- if(buckled.buckle_lying != -1)
- should_be_lying = buckled.buckle_lying
-
- if(should_be_lying)
+ if(buckled && buckled.buckle_lying != -1)
+ if(buckled.buckle_lying != 0)
+ mobility_flags &= ~MOBILITY_STAND
+ else
+ mobility_flags |= MOBILITY_STAND
+ set_lying_angle(buckled.buckle_lying)
+ else if(!canstand)
mobility_flags &= ~MOBILITY_STAND
- if(buckled)
- if(buckled.buckle_lying != -1)
- lying = buckled.buckle_lying
- if(!lying) //force them on the ground
- lying = pick(90, 270)
+ if(lying_angle == 0) //force them on the ground
+ set_lying_angle(pick(90, 270))
+ if(!canstand_involuntary)
+ on_fall()
else
mobility_flags |= MOBILITY_STAND
- lying = 0
+ set_lying_angle(0)
- if(should_be_lying || restrained || incapacitated())
+ if(lying_angle != 0 || restrained || incapacitated())
mobility_flags &= ~(MOBILITY_UI|MOBILITY_PULL)
else
mobility_flags |= MOBILITY_UI|MOBILITY_PULL
@@ -1214,17 +1215,6 @@
stop_pulling()
if(!(mobility_flags & MOBILITY_UI))
unset_machine()
- density = !lying
- if(lying)
- if(!lying_prev)
- fall(!canstand_involuntary)
- if(layer == initial(layer)) //to avoid special cases like hiding larvas.
- layer = LYING_MOB_LAYER //so mob lying always appear behind standing mobs
- else
- if(layer == LYING_MOB_LAYER)
- layer = initial(layer)
- update_transform()
- lying_prev = lying
// Movespeed mods based on arms/legs quantity
if(!get_leg_ignore())
@@ -1239,9 +1229,9 @@
else
remove_movespeed_modifier(/datum/movespeed_modifier/limbless)
-/mob/living/proc/fall(forced)
- if(!(mobility_flags & MOBILITY_USE))
- drop_all_held_items()
+///Called when mob changes from a standing position into a prone while lacking the ability to stand up at the moment, through update_mobility()
+/mob/living/proc/on_fall()
+ return
/mob/living/proc/AddAbility(obj/effect/proc_holder/A)
abilities.Add(A)
@@ -1429,6 +1419,34 @@
log_mapping(ERROR_ERROR_LANDMARK_ERROR)
CRASH(ERROR_ERROR_LANDMARK_ERROR)
+/**
+ * Changes the inclination angle of a mob, used by humans and others to differentiate between standing up and prone positions.
+ *
+ * In BYOND-angles 0 is NORTH, 90 is EAST, 180 is SOUTH and 270 is WEST.
+ * This usually means that 0 is standing up, 90 and 270 are horizontal positions to right and left respectively, and 180 is upside-down.
+ * Mobs that do now follow these conventions due to unusual sprites should require a special handling or redefinition of this proc, due to the density and layer changes.
+ * The return of this proc is the previous value of the modified lying_angle if a change was successful (might include zero), or null if no change was made.
+ */
+/mob/living/proc/set_lying_angle(new_lying)
+ if(new_lying == lying_angle)
+ return
+ . = lying_angle
+ lying_angle = new_lying
+ if(lying_angle != lying_prev)
+ update_transform()
+ lying_prev = lying_angle
+ if(lying_angle != 0) //We are not standing up.
+ if(layer == initial(layer)) //to avoid things like hiding larvas.
+ layer = LYING_MOB_LAYER //so mob lying always appear behind standing mobs
+ if(. != 0) //We became prone and were not before. We lose density and stop bumping passable dense things.
+ density = FALSE
+ else //We are prone.
+ if(layer == LYING_MOB_LAYER)
+ layer = initial(layer)
+ if(.) //We weren't pone before, so we become dense and things can bump into us again.
+ density = initial(density)
+
+
/**
* add_body_temperature_change Adds modifications to the body temperature
*
diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm
index 0e6ee3372d1..242eeddc1af 100644
--- a/code/modules/mob/living/living_defines.dm
+++ b/code/modules/mob/living/living_defines.dm
@@ -28,7 +28,7 @@
var/resting = FALSE
- VAR_PROTECTED/lying = 0 ///number of degrees. DO NOT USE THIS IN CHECKS. CHECK FOR MOBILITY FLAGS INSTEAD!!
+ VAR_PROTECTED/lying_angle = 0 ///number of degrees. DO NOT USE THIS IN CHECKS. CHECK FOR MOBILITY FLAGS INSTEAD!!
var/lying_prev = 0 ///last value of lying on update_mobility
var/confused = 0 ///Makes the mob move in random directions.
diff --git a/code/modules/photography/camera/camera_image_capturing.dm b/code/modules/photography/camera/camera_image_capturing.dm
index f01c51e87ad..fa12cc20a7d 100644
--- a/code/modules/photography/camera/camera_image_capturing.dm
+++ b/code/modules/photography/camera/camera_image_capturing.dm
@@ -11,7 +11,7 @@
step_y = AM.step_y
if(iscarbon(A))
var/mob/living/carbon/C = A
- UNLINT(turn_angle = C.lying) // this is the only place its okay to read lying directly
+ UNLINT(turn_angle = C.lying_angle) // this is the only place its okay to read lying directly
. = ..()
/obj/item/camera/proc/camera_get_icon(list/turfs, turf/center, psize_x = 96, psize_y = 96, datum/turf_reservation/clone_area, size_x, size_y, total_x, total_y)