mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 23:27:34 +01:00
[MIRROR] Fix issue with reagent logging where it would sometimes fail to output reagents on reagent transfer. [MDB IGNORE] (#12435)
* Feex (#65612) Splits reagent log string creation to a standard proc and a bespoke stupid proc that takes an external list instead of using its own reagents_list. * Fix issue with reagent logging where it would sometimes fail to output reagents on reagent transfer. * Update hyposprays_II.dm Co-authored-by: Timberpoes <silent_insomnia_pp@hotmail.co.uk> Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
This commit is contained in:
co-authored by
Timberpoes
Gandalf
parent
750be064f3
commit
d90753ef82
@@ -342,7 +342,7 @@ Behavior that's still missing from this component that original food items had t
|
||||
return
|
||||
if(IsFoodGone(owner, feeder))
|
||||
return
|
||||
log_combat(feeder, eater, "fed", owner.reagents.log_list())
|
||||
log_combat(feeder, eater, "fed", owner.reagents.get_reagent_log_string())
|
||||
eater.visible_message(
|
||||
span_danger("[feeder] forces [eater] to eat [parent]!"),
|
||||
span_userdanger("[feeder] forces you to eat [parent]!")
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
return
|
||||
reagent_container = W
|
||||
to_chat(user, span_notice("You attach [W] to [src]."))
|
||||
user.log_message("attached a [W] to [src] at [AREACOORD(src)] containing ([reagent_container.reagents.log_list()])", LOG_ATTACK)
|
||||
user.log_message("attached a [W] to [src] at [AREACOORD(src)] containing ([reagent_container.reagents.get_reagent_log_string()])", LOG_ATTACK)
|
||||
add_fingerprint(user)
|
||||
update_appearance()
|
||||
return
|
||||
@@ -232,7 +232,7 @@
|
||||
return
|
||||
usr.visible_message(span_warning("[usr] attaches [src] to [target]."), span_notice("You attach [src] to [target]."))
|
||||
var/datum/reagents/container = get_reagent_holder()
|
||||
log_combat(usr, target, "attached", src, "containing: ([container.log_list()])")
|
||||
log_combat(usr, target, "attached", src, "containing: ([container.get_reagent_log_string()])")
|
||||
add_fingerprint(usr)
|
||||
attached = target
|
||||
START_PROCESSING(SSmachines, src)
|
||||
@@ -342,7 +342,7 @@
|
||||
. = ..()
|
||||
AddComponent(/datum/component/plumbing/iv_drip, anchored)
|
||||
AddComponent(/datum/component/simple_rotation)
|
||||
|
||||
|
||||
/obj/machinery/iv_drip/plumbing/wrench_act(mob/living/user, obj/item/I)
|
||||
..()
|
||||
default_unfasten_wrench(user, I)
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
end_life(source)
|
||||
return
|
||||
|
||||
var/puff_reagents_string = reagents.log_list()
|
||||
var/puff_reagents_string = reagents.get_reagent_log_string()
|
||||
var/travelled_max_distance = (source.lifetime - source.delay <= 0)
|
||||
var/turf/our_turf = get_turf(src)
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
return // The drink might be empty after the delay, such as by spam-feeding
|
||||
M.visible_message(span_danger("[user] fed [M] the contents of [src]."), \
|
||||
span_userdanger("[user] fed you the contents of [src]."))
|
||||
log_combat(user, M, "fed", reagents.log_list())
|
||||
log_combat(user, M, "fed", reagents.get_reagent_log_string())
|
||||
|
||||
SEND_SIGNAL(src, COMSIG_DRINK_DRANK, M, user)
|
||||
var/fraction = min(gulp_size/reagents.total_volume, 1)
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
return // The condiment might be empty after the delay.
|
||||
M.visible_message(span_warning("[user] fed [M] from [src]."), \
|
||||
span_warning("[user] fed you from [src]."))
|
||||
log_combat(user, M, "fed", reagents.log_list())
|
||||
log_combat(user, M, "fed", reagents.get_reagent_log_string())
|
||||
reagents.trans_to(M, 10, transfered_by = user, methods = INGEST)
|
||||
playsound(M.loc,'sound/items/drink.ogg', rand(10,50), TRUE)
|
||||
return TRUE
|
||||
|
||||
@@ -546,7 +546,7 @@
|
||||
|
||||
if(transfered_by && target_atom)
|
||||
target_atom.add_hiddenprint(transfered_by) //log prints so admins can figure out who touched it last.
|
||||
log_combat(transfered_by, target_atom, "transferred reagents ([log_list(transfer_log)]) from [my_atom] to")
|
||||
log_combat(transfered_by, target_atom, "transferred reagents ([get_external_reagent_log_string(transfer_log)]) from [my_atom] to")
|
||||
|
||||
update_total()
|
||||
R.update_total()
|
||||
@@ -1506,28 +1506,39 @@
|
||||
ph = clamp(total_ph/total_volume, 0, 14)
|
||||
|
||||
/**
|
||||
* Used in attack logs for reagents in pills and such
|
||||
* Outputs a log-friendly list of reagents based on an external reagent list.
|
||||
*
|
||||
* Arguments:
|
||||
* * external_list - assoc list of reagent type = list(REAGENT_TRANSFER_AMOUNT = amounts, REAGENT_PURITY = purity)
|
||||
* * external_list - Assoc list of (reagent_type) = list(REAGENT_TRANSFER_AMOUNT = amounts, REAGENT_PURITY = purity)
|
||||
*/
|
||||
/datum/reagents/proc/log_list(external_list)
|
||||
if((external_list && !length(external_list)) || !length(reagent_list))
|
||||
/datum/reagents/proc/get_external_reagent_log_string(external_list)
|
||||
if(!length(external_list))
|
||||
return "no reagents"
|
||||
|
||||
|
||||
|
||||
var/list/data = list()
|
||||
if(external_list)
|
||||
for(var/r in external_list)
|
||||
var/list/qualities = external_list[r]
|
||||
data += "[r] ([round(qualities[REAGENT_TRANSFER_AMOUNT], 0.1)]u, [qualities[REAGENT_PURITY]] purity)"
|
||||
else
|
||||
for(var/datum/reagent/reagent as anything in reagent_list) //no reagents will be left behind
|
||||
data += "[reagent.type] ([round(reagent.volume, 0.1)]u, [reagent.purity] purity)"
|
||||
//Using types because SOME chemicals (I'm looking at you, chlorhydrate-beer) have the same names as other chemicals.
|
||||
|
||||
for(var/reagent_type in external_list)
|
||||
var/list/qualities = external_list[reagent_type]
|
||||
data += "[reagent_type] ([round(qualities[REAGENT_TRANSFER_AMOUNT], 0.1)]u, [qualities[REAGENT_PURITY]] purity)"
|
||||
|
||||
return english_list(data)
|
||||
|
||||
/**
|
||||
* Outputs a log-friendly list of reagents based on the internal reagent_list.
|
||||
*
|
||||
* Arguments:
|
||||
* * external_list - Assoc list of (reagent_type) = list(REAGENT_TRANSFER_AMOUNT = amounts, REAGENT_PURITY = purity)
|
||||
*/
|
||||
/datum/reagents/proc/get_reagent_log_string()
|
||||
if(!length(reagent_list))
|
||||
return "no reagents"
|
||||
|
||||
var/list/data = list()
|
||||
|
||||
for(var/datum/reagent/reagent as anything in reagent_list)
|
||||
data += "[reagent.type] ([round(reagent.volume, 0.1)]u, [reagent.purity] purity)"
|
||||
|
||||
return english_list(data)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////UI / REAGENTS LOOKUP CODE/////////////////////////////
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
return // The drink might be empty after the delay, such as by spam-feeding
|
||||
M.visible_message(span_danger("[user] feeds [M] something from [src]."), \
|
||||
span_userdanger("[user] feeds you something from [src]."))
|
||||
log_combat(user, M, "fed", reagents.log_list())
|
||||
log_combat(user, M, "fed", reagents.get_reagent_log_string())
|
||||
else
|
||||
to_chat(user, span_notice("You swallow a gulp of [src]."))
|
||||
SEND_SIGNAL(src, COMSIG_GLASS_DRANK, M, user)
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
to_chat(M, span_notice("You [apply_method] yourself with [src]."))
|
||||
|
||||
else
|
||||
log_combat(user, M, "attempted to apply", src, reagents.log_list())
|
||||
log_combat(user, M, "attempted to apply", src, reagents.get_reagent_log_string())
|
||||
M.visible_message(span_danger("[user] attempts to [apply_method] [src] on [M]."), \
|
||||
span_userdanger("[user] attempts to [apply_method] [src] on you."))
|
||||
if(!do_mob(user, M, CHEM_INTERACT_DELAY(3 SECONDS, user)))
|
||||
@@ -73,7 +73,7 @@
|
||||
return
|
||||
|
||||
else
|
||||
log_combat(user, M, "applied", src, reagents.log_list())
|
||||
log_combat(user, M, "applied", src, reagents.get_reagent_log_string())
|
||||
playsound(src, 'sound/effects/spray.ogg', 30, TRUE, -6)
|
||||
reagents.trans_to(M, amount_per_transfer_from_this, transfered_by = user, methods = apply_type)
|
||||
return
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
reagent_puff.color = mix_color_from_reagents(reagent_puff.reagents.reagent_list)
|
||||
var/wait_step = max(round(2+3/range), 2)
|
||||
|
||||
var/puff_reagent_string = reagent_puff.reagents.log_list()
|
||||
var/puff_reagent_string = reagent_puff.reagents.get_reagent_log_string()
|
||||
var/turf/src_turf = get_turf(src)
|
||||
|
||||
log_combat(user, src_turf, "fired a puff of reagents from", src, addition="with a range of \[[range]\], containing [puff_reagent_string]")
|
||||
@@ -140,7 +140,7 @@
|
||||
if(isturf(usr.loc) && src.loc == usr)
|
||||
to_chat(usr, span_notice("You empty \the [src] onto the floor."))
|
||||
reagents.expose(usr.loc)
|
||||
log_combat(usr, usr.loc, "emptied onto", src, addition="which had [reagents.log_list()]")
|
||||
log_combat(usr, usr.loc, "emptied onto", src, addition="which had [reagents.get_reagent_log_string()]")
|
||||
src.reagents.clear_reagents()
|
||||
|
||||
/// Handles updating the spray distance when the reagents change.
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
if (!try_syringe(target, user, proximity))
|
||||
return
|
||||
|
||||
var/contained = reagents.log_list()
|
||||
var/contained = reagents.get_reagent_log_string()
|
||||
log_combat(user, target, "attempted to inject", src, addition="which had [contained]")
|
||||
|
||||
if(!reagents.total_volume)
|
||||
|
||||
@@ -205,7 +205,7 @@
|
||||
to_chat(user, span_warning("The limb is missing!"))
|
||||
return
|
||||
//Always log attemped injections for admins
|
||||
var/contained = vial.reagents.log_list()
|
||||
var/contained = vial.reagents.get_reagent_log_string()
|
||||
log_combat(user, injectee, "attemped to inject", src, addition="which had [contained]")
|
||||
|
||||
if(!vial)
|
||||
|
||||
Reference in New Issue
Block a user