From 50450698995300a65a4501010a8730c1ef6ae136 Mon Sep 17 00:00:00 2001 From: Razharas Date: Sun, 15 Dec 2013 05:23:50 +0400 Subject: [PATCH] More logging and fingerprints Added helper proc for general logging, replaced some logging with this proc Pulling now leaves fingerprints Judging by the opinions in the thread will add some more logging/fingerprints --- code/__HELPERS/mobs.dm | 22 ++++++++++++++++--- code/_onclick/item_attack.dm | 4 +--- .../living/carbon/human/human_attackhand.dm | 14 ++++++------ code/modules/mob/mob.dm | 1 + 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/code/__HELPERS/mobs.dm b/code/__HELPERS/mobs.dm index fa7d1cdd380..d684c524397 100644 --- a/code/__HELPERS/mobs.dm +++ b/code/__HELPERS/mobs.dm @@ -34,9 +34,9 @@ proc/random_name(gender, attempts_to_find_unique_name=10) for(var/i=1, i<=attempts_to_find_unique_name, i++) if(gender==FEMALE) . = capitalize(pick(first_names_female)) + " " + capitalize(pick(last_names)) else . = capitalize(pick(first_names_male)) + " " + capitalize(pick(last_names)) - + if(i != attempts_to_find_unique_name && !findname(.)) - break + break proc/random_skin_tone() return pick(skin_tones) @@ -67,4 +67,20 @@ proc/age2agedescription(age) if(45 to 60) return "middle-aged" if(60 to 70) return "aging" if(70 to INFINITY) return "elderly" - else return "unknown" \ No newline at end of file + else return "unknown" + +/* +Proc for attack log creation, because really why not +1 argument is the actor +2 argument is the target of action +3 is the description of action(like punched, throwed, or any other verb) +4 is the tool with which the action was made(usually item) +5 is additional information, anything that needs to be added +*/ + +proc/add_logs(mob/user, mob/target, what_done, var/object=null, var/addition=null) + if(ismob(user)) + user.attack_log += text("\[[time_stamp()]\] Has [what_done] [target.name][ismob(target) ? "([target.ckey])" : ""][object ? " with [object]" : " "][addition]") + if(ismob(target)) + target.attack_log += text("\[[time_stamp()]\] Has been [what_done] by [user.name][ismob(user) ? "([user.ckey])" : ""][object ? " with [object]" : " "][addition]") + log_attack("[user.name][ismob(user) ? "([user.ckey])" : ""] [what_done] [target.name][ismob(target) ? "([target.ckey])" : ""][object ? " with [object]" : " "][addition]") \ No newline at end of file diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index 25ccdb506b4..3bc540be44d 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -35,9 +35,7 @@ user.lastattacked = M M.lastattacker = user - user.attack_log += "\[[time_stamp()]\] Attacked [M.name] ([M.ckey]) with [name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(damtype)])" - M.attack_log += "\[[time_stamp()]\] Attacked by [user.name] ([user.ckey]) with [name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(damtype)])" - log_attack("[user.name] ([user.ckey]) attacked [M.name] ([M.ckey]) with [name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(damtype)])" ) + add_logs(user, M, "attacked", src.name, "(INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(damtype)])") //spawn(1800) // this wont work right // M.lastattacker = null diff --git a/code/modules/mob/living/carbon/human/human_attackhand.dm b/code/modules/mob/living/carbon/human/human_attackhand.dm index 4125971cf02..79637a8470c 100644 --- a/code/modules/mob/living/carbon/human/human_attackhand.dm +++ b/code/modules/mob/living/carbon/human/human_attackhand.dm @@ -3,6 +3,7 @@ return if((M != src) && check_shields(0, M.name)) + add_logs(src, M, "attenmped to touch") visible_message("[M] attempted to touch [src]!") return 0 @@ -10,6 +11,7 @@ if("help") if(health >= 0) help_shake_act(M) + add_logs(src, M, "shaked") return 1 //CPR @@ -21,6 +23,7 @@ return 0 if(cpr_time < world.time + 30) + add_logs(src, M, "CPRed") visible_message("[M] is trying to perform CPR on [src]!") if(!do_mob(M, src)) return 0 @@ -33,6 +36,8 @@ src << "You feel a breath of fresh air enter your lungs. It feels good." if("grab") + add_logs(src, M, "grabbed", addition="passively") + if(M == src || anchored) return 0 if(w_uniform) @@ -53,10 +58,7 @@ return 1 if("harm") - M.attack_log += text("\[[time_stamp()]\] Punched [src.name] ([src.ckey])") - src.attack_log += text("\[[time_stamp()]\] Has been punched by [M.name] ([M.ckey])") - - log_attack("[M.name] ([M.ckey]) punched [src.name] ([src.ckey])") + add_logs(src, M, "punched") var/attack_verb = "punch" if(lying) @@ -105,9 +107,7 @@ forcesay(hit_appends) if("disarm") - M.attack_log += text("\[[time_stamp()]\] Disarmed [src.name] ([src.ckey])") - src.attack_log += text("\[[time_stamp()]\] Has been disarmed by [M.name] ([M.ckey])") - log_attack("[M.name] ([M.ckey]) disarmed [src.name] ([src.ckey])") + add_logs(src, M, "disarmed") if(w_uniform) w_uniform.add_fingerprint(M) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index d9941e57a35..a930f07f26f 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -528,6 +528,7 @@ var/list/slot_equipment_priority = list( \ if ( !AM || !usr || src==AM || !isturf(src.loc) ) //if there's no person pulling OR the person is pulling themself OR the object being pulled is inside something: abort! return if (!( AM.anchored )) + AM.add_fingerprint(src) // If we're pulling something then drop what we're currently pulling and pull this instead. if(pulling)