mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-08-27 07:08:22 +01:00
Reworking the taste system to allow for species-level taste definitions.
Reworking how data is initialized and handled by reagents. Post-rebase update for taste PR. Further work on the taste system. Updating taste strings. God help me.
This commit is contained in:
@@ -103,7 +103,6 @@
|
||||
update_total()
|
||||
|
||||
/* Holder-to-chemical */
|
||||
|
||||
/datum/reagents/proc/add_reagent(var/id, var/amount, var/data = null, var/safety = 0)
|
||||
if(!isnum(amount) || amount <= 0)
|
||||
return 0
|
||||
@@ -111,34 +110,11 @@
|
||||
update_total()
|
||||
amount = min(amount, get_free_space())
|
||||
|
||||
if(istype(my_atom,/obj/item/reagent_containers/food)) //The following code is targeted specifically at getting allergen reagents into food items, since for the most part they're not applied by default.
|
||||
var/list/add_reagents = list()
|
||||
var/totalnum = 0
|
||||
|
||||
for(var/item in data) //Try to find the ID
|
||||
var/add_reagent_id = null
|
||||
if(item in SSchemistry.chemical_reagents)
|
||||
add_reagent_id = item
|
||||
else if("[item]juice" in SSchemistry.chemical_reagents)
|
||||
add_reagent_id = "[item]juice"
|
||||
if(add_reagent_id) //If we did find it, add it to our list of reagents to add, and add the number to our total.
|
||||
add_reagents[add_reagent_id] += data[item]
|
||||
totalnum += data[item]
|
||||
|
||||
if(totalnum)
|
||||
var/multconst = amount/totalnum //We're going to add these extra reagents so that they share the ratio described, but only add up to 1x the existing amount at the most
|
||||
for(var/item in add_reagents)
|
||||
add_reagent(item,add_reagents[item]*multconst)
|
||||
|
||||
|
||||
|
||||
|
||||
for(var/datum/reagent/current in reagent_list)
|
||||
if(current.id == id)
|
||||
if(current.id == "blood")
|
||||
if(LAZYLEN(data) && !isnull(data["species"]) && !isnull(current.data["species"]) && data["species"] != current.data["species"]) // Species bloodtypes are already incompatible, this just stops it from mixing into the one already in a container.
|
||||
continue
|
||||
|
||||
current.volume += amount
|
||||
if(!isnull(data)) // For all we know, it could be zero or empty string and meaningful
|
||||
current.mix_data(data, amount)
|
||||
@@ -154,7 +130,7 @@
|
||||
reagent_list += R
|
||||
R.holder = src
|
||||
R.volume = amount
|
||||
R.initialize_data(data)
|
||||
R.initialize_data(R.get_initial_data(data))
|
||||
update_total()
|
||||
if(!safety)
|
||||
handle_reactions()
|
||||
|
||||
Reference in New Issue
Block a user