diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index d96f8eca685..88277514ad9 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -534,4 +534,15 @@ var/global/list/ghost_others_options = list(GHOST_OTHERS_SIMPLE, GHOST_OTHERS_DE //Luma coefficients suggested for HDTVs. If you change these, make sure they add up to 1. #define LUMA_R 0.213 #define LUMA_G 0.715 -#define LUMA_B 0.072 \ No newline at end of file +#define LUMA_B 0.072 + + +//attack visual effects +#define ATTACK_EFFECT_PUNCH "punch" +#define ATTACK_EFFECT_KICK "kick" +#define ATTACK_EFFECT_SMASH "smash" +#define ATTACK_EFFECT_CLAW "claw" +#define ATTACK_EFFECT_DISARM "disarm" +#define ATTACK_EFFECT_BITE "bite" +#define ATTACK_EFFECT_MECHFIRE "mech_fire" +#define ATTACK_EFFECT_MECHTOXIN "mech_toxin" diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index 3a339e0f349..38ab33e0eb1 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -34,8 +34,7 @@ user.lastattacked = M M.lastattacker = user - if(user != M) - user.do_attack_animation(M) + user.do_attack_animation(M) M.attacked_by(src, user) add_logs(user, M, "attacked", src.name, "(INTENT: [uppertext(user.a_intent)]) (DAMTYPE: [uppertext(damtype)])") @@ -57,7 +56,8 @@ /obj/attacked_by(obj/item/I, mob/living/user) if(I.force) - user.visible_message("[user] has hit [src] with [I]!", "You hit [src] with [I]!") + visible_message("[user] has hit [src] with [I]!", null, null, 2, user) + //only witnesses close by and the victim see a hit message. take_damage(I.force, I.damtype, "melee", 1) /mob/living/attacked_by(obj/item/I, mob/living/user) @@ -74,12 +74,8 @@ return TRUE //successful attack /mob/living/simple_animal/attacked_by(obj/item/I, mob/living/user) - if(!I.force) - user.visible_message("[user] gently taps [src] with [I].",\ - "This weapon is ineffective, it does no damage!") - else if(I.force < force_threshold || I.damtype == STAMINA) - visible_message("[I] bounces harmlessly off of [src].",\ - "[I] bounces harmlessly off of [src]!") + if(I.force < force_threshold || I.damtype == STAMINA) + playsound(loc, 'sound/weapons/tap.ogg', I.get_clamped_volume(), 1, -1) else return ..() @@ -105,11 +101,10 @@ var/message_hit_area = "" if(hit_area) message_hit_area = " in the [hit_area]" - var/attack_message = "[src] has been [message_verb][message_hit_area] with [I]." if(user in viewers(src, null)) attack_message = "[user] has [message_verb] [src][message_hit_area] with [I]!" - visible_message("[attack_message]", - "[attack_message]") + visible_message("[attack_message]", \ + "[attack_message]", null, 2,user) return 1 diff --git a/code/datums/martial.dm b/code/datums/martial.dm index b7e65bf3cf1..29763389f5f 100644 --- a/code/datums/martial.dm +++ b/code/datums/martial.dm @@ -28,16 +28,26 @@ /datum/martial_art/proc/basic_hit(mob/living/carbon/human/A,mob/living/carbon/human/D) - A.do_attack_animation(D) var/damage = rand(A.dna.species.punchdamagelow, A.dna.species.punchdamagehigh) var/atk_verb = A.dna.species.attack_verb if(D.lying) atk_verb = "kick" + switch(atk_verb) + if("kick") + A.do_attack_animation(D, ATTACK_EFFECT_KICK) + if("slash") + A.do_attack_animation(D, ATTACK_EFFECT_CLAW) + if("smash") + A.do_attack_animation(D, ATTACK_EFFECT_SMASH) + else + A.do_attack_animation(D, ATTACK_EFFECT_PUNCH) + if(!damage) playsound(D.loc, A.dna.species.miss_sound, 25, 1, -1) - D.visible_message("[A] has attempted to [atk_verb] [D]!") + D.visible_message("[A] has attempted to [atk_verb] [D]!", \ + "[A] has attempted to [atk_verb] [D]!", null, 2, A) add_logs(A, D, "attempted to [atk_verb]") return 0 @@ -46,7 +56,7 @@ playsound(D.loc, A.dna.species.attack_sound, 25, 1, -1) D.visible_message("[A] has [atk_verb]ed [D]!", \ - "[A] has [atk_verb]ed [D]!") + "[A] has [atk_verb]ed [D]!", null, 2, A) D.apply_damage(damage, BRUTE, affecting, armor_block) @@ -90,14 +100,15 @@ /datum/martial_art/boxing/harm_act(mob/living/carbon/human/A, mob/living/carbon/human/D) - A.do_attack_animation(D) + A.do_attack_animation(D, ATTACK_EFFECT_PUNCH) var/atk_verb = pick("left hook","right hook","straight punch") var/damage = rand(5, 8) + A.dna.species.punchdamagelow if(!damage) playsound(D.loc, A.dna.species.miss_sound, 25, 1, -1) - D.visible_message("[A] has attempted to hit [D] with a [atk_verb]!") + D.visible_message("[A] has attempted to [atk_verb] [D]!", \ + "[A] has attempted to [atk_verb] [D]!", null, 2, A) add_logs(A, D, "attempted to hit", atk_verb) return 0 @@ -107,8 +118,8 @@ playsound(D.loc, A.dna.species.attack_sound, 25, 1, -1) - D.visible_message("[A] has hit [D] with a [atk_verb]!", \ - "[A] has hit [D] with a [atk_verb]!") + D.visible_message("[A] has [atk_verb]ed [D]!", \ + "[A] has [atk_verb]ed [D]!", null, 2, A) D.apply_damage(damage, STAMINA, affecting, armor_block) add_logs(A, D, "punched (boxing) ") @@ -185,7 +196,7 @@ return /datum/martial_art/plasma_fist/proc/Plasma(mob/living/carbon/human/A, mob/living/carbon/human/D) - A.do_attack_animation(D) + A.do_attack_animation(D, ATTACK_EFFECT_PUNCH) playsound(D.loc, 'sound/weapons/punch1.ogg', 50, 1, -1) A.say("PLASMA FIST!") D.visible_message("[A] has hit [D] with THE PLASMA FIST TECHNIQUE!", \ @@ -261,7 +272,7 @@ /datum/martial_art/the_sleeping_carp/proc/wristWrench(mob/living/carbon/human/A, mob/living/carbon/human/D) if(!D.stat && !D.stunned && !D.weakened) - A.do_attack_animation(D) + A.do_attack_animation(D, ATTACK_EFFECT_PUNCH) D.visible_message("[A] grabs [D]'s wrist and wrenches it sideways!", \ "[A] grabs your wrist and violently wrenches it to the side!") playsound(get_turf(A), 'sound/weapons/thudswoosh.ogg', 50, 1, -1) @@ -275,7 +286,7 @@ /datum/martial_art/the_sleeping_carp/proc/backKick(mob/living/carbon/human/A, mob/living/carbon/human/D) if(A.dir == D.dir && !D.stat && !D.weakened) - A.do_attack_animation(D) + A.do_attack_animation(D, ATTACK_EFFECT_PUNCH) D.visible_message("[A] kicks [D] in the back!", \ "[A] kicks you in the back, making you stumble and fall!") step_to(D,get_step(D,D.dir),1) @@ -287,7 +298,7 @@ /datum/martial_art/the_sleeping_carp/proc/kneeStomach(mob/living/carbon/human/A, mob/living/carbon/human/D) if(!D.stat && !D.weakened) - A.do_attack_animation(D) + A.do_attack_animation(D, ATTACK_EFFECT_KICK) D.visible_message("[A] knees [D] in the stomach!", \ "[A] winds you with a knee in the stomach!") D.audible_message("[D] gags!") @@ -300,7 +311,7 @@ /datum/martial_art/the_sleeping_carp/proc/headKick(mob/living/carbon/human/A, mob/living/carbon/human/D) if(!D.stat && !D.weakened) - A.do_attack_animation(D) + A.do_attack_animation(D, ATTACK_EFFECT_KICK) D.visible_message("[A] kicks [D] in the head!", \ "[A] kicks you in the jaw!") D.apply_damage(20, BRUTE, "head") @@ -313,7 +324,7 @@ /datum/martial_art/the_sleeping_carp/proc/elbowDrop(mob/living/carbon/human/A, mob/living/carbon/human/D) if(D.weakened || D.resting || D.stat) - A.do_attack_animation(D) + A.do_attack_animation(D, ATTACK_EFFECT_PUNCH) D.visible_message("[A] elbow drops [D]!", \ "[A] piledrives you with their elbow!") if(D.stat) @@ -343,7 +354,7 @@ add_to_streak("H",D) if(check_streak(A,D)) return 1 - A.do_attack_animation(D) + A.do_attack_animation(D, ATTACK_EFFECT_PUNCH) var/atk_verb = pick("punches", "kicks", "chops", "hits", "slams") D.visible_message("[A] [atk_verb] [D]!", \ "[A] [atk_verb] you!") diff --git a/code/datums/martial/krav_maga.dm b/code/datums/martial/krav_maga.dm index eb74f98550d..932d7750216 100644 --- a/code/datums/martial/krav_maga.dm +++ b/code/datums/martial/krav_maga.dm @@ -110,7 +110,6 @@ datum/martial_art/krav_maga/grab_act(var/mob/living/carbon/human/A, var/mob/livi if(check_streak(A,D)) return 1 add_logs(A, D, "punched") - A.do_attack_animation(D) var/picked_hit_type = pick("punches", "kicks") var/bonus_damage = 10 if(D.weakened || D.resting || D.lying) @@ -118,8 +117,10 @@ datum/martial_art/krav_maga/grab_act(var/mob/living/carbon/human/A, var/mob/livi picked_hit_type = "stomps on" D.apply_damage(bonus_damage, BRUTE) if(picked_hit_type == "kicks" || picked_hit_type == "stomps") + A.do_attack_animation(D, ATTACK_EFFECT_KICK) playsound(get_turf(D), 'sound/effects/hit_kick.ogg', 50, 1, -1) else + A.do_attack_animation(D, ATTACK_EFFECT_PUNCH) playsound(get_turf(D), 'sound/effects/hit_punch.ogg', 50, 1, -1) D.visible_message("[A] [picked_hit_type] [D]!", \ "[A] [picked_hit_type] you!") diff --git a/code/game/atoms.dm b/code/game/atoms.dm index eb24d708c1f..bb874f8bed7 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -66,7 +66,7 @@ if(does_attack_animation) user.changeNext_move(CLICK_CD_MELEE) add_logs(user, src, "punched", "hulk powers") - user.do_attack_animation(src) + user.do_attack_animation(src, ATTACK_EFFECT_SMASH) /atom/proc/CheckParts(list/parts_list) for(var/A in parts_list) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index ea1214f2989..7c7814d6b5f 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -348,3 +348,64 @@ //called when a mob resists while inside a container that is itself inside something. /atom/movable/proc/relay_container_resist(mob/living/user, obj/O) return + + + +/atom/movable/proc/do_attack_animation(atom/A, visual_effect_icon, obj/item/used_item, no_effect, end_pixel_y) + if(!no_effect && (visual_effect_icon || used_item)) + do_item_attack_animation(A, visual_effect_icon, used_item) + + var/pixel_x_diff = 0 + var/pixel_y_diff = 0 + var/final_pixel_y = initial(pixel_y) + if(end_pixel_y) + final_pixel_y = end_pixel_y + + var/direction = get_dir(src, A) + if(direction & NORTH) + pixel_y_diff = 8 + else if(direction & SOUTH) + pixel_y_diff = -8 + + if(direction & EAST) + pixel_x_diff = 8 + else if(direction & WEST) + pixel_x_diff = -8 + + animate(src, pixel_x = pixel_x + pixel_x_diff, pixel_y = pixel_y + pixel_y_diff, time = 2) + animate(pixel_x = initial(pixel_x), pixel_y = final_pixel_y, time = 2) + +/atom/movable/proc/do_item_attack_animation(atom/A, visual_effect_icon, obj/item/used_item) + var/image/I + if(visual_effect_icon) + I = image('icons/effects/effects.dmi', A, visual_effect_icon, A.layer + 0.1) + else if(used_item) + I = image(used_item.icon, A, used_item.icon_state, A.layer + 0.1) + + // Scale the icon. + I.transform *= 0.75 + // The icon should not rotate. + I.appearance_flags = APPEARANCE_UI_IGNORE_ALPHA + + // Set the direction of the icon animation. + var/direction = get_dir(src, A) + if(direction & NORTH) + I.pixel_y = -16 + else if(direction & SOUTH) + I.pixel_y = 16 + + if(direction & EAST) + I.pixel_x = -16 + else if(direction & WEST) + I.pixel_x = 16 + + if(!direction) // Attacked self?! + I.pixel_z = 16 + + if(!I) + return + + flick_overlay(I, clients, 5) // 5 ticks/half a second + + // And animate the attack! + animate(I, alpha = 175, pixel_x = 0, pixel_y = 0, pixel_z = 0, time = 3) diff --git a/code/game/gamemodes/devil/true_devil/_true_devil.dm b/code/game/gamemodes/devil/true_devil/_true_devil.dm index 22bb549558d..0ba2a3ccb90 100644 --- a/code/game/gamemodes/devil/true_devil/_true_devil.dm +++ b/code/game/gamemodes/devil/true_devil/_true_devil.dm @@ -130,7 +130,7 @@ attack_message = "[user] has [message_verb] [src] with [I]!" if(message_verb) visible_message("[attack_message]", - "[attack_message]") + "[attack_message]", null, 2, user) return TRUE /mob/living/carbon/true_devil/Process_Spacemove(movement_dir = 0) diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm index 7c428691857..535dae8806e 100644 --- a/code/game/machinery/machinery.dm +++ b/code/game/machinery/machinery.dm @@ -246,9 +246,8 @@ Class Procs: return attack_hand(user) else user.changeNext_move(CLICK_CD_MELEE) - user.do_attack_animation(src) - user.visible_message("[user.name] smashes against \the [src.name] with its paws.",\ - "You smash against the [src.name] with your paws.") + user.do_attack_animation(src, ATTACK_EFFECT_PUNCH) + user.visible_message("[user.name] smashes against \the [src.name] with its paws.", null, null, 2, user) take_damage(4, BRUTE, "melee", 1) diff --git a/code/game/machinery/porta_turret/portable_turret_cover.dm b/code/game/machinery/porta_turret/portable_turret_cover.dm index 5e2a860da13..4ecfb355932 100644 --- a/code/game/machinery/porta_turret/portable_turret_cover.dm +++ b/code/game/machinery/porta_turret/portable_turret_cover.dm @@ -83,7 +83,7 @@ parent_turret.attack_animal(user) /obj/machinery/porta_turret_cover/attack_hulk(mob/living/carbon/human/user, does_attack_animation = 0) - parent_turret.attack_hulk(user) + return parent_turret.attack_hulk(user) /obj/machinery/porta_turret_cover/can_be_overridden() . = 0 diff --git a/code/game/mecha/equipment/weapons/weapons.dm b/code/game/mecha/equipment/weapons/weapons.dm index 81f693e4c8f..8e7909fd87f 100644 --- a/code/game/mecha/equipment/weapons/weapons.dm +++ b/code/game/mecha/equipment/weapons/weapons.dm @@ -8,6 +8,7 @@ var/variance = 0 var/randomspread = 0 //use random spread for machineguns, instead of shotgun scatter var/projectile_delay = 0 + var/firing_effect_type = /obj/effect/overlay/temp/dir_setting/firing_effect //the visual effect appearing when the weapon is fired. /obj/item/mecha_parts/mecha_equipment/weapon/can_attach(obj/mecha/combat/M) if(..()) @@ -35,6 +36,9 @@ A.firer = chassis.occupant A.original = target A.current = curloc + if(!A.suppressed && firing_effect_type) + PoolOrNew(firing_effect_type, list(get_turf(src), chassis.dir)) + var/spread = 0 if(variance) @@ -56,6 +60,7 @@ //Base energy weapon type /obj/item/mecha_parts/mecha_equipment/weapon/energy name = "general energy weapon" + firing_effect_type = /obj/effect/overlay/temp/dir_setting/firing_effect/energy /obj/item/mecha_parts/mecha_equipment/weapon/energy/get_shot_amount() return min(round(chassis.cell.charge / energy_drain), projectiles_per_shot) diff --git a/code/game/mecha/mecha_defense.dm b/code/game/mecha/mecha_defense.dm index 55d98e86a88..60d17d478a5 100644 --- a/code/game/mecha/mecha_defense.dm +++ b/code/game/mecha/mecha_defense.dm @@ -54,9 +54,10 @@ /obj/mecha/attack_hand(mob/living/user) user.changeNext_move(CLICK_CD_MELEE) // Ugh. Ideally we shouldn't be setting cooldowns outside of click code. - user.do_attack_animation(src) + user.do_attack_animation(src, ATTACK_EFFECT_PUNCH) + playsound(loc, 'sound/weapons/tap.ogg', 40, 1, -1) + user.visible_message("[user] hits [name]. Nothing happens", null, null, 2, user) log_message("Attack by hand/paw. Attacker - [user].",1) - user.visible_message("[user] hits [name]. Nothing happens","You hit [name] with no visible effect.") log_append_to_last("Armor saved.") /obj/mecha/attack_paw(mob/user as mob) @@ -93,9 +94,10 @@ log_message("Attack by hulk. Attacker - [user].",1) user.changeNext_move(CLICK_CD_MELEE) add_logs(user, src, "punched", "hulk powers") - user.do_attack_animation(src) - user.visible_message("[user] hits [name]. The metal creaks and bends.") + user.visible_message("[user] hits [name]. The metal creaks and bends.", null, null, 2, user) + user.do_attack_animation(src, ATTACK_EFFECT_SMASH) take_damage(15, BRUTE, "melee", 0, get_dir(src, user)) + return 1 /obj/mecha/blob_act(obj/structure/blob/B) take_damage(30, BRUTE, "melee", 0, get_dir(src, B)) @@ -317,3 +319,16 @@ go_out(TRUE) if(L) L.ratvar_act() + +/obj/mecha/do_attack_animation(atom/A, visual_effect_icon, obj/item/used_item, no_effect, end_pixel_y) + if(!no_effect) + if(selected) + used_item = selected + else if(!visual_effect_icon) + visual_effect_icon = ATTACK_EFFECT_SMASH + if(damtype == BURN) + visual_effect_icon = ATTACK_EFFECT_MECHFIRE + else if(damtype == TOX) + visual_effect_icon = ATTACK_EFFECT_MECHTOXIN + ..() + diff --git a/code/game/objects/effects/effect_system/effects_foam.dm b/code/game/objects/effects/effect_system/effects_foam.dm index 80e6712ad5b..9cb25ce1372 100644 --- a/code/game/objects/effects/effect_system/effects_foam.dm +++ b/code/game/objects/effects/effect_system/effects_foam.dm @@ -207,7 +207,7 @@ /obj/structure/foamedmetal/attack_hand(mob/user) user.changeNext_move(CLICK_CD_MELEE) - user.do_attack_animation(src) + user.do_attack_animation(src, ATTACK_EFFECT_PUNCH) user << "You hit the metal foam but bounce off it!" playsound(src.loc, 'sound/weapons/tap.ogg', 100, 1) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 5adb6b3e75f..a6558e42a41 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -452,10 +452,11 @@ obj/item/proc/item_action_slot_check(slot, mob/user) playsound(loc, src.hitsound, 30, 1, -1) + user.do_attack_animation(M) + if(M != user) M.visible_message("[user] has stabbed [M] in the eye with [src]!", \ "[user] stabs you in the eye with [src]!") - user.do_attack_animation(M) else user.visible_message( \ "[user] has stabbed themself in the eyes with [src]!", \ diff --git a/code/game/objects/obj_defense.dm b/code/game/objects/obj_defense.dm index 439820aace8..a54341f2c50 100644 --- a/code/game/objects/obj_defense.dm +++ b/code/game/objects/obj_defense.dm @@ -62,15 +62,15 @@ /obj/bullet_act(obj/item/projectile/P) . = ..() - visible_message("[src] is hit by \a [P]!") playsound(src, P.hitsound, 50, 1) + visible_message("[src] is hit by \a [P]!", null, null, 2) take_damage(P.damage, P.damage_type, P.flag, 0, turn(P.dir, 180)) /obj/attack_hulk(mob/living/carbon/human/user, does_attack_animation = 0) if(user.a_intent == "harm") ..(user, 1) - visible_message("[user] smashes [src]!") + visible_message("[user] smashes [src]!", null, null, 2, user) if(density) playsound(src, 'sound/effects/meteorimpact.ogg', 100, 1) user.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" )) @@ -90,7 +90,6 @@ /obj/proc/attack_generic(mob/user, damage_amount = 0, damage_type = BRUTE, damage_flag = 0, sound_effect = 1) //used by attack_alien, attack_animal, and attack_slime user.do_attack_animation(src) user.changeNext_move(CLICK_CD_MELEE) - user.visible_message("[user] smashes into [src]!") take_damage(damage_amount, damage_type, damage_flag, sound_effect, get_dir(src, user)) /obj/attack_alien(mob/living/carbon/alien/humanoid/user) @@ -119,15 +118,24 @@ /obj/mech_melee_attack(obj/mecha/M) M.do_attack_animation(src) - switch(damtype) - if(BRUTE) - playsound(src, 'sound/weapons/punch4.ogg', 50, 1) - if(BURN) - playsound(src, 'sound/items/Welder.ogg', 50, 1) - else - return 0 - visible_message("[M.name] has hit [src].") - return take_damage(M.force*3, M.damtype, "melee", 0, get_dir(src, M)) // multiplied by 3 so we can hit objs hard but not be overpowered against mobs. + var/play_soundeffect = 0 + var/mech_damtype = M.damtype + if(M.selected) + mech_damtype = M.selected.damtype + play_soundeffect = 1 + else + switch(M.damtype) + if(BRUTE) + playsound(src, 'sound/weapons/punch4.ogg', 50, 1) + if(BURN) + playsound(src, 'sound/items/Welder.ogg', 50, 1) + if(TOX) + playsound(src, 'sound/effects/spray2.ogg', 50, 1) + return 0 + else + return 0 + visible_message("[M.name] has hit [src].", null, null, 2, M.occupant) + return take_damage(M.force*3, mech_damtype, "melee", play_soundeffect, get_dir(src, M)) // multiplied by 3 so we can hit objs hard but not be overpowered against mobs. /obj/singularity_act() ex_act(1) diff --git a/code/game/objects/structures/aliens.dm b/code/game/objects/structures/aliens.dm index 660b0aebee4..a8c350e4d4d 100644 --- a/code/game/objects/structures/aliens.dm +++ b/code/game/objects/structures/aliens.dm @@ -105,12 +105,6 @@ return attack_hand(user) -/obj/structure/alien/resin/attack_alien(mob/living/user) - user.changeNext_move(CLICK_CD_MELEE) - user.do_attack_animation(src) - user.visible_message("[user] claws at the resin!") - take_damage(50) - /obj/structure/alien/resin/CanPass(atom/movable/mover, turf/target, height=0) return !density diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index d728fe8d053..febdce95ed6 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -302,10 +302,6 @@ togglelock(user) return -/obj/structure/closet/attack_alien(mob/living/user) - return attack_hand(user) - - // tk grab then use on self /obj/structure/closet/attack_self_tk(mob/user) return attack_hand(user) diff --git a/code/game/objects/structures/displaycase.dm b/code/game/objects/structures/displaycase.dm index b0e6253509e..1653b83729f 100644 --- a/code/game/objects/structures/displaycase.dm +++ b/code/game/objects/structures/displaycase.dm @@ -185,9 +185,8 @@ //prevents remote "kicks" with TK if (!Adjacent(user)) return - user.do_attack_animation(src) - user.visible_message("[user] kicks the display case.", \ - "You kick the display case.") + user.visible_message("[user] kicks the display case.", null, null, 2, user) + user.do_attack_animation(src, ATTACK_EFFECT_KICK) take_damage(2) diff --git a/code/game/objects/structures/extinguisher.dm b/code/game/objects/structures/extinguisher.dm index 51b80b07e36..3c25608ad80 100644 --- a/code/game/objects/structures/extinguisher.dm +++ b/code/game/objects/structures/extinguisher.dm @@ -44,8 +44,7 @@ if(do_after(user, 60/I.toolspeed, target = src)) playsound(loc, 'sound/items/Deconstruct.ogg', 50, 1) user << "You unsecure [name]." - new /obj/item/wallframe/extinguisher_cabinet(loc) - qdel(src) + deconstruct(TRUE) return if(iscyborg(user) || isalien(user)) @@ -58,6 +57,7 @@ stored_extinguisher = I update_icon() user << "You place [I] in [src]." + update_icon() else toggle_cabinet(user) else if(user.a_intent != "harm") @@ -73,8 +73,9 @@ user.put_in_hands(stored_extinguisher) user << "You take [stored_extinguisher] from [src]." stored_extinguisher = null - opened = 1 - playsound(loc, 'sound/machines/click.ogg', 15, 1, -3) + if(!opened) + opened = 1 + playsound(loc, 'sound/machines/click.ogg', 15, 1, -3) update_icon() else toggle_cabinet(user) @@ -123,16 +124,19 @@ /obj/structure/extinguisher_cabinet/obj_break(damage_flag) if(!broken && !(flags & NODECONSTRUCT)) broken = 1 - opened = 0 - update_icon() + opened = 1 if(stored_extinguisher) stored_extinguisher.forceMove(loc) stored_extinguisher = null + update_icon() /obj/structure/extinguisher_cabinet/deconstruct(disassembled = TRUE) if(!(flags & NODECONSTRUCT)) - new /obj/item/stack/sheet/metal (loc, 2) + if(disassembled) + new /obj/item/wallframe/extinguisher_cabinet(loc) + else + new /obj/item/stack/sheet/metal (loc, 2) if(stored_extinguisher) stored_extinguisher.forceMove(loc) stored_extinguisher = null diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index 01a68a0ff97..0cf89e51d3c 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -42,19 +42,15 @@ /obj/structure/grille/attack_hand(mob/living/user) user.changeNext_move(CLICK_CD_MELEE) - user.do_attack_animation(src) - user.visible_message("[user] hits [src].", \ - "You hit [src].", \ - "You hear twisting metal.") + user.do_attack_animation(src, ATTACK_EFFECT_KICK) + user.visible_message("[user] hits [src].", null, null, 2, user) if(!shock(user, 70)) take_damage(rand(5,10), BRUTE, "melee", 1) /obj/structure/grille/attack_alien(mob/living/user) user.do_attack_animation(src) user.changeNext_move(CLICK_CD_MELEE) - user.visible_message("[user] mangles [src].", \ - "You mangle [src].", \ - "You hear twisting metal.") + user.visible_message("[user] mangles [src].", null, null, 2, user) if(!shock(user, 70)) take_damage(20, BRUTE, "melee", 1) diff --git a/code/game/objects/structures/holosign.dm b/code/game/objects/structures/holosign.dm index ac8ad9d02e0..eeb6724399e 100644 --- a/code/game/objects/structures/holosign.dm +++ b/code/game/objects/structures/holosign.dm @@ -23,7 +23,7 @@ return ..() /obj/structure/holosign/attack_hand(mob/living/user) - user.do_attack_animation(src) + user.do_attack_animation(src, ATTACK_EFFECT_PUNCH) user.changeNext_move(CLICK_CD_MELEE) take_damage(5 , BRUTE, "melee", 1) diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index b896b475cf8..72468918b2c 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -437,9 +437,8 @@ /obj/structure/rack/attack_hand(mob/living/user) user.changeNext_move(CLICK_CD_MELEE) - user.do_attack_animation(src) - user.visible_message("[user] kicks [src].", \ - "You kick [src].") + user.do_attack_animation(src, ATTACK_EFFECT_KICK) + user.visible_message("[user] kicks [src].", null, null, 2, user) take_damage(rand(4,8), BRUTE, "melee", 1) diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index a426f311f8c..d9c3724f438 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -101,7 +101,7 @@ /obj/structure/window/attack_hulk(mob/living/carbon/human/user, does_attack_animation = 0) if(!can_be_reached(user)) return 1 - ..() + . = ..() /obj/structure/window/attack_hand(mob/user) if(!can_be_reached(user)) diff --git a/code/game/turfs/simulated/wall/reinf_walls.dm b/code/game/turfs/simulated/wall/reinf_walls.dm index 882833f1079..cc0c487ecef 100644 --- a/code/game/turfs/simulated/wall/reinf_walls.dm +++ b/code/game/turfs/simulated/wall/reinf_walls.dm @@ -25,8 +25,8 @@ if(M.environment_smash == 3) dismantle_wall(1) playsound(src, 'sound/effects/meteorimpact.ogg', 100, 1) - M << "You smash through the wall." else + playsound(src, 'sound/effects/bang.ogg', 50, 1) M << "This wall is far too strong for you to destroy." /turf/closed/wall/r_wall/try_destroy(obj/item/weapon/W, mob/user, turf/T) diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index 2793f838e2e..77947c313c2 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -84,13 +84,18 @@ /turf/closed/wall/mech_melee_attack(obj/mecha/M) M.do_attack_animation(src) - if(M.damtype == "brute") - playsound(src, 'sound/weapons/punch4.ogg', 50, 1) - visible_message("[M.name] has hit [src]!") - if(prob(hardness + M.force) && M.force > 20) - dismantle_wall(1) - visible_message("[M.name] smashes through the wall!") - playsound(src, 'sound/effects/meteorimpact.ogg', 100, 1) + switch(M.damtype) + if(BRUTE) + playsound(src, 'sound/weapons/punch4.ogg', 50, 1) + visible_message("[M.name] has hit [src]!", null, null, 2, M.occupant) + if(prob(hardness + M.force) && M.force > 20) + dismantle_wall(1) + playsound(src, 'sound/effects/meteorimpact.ogg', 100, 1) + if(BURN) + playsound(src, 'sound/items/Welder.ogg', 100, 1) + if(TOX) + playsound(src, 'sound/effects/spray2.ogg', 100, 1) + return 0 /turf/closed/wall/attack_paw(mob/living/user) user.changeNext_move(CLICK_CD_MELEE) @@ -102,7 +107,6 @@ M.do_attack_animation(src) if(M.environment_smash >= 2) playsound(src, 'sound/effects/meteorimpact.ogg', 100, 1) - M << "You smash through the wall." dismantle_wall(1) return @@ -110,7 +114,6 @@ ..(user, 1) if(prob(hardness)) playsound(src, 'sound/effects/meteorimpact.ogg', 100, 1) - user << text("You smash through the wall.") user.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" )) dismantle_wall(1) else diff --git a/code/modules/client/verbs/suicide.dm b/code/modules/client/verbs/suicide.dm index 659fe3f3c8d..92221f35b11 100644 --- a/code/modules/client/verbs/suicide.dm +++ b/code/modules/client/verbs/suicide.dm @@ -120,7 +120,8 @@ if(answer == "Yes") card.removePersonality() var/turf/T = get_turf(src.loc) - T.visible_message("[src] flashes a message across its screen, \"Wiping core files. Please acquire a new personality to continue using pAI device functions.\"", "[src] bleeps electronically.") + T.visible_message("[src] flashes a message across its screen, \"Wiping core files. Please acquire a new personality to continue using pAI device functions.\"", null, \ + "[src] bleeps electronically.") death(0) else src << "Aborting suicide attempt." diff --git a/code/modules/events/spacevine.dm b/code/modules/events/spacevine.dm index c002d51ef79..654ea710711 100644 --- a/code/modules/events/spacevine.dm +++ b/code/modules/events/spacevine.dm @@ -459,7 +459,6 @@ /obj/structure/spacevine/attack_paw(mob/living/user) - user.do_attack_animation(src) for(var/datum/spacevine_mutation/SM in mutations) SM.on_hit(src, user) user_unbuckle_mob(user,user) diff --git a/code/modules/flufftext/Hallucination.dm b/code/modules/flufftext/Hallucination.dm index c1cd8ab0e6b..de4ccc102e4 100644 --- a/code/modules/flufftext/Hallucination.dm +++ b/code/modules/flufftext/Hallucination.dm @@ -419,7 +419,7 @@ Gunshots/explosions/opening doors/less rare audio (done) updateimage() else if(prob(15)) - src.do_attack_animation(my_target) + do_attack_animation(my_target, ATTACK_EFFECT_PUNCH) if(weapon_name) my_target << sound(pick('sound/weapons/genhit1.ogg', 'sound/weapons/genhit2.ogg', 'sound/weapons/genhit3.ogg')) my_target.show_message("[src.name] has attacked [my_target] with [weapon_name]!", 1) diff --git a/code/modules/mob/living/carbon/alien/alien_defense.dm b/code/modules/mob/living/carbon/alien/alien_defense.dm index 0ac53a3c8a0..5298b62cfe8 100644 --- a/code/modules/mob/living/carbon/alien/alien_defense.dm +++ b/code/modules/mob/living/carbon/alien/alien_defense.dm @@ -14,10 +14,6 @@ As such, they can either help or harm other aliens. Help works like the human he In all, this is a lot like the monkey code. /N */ /mob/living/carbon/alien/attack_alien(mob/living/carbon/alien/M) - if(!ticker || !ticker.mode) - M << "You cannot attack people before the game has started." - return - if(isturf(loc) && istype(loc.loc, /area/start)) M << "No attacking people at spawn, you jackass." return @@ -37,12 +33,11 @@ In all, this is a lot like the monkey code. /N else if (health > 0) - M.do_attack_animation(src) + M.do_attack_animation(src, ATTACK_EFFECT_BITE) playsound(loc, 'sound/weapons/bite.ogg', 50, 1, -1) - var/damage = 1 visible_message("[M.name] bites [src]!", \ - "[M.name] bites [src]!") - adjustBruteLoss(damage) + "[M.name] bites [src]!", null, 2, M) + adjustBruteLoss(1) add_logs(M, src, "attacked") updatehealth() else @@ -62,8 +57,11 @@ In all, this is a lot like the monkey code. /N help_shake_act(M) if("grab") grabbedby(M) - if ("harm", "disarm") - M.do_attack_animation(src) + if ("harm") + M.do_attack_animation(src, ATTACK_EFFECT_PUNCH) + return 1 + if("disarm") + M.do_attack_animation(src, ATTACK_EFFECT_DISARM) return 1 return 0 @@ -75,8 +73,6 @@ In all, this is a lot like the monkey code. /N apply_damage(rand(1, 3), BRUTE, affecting) - - /mob/living/carbon/alien/attack_animal(mob/living/simple_animal/M) if(..()) var/damage = rand(M.melee_damage_lower, M.melee_damage_upper) diff --git a/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm b/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm index a9b5fae735f..9511129b725 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm @@ -17,7 +17,7 @@ hitverb = "slammed" playsound(loc, "punch", 25, 1, -1) visible_message("[user] has [hitverb] [src]!", \ - "[user] has [hitverb] [src]!") + "[user] has [hitverb] [src]!", null, 2, user) return 1 /mob/living/carbon/alien/humanoid/attack_hand(mob/living/carbon/human/M) @@ -28,7 +28,7 @@ if (prob(90)) playsound(loc, "punch", 25, 1, -1) visible_message("[M] has punched [src]!", \ - "[M] has punched [src]!") + "[M] has punched [src]!", null, 2, M) if ((stat != DEAD) && (damage > 9 || prob(5)))//Regular humans have a very small chance of weakening an alien. Paralyse(2) visible_message("[M] has weakened [src]!", \ @@ -38,7 +38,8 @@ add_logs(M, src, "attacked") else playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) - visible_message("[M] has attempted to punch [src]!") + visible_message("[M] has attempted to punch [src]!", \ + "[M] has attempted to punch [src]!", null, 2, M) if ("disarm") if (!lying) @@ -53,7 +54,15 @@ drop_item() playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) visible_message("[M] has disarmed [src]!", \ - "[M] has disarmed [src]!") + "[M] has disarmed [src]!", null, 2, M) else playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) - visible_message("[M] has attempted to disarm [src]!") + visible_message("[M] has attempted to disarm [src]!",\ + "[M] has attempted to disarm [src]!", null, 2, M) + + + +/mob/living/carbon/alien/humanoid/do_attack_animation(atom/A, visual_effect_icon, obj/item/used_item, no_effect, end_pixel_y) + if(!no_effect && !visual_effect_icon) + visual_effect_icon = ATTACK_EFFECT_CLAW + ..() diff --git a/code/modules/mob/living/carbon/alien/larva/larva_defense.dm b/code/modules/mob/living/carbon/alien/larva/larva_defense.dm index 82bb19b1475..36b685e9a58 100644 --- a/code/modules/mob/living/carbon/alien/larva/larva_defense.dm +++ b/code/modules/mob/living/carbon/alien/larva/larva_defense.dm @@ -7,7 +7,7 @@ playsound(loc, "punch", 25, 1, -1) add_logs(M, src, "attacked") visible_message("[M] has kicked [src]!", \ - "[M] has kicked [src]!") + "[M] has kicked [src]!", null, 2, M) if ((stat != DEAD) && (damage > 4.9)) Paralyse(rand(5,10)) @@ -16,7 +16,7 @@ else playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) visible_message("[M] has attempted to kick [src]!", \ - "[M] has attempted to kick [src]!") + "[M] has attempted to kick [src]!", null, 2, M) /mob/living/carbon/alien/larva/attack_hulk(mob/living/carbon/human/user, does_attack_animation = 0) if(user.a_intent == "harm") @@ -26,4 +26,9 @@ step_away(src,user,15) sleep(1) step_away(src,user,15) - return 1 \ No newline at end of file + return 1 + +/mob/living/carbon/alien/larva/do_attack_animation(atom/A, visual_effect_icon, obj/item/used_item, no_effect, end_pixel_y) + if(!no_effect && !visual_effect_icon) + visual_effect_icon = ATTACK_EFFECT_BITE + ..() diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 8d98283958a..b5a9658e9f5 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -332,7 +332,7 @@ updatehealth() visible_message("[M.name] has hit [src]!", \ - "[M.name] has hit [src]!") + "[M.name] has hit [src]!", null, 2, M.occupant) add_logs(M.occupant, src, "attacked", M, "(INTENT: [uppertext(M.occupant.a_intent)]) (DAMTYPE: [uppertext(M.damtype)])") else diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index ac7334bcf2c..e5b4cae8d3b 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -964,19 +964,29 @@ if(attacker_style && attacker_style.harm_act(user,target)) return 1 else - user.do_attack_animation(target) var/atk_verb = user.dna.species.attack_verb if(target.lying) atk_verb = "kick" + switch(atk_verb) + if("kick") + user.do_attack_animation(target, ATTACK_EFFECT_KICK) + if("slash") + user.do_attack_animation(target, ATTACK_EFFECT_CLAW) + if("smash") + user.do_attack_animation(target, ATTACK_EFFECT_SMASH) + else + user.do_attack_animation(target, ATTACK_EFFECT_PUNCH) + var/damage = rand(user.dna.species.punchdamagelow, user.dna.species.punchdamagehigh) var/obj/item/bodypart/affecting = target.get_bodypart(ran_zone(user.zone_selected)) if(!damage || !affecting) playsound(target.loc, user.dna.species.miss_sound, 25, 1, -1) - target.visible_message("[user] has attempted to [atk_verb] [target]!") + target.visible_message("[user] has attempted to [atk_verb] [target]!",\ + "[user] has attempted to [atk_verb] [target]!", null, 2, user) return 0 @@ -985,7 +995,7 @@ playsound(target.loc, user.dna.species.attack_sound, 25, 1, -1) target.visible_message("[user] has [atk_verb]ed [target]!", \ - "[user] has [atk_verb]ed [target]!") + "[user] has [atk_verb]ed [target]!", null, 2, user) if(user.limb_destroyer) target.dismembering_strike(user, affecting.body_zone) @@ -1003,7 +1013,7 @@ if(attacker_style && attacker_style.disarm_act(user,target)) return 1 else - user.do_attack_animation(target) + user.do_attack_animation(target, ATTACK_EFFECT_DISARM) add_logs(user, target, "disarmed") if(target.w_uniform) @@ -1013,7 +1023,7 @@ if(randn <= 25) playsound(target, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) target.visible_message("[user] has pushed [target]!", - "[user] has pushed [target]!") + "[user] has pushed [target]!", null, 2, user) target.apply_effect(2, WEAKEN, target.run_armor_check(affecting, "melee", "Your armor prevents your fall!", "Your armor softens your fall!")) target.forcesay(hit_appends) return @@ -1023,7 +1033,7 @@ if(randn <= 60) //BubbleWrap: Disarming breaks a pull if(target.pulling) - target.visible_message("[user] has broken [target]'s grip on [target.pulling]!") + target << "[user] has broken [target]'s grip on [target.pulling]!" talked = 1 target.stop_pulling() //End BubbleWrap @@ -1031,15 +1041,14 @@ if(!talked) //BubbleWrap if(target.drop_item()) target.visible_message("[user] has disarmed [target]!", \ - "[user] has disarmed [target]!") + "[user] has disarmed [target]!", null, 2, user) playsound(target, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) return playsound(target, 'sound/weapons/punchmiss.ogg', 25, 1, -1) target.visible_message("[user] attempted to disarm [target]!", \ - "[user] attemped to disarm [target]!") - return + "[user] attemped to disarm [target]!", null, 2, user) /datum/species/proc/spec_attack_hand(mob/living/carbon/human/M, mob/living/carbon/human/H, datum/martial_art/attacker_style = M.martial_art) diff --git a/code/modules/mob/living/carbon/monkey/monkey_defense.dm b/code/modules/mob/living/carbon/monkey/monkey_defense.dm index b698452162f..8ef1521fc84 100644 --- a/code/modules/mob/living/carbon/monkey/monkey_defense.dm +++ b/code/modules/mob/living/carbon/monkey/monkey_defense.dm @@ -49,10 +49,10 @@ if("grab") grabbedby(M) if("harm") - M.do_attack_animation(src) + M.do_attack_animation(src, ATTACK_EFFECT_PUNCH) if (prob(75)) visible_message("[M] has punched [name]!", \ - "[M] has punched [name]!") + "[M] has punched [name]!", null, 2, M) playsound(loc, "punch", 25, 1, -1) var/damage = rand(5, 10) @@ -61,7 +61,7 @@ if ( (paralysis < 5) && (health > 0) ) Paralyse(rand(10, 15)) visible_message("[M] has knocked out [name]!", \ - "[M] has knocked out [name]!") + "[M] has knocked out [name]!", null, 5) var/obj/item/bodypart/affecting = get_bodypart(ran_zone(M.zone_selected)) if(!affecting) affecting = get_bodypart("chest") @@ -72,21 +72,21 @@ else playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) visible_message("[M] has attempted to punch [name]!", \ - "[M] has attempted to punch [name]!") + "[M] has attempted to punch [name]!", null, 2, M) if("disarm") - if (!( paralysis )) - M.do_attack_animation(src) + if (!paralysis) + M.do_attack_animation(src, ATTACK_EFFECT_DISARM) if (prob(25)) Paralyse(2) playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) add_logs(M, src, "pushed") visible_message("[M] has pushed down [src]!", \ - "[M] has pushed down [src]!") + "[M] has pushed down [src]!", null, 2, M) else if(drop_item()) playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) visible_message("[M] has disarmed [src]!", \ - "[M] has disarmed [src]!") + "[M] has disarmed [src]!", null, 2, M) /mob/living/carbon/monkey/attack_alien(mob/living/carbon/alien/humanoid/M) if(..()) //if harm or disarm intent. @@ -99,10 +99,10 @@ if (paralysis < 15) Paralyse(rand(10, 15)) visible_message("[M] has wounded [name]!", \ - "[M] has wounded [name]!") + "[M] has wounded [name]!", null, 2, M) else visible_message("[M] has slashed [name]!", \ - "[M] has slashed [name]!") + "[M] has slashed [name]!", null, 2, M) var/obj/item/bodypart/affecting = get_bodypart(ran_zone(M.zone_selected)) add_logs(M, src, "attacked") @@ -116,18 +116,18 @@ else playsound(loc, 'sound/weapons/slashmiss.ogg', 25, 1, -1) visible_message("[M] has attempted to lunge at [name]!", \ - "[M] has attempted to lunge at [name]!") + "[M] has attempted to lunge at [name]!", null, 2, M) if (M.a_intent == "disarm") playsound(loc, 'sound/weapons/pierce.ogg', 25, 1, -1) if(prob(95)) Weaken(10) visible_message("[M] has tackled down [name]!", \ - "[M] has tackled down [name]!") + "[M] has tackled down [name]!", null, 2, M) else if(drop_item()) visible_message("[M] has disarmed [name]!", \ - "[M] has disarmed [name]!") + "[M] has disarmed [name]!", null, 2, M) add_logs(M, src, "disarmed") updatehealth() diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 1933cf891ff..1b5e68293f0 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -654,71 +654,6 @@ else step_towards(src,S) -/atom/movable/proc/do_attack_animation(atom/A, end_pixel_y) - var/pixel_x_diff = 0 - var/pixel_y_diff = 0 - var/final_pixel_y = initial(pixel_y) - if(end_pixel_y) - final_pixel_y = end_pixel_y - - var/direction = get_dir(src, A) - if(direction & NORTH) - pixel_y_diff = 8 - else if(direction & SOUTH) - pixel_y_diff = -8 - - if(direction & EAST) - pixel_x_diff = 8 - else if(direction & WEST) - pixel_x_diff = -8 - - animate(src, pixel_x = pixel_x + pixel_x_diff, pixel_y = pixel_y + pixel_y_diff, time = 2) - animate(pixel_x = initial(pixel_x), pixel_y = final_pixel_y, time = 2) - - -/mob/living/do_attack_animation(atom/A) - var/final_pixel_y = get_standard_pixel_y_offset(lying) - ..(A, final_pixel_y) - floating = 0 // If we were without gravity, the bouncing animation got stopped, so we make sure we restart the bouncing after the next movement. - - // What icon do we use for the attack? - var/image/I - var/obj/item/held_item = get_active_held_item() - if(held_item) - I = image(held_item.icon, A, held_item.icon_state, A.layer + 0.1) - else - return - - // Who can see the attack? - var/list/viewing = list() - for(var/mob/M in viewers(A)) - if(M.client) - viewing |= M.client - flick_overlay(I, viewing, 5) // 5 ticks/half a second - - // Scale the icon. - I.transform *= 0.75 - // The icon should not rotate. - I.appearance_flags = APPEARANCE_UI_IGNORE_ALPHA - - // Set the direction of the icon animation. - var/direction = get_dir(src, A) - if(direction & NORTH) - I.pixel_y = -16 - else if(direction & SOUTH) - I.pixel_y = 16 - - if(direction & EAST) - I.pixel_x = -16 - else if(direction & WEST) - I.pixel_x = 16 - - if(!direction) // Attacked self?! - I.pixel_z = 16 - - // And animate the attack! - animate(I, alpha = 175, pixel_x = 0, pixel_y = 0, pixel_z = 0, time = 3) - /mob/living/proc/do_jitter_animation(jitteriness) var/amplitude = min(4, (jitteriness/100) + 1) var/pixel_x_diff = rand(-amplitude, amplitude) diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index fa01c2bf1f8..f8a7915357e 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -97,25 +97,25 @@ if(M.damtype == "brute") step_away(src,M,15) switch(M.damtype) - if("brute") + if(BRUTE) Paralyse(1) take_overall_damage(rand(M.force/2, M.force)) playsound(src, 'sound/weapons/punch4.ogg', 50, 1) - if("fire") + if(BURN) take_overall_damage(0, rand(M.force/2, M.force)) playsound(src, 'sound/items/Welder.ogg', 50, 1) - if("tox") + if(TOX) M.mech_toxin_damage(src) else return updatehealth() visible_message("[M.name] has hit [src]!", \ - "[M.name] has hit [src]!") + "[M.name] has hit [src]!", null, 2, M.occupant) add_logs(M.occupant, src, "attacked", M, "(INTENT: [uppertext(M.occupant.a_intent)]) (DAMTYPE: [uppertext(M.damtype)])") else step_away(src,M) add_logs(M.occupant, src, "pushed", M) - visible_message("[M] pushes [src] out of the way.") + visible_message("[M] pushes [src] out of the way.", null, null, 5) /mob/living/fire_act() adjust_fire_stacks(3) @@ -185,7 +185,7 @@ add_logs(M, src, "attacked") M.do_attack_animation(src) visible_message("The [M.name] glomps [src]!", \ - "The [M.name] glomps [src]!") + "The [M.name] glomps [src]!", null, 2, M) return 1 /mob/living/attack_animal(mob/living/simple_animal/M) @@ -198,16 +198,12 @@ playsound(loc, M.attack_sound, 50, 1, 1) M.do_attack_animation(src) visible_message("\The [M] [M.attacktext] [src]!", \ - "\The [M] [M.attacktext] [src]!") + "\The [M] [M.attacktext] [src]!", null, 2, M) add_logs(M, src, "attacked") return 1 /mob/living/attack_paw(mob/living/carbon/monkey/M) - if(!ticker || !ticker.mode) - M << "You cannot attack people before the game has started." - return 0 - if(isturf(loc) && istype(loc.loc, /area/start)) M << "No attacking people at spawn, you jackass." return 0 @@ -216,16 +212,16 @@ if(M.is_muzzled() || (M.wear_mask && M.wear_mask.flags_cover & MASKCOVERSMOUTH)) M << "You can't bite with your mouth covered!" return 0 - M.do_attack_animation(src) + M.do_attack_animation(src, ATTACK_EFFECT_BITE) if (prob(75)) add_logs(M, src, "attacked") playsound(loc, 'sound/weapons/bite.ogg', 50, 1, -1) visible_message("[M.name] bites [src]!", \ - "[M.name] bites [src]!") + "[M.name] bites [src]!", null, 2, M) return 1 else visible_message("[M.name] has attempted to bite [src]!", \ - "[M.name] has attempted to bite [src]!") + "[M.name] has attempted to bite [src]!", null, 2, M) return 0 /mob/living/attack_larva(mob/living/carbon/alien/larva/L) @@ -239,19 +235,15 @@ if(prob(90)) add_logs(L, src, "attacked") visible_message("[L.name] bites [src]!", \ - "[L.name] bites [src]!") + "[L.name] bites [src]!", null, 2, L) playsound(loc, 'sound/weapons/bite.ogg', 50, 1, -1) return 1 else visible_message("[L.name] has attempted to bite [src]!", \ - "[L.name] has attempted to bite [src]!") + "[L.name] has attempted to bite [src]!", null, 2, L) return 0 /mob/living/attack_alien(mob/living/carbon/alien/humanoid/M) - if(!ticker || !ticker.mode) - M << "You cannot attack people before the game has started." - return 0 - if(isturf(loc) && istype(loc.loc, /area/start)) M << "No attacking people at spawn, you jackass." return 0 @@ -264,9 +256,12 @@ if ("grab") grabbedby(M) return 0 - else + if("harm") M.do_attack_animation(src) return 1 + if("disarm") + M.do_attack_animation(src, ATTACK_EFFECT_DISARM) + return 1 /mob/living/ex_act(severity, target, origin) if(origin && istype(origin, /datum/spacevine_mutation) && isvineimmune(src)) @@ -352,3 +347,11 @@ //to damage the clothes worn by a mob /mob/living/proc/damage_clothes(damage_amount, damage_type = BRUTE, damage_flag = 0, def_zone) return + + +/mob/living/do_attack_animation(atom/A, visual_effect_icon, obj/item/used_item, no_effect, end_pixel_y) + if(A != src) + end_pixel_y = get_standard_pixel_y_offset(lying) + used_item = get_active_held_item() + ..() + floating = 0 // If we were without gravity, the bouncing animation got stopped, so we make sure we restart the bouncing after the next movement. diff --git a/code/modules/mob/living/silicon/robot/robot_defense.dm b/code/modules/mob/living/silicon/robot/robot_defense.dm index bd7adc230f3..0c375b2da1f 100644 --- a/code/modules/mob/living/silicon/robot/robot_defense.dm +++ b/code/modules/mob/living/silicon/robot/robot_defense.dm @@ -8,18 +8,18 @@ /mob/living/silicon/robot/attack_alien(mob/living/carbon/alien/humanoid/M) if (M.a_intent =="disarm") if(!(lying)) - M.do_attack_animation(src) + M.do_attack_animation(src, ATTACK_EFFECT_DISARM) if(get_active_held_item()) uneq_active() visible_message("[M] disarmed [src]!", \ - "[M] has disabled [src]'s active module!") + "[M] has disabled [src]'s active module!", null, 2, M) add_logs(M, src, "disarmed") else Stun(2) step(src,get_dir(M,src)) add_logs(M, src, "pushed") visible_message("[M] has forced back [src]!", \ - "[M] has forced back [src]!") + "[M] has forced back [src]!", null, 2, M) playsound(loc, 'sound/weapons/pierce.ogg', 50, 1, -1) else ..() diff --git a/code/modules/mob/living/silicon/silicon_defense.dm b/code/modules/mob/living/silicon/silicon_defense.dm index 34b0e954c8a..d6803b16150 100644 --- a/code/modules/mob/living/silicon/silicon_defense.dm +++ b/code/modules/mob/living/silicon/silicon_defense.dm @@ -66,10 +66,10 @@ if("grab") grabbedby(M) else - M.do_attack_animation(src) + M.do_attack_animation(src, ATTACK_EFFECT_PUNCH) playsound(src.loc, 'sound/effects/bang.ogg', 10, 1) - visible_message("[M] punches [src], but doesn't leave a dent.", \ - "[M] punches [src], but doesn't leave a dent.") + visible_message("[M] punches [src], but doesn't leave a dent.", \ + "[M] punches [src], but doesn't leave a dent.", null, 2, M) return 0 /mob/living/silicon/electrocute_act(shock_damage, obj/source, siemens_coeff = 1, safety = 0, tesla_shock = 0) diff --git a/code/modules/mob/living/simple_animal/animal_defense.dm b/code/modules/mob/living/simple_animal/animal_defense.dm index d2a260f2f62..9fd8841f97d 100644 --- a/code/modules/mob/living/simple_animal/animal_defense.dm +++ b/code/modules/mob/living/simple_animal/animal_defense.dm @@ -13,8 +13,9 @@ grabbedby(M) if("harm", "disarm") - M.do_attack_animation(src) - visible_message("[M] [response_harm] [src]!") + M.do_attack_animation(src, ATTACK_EFFECT_PUNCH) + visible_message("[M] [response_harm] [src]!",\ + "[M] [response_harm] [src]!", null, 2, M) playsound(loc, attacked_sound, 25, 1, -1) attack_threshold_check(harm_intent_damage) add_logs(M, src, "attacked") @@ -26,7 +27,7 @@ ..(user, 1) playsound(loc, "punch", 25, 1, -1) visible_message("[user] has punched [src]!", \ - "[user] has punched [src]!") + "[user] has punched [src]!", null, 2, user) adjustBruteLoss(15) return 1 @@ -47,12 +48,12 @@ if(M.a_intent == "disarm") playsound(loc, 'sound/weapons/pierce.ogg', 25, 1, -1) visible_message("[M] [response_disarm] [name]!", \ - "[M] [response_disarm] [name]!") + "[M] [response_disarm] [name]!", null, 2, M) add_logs(M, src, "disarmed") else var/damage = rand(15, 30) visible_message("[M] has slashed at [src]!", \ - "[M] has slashed at [src]!") + "[M] has slashed at [src]!", null, 2, M) playsound(loc, 'sound/weapons/slice.ogg', 25, 1, -1) attack_threshold_check(damage) add_logs(M, src, "attacked") @@ -125,4 +126,12 @@ /mob/living/simple_animal/blob_act(obj/structure/blob/B) adjustBruteLoss(20) - return \ No newline at end of file + return + +/mob/living/simple_animal/do_attack_animation(atom/A, visual_effect_icon, used_item, no_effect, end_pixel_y) + if(!no_effect && !visual_effect_icon && melee_damage_upper) + if(melee_damage_upper < 10) + visual_effect_icon = ATTACK_EFFECT_PUNCH + else + visual_effect_icon = ATTACK_EFFECT_SMASH + ..() \ No newline at end of file diff --git a/code/modules/mob/living/simple_animal/guardian/types/support.dm b/code/modules/mob/living/simple_animal/guardian/types/support.dm index 041116b0a39..a81f4b45272 100644 --- a/code/modules/mob/living/simple_animal/guardian/types/support.dm +++ b/code/modules/mob/living/simple_animal/guardian/types/support.dm @@ -139,7 +139,7 @@ A.visible_message("[A] starts to glow faintly!\ ", "You start to faintly glow, and \ you feel strangely weightless!") - do_attack_animation(A) + do_attack_animation(A, null, 1) if(!do_mob(src, A, 60)) //now start the channel src << "You need to hold still!" diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index d4b62f616ce..2f9edf13a14 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -329,10 +329,9 @@ return var/turf/startloc = get_turf(targets_from) if(casingtype) - var/obj/item/ammo_casing/casing = new casingtype + var/obj/item/ammo_casing/casing = new casingtype(startloc) playsound(src, projectilesound, 100, 1) casing.fire(targeted_atom, src, zone_override = ran_zone()) - casing.loc = startloc else if(projectiletype) var/obj/item/projectile/P = new projectiletype(startloc) playsound(src, projectilesound, 100, 1) diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm index 50e344a846d..281b840ece2 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm @@ -115,7 +115,7 @@ Difficulty: Hard bloodspell.phased = 1 internal = new/obj/item/device/gps/internal/bubblegum(src) -/mob/living/simple_animal/hostile/megafauna/bubblegum/do_attack_animation(atom/A) +/mob/living/simple_animal/hostile/megafauna/bubblegum/do_attack_animation(atom/A, visual_effect_icon) if(!charging) ..() diff --git a/code/modules/mob/living/simple_animal/slime/slime.dm b/code/modules/mob/living/simple_animal/slime/slime.dm index ace41147727..6e22327d8a1 100644 --- a/code/modules/mob/living/simple_animal/slime/slime.dm +++ b/code/modules/mob/living/simple_animal/slime/slime.dm @@ -268,6 +268,7 @@ var/list/slime_colours = list("rainbow", "grey", "purple", "metal", "orange", /mob/living/simple_animal/slime/attack_hand(mob/living/carbon/human/M) if(buckled) + M.do_attack_animation(src, ATTACK_EFFECT_DISARM) if(buckled == M) if(prob(60)) visible_message("[M] attempts to wrestle \the [name] off!") @@ -280,7 +281,6 @@ var/list/slime_colours = list("rainbow", "grey", "purple", "metal", "orange", discipline_slime(M) else - M.do_attack_animation(src) if(prob(30)) visible_message("[M] attempts to wrestle \the [name] off of [buckled]!") playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 6e72855055d..38c17accf6f 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -84,63 +84,45 @@ var/next_mob_id = 0 else src << msg -// Show a message the src mob and to all player mobs who sees the src mob -// This would be for visible actions by the src mob -// message is the message output to anyone who can see e.g. "[src] does something!" +// Show a message to all player mobs who sees this atom +// Show a message to the src mob (if the src is a mob) +// Use for atoms performing visible actions +// message is output to anyone who can see, e.g. "The [src] does something!" // self_message (optional) is what the src mob sees e.g. "You do something!" // blind_message (optional) is what blind people will hear e.g. "You hear something!" +// vision_distance (optional) define how many tiles away the message can be seen. +// ignored_mob (optional) doesn't show any message to a given mob if TRUE. -/mob/visible_message(message, self_message, blind_message) +/atom/proc/visible_message(message, self_message, blind_message, vision_distance, ignored_mob) var/turf/T = get_turf(src) if(!T) return - for(var/mob/M in get_hearers_in_view(7, src)) + var/range = 7 + if(vision_distance) + range = vision_distance + for(var/mob/M in get_hearers_in_view(range, src)) if(!M.client) continue + if(M == ignored_mob) + continue var/msg = message if(M == src) //the src always see the main message or self message if(self_message) msg = self_message else - if(M.see_invisible\The [AM] slams into \the [src] inducing a resonance... \his body starts to glow and catch flame before flashing into ash.",\ "You slam into \the [src] as your ears are filled with unearthly ringing. Your last thought is \"Oh, fuck.\"",\ "You hear an unearthly noise as a wave of heat washes over you.") else if(isobj(AM) && !istype(AM, /obj/effect)) - AM.visible_message("\The [AM] smacks into \the [src] and rapidly flashes to ash.",\ + AM.visible_message("\The [AM] smacks into \the [src] and rapidly flashes to ash.", null,\ "You hear a loud crack as you are washed with a wave of heat.") else return diff --git a/code/modules/projectiles/ammunition.dm b/code/modules/projectiles/ammunition.dm index e401a5dae8b..675f404282b 100644 --- a/code/modules/projectiles/ammunition.dm +++ b/code/modules/projectiles/ammunition.dm @@ -56,7 +56,7 @@ else user << "You fail to collect anything!" else - ..() + return ..() //Boxes of ammo /obj/item/ammo_box diff --git a/code/modules/projectiles/ammunition/ammo_casings.dm b/code/modules/projectiles/ammunition/ammo_casings.dm index a3653f0717c..f09407cef92 100644 --- a/code/modules/projectiles/ammunition/ammo_casings.dm +++ b/code/modules/projectiles/ammunition/ammo_casings.dm @@ -371,18 +371,18 @@ if(BB) BB.icon_state = "foamdart_empty" else - icon_state = "foamdart" + icon_state = initial(icon_state) desc = "Its nerf or nothing! Ages 8 and up." if(BB) - BB.icon_state = "foamdart_empty" + BB.icon_state = initial(BB.icon_state) /obj/item/ammo_casing/caseless/foam_dart/attackby(obj/item/A, mob/user, params) - ..() var/obj/item/projectile/bullet/reusable/foam_dart/FD = BB if (istype(A, /obj/item/weapon/screwdriver) && !modified) modified = 1 FD.damage_type = BRUTE + user << "You pop the safety cap off of [src]." update_icon() else if ((istype(A, /obj/item/weapon/pen)) && modified && !FD.pen) if(!user.unEquip(A)) @@ -392,7 +392,8 @@ FD.damage = 5 FD.nodamage = 0 user << "You insert [A] into [src]." - return + else + return ..() /obj/item/ammo_casing/caseless/foam_dart/attack_self(mob/living/user) var/obj/item/projectile/bullet/reusable/foam_dart/FD = BB diff --git a/code/modules/projectiles/ammunition/magazines.dm b/code/modules/projectiles/ammunition/magazines.dm index aed3c13e708..8d4def459a4 100644 --- a/code/modules/projectiles/ammunition/magazines.dm +++ b/code/modules/projectiles/ammunition/magazines.dm @@ -439,12 +439,15 @@ obj/item/ammo_box/magazine/tommygunm45 /obj/item/ammo_box/magazine/toy/smg name = "foam force SMG magazine" - icon_state = "smg9mm-20" + icon_state = "smg9mm-42" max_ammo = 20 /obj/item/ammo_box/magazine/toy/smg/update_icon() ..() - icon_state = "smg9mm-[round(ammo_count(),5)]" + if(ammo_count()) + icon_state = "smg9mm-42" + else + icon_state = "smg9mm-0" /obj/item/ammo_box/magazine/toy/smg/riot ammo_type = /obj/item/ammo_casing/caseless/foam_dart/riot diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 8c44806da96..6fab2ac2fa1 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -77,7 +77,7 @@ G.loc = loc qdel(G.pin) G.pin = null - visible_message("[G] can now fit a new pin, but old one was destroyed in the process.") + visible_message("[G] can now fit a new pin, but old one was destroyed in the process.", null, null, 3) qdel(src) /obj/item/weapon/gun/examine(mob/user) @@ -113,12 +113,11 @@ playsound(user, fire_sound, 10, 1) else playsound(user, fire_sound, 50, 1) - if(!message) - return - if(pointblank) - user.visible_message("[user] fires [src] point blank at [pbtarget]!", "You fire [src] point blank at [pbtarget]!", "You hear a [istype(src, /obj/item/weapon/gun/energy) ? "laser blast" : "gunshot"]!") - else - user.visible_message("[user] fires [src]!", "You fire [src]!", "You hear a [istype(src, /obj/item/weapon/gun/energy) ? "laser blast" : "gunshot"]!") + if(message) + if(pointblank) + user.visible_message("[user] fires [src] point blank at [pbtarget]!", null, null, 2, user) + else + user.visible_message("[user] fires [src]!", null, null, 2, user) if(weapon_weight >= WEAPON_MEDIUM) if(user.get_inactive_held_item()) diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index da8e2c83ec7..78866b40e0f 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -107,7 +107,7 @@ var/volume = vol_by_damage() playsound(loc, hitsound, volume, 1, -1) L.visible_message("[L] is hit by \a [src][organ_hit_text]!", \ - "[L] is hit by \a [src][organ_hit_text]!") //X has fired Y is now given by the guns so you cant tell who shot you if you could not see the shooter + "[L] is hit by \a [src][organ_hit_text]!", null, 2) L.on_hit(type) var/reagent_note diff --git a/code/modules/projectiles/projectile/reusable.dm b/code/modules/projectiles/projectile/reusable.dm index 6d6b086f63b..3fbc6888f3b 100644 --- a/code/modules/projectiles/projectile/reusable.dm +++ b/code/modules/projectiles/projectile/reusable.dm @@ -15,7 +15,8 @@ /obj/item/projectile/bullet/reusable/proc/handle_drop() if(!dropped) - new ammo_type(src.loc) + var/turf/T = get_turf(src) + new ammo_type(T) dropped = 1 /obj/item/projectile/bullet/reusable/magspear @@ -32,7 +33,7 @@ damage_type = OXY nodamage = 1 icon = 'icons/obj/guns/toy.dmi' - icon_state = "foamdart" + icon_state = "foamdart_proj" ammo_type = /obj/item/ammo_casing/caseless/foam_dart range = 10 var/obj/item/weapon/pen/pen = null @@ -40,8 +41,9 @@ /obj/item/projectile/bullet/reusable/foam_dart/handle_drop() if(dropped) return + var/turf/T = get_turf(src) dropped = 1 - var/obj/item/ammo_casing/caseless/foam_dart/newdart = new ammo_type(src.loc) + var/obj/item/ammo_casing/caseless/foam_dart/newdart = new ammo_type(T) var/obj/item/ammo_casing/caseless/foam_dart/old_dart = ammo_casing newdart.modified = old_dart.modified if(pen) @@ -54,12 +56,13 @@ newdart.BB.damage_type = damage_type newdart.update_icon() + /obj/item/projectile/bullet/reusable/foam_dart/Destroy() pen = null return ..() /obj/item/projectile/bullet/reusable/foam_dart/riot name = "riot foam dart" - icon_state = "foamdart_riot" + icon_state = "foamdart_riot_proj" ammo_type = /obj/item/ammo_casing/caseless/foam_dart/riot stamina = 25 diff --git a/icons/effects/effects.dmi b/icons/effects/effects.dmi index 84611b698b9..eb49d01877e 100644 Binary files a/icons/effects/effects.dmi and b/icons/effects/effects.dmi differ diff --git a/icons/effects/genetics.dmi b/icons/effects/genetics.dmi index 2a4c02d38f3..6e48e489023 100644 Binary files a/icons/effects/genetics.dmi and b/icons/effects/genetics.dmi differ diff --git a/icons/obj/guns/toy.dmi b/icons/obj/guns/toy.dmi index e3700ae841a..1e1ca047c02 100644 Binary files a/icons/obj/guns/toy.dmi and b/icons/obj/guns/toy.dmi differ diff --git a/icons/obj/projectiles.dmi b/icons/obj/projectiles.dmi index bdefb354d77..bdbd818cc2e 100644 Binary files a/icons/obj/projectiles.dmi and b/icons/obj/projectiles.dmi differ