From fcf549aba5b66ec2fa55aec6cc7ada0c890e5b91 Mon Sep 17 00:00:00 2001 From: MistakeNot4892 Date: Wed, 1 May 2024 18:32:25 +1000 Subject: [PATCH] Further supporting tweaks for drakes. --- code/modules/emotes/definitions/audible.dm | 15 ------------- .../emotes/definitions/audible_cough.dm | 14 +++++++++++++ code/modules/emotes/definitions/tail.dm | 7 +++++++ code/modules/emotes/definitions/visible.dm | 5 +++-- code/modules/emotes/emote_define.dm | 10 ++++----- .../living/carbon/human/human_attackhand.dm | 2 +- .../mob/living/carbon/human/unarmed_attack.dm | 21 ++++++++++++------- code/modules/organs/internal/lungs.dm | 5 +++-- .../reagents/reagent_containers/food.dm | 8 +++---- code/modules/species/species_attack.dm | 9 ++++---- 10 files changed, 54 insertions(+), 42 deletions(-) diff --git a/code/modules/emotes/definitions/audible.dm b/code/modules/emotes/definitions/audible.dm index b92bbb03a4be..5e6a36e37028 100644 --- a/code/modules/emotes/definitions/audible.dm +++ b/code/modules/emotes/definitions/audible.dm @@ -90,21 +90,6 @@ key = "chuckle" emote_message_3p = "$USER$ chuckles." -/decl/emote/audible/cough - key = "cough" - -/decl/emote/audible/cough/mob_can_use(mob/living/user, assume_available = FALSE) - . = ..() - if(.) - var/obj/item/organ/internal/lungs/lung = user.get_organ(BP_LUNGS) - . = lung?.active_breathing && !user.isSynthetic() - -/decl/emote/audible/cough/do_emote(var/mob/living/user, var/extra_params) - if(!istype(user)) - to_chat(user, SPAN_WARNING("You are unable to cough.")) - return - user.cough(deliberate = TRUE) - /decl/emote/audible/cry key = "cry" emote_message_3p = "$USER$ cries." diff --git a/code/modules/emotes/definitions/audible_cough.dm b/code/modules/emotes/definitions/audible_cough.dm index 02a320479279..2723381fb0f7 100644 --- a/code/modules/emotes/definitions/audible_cough.dm +++ b/code/modules/emotes/definitions/audible_cough.dm @@ -12,3 +12,17 @@ emote_volume_synthetic = 50 conscious = FALSE bodytype_emote_sound = "cough" + +/decl/emote/audible/cough/mob_can_use(mob/living/user, assume_available = FALSE) + . = ..() + if(. && !user.isSynthetic()) + var/obj/item/organ/internal/lungs/lung = user.get_organ(BP_LUNGS) + . = lung?.active_breathing + +/decl/emote/audible/cough/do_emote(var/mob/living/user, var/extra_params) + . = ..() + if(. && istype(user)) + user.cough(silent = TRUE, deliberate = TRUE) + return TRUE + to_chat(src, SPAN_WARNING("You are unable to cough.")) + return FALSE diff --git a/code/modules/emotes/definitions/tail.dm b/code/modules/emotes/definitions/tail.dm index de38cf69141f..e4a5c1edc3e2 100644 --- a/code/modules/emotes/definitions/tail.dm +++ b/code/modules/emotes/definitions/tail.dm @@ -12,6 +12,7 @@ var/mob/living/carbon/human/human_user = user if(istype(human_user)) human_user.animate_tail_once() + return TRUE /decl/emote/visible/tail/wag key = "wag" @@ -20,6 +21,7 @@ var/mob/living/carbon/human/human_user = user if(istype(human_user)) human_user.animate_tail_start() + return TRUE /decl/emote/visible/tail/sway key = "sway" @@ -28,6 +30,7 @@ var/mob/living/carbon/human/human_user = user if(istype(human_user)) human_user.animate_tail_start() + return TRUE /decl/emote/visible/tail/qwag key = "qwag" @@ -36,6 +39,7 @@ var/mob/living/carbon/human/human_user = user if(istype(human_user)) human_user.animate_tail_fast() + return TRUE /decl/emote/visible/tail/fastsway key = "fastsway" @@ -44,6 +48,7 @@ var/mob/living/carbon/human/human_user = user if(istype(human_user)) human_user.animate_tail_fast() + return TRUE /decl/emote/visible/tail/swag key = "swag" @@ -52,6 +57,7 @@ var/mob/living/carbon/human/human_user = user if(istype(human_user)) human_user.animate_tail_stop() + return TRUE /decl/emote/visible/tail/stopsway key = "stopsway" @@ -60,3 +66,4 @@ var/mob/living/carbon/human/human_user = user if(istype(human_user)) human_user.animate_tail_stop() + return TRUE diff --git a/code/modules/emotes/definitions/visible.dm b/code/modules/emotes/definitions/visible.dm index ea4373df470e..c4c2f76ae2c5 100644 --- a/code/modules/emotes/definitions/visible.dm +++ b/code/modules/emotes/definitions/visible.dm @@ -365,5 +365,6 @@ var/mob/living/carbon/human/H = user if(istype(H)) H.vomit(deliberate = TRUE) - else - to_chat(src, SPAN_WARNING("You are unable to vomit.")) + return TRUE + to_chat(src, SPAN_WARNING("You are unable to vomit.")) + return FALSE diff --git a/code/modules/emotes/emote_define.dm b/code/modules/emotes/emote_define.dm index ed76416f9e7f..a522d292aff4 100644 --- a/code/modules/emotes/emote_define.dm +++ b/code/modules/emotes/emote_define.dm @@ -180,7 +180,7 @@ var/global/list/_emotes_by_key var/mob/M = user if(M.restrained()) to_chat(user, SPAN_WARNING("You are restrained and cannot do that.")) - return + return FALSE if(emote_cooldown) var/user_ref = "\ref[user]" @@ -212,7 +212,7 @@ var/global/list/_emotes_by_key if(mandatory_targetted_emote && !target) to_chat(user, SPAN_WARNING("You can't do that to thin air.")) - return + return FALSE var/use_1p = get_emote_message_1p(user, target, extra_params) if(use_1p) @@ -243,14 +243,14 @@ var/global/list/_emotes_by_key var/mob/living/L = user if(HAS_STATUS(L, STAT_SILENCE)) M.visible_message(message = "[user] opens their mouth silently!", self_message = "You cannot say anything!", blind_message = emote_message_impaired, checkghosts = /datum/client_preference/ghost_sight) - return - else - M.audible_message(message = use_3p, self_message = use_1p, deaf_message = emote_message_impaired, hearing_distance = use_range, checkghosts = /datum/client_preference/ghost_sight, radio_message = use_radio) + return FALSE + M.audible_message(message = use_3p, self_message = use_1p, deaf_message = emote_message_impaired, hearing_distance = use_range, checkghosts = /datum/client_preference/ghost_sight, radio_message = use_radio) else M.visible_message(message = use_3p, self_message = use_1p, blind_message = emote_message_impaired, range = use_range, checkghosts = /datum/client_preference/ghost_sight) do_extra(user, target) do_sound(user) + return TRUE /decl/emote/proc/replace_target_tokens(var/msg, var/atom/target) . = msg diff --git a/code/modules/mob/living/carbon/human/human_attackhand.dm b/code/modules/mob/living/carbon/human/human_attackhand.dm index fe16fb6e8c1e..3a40de391229 100644 --- a/code/modules/mob/living/carbon/human/human_attackhand.dm +++ b/code/modules/mob/living/carbon/human/human_attackhand.dm @@ -151,7 +151,7 @@ return TRUE var/real_damage = rand_damage - real_damage += attack.get_unarmed_damage(H) + real_damage += attack.get_unarmed_damage(H, src) real_damage *= damage_multiplier rand_damage *= damage_multiplier real_damage = max(1, real_damage) diff --git a/code/modules/mob/living/carbon/human/unarmed_attack.dm b/code/modules/mob/living/carbon/human/unarmed_attack.dm index f9480eccc43c..abe7c83f1bda 100644 --- a/code/modules/mob/living/carbon/human/unarmed_attack.dm +++ b/code/modules/mob/living/carbon/human/unarmed_attack.dm @@ -66,18 +66,21 @@ return TRUE return FALSE -/decl/natural_attack/proc/get_unarmed_damage() +/decl/natural_attack/proc/get_unarmed_damage(mob/living/user, mob/living/victim) return damage -/decl/natural_attack/proc/apply_effects(var/mob/living/carbon/human/user,var/mob/living/carbon/human/target,var/attack_damage,var/zone) +// Returns TRUE if further affects should be applied. +/decl/natural_attack/proc/apply_effects(mob/living/user, mob/living/target, attack_damage, zone) if(target.stat == DEAD) - return + return FALSE - var/stun_chance = rand(0, 100) var/armour = target.get_blocked_ratio(zone, BRUTE, damage = attack_damage) + if(armour >= 1) + return FALSE - if(attack_damage >= 5 && armour < 1 && !(target == user) && stun_chance <= attack_damage * 5) // 25% standard chance + var/stun_chance = rand(0, 100) + if(attack_damage >= 5 && !(target == user) && stun_chance <= attack_damage * 5) // 25% standard chance switch(zone) // strong punches can have effects depending on where they hit if(BP_HEAD, BP_EYES, BP_MOUTH) // Induce blurriness @@ -112,7 +115,7 @@ if(!target.lying) target.visible_message("[target] gives way slightly.") target.apply_effect(attack_damage*3, PAIN, armour) - else if(attack_damage >= 5 && !(target == user) && (stun_chance + attack_damage * 5 >= 100) && armour < 1) // Chance to get the usual throwdown as well (25% standard chance) + else if(attack_damage >= 5 && !(target == user) && (stun_chance + attack_damage * 5 >= 100)) // Chance to get the usual throwdown as well (25% standard chance) if(!target.lying) target.visible_message("[target] [pick("slumps", "falls", "drops")] down to the ground!") else @@ -123,6 +126,8 @@ if(istype(C) && prob(10)) C.leave_evidence(user) + return TRUE + /decl/natural_attack/proc/show_attack(var/mob/living/carbon/human/user, var/mob/living/carbon/human/target, var/zone, var/attack_damage) var/msg = "\The [user] [pick(attack_verb)] \the [target]" var/obj/item/organ/external/affecting = istype(target) && zone && GET_EXTERNAL_ORGAN(target, zone) @@ -258,7 +263,7 @@ zone = BP_CHEST . = ..() -/decl/natural_attack/kick/get_unarmed_damage(var/mob/living/carbon/human/user) +/decl/natural_attack/kick/get_unarmed_damage(mob/living/user, mob/living/victim) var/obj/item/clothing/shoes = user.get_equipped_item(slot_shoes_str) if(!istype(shoes)) return damage @@ -296,7 +301,7 @@ return TRUE return FALSE -/decl/natural_attack/stomp/get_unarmed_damage(var/mob/living/carbon/human/user) +/decl/natural_attack/stomp/get_unarmed_damage(mob/living/user, mob/living/victim) var/obj/item/clothing/shoes = user.get_equipped_item(slot_shoes_str) return damage + (shoes ? shoes.force : 0) diff --git a/code/modules/organs/internal/lungs.dm b/code/modules/organs/internal/lungs.dm index c3430ae4ea93..e34edb6f2d9b 100644 --- a/code/modules/organs/internal/lungs.dm +++ b/code/modules/organs/internal/lungs.dm @@ -362,7 +362,7 @@ name = "lungs and gills" has_gills = TRUE -/mob/living/proc/cough(var/deliberate = FALSE) +/mob/living/proc/cough(silent = FALSE, deliberate = FALSE) var/obj/item/organ/internal/lungs/lung = get_organ(BP_LUNGS) if(!lung || !lung.active_breathing || isSynthetic() || stat == DEAD || (deliberate && last_cough + 3 SECONDS > world.time)) @@ -377,7 +377,8 @@ to_chat(src, SPAN_WARNING("You cannot do that right now.")) return - audible_message("[src] coughs!", "You cough!", radio_message = "coughs!") // styled like an emote + if(!silent) + audible_message("[src] coughs!", "You cough!", radio_message = "coughs!") // styled like an emote last_cough = world.time diff --git a/code/modules/reagents/reagent_containers/food.dm b/code/modules/reagents/reagent_containers/food.dm index 2dad0f95e459..86f12dd5a0ea 100644 --- a/code/modules/reagents/reagent_containers/food.dm +++ b/code/modules/reagents/reagent_containers/food.dm @@ -60,11 +60,9 @@ return FALSE /obj/item/chems/food/attack_self(mob/user) - if(is_edible(user)) - use_on_mob(user, user) - else - to_chat(user, SPAN_WARNING("\The [src] is empty!")) - return TRUE + if(is_edible(user) && handle_eaten_by_mob(user, user) != EATEN_INVALID) + return TRUE + return ..() /obj/item/chems/food/dragged_onto(var/mob/user) return attack_self(user) diff --git a/code/modules/species/species_attack.dm b/code/modules/species/species_attack.dm index 3582aba6ebc2..b09bfdacc0d0 100644 --- a/code/modules/species/species_attack.dm +++ b/code/modules/species/species_attack.dm @@ -90,15 +90,16 @@ damage = 2 usable_with_limbs = list(BP_CHEST, BP_GROIN) -/decl/natural_attack/slime_glomp/apply_effects(var/mob/living/carbon/human/user,var/mob/living/carbon/human/target,var/armour,var/attack_damage,var/zone) - ..() - user.apply_stored_shock_to(target) +/decl/natural_attack/slime_glomp/apply_effects(mob/living/user, mob/living/target, attack_damage, zone) + . = ..() + if(.) + user.apply_stored_shock_to(target) /decl/natural_attack/stomp/weak name = "weak stomp" attack_verb = list("jumped on") -/decl/natural_attack/stomp/weak/get_unarmed_damage() +/decl/natural_attack/stomp/weak/get_unarmed_damage(mob/living/user, mob/living/victim) return damage /decl/natural_attack/stomp/weak/show_attack(var/mob/living/carbon/human/user, var/mob/living/carbon/human/target, var/zone, var/attack_damage)