animation refresh - huge unatomized bundle of fixes and tweaks to numerous animations in the game

This commit is contained in:
deathride58
2022-05-31 19:22:30 -04:00
parent f34e268a1c
commit 1a918ed8db
26 changed files with 88 additions and 113 deletions
+4 -2
View File
@@ -121,7 +121,8 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
remove_verb(src, /mob/dead/observer/verb/boo)
remove_verb(src, /mob/dead/observer/verb/possess)
animate(src, pixel_y = 2, time = 10, loop = -1)
animate(src, pixel_z = 2, time = 10, loop = -1, flags = ANIMATION_RELATIVE)
animate(pixel_z = -4, time = 10, loop = -1, flags = ANIMATION_RELATIVE)
add_to_dead_mob_list()
@@ -535,7 +536,8 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
. = ..()
//restart our floating animation after orbit is done.
pixel_y = 0
animate(src, pixel_y = 2, time = 10, loop = -1)
animate(src, pixel_z = 2, time = 10, loop = -1, flags = ANIMATION_RELATIVE)
animate(pixel_z = -4, time = 10, loop = -1, flags = ANIMATION_RELATIVE)
/mob/dead/observer/verb/jumptomob() //Moves the ghost instead of just changing the ghosts's eye -Nodrak
set category = "Ghost"
@@ -51,7 +51,7 @@
// update_icons() //Handled in update_transform(), leaving this here as a reminder
update_transform()
/mob/living/carbon/alien/humanoid/update_transform() //The old method of updating lying/standing was update_icons(). Aliens still expect that.
/mob/living/carbon/alien/humanoid/update_transform(do_animate) //The old method of updating lying/standing was update_icons(). Aliens still expect that.
if(lying > 0)
lying = 90 //Anything else looks silly
..()
@@ -21,7 +21,7 @@
else
icon_state = "larva[state]"
/mob/living/carbon/alien/larva/update_transform() //All this is handled in update_icons()
/mob/living/carbon/alien/larva/update_transform(do_animate) //All this is handled in update_icons()
..()
return update_icons()
+27 -24
View File
@@ -354,29 +354,33 @@
offset = GRAB_PIXEL_SHIFT_NECK
if(GRAB_KILL)
offset = GRAB_PIXEL_SHIFT_NECK
M.setDir(get_dir(M, src))
switch(M.dir)
if(NORTH)
animate(M, pixel_x = 0, pixel_y = offset, 3)
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
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
animate(M, pixel_x = -offset, pixel_y = 0, 3)
var/target_dir = get_dir(M, src)
M.setDir(target_dir)
var/target_x
var/target_y
if(target_dir & NORTH)
target_y += offset
if(target_dir & SOUTH)
target_y -= offset
if(target_dir & EAST)
target_x += offset
if(target_dir & WEST)
target_x -= offset
if(target_x || target_y)
if(0 < target_x && M.lying == 270)
M.lying = 90
M.update_transform(FALSE) //force a transformation update, otherwise it'll take a few ticks for update_mobility() to do so
M.lying_prev = M.lying
if(0 > target_x && M.lying == 90)
M.lying = 270
M.update_transform(FALSE)
M.lying_prev = M.lying
animate(M, pixel_x = target_x, pixel_y = target_y, time = 3, flags = ANIMATION_PARALLEL)
/mob/living/proc/reset_pull_offsets(mob/living/M, override)
if(!override && M.buckled)
return
animate(M, pixel_x = 0, pixel_y = 0, 1)
animate(M, pixel_x = 0, pixel_y = 0, time = 3, flags = ANIMATION_PARALLEL)
//mob verbs are a lot faster than object verbs
//for more info on why this is not atom/pull, see examinate() in mob.dm
@@ -885,12 +889,11 @@
if(anchored || (buckled && buckled.anchored))
fixed = 1
if(on && !(movement_type & FLOATING) && !fixed)
animate(src, pixel_y = pixel_y + 2, time = 10, loop = -1)
sleep(10)
animate(src, pixel_y = pixel_y - 2, time = 10, loop = -1)
animate(src, pixel_z = 2, time = 10, loop = -1, flags = ANIMATION_RELATIVE)
animate(pixel_z = -4, time = 10, loop = -1, flags = ANIMATION_RELATIVE)
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_z = get_standard_pixel_y_offset(lying), time = 10)
setMovetype(movement_type & ~FLOATING)
// The src mob is trying to strip an item from someone
@@ -989,7 +992,7 @@
var/pixel_y_diff = rand(-amplitude/3, amplitude/3)
var/final_pixel_x = get_standard_pixel_x_offset(lying)
var/final_pixel_y = get_standard_pixel_y_offset(lying)
animate(src, pixel_x = pixel_x + pixel_x_diff, pixel_y = pixel_y + pixel_y_diff , time = 2, loop = 6)
animate(src, pixel_x = pixel_x_diff, pixel_y = pixel_y_diff , time = 2, loop = 6, flags = ANIMATION_PARALLEL | ANIMATION_RELATIVE)
animate(pixel_x = final_pixel_x , pixel_y = final_pixel_y , time = 2)
floating_need_update = TRUE
+1 -1
View File
@@ -413,7 +413,7 @@
src << browse(dat, "window=airoster")
onclose(src, "airoster")
/mob/living/silicon/update_transform()
/mob/living/silicon/update_transform(do_animate)
var/matrix/ntransform = matrix(transform) //aka transform.Copy()
var/changed = 0
if(resize != RESIZE_DEFAULT_SIZE)
@@ -482,7 +482,7 @@
update_action_buttons_icon()
return mobility_flags
/mob/living/simple_animal/update_transform()
/mob/living/simple_animal/update_transform(do_animate)
var/matrix/ntransform = matrix(transform) //aka transform.Copy()
var/changed = 0
+6 -2
View File
@@ -1,5 +1,5 @@
//IMPORTANT: Multiple animate() calls do not stack well, so try to do them all at once if you can.
/mob/living/update_transform()
/mob/living/update_transform(do_animate = TRUE)
var/matrix/ntransform = matrix(transform) //aka transform.Copy()
var/final_pixel_y = pixel_y
var/changed = 0
@@ -21,5 +21,9 @@
resize = RESIZE_DEFAULT_SIZE
if(changed)
animate(src, transform = ntransform, time = 2, pixel_y = final_pixel_y, easing = EASE_IN|EASE_OUT)
if(do_animate)
animate(src, transform = ntransform, time = 2, pixel_y = final_pixel_y, easing = EASE_IN|EASE_OUT, flags = ANIMATION_PARALLEL)
else
transform = ntransform
pixel_y = final_pixel_y
floating_need_update = TRUE
+11 -5
View File
@@ -229,17 +229,23 @@ It's fairly easy to fix if dealing with single letters but not so much with comp
return copytext_char(sanitize(.),1,MAX_MESSAGE_LEN)
/proc/shake_camera(mob/M, duration, strength=1)
if(!M || !M.client || duration < 1)
set waitfor = FALSE
if(!M || !M.client || duration <= 0)
return
var/client/C = M.client
if (C.prefs.screenshake==0)
return
var/oldx = C.pixel_x
var/oldy = C.pixel_y
var/max = strength*world.icon_size
var/min = -(strength*world.icon_size)
var/clientscreenshake = (C.prefs.screenshake * 0.01)
var/max = (strength*clientscreenshake) * world.icon_size
var/min = -((strength*clientscreenshake) * world.icon_size)
var/roundedduration = -round(-duration) // round() with only one arg will always round down. so uh. this is Something all right
for(var/i in 0 to duration-1)
for(var/i in 0 to roundedduration-1)
duration--
if (i == 0)
animate(C, pixel_x=rand(min,max), pixel_y=rand(min,max), time=1)
animate(C, pixel_x=(rand(min,max)*duration), pixel_y=(rand(min,max)*duration), time=1)
else
animate(pixel_x=rand(min,max), pixel_y=rand(min,max), time=1)
animate(pixel_x=oldx, pixel_y=oldy, time=1)
@@ -3,6 +3,7 @@
name = "projectile gun"
icon_state = "pistol"
w_class = WEIGHT_CLASS_NORMAL
recoil = 0.25
var/spawnwithmagazine = TRUE
var/mag_type = /obj/item/ammo_box/magazine/m10mm //Removes the need for max_ammo and caliber info
var/obj/item/ammo_box/magazine/magazine
@@ -5,6 +5,7 @@
mag_type = /obj/item/ammo_box/magazine/internal/cylinder
fire_sound = "sound/weapons/revolvershot.ogg"
casing_ejector = FALSE
recoil = 0.5
/obj/item/gun/ballistic/revolver/Initialize(mapload)
. = ..()
@@ -285,6 +286,7 @@
item_state = "shotgun"
w_class = WEIGHT_CLASS_BULKY
weapon_weight = WEAPON_MEDIUM
recoil = 1
force = 10
flags_1 = CONDUCT_1
slot_flags = ITEM_SLOT_BACK
@@ -5,6 +5,7 @@
item_state = "shotgun"
fire_sound = "sound/weapons/gunshotshotgunshot.ogg"
w_class = WEIGHT_CLASS_BULKY
recoil = 1
force = 10
flags_1 = CONDUCT_1
slot_flags = ITEM_SLOT_BACK
+1
View File
@@ -16,6 +16,7 @@
name = "energy gun"
desc = "A basic energy-based gun."
icon = 'icons/obj/guns/energy.dmi'
recoil = 0.1
var/obj/item/stock_parts/cell/cell //What type of power cell this uses
var/cell_type = /obj/item/stock_parts/cell
@@ -8,6 +8,7 @@
item_flags = NONE
obj_flags = UNIQUE_RENAME
weapon_weight = WEAPON_LIGHT
recoil = 0.5
can_flashlight = 1
flight_x_offset = 15
flight_y_offset = 9
@@ -4,6 +4,7 @@
icon_state = "syringegun"
item_state = "syringegun"
w_class = WEIGHT_CLASS_NORMAL
recoil = 0.1
throw_speed = 3
throw_range = 7
force = 4