[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
+2 -5
View File
@@ -341,11 +341,8 @@
return
var/atom/target = get_edge_target_turf(user, user.dir) //gets the user's direction
var/do_callback = FALSE
if(!user.flying)
user.flying = TRUE
do_callback = TRUE
if(user.throw_at(target, jumpdistance, jumpspeed, spin = FALSE, diagonals_first = TRUE, callback = do_callback ? VARSET_CALLBACK(user, flying, FALSE) : null))
ADD_TRAIT(user, TRAIT_FLYING, "gravity_boots")
if(user.throw_at(target, jumpdistance, jumpspeed, spin = FALSE, diagonals_first = TRUE, callback = CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(callback_remove_trait), user, TRAIT_FLYING, "gravity_boots")))
playsound(src, 'sound/effects/stealthoff.ogg', 50, TRUE, 1)
user.visible_message("<span class='warning'>[usr] dashes forward into the air!</span>")
recharging_time = world.time + recharging_rate
+2 -5
View File
@@ -472,11 +472,8 @@
return
var/atom/target = get_edge_target_turf(user, user.dir) //gets the user's direction
var/do_callback = FALSE
if(!user.flying)
user.flying = TRUE
do_callback = TRUE
if(user.throw_at(target, jumpdistance, jumpspeed, spin = FALSE, diagonals_first = TRUE, callback = do_callback ? VARSET_CALLBACK(user, flying, FALSE) : null))
ADD_TRAIT(user, TRAIT_FLYING, "bhop_shoes")
if(user.throw_at(target, jumpdistance, jumpspeed, spin = FALSE, diagonals_first = TRUE, callback = CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(callback_remove_trait), user, TRAIT_FLYING, "bhop_shoes")))
playsound(src, 'sound/effects/stealthoff.ogg', 50, TRUE, 1)
user.visible_message("<span class='warning'>[usr] dashes forward into the air!</span>")
recharging_time = world.time + recharging_rate
+1 -1
View File
@@ -67,7 +67,7 @@
environment_smash = ENVIRONMENT_SMASH_STRUCTURES
attacktext = "hits"
attack_sound = 'sound/weapons/genhit1.ogg'
flying = TRUE
initial_traits = list(TRAIT_FLYING)
speak_emote = list("pulses")
var/obj/structure/blob/factory/factory = null
var/list/human_overlays = list()
@@ -261,7 +261,7 @@
harm_intent_damage = 1
friendly = "mends"
density = FALSE
flying = TRUE
initial_traits = list(TRAIT_FLYING)
obj_damage = 0
pass_flags = PASSTABLE | PASSGRILLE | PASSMOB
ventcrawler = VENTCRAWLER_ALWAYS
@@ -1048,7 +1048,7 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven
/mob/living/carbon/proc/slip(description, knockdown, tilesSlipped, walkSafely, slipAny, slipVerb = "slip")
if(flying || buckled || (walkSafely && m_intent == MOVE_INTENT_WALK))
if(HAS_TRAIT(src, TRAIT_FLYING) || buckled || (walkSafely && m_intent == MOVE_INTENT_WALK))
return FALSE
if(IS_HORIZONTAL(src) && !tilesSlipped)
@@ -293,7 +293,7 @@
if(HAS_TRAIT(H, TRAIT_IGNORESLOWDOWN))
ignoreslow = TRUE
var/flight = H.flying //Check for flight and flying items
var/flight = HAS_TRAIT(H, TRAIT_FLYING) //Check for flight and flying items
ADD_SLOWDOWN(speed_mod)
+5 -2
View File
@@ -9,6 +9,9 @@
if(advanced_bullet_dodge_chance)
RegisterSignal(src, COMSIG_ATOM_PREHIT, PROC_REF(advanced_bullet_dodge))
for(var/initial_trait in initial_traits)
ADD_TRAIT(src, initial_trait, INNATE_TRAIT)
// Used to determine the forces dependend on the mob size
// Will only change the force if the force was not set in the mob type itself
/mob/living/proc/determine_move_and_pull_forces()
@@ -824,7 +827,7 @@
clear_alert("weightless")
else
throw_alert("weightless", /atom/movable/screen/alert/weightless)
if(!flying)
if(!HAS_TRAIT(src, TRAIT_FLYING))
float(!has_gravity)
/mob/living/proc/float(on)
@@ -1112,7 +1115,7 @@
return ..()
/mob/living/hit_by_thrown_mob(mob/living/C, datum/thrownthing/throwingdatum, damage, mob_hurt, self_hurt)
if(C == src || flying || !density)
if(C == src || HAS_TRAIT(src, TRAIT_FLYING) || !density)
return
playsound(src, 'sound/weapons/punch1.ogg', 50, 1)
if(mob_hurt)
@@ -105,6 +105,9 @@
///This variable is the chance for a mob to automatically dodge a bullet. Useful for admins, and applied to some mobs by default, such as the malfunctioning drone mobs.
var/advanced_bullet_dodge_chance = 0
/// List of traits that should be applied on Initialize
var/list/initial_traits = list()
/*
Taste Vars
*/
+1 -1
View File
@@ -2,7 +2,7 @@
set waitfor = FALSE
set invisibility = 0
if(flying && !floating) //TODO: Better floating
if(HAS_TRAIT(src, TRAIT_FLYING) && !floating) //TODO: Better floating
float(TRUE)
if(client || registered_z) // This is a temporary error tracker to make sure we've caught everything
@@ -18,7 +18,6 @@
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 = TRUE
pressure_resistance = 100
universal_speak = TRUE
AIStatus = AI_OFF //normal constructs don't have AI
@@ -16,17 +16,13 @@
harm_intent_damage = 1
friendly = "nudges"
density = FALSE
flying = TRUE
pass_flags = PASSTABLE | PASSGRILLE | PASSMOB
ventcrawler = VENTCRAWLER_ALWAYS
mob_size = MOB_SIZE_TINY
mob_biotypes = MOB_ORGANIC | MOB_BUG
butcher_results = list(/obj/item/food/meat = 0)
gold_core_spawnable = FRIENDLY_SPAWN
/mob/living/simple_animal/butterfly/Initialize(mapload) //Not the poor butterfly!
. = ..()
ADD_TRAIT(src, TRAIT_EDIBLE_BUG, "edible_bug")
initial_traits = list(TRAIT_FLYING, TRAIT_EDIBLE_BUG)
/mob/living/simple_animal/butterfly/New()
..()
@@ -17,7 +17,6 @@
maxHealth = 20
health = 20
mob_size = MOB_SIZE_TINY
flying = TRUE
harm_intent_damage = 8
melee_damage_lower = 10
melee_damage_upper = 10
@@ -35,6 +34,8 @@
faction = list("scarybat")
gold_core_spawnable = HOSTILE_SPAWN
initial_traits = list(TRAIT_FLYING)
/mob/living/simple_animal/hostile/scarybat/Initialize(mapload, mob/living/L)
. = ..()
if(istype(L))
@@ -34,7 +34,6 @@
density = FALSE
mob_size = MOB_SIZE_TINY
mob_biotypes = MOB_ORGANIC | MOB_BUG
flying = TRUE
gold_core_spawnable = HOSTILE_SPAWN
search_objects = TRUE //have to find those plant trays!
@@ -43,6 +42,8 @@
minbodytemp = 0
del_on_death = TRUE
initial_traits = list(TRAIT_FLYING)
var/datum/reagent/beegent = null //hehe, beegent
var/obj/structure/beebox/beehome = null
var/idle = 0
@@ -34,10 +34,11 @@
minbodytemp = 0
maxbodytemp = 1500
faction = list("carp")
flying = TRUE
pressure_resistance = 200
gold_core_spawnable = HOSTILE_SPAWN
initial_traits = list(TRAIT_FLYING, TRAIT_SHOCKIMMUNE)
var/random_color = TRUE //if the carp uses random coloring
var/rarechance = 1 //chance for rare color variant
@@ -63,7 +64,6 @@
/mob/living/simple_animal/hostile/carp/Initialize(mapload)
. = ..()
ADD_TRAIT(src, TRAIT_SHOCKIMMUNE, SPECIES_TRAIT)
carp_randomify(rarechance)
update_icons()
@@ -631,7 +631,6 @@ Difficulty: Hard
weather_immunities = list("lava","ash")
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
check_friendly_fire = 1
ranged = TRUE
projectilesound = 'sound/weapons/gunshots/gunshot.ogg'
@@ -652,6 +651,7 @@ Difficulty: Hard
ranged_ignores_vision = TRUE
stat_attack = UNCONSCIOUS
maxbodytemp = INFINITY
initial_traits = list(TRAIT_FLYING)
var/range = 3
var/mob/living/simple_animal/hostile/megafauna/ancient_robot/core = null
var/fake_max_hp = 300
@@ -30,7 +30,6 @@ Difficulty: Medium
icon = 'icons/mob/lavaland/blood_drunk.dmi'
mob_biotypes = MOB_ORGANIC | MOB_HUMANOID
light_color = "#E4C7C5"
flying = FALSE
speak_emote = list("roars")
speed = 3
move_to_delay = 3
@@ -61,6 +60,8 @@ Difficulty: Medium
/datum/action/innate/megafauna_attack/kinetic_accelerator,
/datum/action/innate/megafauna_attack/transform_weapon)
initial_traits = list() // Don't want to inherit flight from parent type /megafauna/
/obj/item/gps/internal/miner
icon_state = null
gpstag = "Resonant Signal"
@@ -11,7 +11,6 @@
light_range = 3
faction = list("mining", "boss")
weather_immunities = list("lava","ash")
flying = TRUE
robust_searching = TRUE
ranged_ignores_vision = TRUE
stat_attack = DEAD
@@ -29,6 +28,7 @@
flags_2 = IMMUNE_TO_SHUTTLECRUSH_2
mouse_opacity = MOUSE_OPACITY_ICON
dodging = FALSE // This needs to be false until someone fixes megafauna pathing so they dont lag-switch teleport at you (09-15-2023)
initial_traits = list(TRAIT_FLYING)
var/list/crusher_loot
var/medal_type
var/score_type = BOSS_SCORE
@@ -81,11 +81,11 @@
speak_emote = list("telepathically cries")
attack_sound = 'sound/weapons/bladeslice.ogg'
stat_attack = UNCONSCIOUS
flying = TRUE
robust_searching = TRUE
crusher_loot = /obj/item/crusher_trophy/watcher_wing
loot = list()
butcher_results = list(/obj/item/stack/ore/diamond = 2, /obj/item/stack/sheet/sinew = 2, /obj/item/stack/sheet/bone = 1)
initial_traits = list(TRAIT_FLYING)
/mob/living/simple_animal/hostile/asteroid/basilisk/watcher/magmawing
name = "magmawing watcher"
@@ -209,8 +209,8 @@
del_on_death = TRUE
is_mirror = TRUE
move_resist = MOVE_FORCE_OVERPOWERING // no dragging your mirror around
flying = TRUE
var/mob/living/simple_animal/hostile/asteroid/elite/herald/my_master = null
initial_traits = list(TRAIT_FLYING)
/mob/living/simple_animal/hostile/asteroid/elite/herald/mirror/Initialize(mapload)
. = ..()
@@ -74,7 +74,6 @@
speed = 3
maxHealth = 1
health = 1
flying = TRUE
harm_intent_damage = 5
melee_damage_lower = 2
melee_damage_upper = 2
@@ -87,13 +86,13 @@
pass_flags = PASSTABLE | PASSMOB
density = FALSE
del_on_death = TRUE
initial_traits = list(TRAIT_FLYING)
/mob/living/simple_animal/hostile/asteroid/hivelordbrood/Initialize(mapload)
. = ..()
addtimer(CALLBACK(src, PROC_REF(death)), 100)
AddComponent(/datum/component/swarming)
/mob/living/simple_animal/hostile/asteroid/hivelordbrood/blood
name = "blood brood"
desc = "A living string of blood and alien materials."
@@ -24,7 +24,7 @@
attack_sound = 'sound/weapons/bite.ogg'
speak_emote = list("gnashes")
faction = list("carp")
flying = TRUE
initial_traits = list(TRAIT_FLYING)
var/carp_color = "carp" //holder for icon set
var/static/list/carp_colors = list(\
@@ -29,13 +29,14 @@
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
loot = list(/obj/item/food/ectoplasm)
del_on_death = TRUE
initial_traits = list(TRAIT_FLYING)
/mob/living/simple_animal/hostile/retaliate/ghost/Process_Spacemove(check_drift = 0)
return 1
@@ -411,12 +411,13 @@
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 = TRUE
bubble_icon = "syndibot"
gold_core_spawnable = HOSTILE_SPAWN
del_on_death = TRUE
deathmessage = "is smashed into pieces!"
initial_traits = list(TRAIT_FLYING)
/mob/living/simple_animal/hostile/viscerator/Initialize(mapload)
. = ..()
AddComponent(/datum/component/swarming)
@@ -84,7 +84,7 @@
//Parrots are kleptomaniacs. This variable ... stores the item a parrot is holding.
var/obj/item/held_item = null
flying = TRUE
initial_traits = list(TRAIT_FLYING)
gold_core_spawnable = FRIENDLY_SPAWN
/mob/living/simple_animal/parrot/New()
@@ -27,10 +27,10 @@
universal_speak = TRUE
faction = list("cult")
status_flags = CANPUSH
flying = TRUE
loot = list(/obj/item/food/ectoplasm)
del_on_death = TRUE
deathmessage = "lets out a contented sigh as their form unwinds."
initial_traits = list(TRAIT_FLYING, TRAIT_SHOCKIMMUNE)
var/holy = FALSE
/mob/living/simple_animal/shade/attackby(obj/item/O, mob/user) //Marker -Agouri
@@ -194,7 +194,7 @@
return
/*
* String associated list returns a cached list.
* String associated list returns a cached list.
* This is like a static list to pass into the element below.
*/
atmos_requirements = string_assoc_list(atmos_requirements)
@@ -354,7 +354,8 @@
icon = initial(icon)
icon_state = icon_living
density = initial(density)
flying = initial(flying)
if(TRAIT_FLYING in initial_traits)
ADD_TRAIT(src, TRAIT_FLYING, INNATE_TRAIT)
if(collar_type)
collar_type = "[initial(collar_type)]"
regenerate_icons()
@@ -364,7 +365,7 @@
. = ..()
if(!.)
return FALSE
flying = FALSE
REMOVE_TRAIT(src, TRAIT_FLYING, INNATE_TRAIT)
walk(src, 0)
if(nest)
nest.spawned_mobs -= src
-1
View File
@@ -63,7 +63,6 @@
var/timeofdeath = 0 //Living
var/bodytemperature = 310.055 //98.7 F
var/flying = FALSE
var/nutrition = NUTRITION_LEVEL_FED + 50 //Carbon
var/satiety = 0 //Carbon
var/hunger_drain = HUNGER_FACTOR // how quickly the mob gets hungry; largely utilized by species.
+1 -1
View File
@@ -907,7 +907,7 @@
/obj/item/light/Crossed(mob/living/L)
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)
if(status == LIGHT_BURNED || status == LIGHT_OK)
@@ -185,7 +185,7 @@
if(!istype(H) || !H.reagents || HAS_TRAIT(H, TRAIT_PIERCEIMMUNE) || ismachineperson(H))
return
if(H.floating || H.flying || H.buckled)
if(H.floating || HAS_TRAIT(H, TRAIT_FLYING) || H.buckled)
return
if(!IS_HORIZONTAL(H) && (H.shoes || (H.wear_suit && (H.wear_suit.body_parts_covered & FEET)) || (H.w_uniform && (H.w_uniform.body_parts_covered & FEET))))