Pixel adjustments to mobs are now sourced / Refactors riding (#89320)

Fixes #85980

- Pixel adjustments are now sourced

When tweaking a mob's pixel w, x, y, z, is is now done via `add_offsets`
and must have a source string associated

- Refactors riding

Refactors how riding component selects the offsets to use. It's now all
done via the getter rather than a weird mix of a var, a cache, and a
getter.

- Moves a bunch of animations to use `pixel_w` / `pixel_z`

Largely to prevent conflicts with adjustments to a mob's pixel position,
but also as many animations are not actual movements, but visual
movements. Floating is one such example.

It just works

🆑 Melbert
fix: Fixed grab offsets not showing for anything but passive grab
fix: Fix jank with mob offsets when riding things
refactor: Refactored riding component, particularly how it selects layer
and offsets. Report any oddities
refactor: Refactored pixel offsets of mobs. Report any oddities
/🆑
This commit is contained in:
MrMelbert
2025-03-12 16:00:01 -04:00
committed by Roxy
parent 483888e64d
commit 5a16f74fb3
50 changed files with 997 additions and 727 deletions
+4 -4
View File
@@ -81,8 +81,8 @@
* * leaning_offset - pixel offset to apply on the mob when leaning
*/
/mob/living/proc/start_leaning(atom/lean_target, leaning_offset)
var/new_x = lean_target.pixel_x + base_pixel_x + body_position_pixel_x_offset
var/new_y = lean_target.pixel_y + base_pixel_y + body_position_pixel_y_offset
var/new_x = 0
var/new_y = 0
switch(dir)
if(SOUTH)
new_y += leaning_offset
@@ -93,7 +93,7 @@
if(EAST)
new_x -= leaning_offset
animate(src, 0.2 SECONDS, pixel_x = new_x, pixel_y = new_y)
add_offsets(LEANING_TRAIT, x_add = new_x, y_add = new_y)
add_traits(list(TRAIT_UNDENSE, TRAIT_EXPANDED_FOV), LEANING_TRAIT)
visible_message(
span_notice("[src] leans against [lean_target]."),
@@ -129,7 +129,7 @@
COMSIG_ATOM_POST_DIR_CHANGE,
COMSIG_MOVABLE_TELEPORTED,
))
animate(src, 0.2 SECONDS, pixel_x = base_pixel_x + body_position_pixel_x_offset, pixel_y = base_pixel_y + body_position_pixel_y_offset)
remove_offsets(LEANING_TRAIT)
remove_traits(list(TRAIT_UNDENSE, TRAIT_EXPANDED_FOV), LEANING_TRAIT)
SEND_SIGNAL(src, COMSIG_LIVING_STOPPED_LEANING)
update_fov()