Merge pull request #13703 from Fox-McCloud/tg-flying-floating-float-refactor

TG Flying+Floating Refactor
This commit is contained in:
AffectedArc07
2020-08-27 20:08:35 +01:00
committed by GitHub
30 changed files with 61 additions and 49 deletions
+2
View File
@@ -538,6 +538,8 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven
take_organ_damage(10)
if(iscarbon(hit_atom) && hit_atom != src)
var/mob/living/carbon/victim = hit_atom
if(victim.flying)
return
if(hurt)
victim.take_organ_damage(10)
take_organ_damage(10)
@@ -29,7 +29,7 @@
if(changed)
animate(src, transform = ntransform, time = 2, pixel_y = final_pixel_y, dir = final_dir, easing = EASE_IN|EASE_OUT)
handle_transform_change()
floating = 0 // If we were without gravity, the bouncing animation got stopped, so we make sure we restart it in next life().
floating = FALSE // If we were without gravity, the bouncing animation got stopped, so we make sure we restart it in next life().
/mob/living/carbon/proc/handle_transform_change()
return
+2 -3
View File
@@ -2,9 +2,8 @@
set waitfor = FALSE
set invisibility = 0
if(flying) //TODO: Better floating
animate(src, pixel_y = pixel_y + 5 , time = 10, loop = 1, easing = SINE_EASING)
animate(pixel_y = pixel_y - 5, time = 10, loop = 1, easing = SINE_EASING)
if(flying && !floating) //TODO: Better floating
float(TRUE)
if(client || registered_z) // This is a temporary error tracker to make sure we've caught everything
var/turf/T = get_turf(src)
+14 -11
View File
@@ -758,16 +758,17 @@
/mob/living/proc/float(on)
if(throwing)
return
var/fixed = 0
var/fixed = FALSE
if(anchored || (buckled && buckled.anchored))
fixed = 1
fixed = TRUE
if(on && !floating && !fixed)
animate(src, pixel_y = pixel_y + 2, time = 10, loop = -1)
floating = 1
sleep(10)
animate(src, pixel_y = pixel_y - 2, time = 10, loop = -1)
floating = TRUE
else if(((!on || fixed) && floating))
var/final_pixel_y = get_standard_pixel_y_offset(lying)
animate(src, pixel_y = final_pixel_y, time = 10)
floating = 0
animate(src, pixel_y = get_standard_pixel_y_offset(lying), time = 10)
floating = FALSE
/mob/living/proc/can_use_vents()
return "You can't fit into that vent."
@@ -842,15 +843,17 @@
if(!used_item)
used_item = get_active_hand()
..()
floating = 0 // If we were without gravity, the bouncing animation got stopped, so we make sure we restart the bouncing after the next movement.
floating = FALSE // If we were without gravity, the bouncing animation got stopped, so we make sure we restart the bouncing after the next movement.
/mob/living/proc/do_jitter_animation(jitteriness, loop_amount = 6)
var/amplitude = min(4, (jitteriness/100) + 1)
var/amplitude = min(4, (jitteriness / 100) + 1)
var/pixel_x_diff = rand(-amplitude, amplitude)
var/pixel_y_diff = rand(-amplitude/3, amplitude/3)
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 = loop_amount)
animate(pixel_x = initial(pixel_x) , pixel_y = initial(pixel_y) , time = 2)
floating = 0 // If we were without gravity, the bouncing animation got stopped, so we make sure we restart the bouncing after the next movement.
animate(pixel_x = final_pixel_x , pixel_y = final_pixel_y , time = 2)
floating = FALSE // If we were without gravity, the bouncing animation got stopped, so we make sure we restart the bouncing after the next movement.
/mob/living/proc/get_temperature(datum/gas_mixture/environment)
+1 -1
View File
@@ -33,7 +33,7 @@
var/on_fire = 0 //The "Are we on fire?" var
var/fire_stacks = 0 //Tracks how many stacks of fire we have on, max is usually 20
var/floating = 0
var/floating = FALSE
var/mob_size = MOB_SIZE_HUMAN
var/metabolism_efficiency = 1 //more or less efficiency to metabolize helpful/harmful reagents and regulate body temperature..
var/digestion_ratio = 1 //controls how quickly reagents metabolize; largely governered by species attributes.
@@ -17,7 +17,7 @@
atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0)
minbodytemp = 0
faction = list("cult")
flying = 1
flying = TRUE
pressure_resistance = 100
universal_speak = 1
AIStatus = AI_OFF //normal constructs don't have AI
@@ -15,6 +15,7 @@
harm_intent_damage = 1
friendly = "nudges"
density = 0
flying = TRUE
pass_flags = PASSTABLE | PASSGRILLE | PASSMOB
ventcrawler = 2
mob_size = MOB_SIZE_TINY
@@ -16,6 +16,7 @@
maxHealth = 20
health = 20
mob_size = MOB_SIZE_TINY
flying = TRUE
harm_intent_damage = 8
melee_damage_lower = 10
melee_damage_upper = 10
@@ -241,6 +241,14 @@ Difficulty: Very Hard
AT.pixel_y += random_y
return ..()
/mob/living/simple_animal/hostile/megafauna/colossus/float(on) //we don't want this guy to float, messes up his animations
if(throwing)
return
if(on && !floating)
floating = TRUE
else if(!on && floating)
floating = FALSE
/obj/item/projectile/colossus
name ="death bolt"
icon_state= "chronobolt"
@@ -46,6 +46,7 @@
atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0)
minbodytemp = 0
flying = TRUE
pressure_resistance = 300
gold_core_spawnable = NO_SPAWN //too spooky for science
faction = list("undead") // did I mention ghost
@@ -362,7 +362,7 @@
atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0)
minbodytemp = 0
mob_size = MOB_SIZE_TINY
flying = 1
flying = TRUE
bubble_icon = "syndibot"
gold_core_spawnable = HOSTILE_SPAWN
del_on_death = 1
@@ -86,6 +86,7 @@
//Parrots are kleptomaniacs. This variable ... stores the item a parrot is holding.
var/obj/item/held_item = null
flying = TRUE
gold_core_spawnable = FRIENDLY_SPAWN
@@ -24,6 +24,7 @@
status_flags = 0
faction = list("cult")
status_flags = CANPUSH
flying = TRUE
loot = list(/obj/item/reagent_containers/food/snacks/ectoplasm)
del_on_death = 1
deathmessage = "lets out a contented sigh as their form unwinds."
-12
View File
@@ -141,18 +141,6 @@
if(updating && val_change)
update_canmove()
/mob/living/proc/StartFlying()
var/val_change = !flying
flying = TRUE
if(val_change)
update_animations()
/mob/living/proc/StopFlying()
var/val_change = !!flying
flying = FALSE
if(val_change)
update_animations()
// SCALAR STATUS EFFECTS
+2 -1
View File
@@ -369,8 +369,9 @@
step(pulling, get_dir(pulling.loc, A))
return
/mob/proc/update_gravity()
/mob/proc/update_gravity(has_gravity)
return
/client/proc/check_has_body_select()
return mob && mob.hud_used && mob.hud_used.zone_select && istype(mob.hud_used.zone_select, /obj/screen/zone_sel)
-6
View File
@@ -55,12 +55,6 @@
// Procs that update other things about the mob
// Does various animations - Jitter, Flying, Spinning
/mob/proc/update_animations()
if(flying)
animate(src, pixel_y = pixel_y + 5 , time = 10, loop = 1, easing = SINE_EASING)
animate(pixel_y = pixel_y - 5, time = 10, loop = 1, easing = SINE_EASING)
/mob/proc/update_stat()
return