From 9ae57e95e1d3590afd14aaa901655f5e9cdec41c Mon Sep 17 00:00:00 2001 From: mwerezak Date: Sat, 16 May 2015 12:44:49 -0400 Subject: [PATCH 1/5] Moves mob animations to a new source file, adds attack animation --- baystation12.dme | 1 + code/modules/mob/animations.dm | 164 ++++++++++++++++++++++++++++++ code/modules/mob/living/living.dm | 17 ---- code/modules/mob/mob.dm | 105 ------------------- code/modules/mob/mob_defines.dm | 6 -- 5 files changed, 165 insertions(+), 128 deletions(-) create mode 100644 code/modules/mob/animations.dm diff --git a/baystation12.dme b/baystation12.dme index a1074dc190e..f9650c3fce0 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -1056,6 +1056,7 @@ #include "code\modules\mining\satchel_ore_boxdm.dm" #include "code\modules\mining\drilling\drill.dm" #include "code\modules\mining\drilling\scanner.dm" +#include "code\modules\mob\animations.dm" #include "code\modules\mob\death.dm" #include "code\modules\mob\emote.dm" #include "code\modules\mob\hear_say.dm" diff --git a/code/modules/mob/animations.dm b/code/modules/mob/animations.dm new file mode 100644 index 00000000000..8deca57d180 --- /dev/null +++ b/code/modules/mob/animations.dm @@ -0,0 +1,164 @@ +/* +adds a dizziness amount to a mob +use this rather than directly changing var/dizziness +since this ensures that the dizzy_process proc is started +currently only humans get dizzy + +value of dizziness ranges from 0 to 1000 +below 100 is not dizzy +*/ + +/mob/var/dizziness = 0//Carbon +/mob/var/is_dizzy = 0 + +/mob/proc/make_dizzy(var/amount) + if(!istype(src, /mob/living/carbon/human)) // for the moment, only humans get dizzy + return + + dizziness = min(1000, dizziness + amount) // store what will be new value + // clamped to max 1000 + if(dizziness > 100 && !is_dizzy) + spawn(0) + dizzy_process() + + +/* +dizzy process - wiggles the client's pixel offset over time +spawned from make_dizzy(), will terminate automatically when dizziness gets <100 +note dizziness decrements automatically in the mob's Life() proc. +*/ +/mob/proc/dizzy_process() + is_dizzy = 1 + while(dizziness > 100) + if(client) + var/amplitude = dizziness*(sin(dizziness * 0.044 * world.time) + 1) / 70 + client.pixel_x = amplitude * sin(0.008 * dizziness * world.time) + client.pixel_y = amplitude * cos(0.008 * dizziness * world.time) + + sleep(1) + //endwhile - reset the pixel offsets to zero + is_dizzy = 0 + if(client) + client.pixel_x = 0 + client.pixel_y = 0 + +// jitteriness - copy+paste of dizziness +/mob/var/is_jittery = 0 +/mob/var/jitteriness = 0//Carbon +/mob/proc/make_jittery(var/amount) + if(!istype(src, /mob/living/carbon/human)) // for the moment, only humans get dizzy + return + + jitteriness = min(1000, jitteriness + amount) // store what will be new value + // clamped to max 1000 + if(jitteriness > 100 && !is_jittery) + spawn(0) + jittery_process() + + +// Typo from the oriignal coder here, below lies the jitteriness process. So make of his code what you will, the previous comment here was just a copypaste of the above. +/mob/proc/jittery_process() + //var/old_x = pixel_x + //var/old_y = pixel_y + is_jittery = 1 + while(jitteriness > 100) +// var/amplitude = jitteriness*(sin(jitteriness * 0.044 * world.time) + 1) / 70 +// pixel_x = amplitude * sin(0.008 * jitteriness * world.time) +// pixel_y = amplitude * cos(0.008 * jitteriness * world.time) + + var/amplitude = min(4, jitteriness / 100) + pixel_x = old_x + rand(-amplitude, amplitude) + pixel_y = old_y + rand(-amplitude/3, amplitude/3) + + sleep(1) + //endwhile - reset the pixel offsets to zero + is_jittery = 0 + pixel_x = old_x + pixel_y = old_y + + +//handles up-down floaty effect in space +/mob/var/is_floating = 0 +/mob/var/floatiness = 0 + +/mob/proc/make_floating(var/n) + + floatiness = n + + if(floatiness && !is_floating) + start_floating() + else if(!floatiness && is_floating) + stop_floating() + +/mob/proc/start_floating() + + is_floating = 1 + + var/amplitude = 2 //maximum displacement from original position + var/period = 36 //time taken for the mob to go up >> down >> original position, in deciseconds. Should be multiple of 4 + + var/top = old_y + amplitude + var/bottom = old_y - amplitude + var/half_period = period / 2 + var/quarter_period = period / 4 + + animate(src, pixel_y = top, time = quarter_period, easing = SINE_EASING | EASE_OUT, loop = -1) //up + animate(pixel_y = bottom, time = half_period, easing = SINE_EASING, loop = -1) //down + animate(pixel_y = old_y, time = quarter_period, easing = SINE_EASING | EASE_IN, loop = -1) //back + +/mob/proc/stop_floating() + animate(src, pixel_y = old_y, time = 5, easing = SINE_EASING | EASE_IN) //halt animation + //reset the pixel offsets to zero + is_floating = 0 + +/atom/movable/proc/do_attack_animation(atom/A) + world << "[src].do_attack_animation([A])" + + var/pixel_x_diff = 0 + var/pixel_y_diff = 0 + var/direction = get_dir(src, A) + switch(direction) + if(NORTH) + pixel_y_diff = 8 + if(SOUTH) + pixel_y_diff = -8 + if(EAST) + pixel_x_diff = 8 + if(WEST) + pixel_x_diff = -8 + if(NORTHEAST) + pixel_x_diff = 8 + pixel_y_diff = 8 + if(NORTHWEST) + pixel_x_diff = -8 + pixel_y_diff = 8 + if(SOUTHEAST) + pixel_x_diff = 8 + pixel_y_diff = -8 + if(SOUTHWEST) + pixel_x_diff = -8 + pixel_y_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 = initial(pixel_y), time = 2) + +/mob/do_attack_animation(atom/A) + ..() + is_floating = 0 // If we were without gravity, the bouncing animation got stopped, so we make sure we restart the bouncing after the next movement. + +/mob/proc/spin(spintime, speed) + spawn() + var/D = dir + while(spintime >= speed) + sleep(speed) + switch(D) + if(NORTH) + D = EAST + if(SOUTH) + D = WEST + if(EAST) + D = SOUTH + if(WEST) + D = NORTH + set_dir(D) + spintime -= speed + return diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index c37dce28246..80902ddaa91 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -777,20 +777,3 @@ default behaviour is: return ..() -/mob/living/carbon/proc/spin(spintime, speed) - spawn() - var/D = dir - while(spintime >= speed) - sleep(speed) - switch(D) - if(NORTH) - D = EAST - if(SOUTH) - D = WEST - if(EAST) - D = SOUTH - if(WEST) - D = NORTH - set_dir(D) - spintime -= speed - return diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index e9cae30755d..370ecce03ad 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -615,111 +615,6 @@ for(var/mob/M in viewers()) M.see(message) -/* -adds a dizziness amount to a mob -use this rather than directly changing var/dizziness -since this ensures that the dizzy_process proc is started -currently only humans get dizzy - -value of dizziness ranges from 0 to 1000 -below 100 is not dizzy -*/ -/mob/proc/make_dizzy(var/amount) - if(!istype(src, /mob/living/carbon/human)) // for the moment, only humans get dizzy - return - - dizziness = min(1000, dizziness + amount) // store what will be new value - // clamped to max 1000 - if(dizziness > 100 && !is_dizzy) - spawn(0) - dizzy_process() - - -/* -dizzy process - wiggles the client's pixel offset over time -spawned from make_dizzy(), will terminate automatically when dizziness gets <100 -note dizziness decrements automatically in the mob's Life() proc. -*/ -/mob/proc/dizzy_process() - is_dizzy = 1 - while(dizziness > 100) - if(client) - var/amplitude = dizziness*(sin(dizziness * 0.044 * world.time) + 1) / 70 - client.pixel_x = amplitude * sin(0.008 * dizziness * world.time) - client.pixel_y = amplitude * cos(0.008 * dizziness * world.time) - - sleep(1) - //endwhile - reset the pixel offsets to zero - is_dizzy = 0 - if(client) - client.pixel_x = 0 - client.pixel_y = 0 - -// jitteriness - copy+paste of dizziness - -/mob/proc/make_jittery(var/amount) - if(!istype(src, /mob/living/carbon/human)) // for the moment, only humans get dizzy - return - - jitteriness = min(1000, jitteriness + amount) // store what will be new value - // clamped to max 1000 - if(jitteriness > 100 && !is_jittery) - spawn(0) - jittery_process() - - -// Typo from the oriignal coder here, below lies the jitteriness process. So make of his code what you will, the previous comment here was just a copypaste of the above. -/mob/proc/jittery_process() - //var/old_x = pixel_x - //var/old_y = pixel_y - is_jittery = 1 - while(jitteriness > 100) -// var/amplitude = jitteriness*(sin(jitteriness * 0.044 * world.time) + 1) / 70 -// pixel_x = amplitude * sin(0.008 * jitteriness * world.time) -// pixel_y = amplitude * cos(0.008 * jitteriness * world.time) - - var/amplitude = min(4, jitteriness / 100) - pixel_x = old_x + rand(-amplitude, amplitude) - pixel_y = old_y + rand(-amplitude/3, amplitude/3) - - sleep(1) - //endwhile - reset the pixel offsets to zero - is_jittery = 0 - pixel_x = old_x - pixel_y = old_y - - -//handles up-down floaty effect in space -/mob/proc/make_floating(var/n) - - floatiness = n - - if(floatiness && !is_floating) - start_floating() - else if(!floatiness && is_floating) - stop_floating() - -/mob/proc/start_floating() - - is_floating = 1 - - var/amplitude = 2 //maximum displacement from original position - var/period = 36 //time taken for the mob to go up >> down >> original position, in deciseconds. Should be multiple of 4 - - var/top = old_y + amplitude - var/bottom = old_y - amplitude - var/half_period = period / 2 - var/quarter_period = period / 4 - - animate(src, pixel_y = top, time = quarter_period, easing = SINE_EASING | EASE_OUT, loop = -1) //up - animate(pixel_y = bottom, time = half_period, easing = SINE_EASING, loop = -1) //down - animate(pixel_y = old_y, time = quarter_period, easing = SINE_EASING | EASE_IN, loop = -1) //back - -/mob/proc/stop_floating() - animate(src, pixel_y = old_y, time = 5, easing = SINE_EASING | EASE_IN) //halt animation - //reset the pixel offsets to zero - is_floating = 0 - /mob/Stat() ..() diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index 792517c6d05..897c5181da7 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -108,12 +108,6 @@ var/old_x = 0 var/old_y = 0 var/drowsyness = 0.0//Carbon - var/dizziness = 0//Carbon - var/is_dizzy = 0 - var/is_jittery = 0 - var/jitteriness = 0//Carbon - var/is_floating = 0 - var/floatiness = 0 var/charges = 0.0 var/nutrition = 400.0//Carbon From 20b72b9911d4e6ad8651dad8f63fe07b675f7ba5 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Sat, 16 May 2015 13:47:19 -0400 Subject: [PATCH 2/5] Adds attack animation calls --- code/_onclick/item_attack.dm | 10 +++++ code/modules/mob/living/bot/farmbot.dm | 1 + code/modules/mob/living/bot/secbot.dm | 2 + .../living/carbon/human/human_attackhand.dm | 6 ++- .../species/xenomorphs/alien_facehugger.dm | 8 ++-- .../simple_animal/friendly/spiderbot.dm | 14 +----- .../living/simple_animal/hostile/syndicate.dm | 1 + .../mob/living/simple_animal/simple_animal.dm | 44 +++++++++++-------- 8 files changed, 51 insertions(+), 35 deletions(-) diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index 7bb85445d4d..0c8685162fd 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -20,6 +20,15 @@ /obj/item/proc/afterattack(atom/target, mob/user, proximity_flag, click_parameters) return +//TODO: refactor mob attack code. +/* +Busy writing something else that I don't want to get mixed up in a general attack code, and I don't want to forget this so leaving a note here. +leave attackby() as handling the general case of "using an item on a mob" +attackby() will decide to call attacked_by() or not. +attacked_by() will be made a living level proc and handle the specific case of "attacking with an item to cause harm" +attacked_by() will then call attack() so that stunbatons and other weapons that have special attack effects can do their thing. +attacked_by() will handle hitting/missing/logging as it does now, and will call attack() to apply the attack effects (damage) instead of the other way around (as it is now). +*/ /obj/item/proc/attack(mob/living/M as mob, mob/living/user as mob, def_zone) @@ -57,6 +66,7 @@ power *= 2 // TODO: needs to be refactored into a mob/living level attacked_by() proc. ~Z + user.do_attack_animation(M) if(istype(M, /mob/living/carbon/human)) var/mob/living/carbon/human/H = M diff --git a/code/modules/mob/living/bot/farmbot.dm b/code/modules/mob/living/bot/farmbot.dm index f1c84f38662..4a7c6c0f22f 100644 --- a/code/modules/mob/living/bot/farmbot.dm +++ b/code/modules/mob/living/bot/farmbot.dm @@ -228,6 +228,7 @@ switch(action) if("weed") flick("farmbot_hoe", src) + do_attack_animation(A) if(prob(50)) visible_message("[src] swings wildly at [A] with a minihoe, missing completely!") return diff --git a/code/modules/mob/living/bot/secbot.dm b/code/modules/mob/living/bot/secbot.dm index eba380340f6..848da5633a5 100644 --- a/code/modules/mob/living/bot/secbot.dm +++ b/code/modules/mob/living/bot/secbot.dm @@ -264,6 +264,7 @@ if(!cuff) C.stun_effect_act(0, 60, null) playsound(loc, 'sound/weapons/Egloves.ogg', 50, 1, -1) + do_attack_animation(C) is_attacking = 1 update_icons() spawn(2) @@ -283,6 +284,7 @@ var/mob/living/simple_animal/S = M S.AdjustStunned(10) S.adjustBruteLoss(15) + do_attack_animation(M) playsound(loc, "swing_hit", 50, 1, -1) is_attacking = 1 update_icons() diff --git a/code/modules/mob/living/carbon/human/human_attackhand.dm b/code/modules/mob/living/carbon/human/human_attackhand.dm index b8244e83268..92a022f1059 100644 --- a/code/modules/mob/living/carbon/human/human_attackhand.dm +++ b/code/modules/mob/living/carbon/human/human_attackhand.dm @@ -15,10 +15,11 @@ if(istype(H)) if((H != src) && check_shields(0, H.name)) visible_message("\red [H] attempted to touch [src]!") + H.do_attack_animation(src) return 0 if(istype(H.gloves, /obj/item/clothing/gloves/boxing/hologlove)) - + H.do_attack_animation(src) var/damage = rand(0, 9) if(!damage) playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) @@ -88,6 +89,7 @@ G.synch() LAssailant = M + H.do_attack_animation(src) playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) visible_message("[M] has grabbed [src] passively!") return 1 @@ -179,6 +181,7 @@ if(!attack) return 0 + H.do_attack_animation(src) if(!attack_message) attack.show_attack(H, src, hit_zone, rand_damage) else @@ -213,6 +216,7 @@ src.attack_log += text("\[[time_stamp()]\] Has been disarmed by [M.name] ([M.ckey])") msg_admin_attack("[key_name(M)] disarmed [src.name] ([src.ckey])") + M.do_attack_animation(src) if(w_uniform) w_uniform.add_fingerprint(M) diff --git a/code/modules/mob/living/carbon/human/species/xenomorphs/alien_facehugger.dm b/code/modules/mob/living/carbon/human/species/xenomorphs/alien_facehugger.dm index bdc505fe343..68e106ee1dd 100644 --- a/code/modules/mob/living/carbon/human/species/xenomorphs/alien_facehugger.dm +++ b/code/modules/mob/living/carbon/human/species/xenomorphs/alien_facehugger.dm @@ -54,8 +54,10 @@ var/const/MAX_ACTIVE_TIME = 400 user << "\red \b It looks like the proboscis has been removed." return -/obj/item/clothing/mask/facehugger/attackby() - Die() +/obj/item/clothing/mask/facehugger/attackby(obj/item/I, mob/user) + if(I.force) + user.do_attack_animation(src) + Die() return /obj/item/clothing/mask/facehugger/bullet_act() @@ -63,7 +65,7 @@ var/const/MAX_ACTIVE_TIME = 400 return /obj/item/clothing/mask/facehugger/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) - if(exposed_temperature > 300) + if(exposed_temperature > T0C+80) Die() return diff --git a/code/modules/mob/living/simple_animal/friendly/spiderbot.dm b/code/modules/mob/living/simple_animal/friendly/spiderbot.dm index af59941b1f7..0631273769c 100644 --- a/code/modules/mob/living/simple_animal/friendly/spiderbot.dm +++ b/code/modules/mob/living/simple_animal/friendly/spiderbot.dm @@ -135,19 +135,7 @@ spawn(300) src.explode() else - if(O.force) - var/damage = O.force - if (O.damtype == HALLOSS) - damage = 0 - adjustBruteLoss(damage) - for(var/mob/M in viewers(src, null)) - if ((M.client && !( M.blinded ))) - M.show_message("\red \b [src] has been attacked with the [O] by [user]. ") - else - usr << "\red This weapon is ineffective, it does no damage." - for(var/mob/M in viewers(src, null)) - if ((M.client && !( M.blinded ))) - M.show_message("\red [user] gently taps [src] with the [O]. ") + attacked_with_item(O, user) /mob/living/simple_animal/spiderbot/proc/transfer_personality(var/obj/item/device/mmi/M as obj) diff --git a/code/modules/mob/living/simple_animal/hostile/syndicate.dm b/code/modules/mob/living/simple_animal/hostile/syndicate.dm index e0845a399d8..870ad82c8e0 100644 --- a/code/modules/mob/living/simple_animal/hostile/syndicate.dm +++ b/code/modules/mob/living/simple_animal/hostile/syndicate.dm @@ -68,6 +68,7 @@ visible_message("\red \b [src] has been attacked with the [O] by [user]. ") else visible_message("\red \b [src] blocks the [O] with its shield! ") + //user.do_attack_animation(src) else usr << "\red This weapon is ineffective, it does no damage." visible_message("\red [user] gently taps [src] with the [O]. ") diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index ab2bc3d98cd..fc8f0b33b35 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -240,6 +240,7 @@ if(I_DISARM) M.visible_message("\blue [M] [response_disarm] \the [src]") + M.do_attack_animation(src) //TODO: Push the mob away or something if(I_GRAB) @@ -257,10 +258,12 @@ LAssailant = M M.visible_message("\red [M] has grabbed [src] passively!") + M.do_attack_animation(src) if(I_HURT) adjustBruteLoss(harm_intent_damage) M.visible_message("\red [M] [response_harm] \the [src]") + M.do_attack_animation(src) return @@ -279,28 +282,33 @@ if ((M.client && !( M.blinded ))) M.show_message("[user] applies the [MED] on [src].") else - user << "\The [src] is dead, medical items won't bring it back to life." + user << "\The [src] is dead, medical items won't bring \him back to life." if(meat_type && (stat == DEAD)) //if the animal has a meat, and if it is dead. if(istype(O, /obj/item/weapon/kitchenknife) || istype(O, /obj/item/weapon/butch)) harvest(user) else - user.changeNext_move(8) - if(O.force > resistance) - var/damage = O.force - if (O.damtype == HALLOSS) - damage = 0 - if(supernatural && istype(O,/obj/item/weapon/nullrod)) - damage *= 2 - purge = 3 - adjustBruteLoss(damage) - for(var/mob/M in viewers(src, null)) - if ((M.client && !( M.blinded ))) - M.show_message("This weapon is ineffective, it does no damage." - for(var/mob/M in viewers(src, null)) - if ((M.client && !( M.blinded ))) - M.show_message("[user] gently taps [src] with \the [O].") + attacked_with_item(O, user) + +//TODO: refactor mob attackby(), attacked_by(), and friends. +/mob/living/simple_animal/proc/attacked_with_item(var/obj/item/O, var/mob/user) + user.changeNext_move(8) + if(!O.force) + visible_message("[user] gently taps [src] with \the [O].") + return + + if(O.force > resistance) + var/damage = O.force + if (O.damtype == HALLOSS) + damage = 0 + if(supernatural && istype(O,/obj/item/weapon/nullrod)) + damage *= 2 + purge = 3 + adjustBruteLoss(damage) + else + usr << "[src] has been attacked with the [O] by [user].") + user.do_attack_animation(src) /mob/living/simple_animal/movement_delay() var/tally = 0 //Incase I need to add stuff other than "speed" later From 87178d74a68bd7286617c86d352aeddf1cbc7301 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Wed, 20 May 2015 00:19:39 -0400 Subject: [PATCH 3/5] Adds attack animation calls for attack_generic() --- code/game/gamemodes/cult/cult_structures.dm | 11 ++++++----- code/game/machinery/doors/door.dm | 1 + code/game/machinery/turrets.dm | 1 + code/game/mecha/mecha.dm | 3 ++- code/game/objects/structures.dm | 1 + .../game/objects/structures/crates_lockers/closets.dm | 1 + .../structures/crates_lockers/closets/statue.dm | 1 + code/game/objects/structures/girders.dm | 1 + code/game/objects/structures/grille.dm | 1 + code/game/objects/structures/inflatable.dm | 1 + code/game/objects/structures/mirror.dm | 1 + code/game/objects/structures/window.dm | 1 + code/game/turfs/simulated/wall_attacks.dm | 1 + .../mob/living/carbon/human/human_attackhand.dm | 1 + code/modules/mob/living/living_defense.dm | 1 + code/modules/power/lighting.dm | 1 + code/modules/vehicles/vehicle.dm | 1 + 17 files changed, 23 insertions(+), 6 deletions(-) diff --git a/code/game/gamemodes/cult/cult_structures.dm b/code/game/gamemodes/cult/cult_structures.dm index b5854ed9818..d70c181830a 100644 --- a/code/game/gamemodes/cult/cult_structures.dm +++ b/code/game/gamemodes/cult/cult_structures.dm @@ -38,11 +38,12 @@ /obj/structure/cult/pylon/proc/attackpylon(mob/user as mob, var/damage) if(!isbroken) if(prob(1+ damage * 5)) - user << "You hit the pylon, and its crystal breaks apart!" - for(var/mob/M in viewers(src)) - if(M == user) - continue - M.show_message("[user.name] smashed the pylon!", 3, "You hear a tinkle of crystal shards", 2) + user.visible_message( + "[user] smashed the pylon!", + "You hit the pylon, and its crystal breaks apart!", + "You hear a tinkle of crystal shards" + ) + user.do_attack_animation(src) playsound(get_turf(src), 'sound/effects/Glassbr3.ogg', 75, 1) isbroken = 1 density = 0 diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 0f3760009d6..5fe902c4854 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -43,6 +43,7 @@ take_damage(damage) else visible_message("\The [user] bonks \the [src] harmlessly.") + user.do_attack_animation(src) /obj/machinery/door/New() . = ..() diff --git a/code/game/machinery/turrets.dm b/code/game/machinery/turrets.dm index e3a104d21c5..c36fe7c0644 100644 --- a/code/game/machinery/turrets.dm +++ b/code/game/machinery/turrets.dm @@ -341,6 +341,7 @@ if(stat & BROKEN) user << "That object is useless to you." return 0 + user.do_attack_animation(src) visible_message("[user] [attack_message] the [src]!") user.attack_log += text("\[[time_stamp()]\] attacked [src.name]") src.health -= damage diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index b0423340e7e..3e4703cd331 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -1791,8 +1791,9 @@ if(!damage) return 0 - src.log_message("Attack by an animal. Attacker - [user].",1) + src.log_message("Attacked. Attacker - [user].",1) + user.do_attack_animation(src) if(!prob(src.deflect_chance)) src.take_damage(damage) src.check_for_internal_damage(list(MECHA_INT_TEMP_CONTROL,MECHA_INT_TANK_BREACH,MECHA_INT_CONTROL_LOST)) diff --git a/code/game/objects/structures.dm b/code/game/objects/structures.dm index 4b0501a2d11..fe96abb4696 100644 --- a/code/game/objects/structures.dm +++ b/code/game/objects/structures.dm @@ -192,5 +192,6 @@ if(!breakable || !damage || !wallbreaker) return 0 visible_message("[user] [attack_verb] the [src] apart!") + user.do_attack_animation(src) spawn(1) qdel(src) return 1 diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 5e1a551cecf..2bb423c2410 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -305,6 +305,7 @@ /obj/structure/closet/attack_generic(var/mob/user, var/damage, var/attack_message = "destroys", var/wallbreaker) if(!damage || !wallbreaker) return + user.do_attack_animation(src) visible_message("[user] [attack_message] the [src]!") dump_contents() spawn(1) qdel(src) diff --git a/code/game/objects/structures/crates_lockers/closets/statue.dm b/code/game/objects/structures/crates_lockers/closets/statue.dm index 67a159e7cac..b59cd62dfa3 100644 --- a/code/game/objects/structures/crates_lockers/closets/statue.dm +++ b/code/game/objects/structures/crates_lockers/closets/statue.dm @@ -105,6 +105,7 @@ /obj/structure/closet/statue/attackby(obj/item/I as obj, mob/user as mob) health -= I.force + user.do_attack_animation(src) visible_message("[user] strikes [src] with [I].") if(health <= 0) for(var/mob/M in src) diff --git a/code/game/objects/structures/girders.dm b/code/game/objects/structures/girders.dm index e8cb65a33d7..4a12eb9e007 100644 --- a/code/game/objects/structures/girders.dm +++ b/code/game/objects/structures/girders.dm @@ -17,6 +17,7 @@ /obj/structure/girder/attack_generic(var/mob/user, var/damage, var/attack_message = "smashes apart", var/wallbreaker) if(!damage || !wallbreaker) return 0 + user.do_attack_animation(src) visible_message("[user] [attack_message] the [src]!") spawn(1) dismantle() return 1 diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index b18658d4a6c..0dadc6b44f1 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -217,6 +217,7 @@ /obj/structure/grille/attack_generic(var/mob/user, var/damage, var/attack_verb) visible_message("[user] [attack_verb] the [src]!") + user.do_attack_animation(src) health -= damage spawn(1) healthcheck() return 1 diff --git a/code/game/objects/structures/inflatable.dm b/code/game/objects/structures/inflatable.dm index a9b1359b754..7ded57a35e8 100644 --- a/code/game/objects/structures/inflatable.dm +++ b/code/game/objects/structures/inflatable.dm @@ -115,6 +115,7 @@ /obj/structure/inflatable/attack_generic(var/mob/user, var/damage, var/attack_verb) health -= damage + user.do_attack_animation(src) if(health <= 0) user.visible_message("[user] [attack_verb] open the [src]!") spawn(1) deflate(1) diff --git a/code/game/objects/structures/mirror.dm b/code/game/objects/structures/mirror.dm index 4868f6e0ca5..8141dcf5a39 100644 --- a/code/game/objects/structures/mirror.dm +++ b/code/game/objects/structures/mirror.dm @@ -54,6 +54,7 @@ /obj/structure/mirror/attack_generic(var/mob/user, var/damage) + user.do_attack_animation(src) if(shattered) playsound(src.loc, 'sound/effects/hit_on_shattered_glass.ogg', 70, 1) return 0 diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 387c76eb698..8be7d2bd976 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -207,6 +207,7 @@ take_damage(damage) else visible_message("\The [user] bonks \the [src] harmlessly.") + user.do_attack_animation(src) return 1 /obj/structure/window/attackby(obj/item/W as obj, mob/user as mob) diff --git a/code/game/turfs/simulated/wall_attacks.dm b/code/game/turfs/simulated/wall_attacks.dm index 4d86d70877d..e3037f94a96 100644 --- a/code/game/turfs/simulated/wall_attacks.dm +++ b/code/game/turfs/simulated/wall_attacks.dm @@ -28,6 +28,7 @@ /turf/simulated/wall/proc/success_smash(var/mob/user) user << "You smash through the wall!" + user.do_attack_animation(src) spawn(1) dismantle_wall(1) diff --git a/code/modules/mob/living/carbon/human/human_attackhand.dm b/code/modules/mob/living/carbon/human/human_attackhand.dm index 92a022f1059..081f2c2def1 100644 --- a/code/modules/mob/living/carbon/human/human_attackhand.dm +++ b/code/modules/mob/living/carbon/human/human_attackhand.dm @@ -275,6 +275,7 @@ user.attack_log += text("\[[time_stamp()]\] attacked [src.name] ([src.ckey])") src.attack_log += text("\[[time_stamp()]\] was attacked by [user.name] ([user.ckey])") src.visible_message("[user] has [attack_message] [src]!") + user.do_attack_animation(src) var/dam_zone = pick("head", "chest", "l_arm", "r_arm", "l_leg", "r_leg", "groin") var/obj/item/organ/external/affecting = get_organ(ran_zone(dam_zone)) diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 4a41479e340..9dd399a8041 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -194,6 +194,7 @@ user.attack_log += text("\[[time_stamp()]\] attacked [src.name] ([src.ckey])") src.attack_log += text("\[[time_stamp()]\] was attacked by [user.name] ([user.ckey])") src.visible_message("[user] has [attack_message] [src]!") + user.do_attack_animation(src) spawn(1) updatehealth() return 1 diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index ba3c539c775..0c02a4e182c 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -271,6 +271,7 @@ if(!(status == LIGHT_OK||status == LIGHT_BURNED)) return visible_message("[user] smashes the light!") + user.do_attack_animation(src) broken() return 1 diff --git a/code/modules/vehicles/vehicle.dm b/code/modules/vehicles/vehicle.dm index 9407dc937a0..dc5f1faaf79 100644 --- a/code/modules/vehicles/vehicle.dm +++ b/code/modules/vehicles/vehicle.dm @@ -363,6 +363,7 @@ return visible_message("[user] [attack_message] the [src]!") user.attack_log += text("\[[time_stamp()]\] attacked [src.name]") + user.do_attack_animation(src) src.health -= damage if(prob(10)) new /obj/effect/decal/cleanable/blood/oil(src.loc) From c289975498efecff312aa130441cd5e66726b7fe Mon Sep 17 00:00:00 2001 From: mwerezak Date: Wed, 20 May 2015 00:28:57 -0400 Subject: [PATCH 4/5] Adds attack animation calls for a few common machines and structures - Cameras - Doors - Grilles - Windows --- code/game/machinery/camera/camera.dm | 2 ++ code/game/machinery/doors/door.dm | 1 + code/game/objects/structures/grille.dm | 2 ++ code/game/objects/structures/window.dm | 11 +++++++---- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 4a7aed5555b..c88b9bfa370 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -115,6 +115,7 @@ if(user.species.can_shred(user)) set_status(0) + user.do_attack_animation(src) visible_message("\The [user] slashes at [src]!") playsound(src.loc, 'sound/weapons/slash.ogg', 100, 1) icon_state = "[initial(icon_state)]1" @@ -188,6 +189,7 @@ else if(W.damtype == BRUTE || W.damtype == BURN) //bashing cameras if (W.force >= src.toughness) + user.do_attack_animation(src) visible_message("[src] has been [pick(W.attack_verb)] with [W] by [user]!") if (istype(W, /obj/item)) //is it even possible to get into attackby() with non-items? var/obj/item/I = W diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 5fe902c4854..a5f492814ed 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -265,6 +265,7 @@ if(src.density && istype(I, /obj/item/weapon) && user.a_intent == I_HURT && !istype(I, /obj/item/weapon/card)) var/obj/item/weapon/W = I if(W.damtype == BRUTE || W.damtype == BURN) + user.do_attack_animation(src) if(W.force < min_force) user.visible_message("\red \The [user] hits \the [src] with \the [W] with no visible effect." ) else diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index 0dadc6b44f1..49be0622c94 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -34,6 +34,7 @@ /obj/structure/grille/attack_hand(mob/user as mob) playsound(loc, 'sound/effects/grillehit.ogg', 80, 1) + user.do_attack_animation(src) var/damage_dealt = 1 var/attack_message = "kicks" @@ -156,6 +157,7 @@ else if(istype(W, /obj/item/weapon/shard)) health -= W.force * 0.1 else if(!shock(user, 70)) + user.do_attack_animation(src) playsound(loc, 'sound/effects/grillehit.ogg', 80, 1) switch(W.damtype) if("fire") diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 8be7d2bd976..82a64c2f4ac 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -178,6 +178,7 @@ if(HULK in user.mutations) user.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!")) user.visible_message("[user] smashes through [src]!") + user.do_attack_animation(src) shatter() else if (usr.a_intent == I_HURT) @@ -189,13 +190,14 @@ return playsound(src.loc, 'sound/effects/glassknock.ogg', 80, 1) - usr.visible_message("\red [usr.name] bangs against the [src.name]!", \ - "\red You bang against the [src.name]!", \ + user.do_attack_animation(src) + usr.visible_message("\red [usr.name] bangs against the [src.name]!", + "\red You bang against the [src.name]!", "You hear a banging sound.") else playsound(src.loc, 'sound/effects/glassknock.ogg', 80, 1) - usr.visible_message("[usr.name] knocks on the [src.name].", \ - "You knock on the [src.name].", \ + usr.visible_message("[usr.name] knocks on the [src.name].", + "You knock on the [src.name].", "You hear a knocking sound.") return @@ -270,6 +272,7 @@ qdel(src) else if(W.damtype == BRUTE || W.damtype == BURN) + user.do_attack_animation(src) hit(W.force) if(health <= 7) anchored = 0 From 01e8246e6452cfe54b490c11f849d1fc7d2de3ee Mon Sep 17 00:00:00 2001 From: mwerezak Date: Wed, 20 May 2015 00:35:26 -0400 Subject: [PATCH 5/5] Clean up world print --- code/modules/mob/animations.dm | 1 - 1 file changed, 1 deletion(-) diff --git a/code/modules/mob/animations.dm b/code/modules/mob/animations.dm index 8deca57d180..ac4224dc436 100644 --- a/code/modules/mob/animations.dm +++ b/code/modules/mob/animations.dm @@ -112,7 +112,6 @@ note dizziness decrements automatically in the mob's Life() proc. is_floating = 0 /atom/movable/proc/do_attack_animation(atom/A) - world << "[src].do_attack_animation([A])" var/pixel_x_diff = 0 var/pixel_y_diff = 0