mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-28 07:38:05 +01:00
Merges copy_to() into trans_to() for reagent holder (#92410)
## About The Pull Request
Merges `/datum/reagents/proc/copy_to()` ->
`/datum/reagents/proc/trans_to()`. Added a parameter `copy_only` to
indicate we want a copy operation
## Why It's Good For The Game
- Less code to maintain
- All the functionality of `trans_to()`[logging, transferring single
reagent, expelling reagents from stomach, etc] now applies for copying
reagents as well which was missing a lot of it, so we have consistent
behaviour
## Changelog
🆑
refactor: code for copying reagents has been refactored. Please report
bugs on github
/🆑
(cherry picked from commit a1d27e384d)
This commit is contained in:
@@ -166,7 +166,7 @@
|
||||
foam_mob(foaming, seconds_per_tick)
|
||||
|
||||
var/obj/effect/particle_effect/fluid/foam/spread_foam = new type(spread_turf, group, src)
|
||||
reagents.copy_to(spread_foam, (reagents.total_volume))
|
||||
reagents.trans_to(spread_foam, reagents.total_volume, copy_only = TRUE)
|
||||
spread_foam.add_atom_colour(color, FIXED_COLOUR_PRIORITY)
|
||||
spread_foam.result_type = result_type
|
||||
SSfoam.queue_spread(spread_foam)
|
||||
@@ -199,7 +199,7 @@
|
||||
|
||||
/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, stop_reactions = FALSE)
|
||||
. = ..()
|
||||
carry?.copy_to(chemholder, carry.total_volume, no_react = stop_reactions)
|
||||
carry?.trans_to(chemholder, carry.total_volume, no_react = stop_reactions, copy_only = TRUE)
|
||||
if(!isnull(result_type))
|
||||
src.result_type = result_type
|
||||
|
||||
@@ -208,7 +208,7 @@
|
||||
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.
|
||||
foam.reagents.maximum_volume *= reagent_scale
|
||||
chemholder.copy_to(foam, chemholder.total_volume, reagent_scale) // Foam has an amplifying effect on the reagents it is supplied with. This is balanced by the reagents being diluted as the area the foam covers increases.
|
||||
chemholder.trans_to(foam, chemholder.total_volume, reagent_scale, copy_only = TRUE) // Foam has an amplifying effect on the reagents it is supplied with. This is balanced by the reagents being diluted as the area the foam covers increases.
|
||||
foam.add_atom_colour(foamcolor, FIXED_COLOUR_PRIORITY)
|
||||
if(!isnull(result_type))
|
||||
foam.result_type = result_type
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
smoke_mob(smoker, seconds_per_tick)
|
||||
|
||||
var/obj/effect/particle_effect/fluid/smoke/spread_smoke = new type(spread_turf, group, src)
|
||||
reagents.copy_to(spread_smoke, reagents.total_volume)
|
||||
reagents.trans_to(spread_smoke, reagents.total_volume, copy_only = TRUE)
|
||||
spread_smoke.add_atom_colour(color, FIXED_COLOUR_PRIORITY)
|
||||
spread_smoke.lifetime = lifetime
|
||||
|
||||
@@ -392,7 +392,7 @@
|
||||
return FALSE
|
||||
|
||||
var/fraction = (seconds_per_tick SECONDS) / initial(lifetime)
|
||||
reagents.copy_to(smoker, reagents.total_volume, fraction, copy_methods = SMOKE_MACHINE)
|
||||
reagents.trans_to(smoker, reagents.total_volume, fraction, methods = SMOKE_MACHINE, copy_only = TRUE)
|
||||
reagents.expose(smoker, SMOKE_MACHINE, fraction)
|
||||
return TRUE
|
||||
|
||||
@@ -423,7 +423,7 @@
|
||||
|
||||
/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)
|
||||
carry?.trans_to(chemholder, carry.total_volume, copy_only = TRUE)
|
||||
|
||||
if(silent)
|
||||
return
|
||||
@@ -452,7 +452,7 @@
|
||||
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))
|
||||
chemholder.copy_to(smoke, chemholder.total_volume)
|
||||
chemholder.trans_to(smoke, chemholder.total_volume, copy_only = TRUE)
|
||||
|
||||
if(mixcolor)
|
||||
smoke.add_atom_colour(mixcolor, FIXED_COLOUR_PRIORITY) // give the smoke color, if it has any to begin with
|
||||
|
||||
@@ -134,7 +134,7 @@ GLOBAL_VAR_INIT(chicks_from_eggs, 0)
|
||||
if(LAZYACCESS(modifiers, ICON_Y))
|
||||
broken_egg.pixel_y = clamp(text2num(LAZYACCESS(modifiers, ICON_Y)) - 16, -(ICON_SIZE_Y/2), ICON_SIZE_Y/2)
|
||||
playsound(user, 'sound/items/sheath.ogg', 40, TRUE)
|
||||
reagents.copy_to(broken_egg, reagents.total_volume)
|
||||
reagents.trans_to(broken_egg, reagents.total_volume, copy_only = TRUE)
|
||||
|
||||
hit_griddle.AddToGrill(broken_egg, user)
|
||||
interacting_with.balloon_alert(user, "cracks [src] open")
|
||||
@@ -383,7 +383,7 @@ GLOBAL_VAR_INIT(chicks_from_eggs, 0)
|
||||
if(LAZYACCESS(modifiers, ICON_Y))
|
||||
broken_egg.pixel_y = clamp(text2num(LAZYACCESS(modifiers, ICON_Y)) - 16, -(ICON_SIZE_Y/2), ICON_SIZE_Y/2)
|
||||
playsound(user, 'sound/items/sheath.ogg', 40, TRUE)
|
||||
reagents.copy_to(broken_egg, reagents.total_volume)
|
||||
reagents.trans_to(broken_egg, reagents.total_volume, copy_only = TRUE)
|
||||
|
||||
hit_griddle.AddToGrill(broken_egg, user)
|
||||
interacting_with.balloon_alert(user, "cracks [src] open")
|
||||
|
||||
Reference in New Issue
Block a user