Skip to content

Commit

Permalink
Merge pull request tgstation#10487 from MrStonedOne/attacklogcleanup
Browse files Browse the repository at this point in the history
Attack logging tweaks/cleanup
  • Loading branch information
RemieRichards committed Jul 10, 2015
2 parents 1a66334 + a262f9a commit f7faf4d
Show file tree
Hide file tree
Showing 62 changed files with 118 additions and 113 deletions.
5 changes: 2 additions & 3 deletions code/__HELPERS/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Proc for attack log creation, because really why not
6 is additional information, anything that needs to be added
*/

/proc/add_logs(mob/user, mob/target, what_done, var/admin=1, var/object=null, var/addition=null)
/proc/add_logs(mob/user, mob/target, what_done, var/object=null, var/addition=null)
var/newhealthtxt = ""
if (target && isliving(target))
var/mob/living/L = target
Expand All @@ -137,5 +137,4 @@ Proc for attack log creation, because really why not
user.attack_log += text("\[[time_stamp()]\] <font color='red'>Has [what_done] [target ? "[target.name][(ismob(target) && target.ckey) ? "([target.ckey])" : ""]" : "NON-EXISTANT SUBJECT"][object ? " with [object]" : " "][addition][newhealthtxt]</font>")
if(target && ismob(target))
target.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has been [what_done] by [user ? "[user.name][(ismob(user) && user.ckey) ? "([user.ckey])" : ""]" : "NON-EXISTANT SUBJECT"][object ? " with [object]" : " "][addition][newhealthtxt]</font>")
if(admin)
log_attack("[user ? "[user.name][(ismob(user) && user.ckey) ? "([user.ckey])" : ""]" : "NON-EXISTANT SUBJECT"] [what_done] [target ? "[target.name][(ismob(target) && target.ckey)? "([target.ckey])" : ""]" : "NON-EXISTANT SUBJECT"][object ? " with [object]" : " "][addition][newhealthtxt]")
log_attack("[user ? "[user.name][(ismob(user) && user.ckey) ? "([user.ckey])" : ""]" : "NON-EXISTANT SUBJECT"] [what_done] [target ? "[target.name][(ismob(target) && target.ckey)? "([target.ckey])" : ""]" : "NON-EXISTANT SUBJECT"][object ? " with [object]" : " "][addition][newhealthtxt]")
5 changes: 3 additions & 2 deletions code/_onclick/item_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,12 @@
user.lastattacked = M
M.lastattacker = user

add_logs(user, M, "attacked", object=src.name, addition="(INTENT: [uppertext(user.a_intent)]) (DAMTYPE: [uppertext(damtype)])")

//spawn(1800) // this wont work right
// M.lastattacker = null
/////////////////////////
M.attacked_by(src, user, def_zone)

add_logs(user, M, "attacked", src.name, "(INTENT: [uppertext(user.a_intent)]) (DAMTYPE: [uppertext(damtype)])")
add_fingerprint(user)

return 1
14 changes: 11 additions & 3 deletions code/datums/martial.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
return

/datum/martial_art/proc/basic_hit(var/mob/living/carbon/human/A,var/mob/living/carbon/human/D)
add_logs(A, D, "punched")

A.do_attack_animation(D)
var/damage = rand(0,9)

Expand All @@ -44,6 +44,7 @@
else
playsound(D.loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1)
D.visible_message("<span class='warning'>[A] has attempted to [atk_verb] [D]!</span>")
add_logs(A, D, "attempted to [atk_verb]")
return 0

var/obj/item/organ/limb/affecting = D.get_organ(ran_zone(A.zone_sel.selecting))
Expand All @@ -58,6 +59,9 @@
"<span class='userdanger'>[A] has [atk_verb]ed [D]!</span>")

D.apply_damage(damage, BRUTE, affecting, armor_block)

add_logs(A, D, "punched")

if((D.stat != DEAD) && damage >= 9)
D.visible_message("<span class='danger'>[A] has weakened [D]!!</span>", \
"<span class='userdanger'>[A] has weakened [D]!</span>")
Expand Down Expand Up @@ -95,7 +99,7 @@
return 1

/datum/martial_art/boxing/harm_act(var/mob/living/carbon/human/A, var/mob/living/carbon/human/D)
add_logs(A, D, "punched")

A.do_attack_animation(D)

var/atk_verb = pick("left hook","right hook","straight punch")
Expand All @@ -109,6 +113,7 @@
else
playsound(D.loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1)
D.visible_message("<span class='warning'>[A] has attempted to hit [D] with a [atk_verb]!</span>")
add_logs(A, D, "attempted to hit", atk_verb)
return 0


Expand All @@ -122,6 +127,7 @@
"<span class='userdanger'>[A] has hit [D] with a [atk_verb]!</span>")

D.apply_damage(damage, STAMINA, affecting, armor_block)
add_logs(A, D, "punched")
if(D.getStaminaLoss() > 50)
var/knockout_prob = D.getStaminaLoss() + rand(-15,15)
if((D.stat != DEAD) && prob(knockout_prob))
Expand Down Expand Up @@ -151,13 +157,15 @@


/datum/martial_art/wrestling/proc/Suplex(var/mob/living/carbon/human/A, var/mob/living/carbon/human/D)
add_logs(A, D, "suplexed")

D.visible_message("<span class='danger'>[A] suplexes [D]!</span>", \
"<span class='userdanger'>[A] suplexes [D]!</span>")
D.forceMove(A.loc)
var/armor_block = D.run_armor_check(null, "melee")
D.apply_damage(30, BRUTE, null, armor_block)
D.apply_effect(6, WEAKEN, armor_block)
add_logs(A, D, "suplexed")

A.SpinAnimation(10,1)

D.SpinAnimation(10,1)
Expand Down
4 changes: 2 additions & 2 deletions code/datums/wires/airlock.dm
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
//Cutting this wire electrifies the door, so that the next person to touch the door without insulated gloves gets electrocuted.
if(A.secondsElectrified != -1)
A.shockedby += text("\[[time_stamp()]\][usr](ckey:[usr.ckey])")
add_logs(usr, A, "electrified", admin=0, addition="at [A.x],[A.y],[A.z]")
add_logs(usr, A, "electrified", addition="at [A.x],[A.y],[A.z]")
A.secondsElectrified = -1
else
if(A.secondsElectrified == -1)
Expand Down Expand Up @@ -164,7 +164,7 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
//one wire for electrifying the door. Sending a pulse through this electrifies the door for 30 seconds.
if(A.secondsElectrified==0)
A.shockedby += text("\[[time_stamp()]\][usr](ckey:[usr.ckey])")
add_logs(usr, A, "electrified", admin=0, addition="at [A.x],[A.y],[A.z]")
add_logs(usr, A, "electrified", addition="at [A.x],[A.y],[A.z]")
A.secondsElectrified = 30
spawn(10)
if(A)
Expand Down
2 changes: 1 addition & 1 deletion code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
/atom/proc/attack_hulk(mob/living/carbon/human/hulk, do_attack_animation = 0)
if(do_attack_animation)
hulk.changeNext_move(CLICK_CD_MELEE)
add_logs(hulk, src, "punched", "hulk powers", admin=0)
add_logs(hulk, src, "punched", "hulk powers")
hulk.do_attack_animation(src)
return

Expand Down
13 changes: 6 additions & 7 deletions code/game/gamemodes/changeling/powers/tiny_prick.dm
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
user << "<span class='notice'>We stealthily sting [target.name].</span>"
if(target.mind && target.mind.changeling)
target << "<span class='warning'>You feel a tiny prick.</span>"
add_logs(user, target, "unsuccessfully stung")
return 1


Expand Down Expand Up @@ -88,7 +87,7 @@
return 1

/obj/effect/proc_holder/changeling/sting/transformation/sting_action(var/mob/user, var/mob/target)
add_logs(user, target, "stung", object="transformation sting", addition=" new identity is [selected_dna.real_name]")
add_logs(user, target, "stung", "transformation sting", " new identity is [selected_dna.real_name]")
var/datum/dna/NewDNA = selected_dna
if(ismonkey(target))
user << "<span class='notice'>Our genes cry out as we sting [target.name]!</span>"
Expand Down Expand Up @@ -174,7 +173,7 @@
return user.mind.changeling.can_absorb_dna(user, target)

/obj/effect/proc_holder/changeling/sting/extract_dna/sting_action(var/mob/user, var/mob/living/carbon/human/target)
add_logs(user, target, "stung", object="extraction sting")
add_logs(user, target, "stung", "extraction sting")
if(!(user.mind.changeling.has_dna(target.dna)))
user.mind.changeling.absorb_dna(target, user)
feedback_add_details("changeling_powers","ED")
Expand All @@ -189,7 +188,7 @@
dna_cost = 2

/obj/effect/proc_holder/changeling/sting/mute/sting_action(var/mob/user, var/mob/living/carbon/target)
add_logs(user, target, "stung", object="mute sting")
add_logs(user, target, "stung", "mute sting")
target.silent += 30
feedback_add_details("changeling_powers","MS")
return 1
Expand All @@ -203,7 +202,7 @@
dna_cost = 1

/obj/effect/proc_holder/changeling/sting/blind/sting_action(var/mob/user, var/mob/target)
add_logs(user, target, "stung", object="blind sting")
add_logs(user, target, "stung", "blind sting")
target << "<span class='danger'>Your eyes burn horrifically!</span>"
target.disabilities |= NEARSIGHT
target.eye_blind = 20
Expand All @@ -220,7 +219,7 @@
dna_cost = 1

/obj/effect/proc_holder/changeling/sting/LSD/sting_action(var/mob/user, var/mob/living/carbon/target)
add_logs(user, target, "stung", object="LSD sting")
add_logs(user, target, "stung", "LSD sting")
spawn(rand(300,600))
if(target)
target.hallucination = max(400, target.hallucination)
Expand All @@ -236,7 +235,7 @@
dna_cost = 2

/obj/effect/proc_holder/changeling/sting/cryo/sting_action(var/mob/user, var/mob/target)
add_logs(user, target, "stung", object="cryo sting")
add_logs(user, target, "stung", "cryo sting")
if(target.reagents)
target.reagents.add_reagent("frostoil", 30)
feedback_add_details("changeling_powers","CS")
Expand Down
4 changes: 3 additions & 1 deletion code/game/gamemodes/cult/ritual.dm
Original file line number Diff line number Diff line change
Expand Up @@ -490,13 +490,13 @@ var/engwords = list("travel", "blood", "join", "hell", "destroy", "technology",
// usr << browse(null, "window=tank")

/obj/item/weapon/tome/attack(mob/living/M as mob, mob/living/user as mob)
add_logs(user, M, "smacked", object=src)
if(istype(M,/mob/dead))
M.invisibility = 0
user.visible_message( \
"<span class='danger'>[user] drags the ghost to our plane of reality!</span>", \
"<span class='danger'>You drag the ghost to our plane of reality!</span>" \
)
add_logs(user, M, "smacked", src)
return
if(!istype(M))
return
Expand All @@ -508,10 +508,12 @@ var/engwords = list("travel", "blood", "join", "hell", "destroy", "technology",
var/holy2unholy = M.reagents.get_reagent_amount("holywater")
M.reagents.del_reagent("holywater")
M.reagents.add_reagent("unholywater",holy2unholy)
add_logs(user, M, "smacked", src, " removing the holy water from them")
return
M.take_organ_damage(0,rand(5,20)) //really lucky - 5 hits for a crit
M.visible_message("<span class='danger'>[user] beats [M] with the arcane tome!</span>", \
"<span class='userdanger'>[user] beats you with the tome, and you feel a searing heat inside you!</span>")
add_logs(user, M, "smacked", src)


/obj/item/weapon/tome/attack_self(mob/living/user as mob)
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/wizard/soulstone.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
return ..()
if(istype(M, /mob/living/carbon/human/dummy))
return..()
add_logs(user, M, "captured [M.name]'s soul", object=src)
add_logs(user, M, "captured [M.name]'s soul", src)

transfer_soul("VICTIM", M, user)
return
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/bots/bots.dm
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
M.changeNext_move(CLICK_CD_MELEE)
health -= M.melee_damage_upper
visible_message("<span class='danger'>[M] has [M.attacktext] [src]!</span>")
add_logs(M, src, "attacked", admin=0)
add_logs(M, src, "attacked")
if(prob(10))
new /obj/effect/decal/cleanable/oil(loc)
healthcheck()
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/doors/airlock.dm
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ About the new airlock wires panel:
usr << text("The door is already electrified. You can't re-electrify it while it's already electrified.<br>\n")
else
shockedby += text("\[[time_stamp()]\][usr](ckey:[usr.ckey])")
add_logs(usr, src, "electrified", admin=0, addition="at [x],[y],[z]")
add_logs(usr, src, "electrified", addition="at [x],[y],[z]")
src.secondsElectrified = 30
spawn(10)
while (src.secondsElectrified>0)
Expand All @@ -850,7 +850,7 @@ About the new airlock wires panel:
usr << text("The door is already electrified. You can't re-electrify it while it's already electrified.<br>\n")
else
shockedby += text("\[[time_stamp()]\][usr](ckey:[usr.ckey])")
add_logs(usr, src, "electrified", admin=0, addition="at [x],[y],[z]")
add_logs(usr, src, "electrified", addition="at [x],[y],[z]")
src.secondsElectrified = -1

if (8) // Not in order >.>
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/portable_turret.dm
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@
return
if(!(stat & BROKEN))
visible_message("<span class='danger'>[M] [M.attacktext] [src]!</span>")
add_logs(M, src, "attacked", admin=0)
add_logs(M, src, "attacked")
take_damage(M.melee_damage_upper)
else
M << "<span class='danger'>That object is useless to you.</span>"
Expand All @@ -327,7 +327,7 @@
if(!(stat & BROKEN))
playsound(src.loc, 'sound/weapons/slash.ogg', 25, 1, -1)
visible_message("<span class='danger'>[M] has slashed at [src]!</span>")
add_logs(M, src, "attacked", admin=0)
add_logs(M, src, "attacked")
take_damage(15)
else
M << "\green That object is useless to you."
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/turrets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@
if(M.melee_damage_upper == 0) return
if(!(stat & BROKEN))
visible_message("<span class='danger'>[M] [M.attacktext] [src]!</span>")
add_logs(M, src, "attacked", admin=0)
add_logs(M, src, "attacked")
//src.attack_log += text("\[[time_stamp()]\] <font color='orange'>was attacked by [M.name] ([M.ckey])</font>")
src.health -= M.melee_damage_upper
if (src.health <= 0)
Expand Down
4 changes: 2 additions & 2 deletions code/game/mecha/equipment/tools/medical_tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
if(to_inject && occupant.reagents.get_reagent_amount(R.id) + to_inject <= inject_amount*2)
occupant_message("Injecting [occupant] with [to_inject] units of [R.name].")
log_message("Injecting [occupant] with [to_inject] units of [R.name].")
add_logs(chassis.occupant, occupant, "injected", object="[name] ([R] - [to_inject] units)")
add_logs(chassis.occupant, occupant, "injected", "[name] ([R] - [to_inject] units)")
SG.reagents.trans_id_to(occupant,R.id,to_inject)
update_equip_info()
return
Expand Down Expand Up @@ -328,7 +328,6 @@
if(M)
var/R
mechsyringe.visible_message("<span class=\"attack\"> [M] was hit by the syringe!</span>")
add_logs(originaloccupant, M, "shot", object="syringegun")
if(M.can_inject(null, 1))
if(mechsyringe.reagents)
for(var/datum/reagent/A in mechsyringe.reagents.reagent_list)
Expand All @@ -338,6 +337,7 @@
mechsyringe.icon = initial(mechsyringe.icon)
mechsyringe.reagents.trans_to(M, mechsyringe.reagents.total_volume)
M.take_organ_damage(2)
add_logs(originaloccupant, M, "shot", "syringegun")
break
else if(mechsyringe.loc == trg)
mechsyringe.icon_state = initial(mechsyringe.icon_state)
Expand Down
4 changes: 2 additions & 2 deletions code/game/mecha/equipment/tools/tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
target.visible_message("<span class='danger'>[chassis] squeezes [target].</span>", \
"<span class='userdanger'>[chassis] squeezes [target].</span>",\
"<span class='italics'>You hear something crack.</span>")
add_logs(chassis.occupant, M, "attacked", object="[name]", addition="(INTENT: [uppertext(chassis.occupant.a_intent)]) (DAMTYE: [uppertext(damtype)])")
add_logs(chassis.occupant, M, "attacked", "[name]", "(INTENT: [uppertext(chassis.occupant.a_intent)]) (DAMTYE: [uppertext(damtype)])")
else
step_away(M,chassis)
occupant_message("You push [target] out of the way.")
Expand Down Expand Up @@ -151,7 +151,6 @@
/obj/item/mecha_parts/mecha_equipment/tool/drill/proc/drill_mob(mob/living/target, mob/user, var/drill_damage=80)
target.visible_message("<span class='danger'>[chassis] drills [target] with [src].</span>", \
"<span class='userdanger'>[chassis] drills [target] with [src].</span>")
add_logs(user, target, "attacked", object="[name]", addition="(INTENT: [uppertext(user.a_intent)]) (DAMTYPE: [uppertext(damtype)])")
if(ishuman(target))
var/mob/living/carbon/human/H = target
var/obj/item/organ/limb/affecting = H.get_organ("chest")
Expand All @@ -162,6 +161,7 @@
if(target)
target.Paralyse(10)
target.updatehealth()
add_logs(user, target, "attacked", "[name]", "(INTENT: [uppertext(user.a_intent)]) (DAMTYPE: [uppertext(damtype)])")

/obj/item/mecha_parts/mecha_equipment/tool/drill/diamonddrill
name = "diamond-tipped exosuit drill"
Expand Down
2 changes: 1 addition & 1 deletion code/game/mecha/equipment/weapons/weapons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
src.life -= 10
if(ismob(A))
var/mob/M = A
add_logs(firer, M, "shot", object="[src]")
add_logs(firer, M, "shot", "[src]")
if(life <= 0)
qdel(src)
return
Expand Down
6 changes: 3 additions & 3 deletions code/game/mecha/mecha.dm
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@
return
visible_message("<span class='danger'>[M.name] has hit [src].</span>")
take_damage(M.force, damtype)
add_logs(M.occupant, src, "attacked", object=M, addition="(INTENT: [uppertext(M.occupant.a_intent)]) (DAMTYPE: [uppertext(M.damtype)])")
add_logs(M.occupant, src, "attacked", M, "(INTENT: [uppertext(M.occupant.a_intent)]) (DAMTYPE: [uppertext(M.damtype)])")
return

/obj/mecha/proc/range_action(atom/target)
Expand Down Expand Up @@ -546,12 +546,12 @@
src.take_damage(damage)
src.check_for_internal_damage(list(MECHA_INT_TEMP_CONTROL,MECHA_INT_TANK_BREACH,MECHA_INT_CONTROL_LOST))
visible_message("<span class='danger'>[user] [user.attacktext] [src]!</span>")
add_logs(user, src, "attacked", admin=0)
add_logs(user, src, "attacked")
else
src.log_append_to_last("Armor saved.")
playsound(src.loc, 'sound/weapons/slash.ogg', 50, 1, -1)
visible_message("<span class='notice'>The [user] rebounds off [src.name]'s armor!</span>")
add_logs(user, src, "attacked", admin=0)
add_logs(user, src, "attacked")
return

/obj/mecha/attack_tk()
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,6 @@ var/global/image/fire_overlay = image("icon" = 'icons/effects/fire.dmi', "icon_s
user << "<span class='danger'>You cannot locate any organic eyes on this brain!</span>"
return

add_logs(user, M, "attacked", object="[src.name]", addition="(INTENT: [uppertext(user.a_intent)])")

src.add_fingerprint(user)

if(M != user)
Expand All @@ -393,6 +391,8 @@ var/global/image/fire_overlay = image("icon" = 'icons/effects/fire.dmi', "icon_s
else
M.take_organ_damage(7)

add_logs(user, M, "attacked", "[src.name]", "(INTENT: [uppertext(user.a_intent)])")

M.eye_blurry += rand(3,4)
M.eye_stat += rand(2,4)
if (M.eye_stat >= 10)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/devices/aicard.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
var/mob/living/silicon/ai/AI = locate(/mob/living/silicon/ai) in src
if(AI) //AI is on the card, implies user wants to upload it.
target.transfer_ai(AI_TRANS_FROM_CARD, user, AI, src)
add_logs(user, AI, "carded", object="[name]")
add_logs(user, AI, "carded", src)
else //No AI on the card, therefore the user wants to download one.
target.transfer_ai(AI_TRANS_TO_CARD, user, null, src)
update_state() //Whatever happened, update the card's state (icon, name) to match.
Expand Down
Loading

0 comments on commit f7faf4d

Please sign in to comment.