From 43f9e5ac216653cf69d42f917f0f5844ef815e39 Mon Sep 17 00:00:00 2001 From: silicons Date: Sat, 16 Sep 2023 23:26:34 -0700 Subject: [PATCH] fixes --- code/game/atoms/atom.dm | 8 ++++---- code/game/atoms/movable/movable.dm | 10 ++++++++-- .../structures/stool_bed_chair_nest/bed.dm | 16 +++++++--------- code/modules/mob/living/carbon/human/human.dm | 2 +- code/modules/mob/living/living.dm | 4 ++-- code/modules/mob/living/silicon/pai/pai.dm | 5 +---- code/modules/mob/mob.dm | 18 ++++++++++++++---- code/modules/vore/resizing/resize_vr.dm | 4 ---- 8 files changed, 37 insertions(+), 30 deletions(-) diff --git a/code/game/atoms/atom.dm b/code/game/atoms/atom.dm index 7389a6e0244b..9c9e630ee57d 100644 --- a/code/game/atoms/atom.dm +++ b/code/game/atoms/atom.dm @@ -1081,21 +1081,21 @@ return base_pixel_y /** - * get the pixel_x needed to adjust an atom on our turf **to the position of our visual center** + * get the pixel_x needed to adjust ourselves to be centered on our turf. this is used for alignment with buckles and whatnot. * * e.g. even if we are a 3x3 sprite with -32 x/y offsets, this would be 0 * if we were, for some reason, a 4x4 with -32 x/y, this would probably be 16/16 x/y. */ -/atom/proc/get_centering_pixel_x_offset(dir, atom/aligning) +/atom/proc/get_centering_pixel_x_offset(dir) return base_pixel_x + (icon_x_dimension - WORLD_ICON_SIZE) / 2 /** - * get the pixel_y needed to adjust an atom on our turf **to the position of our visual center** + * get the pixel_y needed to adjust ourselves to be centered on our turf. this is used for alignment with buckles and whatnot. * * e.g. even if we are a 3x3 sprite with -32 x/y offsets, this would be 0 * if we were, for some reason, a 4x4 with -32 x/y, this would probably be 16/16 x/y. */ -/atom/proc/get_centering_pixel_y_offset(dir, atom/aligning) +/atom/proc/get_centering_pixel_y_offset(dir) return base_pixel_y + (icon_y_dimension - WORLD_ICON_SIZE) / 2 /// Setter for the `base_pixel_x` variable to append behavior related to its changing. diff --git a/code/game/atoms/movable/movable.dm b/code/game/atoms/movable/movable.dm index 72d9f8e31d27..a9f16ef5b045 100644 --- a/code/game/atoms/movable/movable.dm +++ b/code/game/atoms/movable/movable.dm @@ -481,14 +481,20 @@ update_emissive_layers() //? Pixel Offsets -/atom/movable/get_centering_pixel_x_offset(dir, atom/aligning) +/atom/movable/get_centering_pixel_x_offset(dir) . = ..() . *= icon_scale_x -/atom/movable/get_centering_pixel_y_offset(dir, atom/aligning) +/atom/movable/get_centering_pixel_y_offset(dir) . = ..() . *= icon_scale_y +/atom/movable/proc/get_buckled_x_offset(atom/buckled) + return buckle_pixel_x + +/atom/movable/proc/get_buckled_y_offset(atom/buckled) + return buckle_pixel_y + //? Emissives /atom/movable/proc/update_emissive_layers() em_block?.layer = MANGLE_PLANE_AND_LAYER(plane, layer) diff --git a/code/game/objects/structures/stool_bed_chair_nest/bed.dm b/code/game/objects/structures/stool_bed_chair_nest/bed.dm index bd6ac09aa5d9..614f3705c1bb 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/bed.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/bed.dm @@ -178,23 +178,21 @@ /obj/structure/bed/double/padded/Initialize(mapload) . = ..(mapload, "wood", "cotton") -/obj/structure/bed/double/padded/get_centering_pixel_y_offset(dir, atom/aligning) - if(!aligning) +/obj/structure/bed/double/padded/get_buckled_y_offset(atom/buckled) + if(isnull(buckled)) return ..() - if(!has_buckled_mobs()) - return ..() - var/index = buckled_mobs.Find(aligning) + var/index = buckled_mobs?.Find(buckled) if(!index) return ..() switch(index) if(1) - return -6 + return 0 if(2) - return 6 + return 12 if(3) - return 3 + return 6 else - return rand(-6, 6) + return rand(0, 12) /* * Roller beds diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 62d1d2e586de..f2742d163b9a 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1633,7 +1633,7 @@ LAZYDISTINCTADD(., SLOT_FEET) //! Pixel Offsets -/mob/living/carbon/human/get_centering_pixel_x_offset(dir, atom/aligning) +/mob/living/carbon/human/get_centering_pixel_x_offset(dir) . = ..() // uh oh stinky if(!isTaurTail(tail_style) || !(dir & (EAST|WEST))) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 6e393cb66718..926b646f739b 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -807,10 +807,10 @@ default behaviour is: //* Pixel Offsets -/mob/living/get_centering_pixel_y_offset(dir, atom/aligning) +/mob/living/get_centering_pixel_y_offset(dir) . = ..() // since we're shifted up by transforms.. - . += ((size_multiplier * icon_scale_y) - 1) * 16 + . -= ((size_multiplier * icon_scale_y) - 1) * 16 /mob/living/get_managed_pixel_y() . = ..() diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index 22c02f4bbbd6..6713a78c7d58 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -189,13 +189,10 @@ if(!chassis) var/icon_width = last_rendered_hologram_icon.Width() icon_x_dimension = icon_width - buckle_pixel_x = (icon_x_dimension - WORLD_ICON_SIZE) / 2 else icon_x_dimension = 32 - buckle_pixel_x = 0 reset_pixel_offsets() - /// camera handling /mob/living/silicon/pai/check_eye(var/mob/user as mob) if (!src.current) @@ -345,5 +342,5 @@ /mob/living/silicon/pai/proc/get_holo_image() return render_hologram_icon(usr.client.prefs.render_to_appearance(PREF_COPY_TO_FOR_RENDER | PREF_COPY_TO_NO_CHECK_SPECIES | PREF_COPY_TO_UNRESTRICTED_LOADOUT), 210) -/mob/living/silicon/pai/get_centering_pixel_x_offset(dir, atom/aligning) +/mob/living/silicon/pai/get_centering_pixel_x_offset(dir) return base_pixel_x + (WORLD_ICON_SIZE - icon_x_dimension) / 2 diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 019feab2cad9..70777dce0d63 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -1140,12 +1140,22 @@ GLOBAL_VAR_INIT(exploit_warn_spam_prevention, 0) /mob/proc/get_buckled_pixel_x_offset() if(!buckled) return 0 - return buckled.get_centering_pixel_x_offset(NONE, src) - get_centering_pixel_x_offset() + buckled.buckle_pixel_x + // todo: this doesn't properly take into account all transforms of both us and the buckled object + . = get_centering_pixel_x_offset(dir) + if(lying != 0) + . *= cos(lying) + . += sin(lying) * get_centering_pixel_y_offset(dir) + return buckled.pixel_x + . - buckled.get_centering_pixel_x_offset(buckled.dir) + buckled.get_buckled_x_offset(src) /mob/proc/get_buckled_pixel_y_offset() if(!buckled) return 0 - return buckled.get_centering_pixel_y_offset(NONE, src) - get_centering_pixel_y_offset() + buckled.buckle_pixel_y + // todo: this doesn't properly take into account all transforms of both us and the buckled object + . = get_centering_pixel_y_offset(dir) + if(lying != 0) + . *= cos(lying) + . += sin(lying) * get_centering_pixel_x_offset(dir) + return buckled.pixel_y + . - buckled.get_centering_pixel_y_offset(buckled.dir) + buckled.get_buckled_y_offset(src) /mob/get_managed_pixel_x() return ..() + shift_pixel_x + get_buckled_pixel_x_offset() @@ -1153,11 +1163,11 @@ GLOBAL_VAR_INIT(exploit_warn_spam_prevention, 0) /mob/get_managed_pixel_y() return ..() + shift_pixel_y + get_buckled_pixel_y_offset() -/mob/get_centering_pixel_x_offset(dir, atom/aligning) +/mob/get_centering_pixel_x_offset(dir) . = ..() . += shift_pixel_x -/mob/get_centering_pixel_y_offset(dir, atom/aligning) +/mob/get_centering_pixel_y_offset(dir) . = ..() . += shift_pixel_y diff --git a/code/modules/vore/resizing/resize_vr.dm b/code/modules/vore/resizing/resize_vr.dm index 36e58a2ad879..a8f248655287 100644 --- a/code/modules/vore/resizing/resize_vr.dm +++ b/code/modules/vore/resizing/resize_vr.dm @@ -468,7 +468,3 @@ var/const/RESIZE_A_SMALLTINY = (RESIZE_SMALL + RESIZE_TINY) / 2 #undef STEP_TEXT_OWNER #undef STEP_TEXT_PREY - -/mob/living/get_standard_pixel_y_offset(lying) - . = ..() - . += (size_multiplier - 1) * 16