From 9a7406aede0d7caaa139da8b548e92884beb6969 Mon Sep 17 00:00:00 2001 From: MistakeNot4892 Date: Mon, 22 Mar 2021 13:58:26 +1100 Subject: [PATCH] Allows Teshari to glide in some multiz fall conditions. --- code/modules/mob/living/carbon/human/human.dm | 5 ++ .../living/carbon/human/species/species.dm | 3 + .../carbon/human/species/station/seromi.dm | 61 +++++++++++++++++++ code/modules/mob/living/living.dm | 12 +++- code/modules/multiz/movement.dm | 6 +- 5 files changed, 83 insertions(+), 4 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 631d8a9410b..4b3257ab65a 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1650,7 +1650,12 @@ ..() +<<<<<<< HEAD /mob/living/carbon/human/reduce_cuff_time() if(istype(gloves, /obj/item/clothing/gloves/gauntlets/rig)) return 2 return ..() +======= +/mob/living/carbon/human/get_mob_riding_slots() + return list(back, head, wear_suit) +>>>>>>> 0b5bb3f... Allows Teshari to glide in some multiz fall conditions. (#7990) diff --git a/code/modules/mob/living/carbon/human/species/species.dm b/code/modules/mob/living/carbon/human/species/species.dm index 6f6ebba1f89..23aa2a57dc1 100644 --- a/code/modules/mob/living/carbon/human/species/species.dm +++ b/code/modules/mob/living/carbon/human/species/species.dm @@ -528,3 +528,6 @@ amount *= water_damage_mod if(amount > 0) H.adjustToxLoss(amount) + +/datum/species/proc/handle_falling(mob/living/carbon/human/H, atom/hit_atom, damage_min, damage_max, silent, planetary) + return FALSE diff --git a/code/modules/mob/living/carbon/human/species/station/seromi.dm b/code/modules/mob/living/carbon/human/species/station/seromi.dm index c39357a3d6a..135c8f30ca3 100644 --- a/code/modules/mob/living/carbon/human/species/station/seromi.dm +++ b/code/modules/mob/living/carbon/human/species/station/seromi.dm @@ -141,6 +141,67 @@ /datum/mob_descriptor/build = -3 ) + var/static/list/flight_bodyparts = list( + BP_L_ARM, + BP_R_ARM, + BP_L_HAND, + BP_R_HAND + ) + var/static/list/flight_suit_blacklisted_types = list( + /obj/item/clothing/suit/space, + /obj/item/clothing/suit/straight_jacket + ) + /datum/species/teshari/equip_survival_gear(var/mob/living/carbon/human/H) ..() H.equip_to_slot_or_del(new /obj/item/clothing/shoes/sandal(H),slot_shoes) + +/datum/species/teshari/handle_falling(mob/living/carbon/human/H, atom/hit_atom, damage_min, damage_max, silent, planetary) + + // Tesh can glide to save themselves from some falls. Basejumping bird + // without parachute, or falling bird without free wings goes splat. + + // Are we landing from orbit, or handcuffed/unconscious/tied to something? + if(planetary || !istype(H) || H.incapacitated()) + return ..() + + // Are we landing on a turf? Not sure how this could not be the case, but let's be safe. + var/turf/landing = get_turf(hit_atom) + if(!istype(landing)) + return ..() + + if(H.buckled) + if(!silent) + to_chat(H, SPAN_WARNING("You try to spread your wings to slow your fall, but \the [H.buckled] weighs you down!")) + return ..() + + // Is there enough air to flap against? + var/datum/gas_mixture/environment = landing.return_air() + if(!environment || environment.return_pressure() < (ONE_ATMOSPHERE * 0.75)) + if(!silent) + to_chat(H, SPAN_WARNING("You spread your wings to slow your fall, but the air is too thin!")) + return ..() + + // Are we wearing a space suit? + if(H.wear_suit) + for(var/blacklisted_type in flight_suit_blacklisted_types) + if(istype(H.wear_suit, blacklisted_type)) + if(!silent) + to_chat(H, SPAN_WARNING("You try to spread your wings to slow your fall, but \the [H.wear_suit] is in the way!")) + return ..() + + // Do we have working wings? + for(var/bp in flight_bodyparts) + var/obj/item/organ/external/E = H.organs_by_name[bp] + if(!istype(E) || !E.is_usable() || E.is_broken() || E.is_stump()) + if(!silent) + to_chat(H, SPAN_WARNING("You try to spread your wings to slow your fall, but they won't hold your weight!")) + return ..() + + // Handled! + if(!silent) + to_chat(H, SPAN_NOTICE("You catch the air in your wings and greatly slow your fall.")) + H.visible_message(SPAN_NOTICE("\The [H] glides down from above, landing safely.")) + H.Stun(2) + playsound(H, "rustle", 25, 1) + return TRUE diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 010a170d1b0..6bb5c382e5e 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -848,8 +848,12 @@ if(lying) density = 0 - if(l_hand) unEquip(l_hand) - if(r_hand) unEquip(r_hand) + if(l_hand) + unEquip(l_hand) + if(r_hand) + unEquip(r_hand) + for(var/obj/item/weapon/holder/holder in get_mob_riding_slots()) + unEquip(holder) update_water() // Submerges the mob. else density = initial(density) @@ -877,6 +881,10 @@ return canmove +// Mob holders in these slots will be spilled if the mob goes prone. +/mob/living/proc/get_mob_riding_slots() + return list(back) + // Adds overlays for specific modifiers. // You'll have to add your own implementation for non-humans currently, just override this proc. /mob/living/proc/update_modifier_visuals() diff --git a/code/modules/multiz/movement.dm b/code/modules/multiz/movement.dm index ce8e1f6f8a0..40447a5a4b9 100644 --- a/code/modules/multiz/movement.dm +++ b/code/modules/multiz/movement.dm @@ -501,8 +501,10 @@ adjustBruteLoss(rand(damage_min, damage_max)) Weaken(4) updatehealth() - return - return + +/mob/living/carbon/human/fall_impact(atom/hit_atom, damage_min, damage_max, silent, planetary) + if(!species?.handle_falling(src, hit_atom, damage_min, damage_max, silent, planetary)) + ..() //Using /atom/movable instead of /obj/item because I'm not sure what all humans can pick up or wear /atom/movable