Fixes many instances of lying mob getting shifted up (pixel_y reset to 0) by adding a lying_pixel_offset var to mob/living.

Removes the delay when toggling resting, sleeping and pouncing, the mob sprite will now update instantly.
This commit is contained in:
phil235
2015-03-30 23:14:21 +02:00
parent 314e9424ae
commit 12a729adcd
8 changed files with 35 additions and 14 deletions
@@ -12,6 +12,7 @@
ventcrawler = 2
languages = ALIEN
verb_say = "hisses"
lying_pixel_offset = 0
var/nightvision = 1
var/storedPlasma = 250
var/max_plasma = 500
@@ -54,6 +54,7 @@
/mob/living/carbon/alien/humanoid/hunter/proc/toggle_leap(var/message = 1)
leap_on_click = !leap_on_click
leap_icon.icon_state = "leap_[leap_on_click ? "on":"off"]"
update_icons()
if(message)
src << "<span class='noticealien'>You will now [leap_on_click ? "leap at":"slash at"] enemies!</span>"
else
@@ -22,3 +22,5 @@
var/co2overloadtime = null
var/temperature_resistance = T0C+75
lying_pixel_offset = -6 //offset for pixel_y when lying down.
@@ -15,7 +15,7 @@
else //if(lying != 0)
if(lying_prev == 0) //Standing to lying
pixel_y = initial(pixel_y)
final_pixel_y -= 6
final_pixel_y = lying_pixel_offset
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
+20 -5
View File
@@ -323,6 +323,7 @@ Sorry Giacom. Please don't be mad :(
else
if(alert(src, "You sure you want to sleep for a while?", "Sleep", "Yes", "No") == "Yes")
usr.sleeping = 20 //Short nap
update_canmove()
/mob/proc/get_contents()
@@ -332,6 +333,7 @@ Sorry Giacom. Please don't be mad :(
resting = !resting
src << "<span class='notice'>You are now [resting ? "resting" : "getting up"].</span>"
update_canmove()
//Recursive function to find everything a mob is holding.
/mob/living/get_contents(var/obj/item/weapon/storage/Storage = null)
@@ -777,7 +779,10 @@ Sorry Giacom. Please don't be mad :(
animate(src, pixel_y = pixel_y + 2, time = 10, loop = -1)
floating = 1
else if(!on && floating)
animate(src, pixel_y = initial(pixel_y), time = 10)
var/final_pixel_y = initial(pixel_y)
if(lying && !buckled)
final_pixel_y = lying_pixel_offset
animate(src, pixel_y = final_pixel_y, time = 10)
floating = 0
//called when the mob receives a bright flash
@@ -840,9 +845,12 @@ Sorry Giacom. Please don't be mad :(
return
/atom/movable/proc/do_attack_animation(atom/A)
/atom/movable/proc/do_attack_animation(atom/A, end_pixel_y)
var/pixel_x_diff = 0
var/pixel_y_diff = 0
var/final_pixel_y = initial(pixel_y)
if(end_pixel_y)
final_pixel_y = end_pixel_y
var/direction = get_dir(src, A)
switch(direction)
if(NORTH)
@@ -865,20 +873,27 @@ Sorry Giacom. Please don't be mad :(
if(SOUTHWEST)
pixel_x_diff = -8
pixel_y_diff = -8
animate(src, pixel_x = pixel_x + pixel_x_diff, pixel_y = pixel_y + pixel_y_diff, time = 2)
animate(pixel_x = initial(pixel_x), pixel_y = initial(pixel_y), time = 2)
animate(pixel_x = initial(pixel_x), pixel_y = final_pixel_y, time = 2)
/mob/living/do_attack_animation(atom/A)
..()
var/final_pixel_y = initial(pixel_y)
if(lying && !buckled)
final_pixel_y = lying_pixel_offset
..(A, final_pixel_y)
floating = 0 // If we were without gravity, the bouncing animation got stopped, so we make sure to restart it in next life().
/mob/living/proc/do_jitter_animation(jitteriness)
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_y = initial(pixel_y)
if(lying && !buckled)
final_pixel_y = lying_pixel_offset
animate(src, pixel_x = pixel_x + pixel_x_diff, pixel_y = pixel_y + pixel_y_diff , time = 2, loop = 6)
animate(pixel_x = initial(pixel_x) , pixel_y = initial(pixel_y) , time = 2)
animate(pixel_x = initial(pixel_x) , pixel_y = final_pixel_y , time = 2)
floating = 0 // If we were without gravity, the bouncing animation got stopped, so we make sure to restart it in next life().
/mob/living/proc/get_temperature(var/datum/gas_mixture/environment)
+3 -1
View File
@@ -42,4 +42,6 @@
var/mob_size = MOB_SIZE_HUMAN
var/metabolism_efficiency = 1 //more or less efficiency to metabolize helpful/harmful reagents and regulate body temperature..
var/list/image/staticOverlays = list()
var/list/image/staticOverlays = list()
var/lying_pixel_offset = 0 //offset for pixel_y when the mob is lying down.