Improves logging for smoke clouds. (#67206)

About The Pull Request

Makes smoke propagate the fingerprints of the last person to touch the source of the smoke.
This makes gunpowder smoke actually log the person responsible for the explosions.
Why It's Good For The Game

As of right now gunpowder smoke (and similar) doesn't actually have very good logging as as far as the smoke is concerned it's never been touched and so the resulting explosions are blameless. Obviously, scrolling up for a good minute looking for who has just obliterated the escape shuttle is slightly annoying for the admins. Ergo, making the explosions log who actually is responsible for making the smoke they originate from should reduce admin annoyance.
Changelog

cl
admin: Smoke now logs the last person to touch the source of the smoke as the last person to touch the smoke itself. Gunpowder smoke should be less annoying to log dive as a result as every explosion will log that person.
/cl
This commit is contained in:
TemporalOroboros
2022-06-07 15:45:20 +12:00
committed by GitHub
parent f3cde8174b
commit 2683ec04b0
48 changed files with 166 additions and 127 deletions
@@ -58,7 +58,7 @@
/datum/effect_system/explosion/smoke/proc/create_smoke()
var/datum/effect_system/fluid_spread/smoke/S = new
S.set_up(2, location = location)
S.set_up(2, holder = holder, location = location)
S.start()
/datum/effect_system/explosion/smoke/start()
@@ -96,6 +96,7 @@
if(!group)
group = source?.group || new
group.add_node(src)
source?.transfer_fingerprints_to(src)
/obj/effect/particle_effect/fluid/Destroy()
group.remove_node(src)
@@ -118,11 +119,42 @@
/// The amount of smoke to produce.
var/amount = 10
/datum/effect_system/fluid_spread/set_up(range = 1, amount = DIAMOND_AREA(range), atom/location, ...)
src.location = get_turf(location)
/datum/effect_system/fluid_spread/set_up(range = 1, amount = DIAMOND_AREA(range), atom/holder, atom/location, ...)
src.holder = holder
src.location = location
src.amount = amount
/datum/effect_system/fluid_spread/start()
var/location = holder ? get_turf(holder) : src.location
/datum/effect_system/fluid_spread/start(log = FALSE)
var/location = src.location || get_turf(holder)
var/obj/effect/particle_effect/fluid/flood = new effect_type(location, new /datum/fluid_group(amount))
if (log) // Smoke is used as an aesthetic effect in a tonne of places and we don't want, say, a broken secway spamming admin chat.
help_out_the_admins(flood, holder, location)
flood.spread()
/**
* Handles logging the beginning of a fluid flood.
*
* Arguments:
* - [flood][/obj/effect/particle_effect/fluid]: The first cell of the fluid flood.
* - [holder][/atom]: What the flood originated from.
* - [location][/atom]: Where the flood originated.
*/
/datum/effect_system/fluid_spread/proc/help_out_the_admins(obj/effect/particle_effect/fluid/flood, atom/holder, atom/location)
var/source_msg
var/blame_msg
if (holder)
holder.transfer_fingerprints_to(flood) // This is important. If this doesn't exist thermobarics are annoying to adjudicate.
source_msg = "from inside of [ismob(holder) ? ADMIN_LOOKUPFLW(holder) : ADMIN_VERBOSEJMP(holder)]"
var/lastkey = holder.fingerprintslast
if (lastkey)
var/mob/scapegoat = get_mob_by_key(lastkey)
blame_msg = " last touched by [ADMIN_LOOKUPFLW(scapegoat)]"
else
blame_msg = " with no known fingerprints"
else
source_msg = "with no known source"
if(!istype(holder, /obj/machinery/plumbing)) //excludes standard plumbing equipment from spamming admins with this shit
message_admins("\A [flood] flood started at [ADMIN_VERBOSEJMP(location)] [source_msg][blame_msg].")
log_game("\A [flood] flood started at [location || "nonexistant location"] [holder ? "from [holder] last touched by [holder || "N/A"]" : "with no known source"].")
@@ -75,7 +75,9 @@
return null
var/atom/location = loc
return (!allow_duplicate_results && (locate(result_type) in location)) || (new result_type(location))
var/atom/movable/result = (!allow_duplicate_results && (locate(result_type) in location)) || (new result_type(location))
transfer_fingerprints_to(result)
return result
/obj/effect/particle_effect/fluid/foam/process(delta_time)
var/ds_delta_time = delta_time SECONDS
@@ -173,13 +175,13 @@
QDEL_NULL(chemholder)
return ..()
/datum/effect_system/fluid_spread/foam/set_up(range = 1, amount = DIAMOND_AREA(range), atom/location = null, datum/reagents/carry = null, result_type = null)
/datum/effect_system/fluid_spread/foam/set_up(range = 1, amount = DIAMOND_AREA(range), atom/holder, atom/location = null, datum/reagents/carry = null, result_type = null)
. = ..()
carry?.copy_to(chemholder, carry.total_volume)
if(!isnull(result_type))
src.result_type = result_type
/datum/effect_system/fluid_spread/foam/start()
/datum/effect_system/fluid_spread/foam/start(log = FALSE)
var/obj/effect/particle_effect/fluid/foam/foam = new effect_type(location, new /datum/fluid_group(amount))
var/foamcolor = mix_color_from_reagents(chemholder.reagent_list)
if(reagent_scale > 1) // Make room in case we were created by a particularly stuffed payload.
@@ -188,6 +190,8 @@
foam.add_atom_colour(foamcolor, FIXED_COLOUR_PRIORITY)
if(!isnull(result_type))
foam.result_type = result_type
if (log)
help_out_the_admins(foam, holder, location)
SSfoam.queue_spread(foam)
@@ -85,7 +85,7 @@
for(var/mob/living/smoker in spread_turf)
smoke_mob(smoker, delta_time)
var/obj/effect/particle_effect/fluid/smoke/spread_smoke = new type(spread_turf, group)
var/obj/effect/particle_effect/fluid/smoke/spread_smoke = new type(spread_turf, group, src)
reagents.copy_to(spread_smoke, reagents.total_volume)
spread_smoke.add_atom_colour(color, FIXED_COLOUR_PRIORITY)
spread_smoke.lifetime = lifetime
@@ -166,11 +166,11 @@
* - location: Where to produce the smoke cloud.
* - smoke_type: The smoke typepath to spawn.
*/
/proc/do_smoke(range = 0, amount = DIAMOND_AREA(range), location = null, smoke_type = /obj/effect/particle_effect/fluid/smoke)
/proc/do_smoke(range = 0, amount = DIAMOND_AREA(range), atom/holder = null, location = null, smoke_type = /obj/effect/particle_effect/fluid/smoke, log = FALSE)
var/datum/effect_system/fluid_spread/smoke/smoke = new
smoke.effect_type = smoke_type
smoke.set_up(amount = amount, location = location)
smoke.start()
smoke.set_up(amount = amount, holder = holder, location = location)
smoke.start(log = log)
/////////////////////////////////////////////
// Quick smoke
@@ -318,11 +318,11 @@
for(var/obj/item/potential_tinder in chilly)
potential_tinder.extinguish()
/datum/effect_system/fluid_spread/smoke/freezing/set_up(range = 5, amount = DIAMOND_AREA(range), atom/location, blast_radius = 0)
/datum/effect_system/fluid_spread/smoke/freezing/set_up(range = 5, amount = DIAMOND_AREA(range), atom/holder, atom/location, blast_radius = 0)
. = ..()
blast = blast_radius
/datum/effect_system/fluid_spread/smoke/freezing/start()
/datum/effect_system/fluid_spread/smoke/freezing/start(log = FALSE)
if(blast)
for(var/turf/T in RANGE_TURFS(blast, location))
Chilled(T)
@@ -410,7 +410,7 @@
return ..()
/datum/effect_system/fluid_spread/smoke/chem/set_up(range = 1, amount = DIAMOND_AREA(range), atom/location = null, datum/reagents/carry = null, silent = FALSE)
/datum/effect_system/fluid_spread/smoke/chem/set_up(range = 1, amount = DIAMOND_AREA(range), atom/holder, atom/location = null, datum/reagents/carry = null, silent = FALSE)
. = ..()
carry?.copy_to(chemholder, carry.total_volume)
@@ -436,7 +436,7 @@
message_admins("Smoke: ([ADMIN_VERBOSEJMP(location)])[contained]. No associated key.")
log_game("A chemical smoke reaction has taken place in ([where])[contained]. No associated key.")
/datum/effect_system/fluid_spread/smoke/chem/start()
/datum/effect_system/fluid_spread/smoke/chem/start(log = FALSE)
var/start_loc = holder ? get_turf(holder) : src.location
var/mixcolor = mix_color_from_reagents(chemholder.reagent_list)
var/obj/effect/particle_effect/fluid/smoke/chem/smoke = new effect_type(start_loc, new /datum/fluid_group(amount))
@@ -444,6 +444,8 @@
if(mixcolor)
smoke.add_atom_colour(mixcolor, FIXED_COLOUR_PRIORITY) // give the smoke color, if it has any to begin with
if (log)
help_out_the_admins(smoke, holder, location)
smoke.spread() // Making the smoke spread immediately.
/**