[MIRROR] Fix royal alien pixel offset, change getter to variable (#1641)

* Fix royal alien pixel offset, change getter to variable (#54706)

Fixed a bug where royal aliens would have their base pixel offset applied twice, making them off-center (https://i.imgur.com/BtspaM0.png)

Changed the mob/living procs get_standard_pixel_x_offset() and get_standard_pixel_y_offset() to variables (body_position_pixel_x_offset and body_position_pixel_y_offset), to match the contribution guidelines.

Also corrected a few random things that weren't using base pixels but should have been.

* Fix royal alien pixel offset, change getter to variable

* Update pixel_shift.dm

Co-authored-by: Yenwodyah <yenwodyah@gmail.com>
Co-authored-by: Azarak <azarak10@gmail.com>
This commit is contained in:
SkyratBot
2020-11-11 03:47:05 +01:00
committed by GitHub
parent 2ff5f9b259
commit 8db24d79e6
13 changed files with 37 additions and 59 deletions
@@ -116,9 +116,6 @@ Des: Removes all infected images from the alien.
return FALSE
return TRUE
/mob/living/carbon/alien/get_standard_pixel_y_offset(lying = FALSE)
return initial(pixel_y)
/mob/living/carbon/alien/proc/alien_evolve(mob/living/carbon/alien/new_xeno)
to_chat(src, "<span class='noticealien'>You begin to evolve!</span>")
visible_message("<span class='alertalien'>[src] begins to twist and contort!</span>")
@@ -44,13 +44,18 @@
return
else //Maybe uses plasma in the future, although that wouldn't make any sense...
leaping = 1
leaping = TRUE
//Because the leaping sprite is bigger than the normal one
body_position_pixel_x_offset = -32
body_position_pixel_y_offset = -32
LAZYADD(weather_immunities,"lava")
update_icons()
throw_at(A, MAX_ALIEN_LEAP_DIST, 1, src, FALSE, TRUE, callback = CALLBACK(src, .proc/leap_end))
/mob/living/carbon/alien/humanoid/hunter/proc/leap_end()
leaping = 0
leaping = FALSE
body_position_pixel_x_offset = 0
body_position_pixel_y_offset = 0
LAZYREMOVE(weather_immunities, "lava")
update_icons()
@@ -81,11 +86,6 @@
visible_message("<span class='danger'>[src] smashes into [hit_atom]!</span>", "<span class='alertalien'>[src] smashes into [hit_atom]!</span>")
Paralyze(40, ignore_canstun = TRUE)
if(leaping)
leaping = FALSE
update_icons()
/mob/living/carbon/alien/humanoid/float(on)
if(leaping)
return
@@ -13,8 +13,6 @@
var/leap_on_click = 0
var/pounce_cooldown = 0
var/pounce_cooldown_time = 30
var/custom_pixel_x_offset = 0 //for admin fuckery.
var/custom_pixel_y_offset = 0
var/sneaking = 0 //For sneaky-sneaky mode and appropriate slowdown
var/drooling = 0 //For Neruotoxic spit overlays
deathsound = 'sound/voice/hiss6.ogg'
@@ -80,22 +78,6 @@
pulledby.stop_pulling()
. = 0
/mob/living/carbon/alien/humanoid/get_standard_pixel_y_offset(lying = FALSE)
if(leaping)
return -32
else if(custom_pixel_y_offset)
return custom_pixel_y_offset
else
return initial(pixel_y)
/mob/living/carbon/alien/humanoid/get_standard_pixel_x_offset(lying = 0)
if(leaping)
return -32
else if(custom_pixel_x_offset)
return custom_pixel_x_offset
else
return initial(pixel_x)
/mob/living/carbon/alien/humanoid/get_permeability_protection(list/target_zones)
return 0.8
@@ -41,8 +41,8 @@
var/old_icon = icon
icon = alt_icon
alt_icon = old_icon
pixel_x = base_pixel_x + get_standard_pixel_x_offset(body_position == LYING_DOWN)
pixel_y = base_pixel_y + get_standard_pixel_y_offset(body_position == LYING_DOWN)
pixel_x = base_pixel_x + body_position_pixel_x_offset
pixel_y = base_pixel_y + body_position_pixel_y_offset
update_inv_hands()
update_inv_handcuffed()
-6
View File
@@ -406,12 +406,6 @@
update_inv_legcuffed()
return TRUE
/mob/living/carbon/get_standard_pixel_y_offset(lying = FALSE)
if(lying)
return -6
else
return initial(pixel_y)
/mob/living/carbon/proc/accident(obj/item/I)
if(!I || (I.item_flags & ABSTRACT) || HAS_TRAIT(I, TRAIT_NODROP))
return
@@ -8,11 +8,11 @@
changed++
ntransform.TurnTo(lying_prev , lying_angle)
if(!lying_angle) //Lying to standing
final_pixel_y = base_pixel_y + get_standard_pixel_y_offset()
final_pixel_y = base_pixel_y
else //if(lying != 0)
if(lying_prev == 0) //Standing to lying
pixel_y = base_pixel_y + get_standard_pixel_y_offset()
final_pixel_y = base_pixel_y + get_standard_pixel_y_offset(lying_angle)
pixel_y = base_pixel_y
final_pixel_y = base_pixel_y + PIXEL_Y_OFFSET_LYING
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)
+5 -9
View File
@@ -548,6 +548,7 @@
density = FALSE // We lose density and stop bumping passable dense things.
if(HAS_TRAIT(src, TRAIT_FLOORED) && !(dir & (NORTH|SOUTH)))
setDir(pick(NORTH, SOUTH)) // We are and look helpless.
body_position_pixel_y_offset = PIXEL_Y_OFFSET_LYING
/// Proc to append behavior related to lying down.
@@ -557,6 +558,7 @@
density = initial(density) // We were prone before, so we become dense and things can bump into us again.
REMOVE_TRAIT(src, TRAIT_UI_BLOCKED, LYING_DOWN_TRAIT)
REMOVE_TRAIT(src, TRAIT_PULL_BLOCKED, LYING_DOWN_TRAIT)
body_position_pixel_y_offset = 0
@@ -964,7 +966,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 = base_pixel_y + get_standard_pixel_y_offset(lying_angle), time = 1 SECONDS)
animate(src, pixel_y = base_pixel_y + body_position_pixel_y_offset, time = 1 SECONDS)
setMovetype(movement_type & ~FLOATING)
// The src mob is trying to strip an item from someone
@@ -1052,8 +1054,8 @@
var/amplitude = min(4, (jitteriness/100) + 1)
var/pixel_x_diff = rand(-amplitude, amplitude)
var/pixel_y_diff = rand(-amplitude/3, amplitude/3)
var/final_pixel_x = base_pixel_x + get_standard_pixel_x_offset(body_position == LYING_DOWN)
var/final_pixel_y = base_pixel_y + get_standard_pixel_y_offset(body_position == LYING_DOWN)
var/final_pixel_x = base_pixel_x + body_position_pixel_x_offset
var/final_pixel_y = base_pixel_y + body_position_pixel_y_offset
animate(src, pixel_x = pixel_x + pixel_x_diff, pixel_y = pixel_y + pixel_y_diff , time = 2, loop = 6)
animate(pixel_x = final_pixel_x , pixel_y = final_pixel_y , time = 2)
setMovetype(movement_type & ~FLOATING) // If we were without gravity, the bouncing animation got stopped, so we make sure to restart it in next life().
@@ -1070,12 +1072,6 @@
loc_temp = heat_turf.temperature
return loc_temp
/mob/living/proc/get_standard_pixel_x_offset(lying = FALSE)
return initial(pixel_x)
/mob/living/proc/get_standard_pixel_y_offset(lying = FALSE)
return initial(pixel_y)
/mob/living/cancel_camera()
..()
cameraFollow = null
@@ -157,3 +157,8 @@
/// Is this mob allowed to be buckled/unbuckled to/from things?
var/can_buckle_to = TRUE
///The y amount a mob's sprite should be offset due to the current position they're in (e.g. lying down moves your sprite down)
var/body_position_pixel_x_offset = 0
///The x amount a mob's sprite should be offset due to the current position they're in
var/body_position_pixel_y_offset = 0