Improves mecha / projectile logging (#69805)

fix: Projectiles fired by non-mob sources (IE turrets) now log reagents contained after hitting a target.
admin: Cleaned up projectile reagent logging a little.
admin: Projectiles fired from mecha will now combat log on the target AND the firer.
admin: Mecha chassis logs will now contain the name/ckey of the person who fired the mecha's weapon.
admin: Projectiles fired from vehicles are now more likely to be combat logged properly after hitting a target (this logs for all people with control of the mecha which is a little messy with multi-seat mecha. Check the vehicle's logs or a user's combat logs for the person that actually SHOT the projectile.)
This commit is contained in:
ShizCalev
2022-09-10 17:43:51 -07:00
committed by GitHub
parent e34c182122
commit d881920e0c
2 changed files with 18 additions and 6 deletions
+14 -5
View File
@@ -319,15 +319,23 @@
var/reagent_note
if(reagents?.reagent_list)
reagent_note = " REAGENTS:"
for(var/datum/reagent/R in reagents.reagent_list)
reagent_note += "[R.name] ([num2text(R.volume)])"
reagent_note = "REAGENTS: [pretty_string_from_reagent_list(reagents.reagent_list)]"
if(ismob(firer))
log_combat(firer, L, "shot", src, reagent_note)
else
L.log_message("has been shot by [firer] with [src]", LOG_ATTACK, color="orange")
return BULLET_ACT_HIT
if(isvehicle(firer))
var/obj/vehicle/firing_vehicle = firer
var/list/logging_mobs = firing_vehicle.return_controllers_with_flag(VEHICLE_CONTROL_EQUIPMENT)
if(!LAZYLEN(logging_mobs))
logging_mobs = firing_vehicle.return_drivers()
for(var/mob/logged_mob as anything in logging_mobs)
log_combat(logged_mob, L, "shot", src, "from inside [firing_vehicle][logging_mobs.len > 1 ? " with multiple occupants" : null][reagent_note ? " and contained [reagent_note]" : null]")
return BULLET_ACT_HIT
L.log_message("has been shot by [firer] with [src][reagent_note ? " containing [reagent_note]" : null]", LOG_VICTIM, color="orange", log_globally=FALSE)
return BULLET_ACT_HIT
/obj/projectile/proc/vol_by_damage()
@@ -698,6 +706,7 @@
AddElement(/datum/element/embed, projectile_payload = shrapnel_type)
if(!log_override && firer && original)
log_combat(firer, original, "fired at", src, "from [get_area_name(src, TRUE)]")
//note: mecha projectile logging is handled in /obj/item/mecha_parts/mecha_equipment/weapon/action(). try to keep these messages roughly the sameish just for consistency's sake.
if(direct_target && (get_dist(direct_target, get_turf(src)) <= 1)) // point blank shots
process_hit(get_turf(direct_target), direct_target)
if(QDELETED(src))
@@ -63,6 +63,7 @@
spread = round((i / projectiles_per_shot - 0.5) * variance)
var/obj/projectile/projectile_obj = new projectile(get_turf(src))
projectile_obj.log_override = TRUE //we log being fired ourselves a little further down.
projectile_obj.firer = chassis
projectile_obj.preparePixelProjectile(target, source, modifiers, spread)
if(source.client && isliving(source)) //dont want it to happen from syndie mecha npc mobs, they do direct fire anyways
@@ -73,11 +74,13 @@
new firing_effect_type(get_turf(src), chassis.dir)
playsound(chassis, fire_sound, 50, TRUE)
log_combat(source, target, "fired [projectile_obj] at", src, "from [chassis] at [get_area_name(src, TRUE)]")
sleep(max(0, projectile_delay))
if(kickback)
chassis.newtonian_move(newtonian_target)
chassis.log_message("Fired from [name], targeting [target].", LOG_ATTACK)
chassis.log_message("[key_name(source)] fired [src], targeting [target].", LOG_ATTACK)
//Base energy weapon type
/obj/item/mecha_parts/mecha_equipment/weapon/energy