From 0b5bb3fbf0f93f0a73cff1837e4e054a23132364 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. (#7990) * Allows Teshari to glide in some multiz fall conditions. * Carried mobs will now fall off you if you go prone. --- code/modules/mob/living/carbon/human/human.dm | 3 + .../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, 81 insertions(+), 4 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 49c0d04013..fd9612abcb 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1617,3 +1617,6 @@ to_chat(src, span("warning", "\The [rig]'s visor has shuddenly deactivated!")) ..() + +/mob/living/carbon/human/get_mob_riding_slots() + return list(back, head, wear_suit) diff --git a/code/modules/mob/living/carbon/human/species/species.dm b/code/modules/mob/living/carbon/human/species/species.dm index 130da51b1b..3302e3417c 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 a70feae2de..938a8b1b39 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 2abf65b20e..c16bce0c57 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -839,8 +839,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) @@ -856,6 +860,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 1ca84e1454..ab0be6db78 100644 --- a/code/modules/multiz/movement.dm +++ b/code/modules/multiz/movement.dm @@ -442,8 +442,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