[REFACTOR] Remove the flying var, adds the flying trait. (#26881)

* Remove the flying var, adds the flying trait

* Remove flight when broomstick is unwielded

* Adds some comments

* tab indentation

* Fix carp flight

* Remove comment

---------

Co-authored-by: Adrer <adrermail@gmail.com>
This commit is contained in:
Chap
2024-10-16 17:46:19 +00:00
committed by GitHub
co-authored by Adrer
parent be2cdeb261
commit c3d773402c
51 changed files with 86 additions and 78 deletions
+1 -1
View File
@@ -53,7 +53,7 @@
/obj/effect/acid/Crossed(AM as mob|obj)
if(isliving(AM))
var/mob/living/L = AM
if(L.flying)
if(HAS_TRAIT(L, TRAIT_FLYING))
return
if(L.m_intent != MOVE_INTENT_WALK && prob(40))
var/acid_used = min(acid_level * 0.05, 20)
+1 -1
View File
@@ -16,7 +16,7 @@
var/mob/living/M = AM
if(faction && (faction in M.faction))
return
if(M.flying)
if(HAS_TRAIT(M, TRAIT_FLYING))
return
triggermine(M)
+1 -1
View File
@@ -102,7 +102,7 @@
return ..()
var/mob/living/L = AM
if((iscarbon(AM) || isanimal(AM)) && !L.flying)
if((iscarbon(AM) || isanimal(AM)) && HAS_TRAIT(L, TRAIT_FLYING))
spring_trap(AM)
if(ishuman(AM))
+1 -1
View File
@@ -72,7 +72,7 @@
/obj/item/shard/Crossed(mob/living/L, oldloc)
if(istype(L) && has_gravity(loc))
if(L.incorporeal_move || L.flying || L.floating)
if(L.incorporeal_move || HAS_TRAIT(L, TRAIT_FLYING) || L.floating)
return
playsound(loc, 'sound/effects/glass_step.ogg', 50, TRUE)
return ..()
+3 -3
View File
@@ -34,7 +34,7 @@
user.update_inv_l_hand()
user.update_inv_r_hand()
if(iswizard(user))
user.flying = TRUE
ADD_TRAIT(user, TRAIT_FLYING, "broomstick")
user.say("QUID 'ITCH")
animate(user, pixel_y = pixel_y + 10 , time = 10, loop = 1, easing = SINE_EASING)
to_chat(user, "<span class='notice'>You hold [src] between your legs.</span>")
@@ -44,6 +44,7 @@
user.update_inv_l_hand()
user.update_inv_r_hand()
if(iswizard(user))
REMOVE_TRAIT(user, TRAIT_FLYING, "broomstick")
animate(user, pixel_y = pixel_y + 10 , time = 1, loop = 1)
animate(user, pixel_y = pixel_y, time = 10, loop = 1, easing = SINE_EASING)
animate(user)
@@ -58,8 +59,7 @@
..()
/obj/item/staff/broom/dropped(mob/user)
if(iswizard(user) && user.flying)
user.flying = FALSE
REMOVE_TRAIT(user, TRAIT_FLYING, "broomstick")
..()
/obj/item/staff/broom/horsebroom
+2 -2
View File
@@ -106,7 +106,7 @@
return TRUE
if(ismob(mover))
var/mob/living/M = mover
if(M.flying || (istype(M) && IS_HORIZONTAL(M) && HAS_TRAIT(M, TRAIT_CONTORTED_BODY)))
if(HAS_TRAIT(M, TRAIT_FLYING) || (istype(M) && IS_HORIZONTAL(M) && HAS_TRAIT(M, TRAIT_CONTORTED_BODY)))
return TRUE
if(mover.throwing)
return TRUE
@@ -133,7 +133,7 @@
if(isprojectile(O))
return TRUE
if(istype(M))
if(M.flying || M.floating || (IS_HORIZONTAL(M) && HAS_TRAIT(M, TRAIT_CONTORTED_BODY)))
if(HAS_TRAIT(M, TRAIT_FLYING) || M.floating || (IS_HORIZONTAL(M) && HAS_TRAIT(M, TRAIT_CONTORTED_BODY)))
return TRUE
if(O.throwing)
return TRUE
+2 -2
View File
@@ -140,7 +140,7 @@
if(istype(mover,/obj/item/projectile))
return (check_cover(mover,target))
var/mob/living/living_mover = mover
if(istype(living_mover) && (living_mover.flying || (IS_HORIZONTAL(living_mover) && HAS_TRAIT(living_mover, TRAIT_CONTORTED_BODY))))
if(istype(living_mover) && (HAS_TRAIT(living_mover, TRAIT_FLYING) || (IS_HORIZONTAL(living_mover) && HAS_TRAIT(living_mover, TRAIT_CONTORTED_BODY))))
return TRUE
if(istype(mover) && mover.checkpass(PASSTABLE))
return TRUE
@@ -484,7 +484,7 @@
if(!isliving(AM))
return
var/mob/living/L = AM
if(L.incorporeal_move || L.flying || L.floating)
if(L.incorporeal_move || HAS_TRAIT(L, TRAIT_FLYING) || L.floating)
return
// Don't break if they're just flying past