Skip to content

Commit

Permalink
Further supporting tweaks for drakes.
Browse files Browse the repository at this point in the history
  • Loading branch information
MistakeNot4892 committed May 1, 2024
1 parent bb01524 commit bed652d
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 47 deletions.
15 changes: 0 additions & 15 deletions code/modules/emotes/definitions/audible.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
16 changes: 15 additions & 1 deletion code/modules/emotes/definitions/audible_cough.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
emote_message_1p = "You cough!"
emote_message_1p_target = "You cough on $TARGET$!"
emote_message_3p = "$USER$ coughs!"
emote_message_3p_target = "$USER$ coughs on $TARGET!"
emote_message_3p_target = "$USER$ coughs on $TARGET$!"
emote_message_synthetic_1p_target = "You emit a robotic cough towards $TARGET$."
emote_message_synthetic_1p = "You emit a robotic cough."
emote_message_synthetic_3p_target = "$USER$ emits a robotic cough towards $TARGET$."
Expand All @@ -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
5 changes: 3 additions & 2 deletions code/modules/emotes/definitions/audible_slap.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
emote_sound = 'sound/effects/snap.ogg'
check_restraints = TRUE
check_range = 1
check_adjacent = TRUE

/decl/emote/audible/slap/New()
..()
/decl/emote/audible/slap/Initialize()
. = ..()
emote_message_1p_target = SPAN_DANGER(emote_message_1p_target)
emote_message_1p = SPAN_DANGER(emote_message_1p)
emote_message_3p_target = SPAN_DANGER(emote_message_3p_target)
Expand Down
7 changes: 7 additions & 0 deletions code/modules/emotes/definitions/tail.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -60,3 +66,4 @@
var/mob/living/carbon/human/human_user = user
if(istype(human_user))
human_user.animate_tail_stop()
return TRUE
5 changes: 3 additions & 2 deletions code/modules/emotes/definitions/visible.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 9 additions & 7 deletions code/modules/emotes/emote_define.dm
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ var/global/list/_emotes_by_key
var/check_restraints
/// falsy, or a range outside which the emote will not work
var/check_range
/// For emotes with physical effecets.
var/check_adjacent
/// Do we need to be awake to emote this?
var/conscious = TRUE
/// If >0, restricts emote visibility to viewers within range.
Expand Down Expand Up @@ -171,16 +173,16 @@ var/global/list/_emotes_by_key
LAZYINITLIST(.)
LAZYSET(., "broadcast", use_broadcast_sound)

/decl/emote/proc/finalize_target(var/atom/target)
return TRUE
/decl/emote/proc/finalize_target(atom/user, atom/target)
return istype(target) && (!check_adjacent || target.Adjacent(user))

/decl/emote/proc/do_emote(var/atom/user, var/extra_params)

if(ismob(user) && check_restraints)
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]"
Expand Down Expand Up @@ -212,7 +214,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)
Expand Down Expand Up @@ -243,14 +245,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
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/human/human_attackhand.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
21 changes: 13 additions & 8 deletions code/modules/mob/living/carbon/human/unarmed_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -112,7 +115,7 @@
if(!target.lying)
target.visible_message("<span class='warning'>[target] gives way slightly.</span>")
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("<span class='danger'>[target] [pick("slumps", "falls", "drops")] down to the ground!</span>")
else
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down
5 changes: 3 additions & 2 deletions code/modules/organs/internal/lungs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -377,7 +377,8 @@
to_chat(src, SPAN_WARNING("You cannot do that right now."))
return

audible_message("<b>[src]</b> coughs!", "You cough!", radio_message = "coughs!") // styled like an emote
if(!silent)
audible_message("<b>[src]</b> coughs!", "You cough!", radio_message = "coughs!") // styled like an emote

last_cough = world.time

Expand Down
8 changes: 3 additions & 5 deletions code/modules/reagents/reagent_containers/food.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 5 additions & 4 deletions code/modules/species/species_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit bed652d

Please sign in to comment.