diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index dad3a686977..c9217db38e9 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -103,32 +103,37 @@ avoid code duplication. This includes items that may sometimes act as a standard to_chat(user, SPAN_WARNING("You don't want to harm other living beings!")) return 0 - if(!force) - playsound(loc, 'sound/weapons/tap.ogg', get_clamped_volume(), 1, -1) - else if(hitsound) - playsound(loc, hitsound, get_clamped_volume(), 1, -1) - - ///////////////////////// - user.lastattacked = M - M.lastattacker = user - - if(!no_attack_log) - user.attack_log += "\[[time_stamp()]\] Attacked [M.name] ([M.ckey]) with [name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(damtype)])" - M.attack_log += "\[[time_stamp()]\] Attacked by [user.name] ([user.ckey]) with [name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(damtype)])" - msg_admin_attack("[key_name(user, highlight_special = 1)] attacked [key_name(M, highlight_special = 1)] with [name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(damtype)]) (JMP)",ckey=key_name(user),ckey_target=key_name(M) ) - ///////////////////////// - user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) user.do_attack_animation(M, src) if(!user.aura_check(AURA_TYPE_WEAPON, src, user)) return FALSE var/mob/living/victim = M.get_attack_victim(src, user, target_zone) + var/hit_zone if(victim) - var/hit_zone = victim.resolve_item_attack(src, user, target_zone) + hit_zone = victim.resolve_item_attack(src, user, target_zone) if(hit_zone) apply_hit_effect(victim, user, hit_zone) + // Null hitzone means a miss. + if(hit_zone) + if(!force) + playsound(loc, 'sound/weapons/tap.ogg', get_clamped_volume(), 1, -1) + else if(hitsound) + playsound(loc, hitsound, get_clamped_volume(), 1, -1) + else + playsound(loc, 'sound/weapons/punchmiss2.ogg', get_clamped_volume(), 1, -1) + + ///////////////////////// + user.lastattacked = M + M.lastattacker = user + + if(!no_attack_log) + user.attack_log += "\[[time_stamp()]\] [hit_zone ? "Attacked" : "Missed"] [M.name] ([M.ckey]) with [name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(damtype)])" + M.attack_log += "\[[time_stamp()]\] [hit_zone ? "Attacked" : "Missed"] by [user.name] ([user.ckey]) with [name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(damtype)])" + msg_admin_attack("[key_name(user, highlight_special = 1)] [hit_zone ? "attacked" : "missed"] [key_name(M, highlight_special = 1)] with [name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(damtype)]) (JMP)",ckey=key_name(user),ckey_target=key_name(M) ) + ///////////////////////// + return 1 //Called when a weapon is used to make a successful melee attack on a mob. Returns whether damage was dealt. diff --git a/html/changelogs/mattatlas-missedopportunity.yml b/html/changelogs/mattatlas-missedopportunity.yml new file mode 100644 index 00000000000..ccab8cc58c4 --- /dev/null +++ b/html/changelogs/mattatlas-missedopportunity.yml @@ -0,0 +1,58 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# - (fixes bugs) +# wip +# - (work in progress) +# qol +# - (quality of life) +# soundadd +# - (adds a sound) +# sounddel +# - (removes a sound) +# rscadd +# - (adds a feature) +# rscdel +# - (removes a feature) +# imageadd +# - (adds an image or sprite) +# imagedel +# - (removes an image or sprite) +# spellcheck +# - (fixes spelling or grammar) +# experiment +# - (experimental change) +# balance +# - (balance changes) +# code_imp +# - (misc internal code change) +# refactor +# - (refactors code) +# config +# - (makes a change to the config files) +# admin +# - (makes changes to administrator tools) +# server +# - (miscellaneous changes to server) +################################# + +# Your name. +author: MattAtlas + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit. +# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "Melee weapons now give audiovisual feedback when they miss a target."