mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 23:27:34 +01:00
Merge commit '179a607a90ad7ec62bdaff4e6fe72af60ee56442' of https://github.com/tgstation/tgstation into upstream-24-10b
This commit is contained in:
+45
-16
@@ -1,3 +1,6 @@
|
||||
#define FUNCTIONAL_WING_FORCE 2.25 NEWTONS
|
||||
#define FUNCTIONAL_WING_STABILIZATION 1.2 NEWTONS
|
||||
|
||||
///hud action for starting and stopping flight
|
||||
/datum/action/innate/flight
|
||||
name = "Toggle Flight"
|
||||
@@ -10,11 +13,6 @@
|
||||
var/obj/item/organ/external/wings/functional/wings = human.get_organ_slot(ORGAN_SLOT_EXTERNAL_WINGS)
|
||||
if(wings?.can_fly(human))
|
||||
wings.toggle_flight(human)
|
||||
if(!(human.movement_type & FLYING))
|
||||
to_chat(human, span_notice("You settle gently back onto the ground..."))
|
||||
else
|
||||
to_chat(human, span_notice("You beat your wings and begin to hover gently above the ground..."))
|
||||
human.set_resting(FALSE, TRUE)
|
||||
|
||||
///The true wings that you can use to fly and shit (you cant actually shit with them)
|
||||
/obj/item/organ/external/wings/functional
|
||||
@@ -55,7 +53,7 @@
|
||||
|
||||
///Called on_life(). Handle flight code and check if we're still flying
|
||||
/obj/item/organ/external/wings/functional/proc/handle_flight(mob/living/carbon/human/human)
|
||||
if(!(human.movement_type & FLYING))
|
||||
if(!HAS_TRAIT_FROM(human, TRAIT_MOVE_FLOATING, SPECIES_FLIGHT_TRAIT))
|
||||
return FALSE
|
||||
if(!can_fly(human))
|
||||
toggle_flight(human)
|
||||
@@ -79,8 +77,7 @@
|
||||
if(environment?.return_pressure() < HAZARD_LOW_PRESSURE + 10)
|
||||
to_chat(human, span_warning("The atmosphere is too thin for you to fly!"))
|
||||
return FALSE
|
||||
else
|
||||
return TRUE
|
||||
return TRUE
|
||||
|
||||
///Slipping but in the air?
|
||||
/obj/item/organ/external/wings/functional/proc/fly_slip(mob/living/carbon/human/human)
|
||||
@@ -107,19 +104,48 @@
|
||||
|
||||
///UNSAFE PROC, should only be called through the Activate or other sources that check for CanFly
|
||||
/obj/item/organ/external/wings/functional/proc/toggle_flight(mob/living/carbon/human/human)
|
||||
if(!HAS_TRAIT_FROM(human, TRAIT_MOVE_FLYING, SPECIES_FLIGHT_TRAIT))
|
||||
if(!HAS_TRAIT_FROM(human, TRAIT_MOVE_FLOATING, SPECIES_FLIGHT_TRAIT))
|
||||
human.physiology.stun_mod *= 2
|
||||
human.add_traits(list(TRAIT_NO_FLOATING_ANIM, TRAIT_MOVE_FLYING), SPECIES_FLIGHT_TRAIT)
|
||||
human.add_traits(list(TRAIT_NO_FLOATING_ANIM, TRAIT_MOVE_FLOATING, TRAIT_IGNORING_GRAVITY, TRAIT_NOGRAV_ALWAYS_DRIFT), SPECIES_FLIGHT_TRAIT)
|
||||
human.add_movespeed_modifier(/datum/movespeed_modifier/jetpack/wings)
|
||||
human.AddElement(/datum/element/forced_gravity, 0)
|
||||
passtable_on(human, SPECIES_FLIGHT_TRAIT)
|
||||
RegisterSignal(human, COMSIG_MOB_CLIENT_MOVE_NOGRAV, PROC_REF(on_client_move))
|
||||
START_PROCESSING(SSnewtonian_movement, src)
|
||||
open_wings()
|
||||
else
|
||||
human.physiology.stun_mod *= 0.5
|
||||
human.remove_traits(list(TRAIT_NO_FLOATING_ANIM, TRAIT_MOVE_FLYING), SPECIES_FLIGHT_TRAIT)
|
||||
passtable_off(human, SPECIES_FLIGHT_TRAIT)
|
||||
close_wings()
|
||||
to_chat(human, span_notice("You beat your wings and begin to hover gently above the ground..."))
|
||||
human.set_resting(FALSE, TRUE)
|
||||
human.refresh_gravity()
|
||||
return
|
||||
|
||||
human.physiology.stun_mod *= 0.5
|
||||
human.remove_traits(list(TRAIT_NO_FLOATING_ANIM, TRAIT_MOVE_FLOATING, TRAIT_IGNORING_GRAVITY, TRAIT_NOGRAV_ALWAYS_DRIFT), SPECIES_FLIGHT_TRAIT)
|
||||
human.remove_movespeed_modifier(/datum/movespeed_modifier/jetpack/wings)
|
||||
human.RemoveElement(/datum/element/forced_gravity, 0)
|
||||
passtable_off(human, SPECIES_FLIGHT_TRAIT)
|
||||
UnregisterSignal(human, COMSIG_MOB_CLIENT_MOVE_NOGRAV)
|
||||
STOP_PROCESSING(SSnewtonian_movement, src)
|
||||
to_chat(human, span_notice("You settle gently back onto the ground..."))
|
||||
close_wings()
|
||||
human.refresh_gravity()
|
||||
|
||||
/obj/item/organ/external/wings/functional/proc/on_client_move(mob/source, list/move_args)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if (!can_fly(source))
|
||||
return
|
||||
|
||||
var/max_drift_force = (DEFAULT_INERTIA_SPEED / source.cached_multiplicative_slowdown - 1) / INERTIA_SPEED_COEF + 1
|
||||
source.newtonian_move(dir2angle(source.client.intended_direction), instant = TRUE, drift_force = FUNCTIONAL_WING_FORCE, controlled_cap = max_drift_force)
|
||||
source.setDir(source.client.intended_direction)
|
||||
|
||||
/obj/item/organ/external/wings/functional/process(seconds_per_tick)
|
||||
if (!owner || !can_fly(owner) || isnull(owner.drift_handler))
|
||||
return
|
||||
|
||||
var/max_drift_force = (DEFAULT_INERTIA_SPEED / owner.cached_multiplicative_slowdown - 1) / INERTIA_SPEED_COEF + 1
|
||||
owner.drift_handler.stabilize_drift(owner.client.intended_direction ? dir2angle(owner.client.intended_direction) : null, owner.client.intended_direction ? max_drift_force : 0, FUNCTIONAL_WING_STABILIZATION * (seconds_per_tick * 1 SECONDS))
|
||||
|
||||
///SPREAD OUR WINGS AND FLLLLLYYYYYY
|
||||
/obj/item/organ/external/wings/functional/proc/open_wings()
|
||||
var/datum/bodypart_overlay/mutant/wings/functional/overlay = bodypart_overlay
|
||||
@@ -202,7 +228,7 @@
|
||||
sprite_accessory_override = /datum/sprite_accessory/wings/skeleton
|
||||
|
||||
/obj/item/organ/external/wings/functional/moth/make_flap_sound(mob/living/carbon/wing_owner)
|
||||
playsound(wing_owner, 'sound/voice/moth/moth_flutter.ogg', 50, TRUE)
|
||||
playsound(wing_owner, 'sound/mobs/humanoids/moth/moth_flutter.ogg', 50, TRUE)
|
||||
|
||||
///mothra wings, which relate to moths.
|
||||
/obj/item/organ/external/wings/functional/moth/mothra
|
||||
@@ -227,3 +253,6 @@
|
||||
name = "slime wings"
|
||||
desc = "How does something so squishy even fly?"
|
||||
sprite_accessory_override = /datum/sprite_accessory/wings/slime
|
||||
|
||||
#undef FUNCTIONAL_WING_FORCE
|
||||
#undef FUNCTIONAL_WING_STABILIZATION
|
||||
|
||||
+46
-12
@@ -1,3 +1,5 @@
|
||||
#define MOTH_WING_FORCE 1 NEWTONS
|
||||
|
||||
///Moth wings! They can flutter in low-grav and burn off in heat
|
||||
/obj/item/organ/external/wings/moth
|
||||
name = "moth wings"
|
||||
@@ -18,30 +20,60 @@
|
||||
. = ..()
|
||||
RegisterSignal(receiver, COMSIG_HUMAN_BURNING, PROC_REF(try_burn_wings))
|
||||
RegisterSignal(receiver, COMSIG_LIVING_POST_FULLY_HEAL, PROC_REF(heal_wings))
|
||||
RegisterSignal(receiver, COMSIG_MOVABLE_PRE_MOVE, PROC_REF(update_float_move))
|
||||
RegisterSignal(receiver, COMSIG_MOB_CLIENT_MOVE_NOGRAV, PROC_REF(on_client_move))
|
||||
START_PROCESSING(SSnewtonian_movement, src)
|
||||
|
||||
/obj/item/organ/external/wings/moth/on_mob_remove(mob/living/carbon/organ_owner)
|
||||
. = ..()
|
||||
UnregisterSignal(organ_owner, list(COMSIG_HUMAN_BURNING, COMSIG_LIVING_POST_FULLY_HEAL, COMSIG_MOVABLE_PRE_MOVE))
|
||||
REMOVE_TRAIT(organ_owner, TRAIT_FREE_FLOAT_MOVEMENT, REF(src))
|
||||
UnregisterSignal(organ_owner, list(COMSIG_HUMAN_BURNING, COMSIG_LIVING_POST_FULLY_HEAL, COMSIG_MOB_CLIENT_MOVE_NOGRAV))
|
||||
STOP_PROCESSING(SSnewtonian_movement, src)
|
||||
|
||||
/obj/item/organ/external/wings/moth/make_flap_sound(mob/living/carbon/wing_owner)
|
||||
playsound(wing_owner, 'sound/voice/moth/moth_flutter.ogg', 50, TRUE)
|
||||
playsound(wing_owner, 'sound/mobs/humanoids/moth/moth_flutter.ogg', 50, TRUE)
|
||||
|
||||
/obj/item/organ/external/wings/moth/can_soften_fall()
|
||||
return !burnt
|
||||
|
||||
///Check if we can flutter around
|
||||
/obj/item/organ/external/wings/moth/proc/update_float_move()
|
||||
/obj/item/organ/external/wings/moth/proc/allow_flight()
|
||||
if(!owner || !owner.client)
|
||||
return FALSE
|
||||
if(!isturf(owner.loc))
|
||||
return FALSE
|
||||
if(!(owner.movement_type & FLOATING) || owner.buckled)
|
||||
return FALSE
|
||||
if(owner.pulledby)
|
||||
return FALSE
|
||||
if(owner.throwing)
|
||||
return FALSE
|
||||
if(owner.has_gravity())
|
||||
return FALSE
|
||||
if(ishuman(owner))
|
||||
var/mob/living/carbon/human/human_owner = owner
|
||||
if(human_owner.wear_suit?.flags_inv & HIDEMUTWINGS)
|
||||
return FALSE //Can't fly with hidden wings
|
||||
if(burnt)
|
||||
return FALSE
|
||||
var/datum/gas_mixture/current = owner.loc.return_air()
|
||||
if(current && (current.return_pressure() >= ONE_ATMOSPHERE*0.85))
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/obj/item/organ/external/wings/moth/process(seconds_per_tick)
|
||||
if (!owner || !allow_flight() || isnull(owner.drift_handler))
|
||||
return
|
||||
|
||||
var/max_drift_force = (DEFAULT_INERTIA_SPEED / owner.cached_multiplicative_slowdown - 1) / INERTIA_SPEED_COEF + 1
|
||||
owner.drift_handler.stabilize_drift(owner.client.intended_direction ? dir2angle(owner.client.intended_direction) : null, owner.client.intended_direction ? max_drift_force : 0, MOTH_WING_FORCE * (seconds_per_tick * 1 SECONDS))
|
||||
|
||||
/obj/item/organ/external/wings/moth/proc/on_client_move(mob/source, list/move_args)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if(!isspaceturf(owner.loc) && !burnt)
|
||||
var/datum/gas_mixture/current = owner.loc.return_air()
|
||||
if(current && (current.return_pressure() >= ONE_ATMOSPHERE*0.85)) //as long as there's reasonable pressure and no gravity, flight is possible
|
||||
ADD_TRAIT(owner, TRAIT_FREE_FLOAT_MOVEMENT, REF(src))
|
||||
return
|
||||
if (!allow_flight())
|
||||
return
|
||||
|
||||
REMOVE_TRAIT(owner, TRAIT_FREE_FLOAT_MOVEMENT, REF(src))
|
||||
var/max_drift_force = (DEFAULT_INERTIA_SPEED / source.cached_multiplicative_slowdown - 1) / INERTIA_SPEED_COEF + 1
|
||||
source.newtonian_move(dir2angle(source.client.intended_direction), instant = TRUE, drift_force = MOTH_WING_FORCE, controlled_cap = max_drift_force)
|
||||
source.setDir(source.client.intended_direction)
|
||||
|
||||
///check if our wings can burn off ;_;
|
||||
/obj/item/organ/external/wings/moth/proc/try_burn_wings(mob/living/carbon/human/human)
|
||||
@@ -96,3 +128,5 @@
|
||||
|
||||
/datum/bodypart_overlay/mutant/wings/moth/get_base_icon_state()
|
||||
return burnt ? burn_datum.icon_state : sprite_datum.icon_state
|
||||
|
||||
#undef MOTH_WING_FORCE
|
||||
|
||||
Reference in New Issue
Block a user