Files
Bubberstation/code/__HELPERS/logging/attack.dm
nevimer 45e52eb774 Merge remote-tracking branch 'skrat/master' into new-bubbermaster
# Conflicts:
#	_maps/RandomRuins/SpaceRuins/hilbertresearchfacility.dmm
#	_maps/RandomRuins/SpaceRuins/skyrat/interdynefob.dmm
#	_maps/map_files/Birdshot/birdshot.dmm
#	_maps/map_files/Deltastation/DeltaStation2.dmm
#	_maps/map_files/IceBoxStation/IceBoxStation.dmm
#	_maps/map_files/MetaStation/MetaStation.dmm
#	_maps/map_files/NorthStar/north_star.dmm
#	_maps/map_files/VoidRaptor/VoidRaptor.dmm
#	_maps/map_files/tramstation/tramstation.dmm
#	_maps/shuttles/pirate_ex_interdyne.dmm
#	code/__DEFINES/mobs.dm
#	code/__HELPERS/~skyrat_helpers/is_helpers.dm
#	code/datums/mood.dm
#	code/game/objects/effects/spawners/random/random.dm
#	code/modules/admin/verbs/adminhelp.dm
#	code/modules/clothing/head/jobs.dm
#	code/modules/mob/living/brain/brain_say.dm
#	code/modules/projectiles/guns/energy/kinetic_accelerator.dm
#	code/modules/unit_tests/screenshots/screenshot_humanoids__datum_species_jelly.png
#	code/modules/unit_tests/screenshots/screenshot_humanoids__datum_species_jelly_stargazer.png
#	code/modules/uplink/uplink_items/job.dm
#	config/lavaruinblacklist.txt
#	icons/mob/actions/actions_changeling.dmi
#	icons/mob/clothing/mask.dmi
#	icons/obj/mining.dmi
#	modular_skyrat/master_files/code/modules/client/preferences/headshot.dm
#	modular_skyrat/master_files/code/modules/mob/living/examine_tgui.dm
#	modular_skyrat/master_files/code/modules/research/techweb/all_nodes.dm
#	modular_skyrat/master_files/icons/mob/clothing/under/skirts_dresses.dmi
#	modular_skyrat/master_files/icons/obj/clothing/under/skirts_dresses.dmi
#	modular_skyrat/modules/aesthetics/airlock/icons/airlocks/multi_tile/metal_overlays.dmi
#	modular_skyrat/modules/colony_fabricator/code/appliances/space_heater.dm
#	modular_skyrat/modules/company_imports/code/armament_datums/deforest_medical.dm
#	modular_skyrat/modules/hyposprays/code/hypospray_kits.dm
#	strings/traumas.json
#	tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/character_preferences/skyrat/headshot.tsx
2024-04-20 22:19:03 -04:00

86 lines
4.3 KiB
Plaintext

/// Generic attack logging
/proc/log_attack(text, list/data, redacted_log_text) // BUBBER EDIT
logger.Log(LOG_CATEGORY_ATTACK, text, data)
log_public_file(redacted_log_text) // BUBBER EDIT
/**
* Log a combat message in the attack log
*
* Arguments:
* * atom/user - argument is the actor performing the action
* * atom/target - argument is the target of the action
* * what_done - is a verb describing the action (e.g. punched, throwed, kicked, etc.)
* * atom/object - is a tool with which the action was made (usually an item)
* * addition - is any additional text, which will be appended to the rest of the log line
*/
/proc/log_combat(atom/user, atom/target, what_done, atom/object=null, addition=null)
var/ssource = key_name(user)
var/starget = key_name(target)
var/mob/living/living_target = target
var/hp = istype(living_target) ? " (NEWHP: [living_target.health]) " : ""
var/sobject = ""
if(object)
sobject = " with [object]"
var/saddition = ""
if(addition)
saddition = " [addition]"
var/postfix = "[sobject][saddition][hp]"
var/redacted_copy = "[what_done] [target][postfix]"
var/message = "[what_done] [starget][postfix]"
user.log_message(message, LOG_ATTACK, color="red", redacted_copy = redacted_copy) // BUBBER EDIT
if(user != target)
var/reverse_message = "was [what_done] by [ssource][postfix]"
target.log_message(reverse_message, LOG_VICTIM, color="orange", log_globally=FALSE)
/**
* log_wound() is for when someone is *attacked* and suffers a wound. Note that this only captures wounds from damage, so smites/forced wounds aren't logged, as well as demotions like cuts scabbing over
*
* Note that this has no info on the attack that dealt the wound: information about where damage came from isn't passed to the bodypart's damaged proc. When in doubt, check the attack log for attacks at that same time
* TODO later: Add logging for healed wounds, though that will require some rewriting of healing code to prevent admin heals from spamming the logs. Not high priority
*
* Arguments:
* * victim- The guy who got wounded
* * suffered_wound- The wound, already applied, that we're logging. It has to already be attached so we can get the limb from it
* * dealt_damage- How much damage is associated with the attack that dealt with this wound.
* * dealt_wound_bonus- The wound_bonus, if one was specified, of the wounding attack
* * dealt_bare_wound_bonus- The bare_wound_bonus, if one was specified *and applied*, of the wounding attack. Not shown if armor was present
* * base_roll- Base wounding ability of an attack is a random number from 1 to (dealt_damage ** WOUND_DAMAGE_EXPONENT). This is the number that was rolled in there, before mods
*/
/proc/log_wound(atom/victim, datum/wound/suffered_wound, dealt_damage, dealt_wound_bonus, dealt_bare_wound_bonus, base_roll)
if(QDELETED(victim) || !suffered_wound)
return
var/message = "suffered: [suffered_wound][suffered_wound.limb ? " to [suffered_wound.limb.plaintext_zone]" : null]"// maybe indicate if it's a promote/demote?
if(dealt_damage)
message += " | Damage: [dealt_damage]"
// The base roll is useful since it can show how lucky someone got with the given attack. For example, dealing a cut
if(base_roll)
message += " (rolled [base_roll]/[dealt_damage ** WOUND_DAMAGE_EXPONENT])"
if(dealt_wound_bonus)
message += " | WB: [dealt_wound_bonus]"
if(dealt_bare_wound_bonus)
message += " | BWB: [dealt_bare_wound_bonus]"
victim.log_message(message, LOG_ATTACK, color="blue")
/// Logging for bombs detonating
/proc/log_bomber(atom/user, details, atom/bomb, additional_details, message_admins = TRUE)
var/bomb_message = "[details][bomb ? " [bomb.name] at [AREACOORD(bomb)]": ""][additional_details ? " [additional_details]" : ""]."
if(user)
user.log_message(bomb_message, LOG_ATTACK) //let it go to individual logs as well as the game log
bomb_message = "[key_name(user)] at [AREACOORD(user)] [bomb_message]."
else
log_game(bomb_message)
GLOB.bombers += bomb_message
var/area/bomb_area = get_area(bomb)
if(message_admins && !(bomb_area.area_flags & QUIET_LOGS)) // Don't spam the logs with deathmatch bombs
message_admins("[user ? "[ADMIN_LOOKUPFLW(user)] at [ADMIN_VERBOSEJMP(user)] " : ""][details][bomb ? " [bomb.name] at [ADMIN_VERBOSEJMP(bomb)]": ""][additional_details ? " [additional_details]" : ""].")