From 45a2d6cb64710e039bebcc97ff875a336dc926b7 Mon Sep 17 00:00:00 2001 From: "sieve32@gmail.com" Date: Sat, 27 Oct 2012 01:04:58 +0000 Subject: [PATCH] - Made throwing log and factor armor. The attack_log (Both server and mob) will show who last touched the object as the 'assailant', even if they didn't directly hit them. Fixes Issue 1033 git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4965 316c924e-a436-60f5-8080-3fe189b3f50e --- code/game/atoms.dm | 5 +---- code/modules/mob/living/living_defense.dm | 25 ++++++++++++++++++++++- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 80588f4dce4..399f0a67755 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -23,10 +23,7 @@ /atom/proc/throw_impact(atom/hit_atom) if(istype(hit_atom,/mob/living)) var/mob/living/M = hit_atom - M.visible_message("\red [hit_atom] has been hit by [src].") - if(isobj(src))//Hate typecheckin for a child object but this is just fixing crap another guy broke so if someone wants to put the time in and make this proper feel free. - M.take_organ_damage(src:throwforce) - + M.hitby(src) else if(isobj(hit_atom)) var/obj/O = hit_atom diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index c0af35f8ca7..7bcb9f53437 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -51,4 +51,27 @@ if(!P.nodamage) apply_damage((P.damage/(absorb+1)), P.damage_type, def_zone) P.on_hit(src, absorb) - return absorb \ No newline at end of file + return absorb + +/mob/living/hitby(atom/movable/AM as mob|obj)//Standardization and logging -Sieve + if(istype(AM,/obj/)) + var/obj/O = AM + var/zone = ran_zone("chest",75)//Hits a random part of the body, geared towards the chest + var/dtype = BRUTE + if(istype(O,/obj/item/weapon)) + var/obj/item/weapon/W = O + dtype = W.damtype + src.visible_message("\red [src] has been hit by [O].") + var/armor = run_armor_check(zone, "melee", "Your armor has protected your [zone].", "Your armor has softened hit to your [zone].") + if(armor < 2) + apply_damage(O.throwforce, dtype, zone, armor, O) + if(!O.fingerprintslast) + return + var/mob/assailant = null + for(var/mob/living/M in player_list)//Finds the name of whoever threw it (This is required unless thrown objects are COMPLETELY reworked + if(M.key == O.fingerprintslast) + assailant = M + continue + src.attack_log += text("\[[time_stamp()]\] Has been hit with [O], last touched by [assailant.name] ([assailant.ckey])") + assailant.attack_log += text("\[[time_stamp()]\] Hit [src.name] ([src.ckey]) with [O]") + log_attack("[src.name] ([src.ckey]) was hit by [O], last touched by [assailant.name] ([assailant.ckey])") \ No newline at end of file