TG Flying+Floating Refactor

This commit is contained in:
Fox McCloud
2020-06-26 21:53:38 -04:00
parent 5a6a0a20af
commit 92e3951efa
30 changed files with 62 additions and 53 deletions
+1 -1
View File
@@ -42,7 +42,7 @@
if(!(flags & CALTROP_BYPASS_SHOES) && (H.shoes || feetCover))
return
if((H.flying) || H.buckled)
if(H.flying || H.floating || H.buckled)
return
var/damage = rand(min_damage, max_damage)
+1 -1
View File
@@ -51,6 +51,6 @@
Additionally calls the parent's `after_slip()` proc on the `victim`.
*/
/datum/component/slippery/proc/Slip(datum/source, mob/living/carbon/human/victim)
if(istype(victim) && prob(slip_chance) && victim.slip(description, stun, weaken, slip_tiles, walking_is_safe, slip_always, slip_verb))
if(istype(victim) && !victim.flying && prob(slip_chance) && victim.slip(description, stun, weaken, slip_tiles, walking_is_safe, slip_always, slip_verb))
var/atom/movable/owner = parent
owner.after_slip(victim)
+8
View File
@@ -67,6 +67,14 @@
var/obj/item/projectile/P = AM
if(P.original != parent)
return
if(ismob(AM))
var/mob/M = AM
if(M.flying)
return
if(isliving(AM))
var/mob/living/L = M
if(L.floating)
return
var/atom/current_parent = parent
if(isturf(current_parent.loc))
play_squeak()
@@ -35,6 +35,8 @@
return
if(!L.client) //Only sentient people are going along with it!
return
if(L.flying)
return
L.adjustFireLoss(3)
/datum/weather/floor_is_lava/fake
+3 -1
View File
@@ -504,6 +504,7 @@
return //don't do an animation if attacking self
var/pixel_x_diff = 0
var/pixel_y_diff = 0
var/direction = get_dir(src, A)
if(direction & NORTH)
pixel_y_diff = 8
@@ -523,7 +524,8 @@
if(visual_effect_icon)
I = image('icons/effects/effects.dmi', A, visual_effect_icon, A.layer + 0.1)
else if(used_item)
I = image(used_item.icon, A, used_item.icon_state, A.layer + 0.1)
I = image(icon = used_item, loc = A, layer = A.layer + 0.1)
I.plane = GAME_PLANE
// Scale the icon.
I.transform *= 0.75
@@ -48,6 +48,7 @@
environment_smash = ENVIRONMENT_SMASH_STRUCTURES
attacktext = "hits"
attack_sound = 'sound/weapons/genhit1.ogg'
flying = TRUE
speak_emote = list("pulses")
var/obj/structure/blob/factory/factory = null
var/list/human_overlays = list()
@@ -14,7 +14,7 @@
a_intent = INTENT_HARM
can_change_intents = 0
stop_automated_movement = 1
floating = 1
flying = TRUE
attack_sound = 'sound/weapons/punch1.ogg'
minbodytemp = 0
maxbodytemp = INFINITY
@@ -33,7 +33,7 @@
status_flags = 0
wander = 0
density = 0
flying = 1
flying = TRUE
move_resist = INFINITY
mob_size = MOB_SIZE_TINY
pass_flags = PASSTABLE | PASSGRILLE | PASSMOB
+1 -1
View File
@@ -83,7 +83,7 @@
/obj/item/shard/Crossed(mob/living/L, oldloc)
if(istype(L) && has_gravity(loc))
if(L.incorporeal_move || L.flying)
if(L.incorporeal_move || L.flying || L.floating)
return
playsound(loc, 'sound/effects/glass_step.ogg', 50, TRUE)
return ..()
+2 -2
View File
@@ -97,8 +97,8 @@
return FALSE
//Flies right over the chasm
if(isliving(AM))
var/mob/M = AM
if(M.flying)
var/mob/living/M = AM
if(M.flying || M.floating)
return FALSE
if(ishuman(AM))
var/mob/living/carbon/human/H = AM
-1
View File
@@ -155,7 +155,6 @@
var/mob/O = M
if(!O.lastarea)
O.lastarea = get_area(O.loc)
// O.update_gravity(O.mob_has_gravity(src))
var/loopsanity = 100
for(var/atom/A in range(1))
@@ -349,7 +349,7 @@
harm_intent_damage = 1
friendly = "mends"
density = 0
flying = 1
flying = TRUE
obj_damage = 0
pass_flags = PASSTABLE | PASSGRILLE | PASSMOB
ventcrawler = 2
+2
View File
@@ -541,6 +541,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(on = 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 -14
View File
@@ -746,16 +746,14 @@
/mob/living/proc/float(on)
if(throwing)
return
var/fixed = 0
if(anchored || (buckled && buckled.anchored))
fixed = 1
if(on && !floating && !fixed)
if(on && !floating)
animate(src, pixel_y = pixel_y + 2, time = 10, loop = -1)
floating = 1
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
sleep(10)
animate(src, pixel_y = pixel_y - 2, time = 10, loop = -1)
floating = TRUE
else if(!on && floating)
animate(src, pixel_y = initial(pixel_y), time = 10)
floating = FALSE
/mob/living/proc/can_use_vents()
return "You can't fit into that vent."
@@ -830,15 +828,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
@@ -28,7 +28,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
gold_core_spawnable = HOSTILE_SPAWN
del_on_death = 1
deathmessage = "is smashed into pieces!"
@@ -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
+3 -2
View File
@@ -186,7 +186,7 @@
if(newdir)
direct = newdir
n = get_step(mob, direct)
. = mob.SelfMove(n, direct, delay)
mob.setDir(direct)
@@ -388,8 +388,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
+1 -1
View File
@@ -627,7 +627,7 @@
/obj/item/light/Crossed(mob/living/L)
if(istype(L) && has_gravity(loc))
if(L.incorporeal_move || L.flying)
if(L.incorporeal_move || L.flying || L.floating)
return
playsound(loc, 'sound/effects/glass_step.ogg', 50, TRUE)
if(status == LIGHT_BURNED || status == LIGHT_OK)
+1 -1
View File
@@ -104,7 +104,7 @@
/mob/living/carbon/human/get_leg_ignore()
if(flying == 1)
if(flying || floating)
return TRUE
var/obj/item/tank/jetpack/J