Merge pull request #10940 from Ghommie/Ghommie-cit560

First tweak to cargo reagents selling.
This commit is contained in:
kevinz000
2020-02-15 12:15:50 -07:00
committed by GitHub
27 changed files with 42 additions and 27 deletions
+5
View File
@@ -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
@@ -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))
@@ -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)
@@ -32,7 +32,7 @@
/obj/effect/particle_effect/smoke/Initialize()
. = ..()
create_reagents(500)
create_reagents(500, NONE, NO_REAGENTS_VALUE)
START_PROCESSING(SSobj, src)
+1 -1
View File
@@ -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)
+2 -2
View File
@@ -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)
+2 -2
View File
@@ -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
+1 -1
View File
@@ -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)
+2
View File
@@ -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, "<span class='notice'>Scanned [O], value: <b>[price]</b> credits[O.contents.len ? " (contents included)" : ""].</span>")
+2 -2
View File
@@ -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)
@@ -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
+1
View File
@@ -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
+2 -2
View File
@@ -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)
+1
View File
@@ -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.
+1 -1
View File
@@ -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()
+1 -1
View File
@@ -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)
@@ -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)
. = ..()
@@ -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
@@ -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))
+5 -3
View File
@@ -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
+3 -2
View File
@@ -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))
@@ -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
@@ -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)
@@ -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
@@ -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)
+1 -1
View File
@@ -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)