From 0703c6eea62559c983c1d3c963b593f472440760 Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Thu, 6 Feb 2020 22:34:54 +0100 Subject: [PATCH 1/2] First tweak to cargo reagents selling. --- code/__DEFINES/reagents.dm | 5 +++++ code/game/objects/effects/decals/cleanable.dm | 2 +- code/game/objects/effects/effect_system/effects_foam.dm | 2 +- code/game/objects/effects/effect_system/effects_smoke.dm | 2 +- code/game/objects/items/airlock_painter.dm | 2 +- code/game/objects/items/cigs_lighters.dm | 4 ++-- code/game/objects/items/crayons.dm | 4 ++-- code/game/objects/items/mop.dm | 2 +- code/modules/cargo/exports.dm | 4 ++-- code/modules/food_and_drinks/drinks/drinks.dm | 1 + code/modules/food_and_drinks/food.dm | 1 + code/modules/food_and_drinks/food/snacks.dm | 4 ++-- code/modules/hydroponics/grown.dm | 1 + code/modules/hydroponics/growninedible.dm | 2 +- code/modules/mob/living/carbon/carbon.dm | 2 +- .../mob/living/simple_animal/friendly/farm_animals.dm | 2 +- code/modules/mob/living/simple_animal/slime/slime.dm | 2 +- .../projectiles/projectile/bullets/dart_syringe.dm | 2 +- code/modules/reagents/chemistry/holder.dm | 8 +++++--- code/modules/reagents/reagent_containers.dm | 5 +++-- code/modules/reagents/reagent_containers/borghydro.dm | 1 + code/modules/reagents/reagent_containers/dropper.dm | 2 +- code/modules/reagents/reagent_containers/rags.dm | 1 + code/modules/reagents/reagent_containers/spray.dm | 2 +- code/modules/shuttle/supply.dm | 2 +- modular_citadel/code/modules/arousal/genitals.dm | 4 ++-- 26 files changed, 41 insertions(+), 28 deletions(-) diff --git a/code/__DEFINES/reagents.dm b/code/__DEFINES/reagents.dm index d08344cc96..97ae7b8e95 100644 --- a/code/__DEFINES/reagents.dm +++ b/code/__DEFINES/reagents.dm @@ -22,6 +22,11 @@ // Is an open container for all intents and purposes. #define OPENCONTAINER (REFILLABLE | DRAINABLE | TRANSPARENT) +//reagents_value defines, for cargo stuff. +#define DEFAULT_REAGENTS_VALUE 1 +#define NO_REAGENTS_VALUE 0 +#define HARVEST_REAGENTS_VALUE 0.3 + #define TOUCH 1 // splashing #define INGEST 2 // ingestion diff --git a/code/game/objects/effects/decals/cleanable.dm b/code/game/objects/effects/decals/cleanable.dm index 30e7c8be05..5720d5ce34 100644 --- a/code/game/objects/effects/decals/cleanable.dm +++ b/code/game/objects/effects/decals/cleanable.dm @@ -11,7 +11,7 @@ LAZYINITLIST(blood_DNA) //Kinda needed if (random_icon_states && (icon_state == initial(icon_state)) && length(random_icon_states) > 0) icon_state = pick(random_icon_states) - create_reagents(300) + create_reagents(300, NONE, NO_REAGENTS_VALUE) if(loc && isturf(loc)) for(var/obj/effect/decal/cleanable/C in loc) if(C != src && C.type == type && !QDELETED(C)) diff --git a/code/game/objects/effects/effect_system/effects_foam.dm b/code/game/objects/effects/effect_system/effects_foam.dm index 38a1a6089e..f98b4937ef 100644 --- a/code/game/objects/effects/effect_system/effects_foam.dm +++ b/code/game/objects/effects/effect_system/effects_foam.dm @@ -94,7 +94,7 @@ /obj/effect/particle_effect/foam/Initialize() . = ..() MakeSlippery() - create_reagents(1000) //limited by the size of the reagent holder anyway. + create_reagents(1000, NONE, NO_REAGENTS_VALUE) //limited by the size of the reagent holder anyway. START_PROCESSING(SSfastprocess, src) playsound(src, 'sound/effects/bubbles2.ogg', 80, 1, -3) diff --git a/code/game/objects/effects/effect_system/effects_smoke.dm b/code/game/objects/effects/effect_system/effects_smoke.dm index 40452f68e2..80c0db2b7d 100644 --- a/code/game/objects/effects/effect_system/effects_smoke.dm +++ b/code/game/objects/effects/effect_system/effects_smoke.dm @@ -32,7 +32,7 @@ /obj/effect/particle_effect/smoke/Initialize() . = ..() - create_reagents(500) + create_reagents(500, NONE, NO_REAGENTS_VALUE) START_PROCESSING(SSobj, src) diff --git a/code/game/objects/items/airlock_painter.dm b/code/game/objects/items/airlock_painter.dm index e63474dd6f..b7c76cad2d 100644 --- a/code/game/objects/items/airlock_painter.dm +++ b/code/game/objects/items/airlock_painter.dm @@ -67,7 +67,7 @@ L.Remove() // make some colorful reagent, and apply it to the lungs - L.create_reagents(10) + L.create_reagents(10, NONE, NO_REAGENTS_VALUE) L.reagents.add_reagent(/datum/reagent/colorful_reagent, 10) L.reagents.reaction(L, TOUCH, 1) diff --git a/code/game/objects/items/cigs_lighters.dm b/code/game/objects/items/cigs_lighters.dm index 1186ea8001..cd163e90a4 100644 --- a/code/game/objects/items/cigs_lighters.dm +++ b/code/game/objects/items/cigs_lighters.dm @@ -122,7 +122,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM /obj/item/clothing/mask/cigarette/Initialize() . = ..() - create_reagents(chem_volume, INJECTABLE | NO_REACT) // so it doesn't react until you light it + create_reagents(chem_volume, INJECTABLE | NO_REACT, NO_REAGENTS_VALUE) // so it doesn't react until you light it if(list_reagents) reagents.add_reagent_list(list_reagents) if(starts_lit) @@ -717,7 +717,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM /obj/item/clothing/mask/vape/Initialize(mapload, param_color) . = ..() - create_reagents(chem_volume, NO_REACT) // so it doesn't react until you light it + create_reagents(chem_volume, NO_REACT, NO_REAGENTS_VALUE) // so it doesn't react until you light it reagents.add_reagent(/datum/reagent/drug/nicotine, 50) if(!icon_state) if(!param_color) diff --git a/code/game/objects/items/crayons.dm b/code/game/objects/items/crayons.dm index 81c5083ef7..2e80325d9f 100644 --- a/code/game/objects/items/crayons.dm +++ b/code/game/objects/items/crayons.dm @@ -96,7 +96,7 @@ charges_left = charges if(!reagents) - create_reagents(charges_left * volume_multiplier) + create_reagents(charges_left * volume_multiplier, NONE, NO_REAGENTS_VALUE) reagents.clear_reagents() var/total_weight = 0 @@ -619,7 +619,7 @@ is_capped = TRUE self_contained = FALSE // Don't disappear when they're empty can_change_colour = TRUE - + reagent_contents = list(/datum/reagent/fuel = 1, /datum/reagent/consumable/ethanol = 1) pre_noise = TRUE diff --git a/code/game/objects/items/mop.dm b/code/game/objects/items/mop.dm index a8b28f2544..233eabd4ca 100644 --- a/code/game/objects/items/mop.dm +++ b/code/game/objects/items/mop.dm @@ -21,7 +21,7 @@ /obj/item/mop/New() ..() - create_reagents(mopcap) + create_reagents(mopcap, NONE, NO_REAGENTS_VALUE) /obj/item/mop/proc/clean(turf/A) diff --git a/code/modules/cargo/exports.dm b/code/modules/cargo/exports.dm index fca10ac01c..bb90fa717a 100644 --- a/code/modules/cargo/exports.dm +++ b/code/modules/cargo/exports.dm @@ -49,13 +49,13 @@ Credit dupes that require a lot of manual work shouldn't be removed, unless they sold = E.sell_object(thing, report, dry_run, allowed_categories , apply_elastic) report.exported_atoms += " [thing.name]" break - if(thing.reagents) + if(thing.reagents?.value_multiplier) for(var/A in thing.reagents.reagent_list) var/datum/reagent/R = A if(!R.value) continue report.reagents_volume[R.name] += R.volume - report.reagents_value[R.name] += R.volume * R.value + report.reagents_value[R.name] += round(R.volume * R.value * thing.reagents.value_multiplier) if(!dry_run && (sold || delete_unsold)) if(ismob(thing)) thing.investigate_log("deleted through cargo export",INVESTIGATE_CARGO) diff --git a/code/modules/food_and_drinks/drinks/drinks.dm b/code/modules/food_and_drinks/drinks/drinks.dm index cd5c9d850b..7ac815dbab 100644 --- a/code/modules/food_and_drinks/drinks/drinks.dm +++ b/code/modules/food_and_drinks/drinks/drinks.dm @@ -9,6 +9,7 @@ lefthand_file = 'icons/mob/inhands/misc/food_lefthand.dmi' righthand_file = 'icons/mob/inhands/misc/food_righthand.dmi' reagent_flags = OPENCONTAINER + reagent_value = DEFAULT_REAGENTS_VALUE var/gulp_size = 5 //This is now officially broken ... need to think of a nice way to fix it. possible_transfer_amounts = list(5,10,15,20,25,30,50) volume = 50 diff --git a/code/modules/food_and_drinks/food.dm b/code/modules/food_and_drinks/food.dm index 6d3f007fd9..2af24080cb 100644 --- a/code/modules/food_and_drinks/food.dm +++ b/code/modules/food_and_drinks/food.dm @@ -12,6 +12,7 @@ possible_transfer_amounts = list() volume = 50 //Sets the default container amount for all food items. reagent_flags = INJECTABLE + reagent_value = NO_REAGENTS_VALUE resistance_flags = FLAMMABLE var/foodtype = NONE var/last_check_time diff --git a/code/modules/food_and_drinks/food/snacks.dm b/code/modules/food_and_drinks/food/snacks.dm index c068c1aa40..796648bf73 100644 --- a/code/modules/food_and_drinks/food/snacks.dm +++ b/code/modules/food_and_drinks/food/snacks.dm @@ -245,7 +245,7 @@ All foods are distributed among various categories. Use common sense. return TRUE /obj/item/reagent_containers/food/snacks/proc/initialize_slice(obj/item/reagent_containers/food/snacks/slice, reagents_per_slice) - slice.create_reagents(slice.volume) + slice.create_reagents(slice.volume, reagent_flags, reagent_value) reagents.trans_to(slice,reagents_per_slice) if(name != initial(name)) slice.name = "slice of [name]" @@ -279,7 +279,7 @@ All foods are distributed among various categories. Use common sense. // initialize_cooked_food() is called when microwaving the food /obj/item/reagent_containers/food/snacks/proc/initialize_cooked_food(obj/item/reagent_containers/food/snacks/S, cooking_efficiency = 1) - S.create_reagents(S.volume) + S.create_reagents(S.volume, reagent_flags, reagent_value) if(reagents) reagents.trans_to(S, reagents.total_volume) if(S.bonus_reagents && S.bonus_reagents.len) diff --git a/code/modules/hydroponics/grown.dm b/code/modules/hydroponics/grown.dm index f99cfde92d..65d942ca2b 100644 --- a/code/modules/hydroponics/grown.dm +++ b/code/modules/hydroponics/grown.dm @@ -15,6 +15,7 @@ // Saves us from having to define each stupid grown's dried_type as itself. // If you don't want a plant to be driable (watermelons) set this to null in the time definition. resistance_flags = FLAMMABLE + reagent_value = HARVEST_REAGENTS_VALUE var/dry_grind = FALSE //If TRUE, this object needs to be dry to be ground up var/can_distill = TRUE //If FALSE, this object cannot be distilled into an alcohol. var/distill_reagent //If NULL and this object can be distilled, it uses a generic fruit_wine reagent and adjusts its variables. diff --git a/code/modules/hydroponics/growninedible.dm b/code/modules/hydroponics/growninedible.dm index ef925e3965..f4859ffb1e 100644 --- a/code/modules/hydroponics/growninedible.dm +++ b/code/modules/hydroponics/growninedible.dm @@ -11,7 +11,7 @@ /obj/item/grown/Initialize(newloc, obj/item/seeds/new_seed) . = ..() - create_reagents(50) + create_reagents(50, NONE, HARVEST_REAGENTS_VALUE) if(new_seed) seed = new_seed.Copy() diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index ef33afec25..6460d8331d 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -3,7 +3,7 @@ /mob/living/carbon/Initialize() . = ..() - create_reagents(1000) + create_reagents(1000, NONE, NO_REAGENTS_VALUE) update_body_parts() //to update the carbon's new bodyparts appearance GLOB.carbon_list += src blood_volume = (BLOOD_VOLUME_NORMAL * blood_ratio) diff --git a/code/modules/mob/living/simple_animal/friendly/farm_animals.dm b/code/modules/mob/living/simple_animal/friendly/farm_animals.dm index 38bcfbde79..b66bedb887 100644 --- a/code/modules/mob/living/simple_animal/friendly/farm_animals.dm +++ b/code/modules/mob/living/simple_animal/friendly/farm_animals.dm @@ -454,7 +454,7 @@ name = "udder" /obj/item/udder/Initialize() - create_reagents(50) + create_reagents(50, NONE, NO_REAGENTS_VALUE) reagents.add_reagent(/datum/reagent/consumable/milk, 20) . = ..() diff --git a/code/modules/mob/living/simple_animal/slime/slime.dm b/code/modules/mob/living/simple_animal/slime/slime.dm index 5a1a794d4e..2ea2a412f8 100644 --- a/code/modules/mob/living/simple_animal/slime/slime.dm +++ b/code/modules/mob/living/simple_animal/slime/slime.dm @@ -97,7 +97,7 @@ else var/datum/action/innate/slime/evolve/E = new E.Grant(src) - create_reagents(100) + create_reagents(100, NONE, NO_REAGENTS_VALUE) set_colour(new_colour) . = ..() nutrition = 700 diff --git a/code/modules/projectiles/projectile/bullets/dart_syringe.dm b/code/modules/projectiles/projectile/bullets/dart_syringe.dm index 3f418df75b..b5a9eb8d69 100644 --- a/code/modules/projectiles/projectile/bullets/dart_syringe.dm +++ b/code/modules/projectiles/projectile/bullets/dart_syringe.dm @@ -6,7 +6,7 @@ /obj/item/projectile/bullet/dart/Initialize() . = ..() - create_reagents(50, NO_REACT) + create_reagents(50, NO_REACT, NO_REAGENTS_VALUE) /obj/item/projectile/bullet/dart/on_hit(atom/target, blocked = FALSE, skip = FALSE) if(iscarbon(target)) diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index 95e104ba68..4c240660a9 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -61,8 +61,9 @@ var/reactedVol = 0 //how much of the reagent is reacted during a fermireaction var/fermiIsReacting = FALSE //that prevents multiple reactions from occurring (i.e. add_reagent calls to process_reactions(), this stops any extra reactions.) var/fermiReactID //instance of the chem reaction used during a fermireaction, kept here so it's cache isn't lost between loops/procs. + var/value_multiplier = DEFAULT_REAGENTS_VALUE //used for cargo reagents selling. -/datum/reagents/New(maximum=100, new_flags) +/datum/reagents/New(maximum=100, new_flags = NONE, new_value = DEFAULT_REAGENTS_VALUE) maximum_volume = maximum //I dislike having these here but map-objects are initialised before world/New() is called. >_> @@ -72,6 +73,7 @@ build_chemical_reactions_list() reagents_holder_flags = new_flags + value_multiplier = new_value /datum/reagents/Destroy() . = ..() @@ -1147,10 +1149,10 @@ // Convenience proc to create a reagents holder for an atom // Max vol is maximum volume of holder -/atom/proc/create_reagents(max_vol, flags) +/atom/proc/create_reagents(max_vol, flags, new_value) if(reagents) qdel(reagents) - reagents = new/datum/reagents(max_vol, flags) + reagents = new/datum/reagents(max_vol, flags, new_value) reagents.my_atom = src /proc/get_random_reagent_id() // Returns a random reagent type minus blacklisted reagents diff --git a/code/modules/reagents/reagent_containers.dm b/code/modules/reagents/reagent_containers.dm index 23176f8a05..e0000c5748 100644 --- a/code/modules/reagents/reagent_containers.dm +++ b/code/modules/reagents/reagent_containers.dm @@ -7,7 +7,8 @@ var/amount_per_transfer_from_this = 5 var/list/possible_transfer_amounts = list(5,10,15,20,25,30) var/volume = 30 - var/reagent_flags //used to determine the reagent holder flags on add_initial_reagents() + var/reagent_flags = NONE //used to determine the reagent holder flags on add_initial_reagents() + var/reagent_value = DEFAULT_REAGENTS_VALUE //same as above but for the holder value multiplier. var/list/list_reagents = null var/spawned_disease = null var/disease_amount = 20 @@ -22,7 +23,7 @@ volume = vol if(container_flags & APTFT_VERB && length(possible_transfer_amounts)) verbs += /obj/item/reagent_containers/proc/set_APTFT - create_reagents(volume, reagent_flags) + create_reagents(volume, reagent_flags, reagent_value) if(spawned_disease) var/datum/disease/F = new spawned_disease() var/list/data = list("blood_DNA" = "UNKNOWN DNA", "blood_type" = "SY","viruses"= list(F)) diff --git a/code/modules/reagents/reagent_containers/borghydro.dm b/code/modules/reagents/reagent_containers/borghydro.dm index 34dd97b0aa..73d0c5eafa 100644 --- a/code/modules/reagents/reagent_containers/borghydro.dm +++ b/code/modules/reagents/reagent_containers/borghydro.dm @@ -19,6 +19,7 @@ Borg Hypospray amount_per_transfer_from_this = 5 volume = 30 possible_transfer_amounts = list() + reagent_value = NO_REAGENTS_VALUE var/mode = 1 var/charge_cost = 50 var/charge_tick = 0 diff --git a/code/modules/reagents/reagent_containers/dropper.dm b/code/modules/reagents/reagent_containers/dropper.dm index 9feec362a4..4e1de85fce 100644 --- a/code/modules/reagents/reagent_containers/dropper.dm +++ b/code/modules/reagents/reagent_containers/dropper.dm @@ -44,7 +44,7 @@ if(safe_thing) if(!safe_thing.reagents) - safe_thing.create_reagents(100) + safe_thing.create_reagents(100, NONE, NO_REAGENTS_VALUE) reagents.reaction(safe_thing, TOUCH, fraction) trans = reagents.trans_to(safe_thing, amount_per_transfer_from_this) diff --git a/code/modules/reagents/reagent_containers/rags.dm b/code/modules/reagents/reagent_containers/rags.dm index 59c956acd6..8e6f5b9581 100644 --- a/code/modules/reagents/reagent_containers/rags.dm +++ b/code/modules/reagents/reagent_containers/rags.dm @@ -11,6 +11,7 @@ container_flags = APTFT_VERB volume = 5 spillable = FALSE + reagent_value = NO_REAGENTS_VALUE var/wipe_sound var/soak_efficiency = 1 var/extinguish_efficiency = 0 diff --git a/code/modules/reagents/reagent_containers/spray.dm b/code/modules/reagents/reagent_containers/spray.dm index e8c8d14141..b2f7392704 100644 --- a/code/modules/reagents/reagent_containers/spray.dm +++ b/code/modules/reagents/reagent_containers/spray.dm @@ -68,7 +68,7 @@ /obj/item/reagent_containers/spray/proc/spray(atom/A) var/range = CLAMP(get_dist(src, A), 1, current_range) var/obj/effect/decal/chempuff/D = new /obj/effect/decal/chempuff(get_turf(src)) - D.create_reagents(amount_per_transfer_from_this) + D.create_reagents(amount_per_transfer_from_this, NONE, NO_REAGENTS_VALUE) var/puff_reagent_left = range //how many turf, mob or dense objet we can react with before we consider the chem puff consumed if(stream_mode) reagents.trans_to(D, amount_per_transfer_from_this) diff --git a/code/modules/shuttle/supply.dm b/code/modules/shuttle/supply.dm index 0e7cba9776..bdf6e8cc87 100644 --- a/code/modules/shuttle/supply.dm +++ b/code/modules/shuttle/supply.dm @@ -168,7 +168,7 @@ GLOBAL_LIST_INIT(cargo_shuttle_leave_behind_typecache, typecacheof(list( for(var/chem in ex.reagents_value) var/value = ex.reagents_value[chem] - msg += "[value] credits: received [ex.reagents_volume[chem]]u of [chem].\n" + msg += "[value > 0 ? "+" : ""][value] credits: received [ex.reagents_volume[chem]]u of [chem].\n" SSshuttle.points += value msg = copytext_char(msg, 1, MAX_MESSAGE_LEN) diff --git a/modular_citadel/code/modules/arousal/genitals.dm b/modular_citadel/code/modules/arousal/genitals.dm index ca01ef46cb..6195f84259 100644 --- a/modular_citadel/code/modules/arousal/genitals.dm +++ b/modular_citadel/code/modules/arousal/genitals.dm @@ -23,7 +23,7 @@ /obj/item/organ/genital/Initialize(mapload, mob/living/carbon/human/H) . = ..() if(fluid_id) - create_reagents(fluid_max_volume) + create_reagents(fluid_max_volume, NONE, NO_REAGENTS_VALUE) if(CHECK_BITFIELD(genital_flags, GENITAL_FUID_PRODUCTION)) reagents.add_reagent(fluid_id, fluid_max_volume) if(H) @@ -357,7 +357,7 @@ genital_overlay.color = "#[H.dna.features["breasts_color"]]" if("vag_color") genital_overlay.color = "#[H.dna.features["vag_color"]]" - + genital_overlay.icon_state = "[G.slot]_[S.icon_state]_[size]-s_[aroused_state]_[layertext]" if(layer == GENITALS_FRONT_LAYER && CHECK_BITFIELD(G.genital_flags, GENITAL_THROUGH_CLOTHES)) From 04261345dd629fb8ef74f82f28be247604ba047c Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Thu, 6 Feb 2020 23:08:32 +0100 Subject: [PATCH 2/2] export scanners. --- code/modules/cargo/export_scanner.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/modules/cargo/export_scanner.dm b/code/modules/cargo/export_scanner.dm index 9c523c194f..80fd05cf8c 100644 --- a/code/modules/cargo/export_scanner.dm +++ b/code/modules/cargo/export_scanner.dm @@ -36,6 +36,8 @@ var/price = 0 for(var/x in ex.total_amount) price += ex.total_value[x] + for(var/x in ex.reagents_value) + price += ex.reagents_value[x] if(price) to_chat(user, "Scanned [O], value: [price] credits[O.contents.len ? " (contents included)" : ""].")