Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kitchen Food Buffs #4482

Closed
wants to merge 16 commits into from
1 change: 1 addition & 0 deletions aurorastation.dme
Expand Up @@ -672,6 +672,7 @@
#include "code\game\mecha\working\working.dm"
#include "code\game\modifiers\modifiers.dm"
#include "code\game\modifiers\modifiers_chem.dm"
#include "code\game\modifiers\modifiers_food.dm"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why exactly do we need another modifier system?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just another file?

#include "code\game\objects\buckling.dm"
#include "code\game\objects\empulse.dm"
#include "code\game\objects\explosion.dm"
Expand Down
2 changes: 1 addition & 1 deletion code/game/modifiers/modifiers.dm
Expand Up @@ -340,7 +340,7 @@ it should be avoided in favour of manual removal where possible
for (var/datum/reagent/R in C.touching.reagent_list)
if (istype(R, ourtype))
totaldose += R.dose

for (var/datum/reagent/R in C.breathing.reagent_list)
if (istype(R, ourtype))
totaldose += R.dose
Expand Down
50 changes: 50 additions & 0 deletions code/game/modifiers/modifiers_food.dm
@@ -0,0 +1,50 @@
/datum/modifier/food
var/regen_added = 0
var/stamina_added = 0
var/nutrition_added = 0
var/original_duration = 0

/datum/modifier/food/activate()
..()
original_duration = duration
var/mob/living/L = target
if(istype(L))
regen_added = L.stamina_recovery + strength*0.03
stamina_added = L.max_stamina + strength
if(strength < 0)
nutrition_added = -strength
L.stamina_recovery += regen_added
L.max_stamina += stamina_added
L.nutrition += nutrition_added

/datum/modifier/food/deactivate()
..()
var/mob/living/L = target
if(istype(L))
L.stamina_recovery -= regen_added
L.max_stamina -= stamina_added
L.nutrition -= nutrition_added

/datum/modifier/food/custom_override(var/datum/modifier/existing)
if((strength > 0 && existing.strength) > 0 || (strength < 0 && existing.strength < 0))
existing.duration += duration
existing.strength += strength
qdel(src)
return existing
else
START_PROCESSING(SSmodifiers, src)
LAZYADD(target.modifiers, src)
activate()
return src


/datum/modifier/food/validity_fail(var/reason) //This is easier and smarter than making a custom check.
//world << "MODIFIER VALIDITY FAIL: [reason]"

if(modifier_type == MODIFIER_REAGENT)
modifier_type = MODIFIER_TIMED
duration = original_duration
return 1

qdel(src)
return 0
1 change: 0 additions & 1 deletion code/modules/hydroponics/trays/tray_tools.dm
Expand Up @@ -92,7 +92,6 @@

if(grown_reagents && grown_reagents.reagent_list && grown_reagents.reagent_list.len)
dat += "<h2>Reagent Data</h2>"

dat += "<br>This sample contains: "
for(var/datum/reagent/R in grown_reagents.reagent_list)
dat += "<br>- [R.id], [grown_reagents.get_reagent_amount(R.id)] unit(s)"
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/taste.dm
Expand Up @@ -27,7 +27,7 @@ calculate text size per text.
for(var/datum/reagent/R in reagent_list)
if(!R.taste_mult)
continue
if(R.id == "nutriment") //this is ugly but apparently only nutriment (not subtypes) has taste data TODO figure out why
if(R.id == "nutriment" || R.id == "flavoring") //this is ugly but apparently only nutriment (not subtypes) has taste data TODO figure out why
var/list/taste_data = R.get_data()
for(var/taste in taste_data)
if(taste in tastes)
Expand Down
14 changes: 11 additions & 3 deletions code/modules/reagents/Chemistry-Holder.dm
Expand Up @@ -88,6 +88,7 @@

//returns 1 if the holder should continue reactiong, 0 otherwise.
/datum/reagents/proc/process_reactions()

if(!my_atom) // No reactions in temporary holders
return 0
if(!my_atom.loc) //No reactions inside GC'd containers
Expand Down Expand Up @@ -144,6 +145,13 @@
return 1
var/datum/reagent/D = SSchemistry.chemical_reagents[id]
if(D)

if(D.container_whitelist.len > 0 && !instances_of_type_in_list(my_atom,D.container_whitelist))
return 0

if(D.container_blacklist.len > 0 && instances_of_type_in_list(my_atom,D.container_blacklist))
return 0

var/datum/reagent/R = new D.type()
reagent_list += R
R.holder = src
Expand Down Expand Up @@ -252,7 +260,7 @@
return amount

/datum/reagents/proc/trans_to_holder(var/datum/reagents/target, var/amount = 1, var/multiplier = 1, var/copy = 0) // Transfers [amount] reagents from [src] to [target], multiplying them by [multiplier]. Returns actual amount removed from [src] (not amount transferred to [target]).

if(!target || !istype(target))
return 0

Expand All @@ -276,7 +284,7 @@
handle_reactions()

target.handle_reactions()

return amount

/* Holder-to-atom and similar procs */
Expand Down Expand Up @@ -389,7 +397,7 @@

if(!target || !istype(target) || !target.simulated)
return 0

var/mob/living/carbon/C = target
if(istype(C))
if(type == CHEM_BREATHE)
Expand Down
13 changes: 12 additions & 1 deletion code/modules/reagents/Chemistry-Machinery.dm
Expand Up @@ -229,7 +229,7 @@
if(inoperable())
return
user.set_machine(src)

var/datum/asset/pill_icons = get_asset_datum(/datum/asset/chem_master)
pill_icons.send(user.client)

Expand Down Expand Up @@ -565,6 +565,10 @@
/obj/item/stack/material/silver = "silver",
/obj/item/stack/material/mhydrogen = "hydrazine" //doesn't really make much sense but thank Bay
)
var/list/convert_reagents = list(
"nutriment" = "slop",
"protein" = "muck"
)

/obj/machinery/reagentgrinder/Initialize()
. = ..()
Expand Down Expand Up @@ -766,6 +770,13 @@
continue

if(O.reagents)
for(var/datum/reagent/R in O.reagents)
var/value = convert_reagents[R.id]
if(!value)
continue
var/vol = R.volume
O.reagents.remove_reagent(R.id,vol)
O.reagents.add_reagent(value,vol)
O.reagents.trans_to(beaker, min(O.reagents.total_volume, remaining_volume))
if(O.reagents.total_volume == 0)
holdingitems -= O
Expand Down
3 changes: 3 additions & 0 deletions code/modules/reagents/Chemistry-Reagents.dm
Expand Up @@ -27,6 +27,9 @@
var/metabolism_min = 0.01 //How much for the medicine to be present in the system to actually have an effect.
var/list/conflicting_reagents //Reagents that conflict with this medicine, and cause adverse effects when in the blood.

var/list/container_whitelist = list()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not make = list() vars on commonly instanced types, like reagents.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove the feature entirely.

var/list/container_blacklist = list()

/datum/reagent/proc/remove_self(var/amount) // Shortcut
if (!holder)
//PROCLOG_WEIRD("Null holder found. Name: [name], id: [id]")
Expand Down
Expand Up @@ -51,6 +51,37 @@
kois_type = 2

/* Food */
/datum/reagent/flavoring
name = "Artificial Flavoring"
id = "flavoring"
description = "Put this in food that you want to taste better."
taste_mult = 40 //1 unit of flavoring is equal to 10
reagent_state = SOLID
metabolism = REM
color = "#FFFFFF"
unaffected_species = IS_MACHINE

/datum/reagent/flavoring/mix_data(var/list/newdata, var/newamount) //According to a comment, mix_data is really weird when it comes to subtypes. That's why it's not in a subtype.
if(!islist(newdata) || !newdata.len)
return
for(var/i in 1 to newdata.len)
if(!(newdata[i] in data))
data.Add(newdata[i])
data[newdata[i]] = 0
data[newdata[i]] += newdata[newdata[i]]
var/totalFlavor = 0
for(var/i in 1 to data.len)
totalFlavor += data[data[i]]

if (!totalFlavor)
return

for(var/i in 1 to data.len) //cull the tasteless
if(data[data[i]]/totalFlavor * 100 < 10)
data[data[i]] = null
data -= data[i]
data -= null

/datum/reagent/nutriment
name = "Nutriment"
id = "nutriment"
Expand All @@ -62,6 +93,8 @@
var/blood_factor = 6
var/regen_factor = 0.8
var/injectable = 0
var/datum/modifier/modifier
var/mod_strength = 1
color = "#664330"
unaffected_species = IS_MACHINE

Expand Down Expand Up @@ -102,16 +135,16 @@
M.heal_organ_damage(regen_factor * removed, 0)
M.nutrition += nutriment_factor * removed // For hunger and fatness
M.add_chemical_effect(CE_BLOODRESTORE, blood_factor * removed)



if (!modifier)
modifier = M.add_modifier(/datum/modifier/food, MODIFIER_REAGENT, src, _strength = (1 + blood_factor*2 + nutriment_factor*2)*mod_strength, _duration = max_dose*20, override = MODIFIER_OVERRIDE_CUSTOM)
/*
Coatings are used in cooking. Dipping food items in a reagent container with a coating in it
allows it to be covered in that, which will add a masked overlay to the sprite.

Coatings have both a raw and a cooked image. Raw coating is generally unhealthy
Generally coatings are intended for deep frying foods
*/

/datum/reagent/nutriment/coating
nutriment_factor = 6 //Less dense than the food itself, but coatings still add extra calories
var/messaged = 0
Expand Down Expand Up @@ -254,6 +287,21 @@
color = "#EDB91F"
taste_description = "cheese"

/datum/reagent/nutriment/protein/muck //Blended meat
name = "muck"
id = "muck"
blood_factor = 6
taste_description = "meat, I think"
mod_strength = -0.5

/datum/reagent/nutriment/slop //Blended plants
name = "Slop"
id = "slop"
description = "A blended mess of cheap food. Serve this to prisoners."
nutriment_factor = 6
taste_description = "slop"
mod_strength = -0.5

//Fats
//=========================
/datum/reagent/nutriment/triglyceride
Expand Down Expand Up @@ -3532,58 +3580,3 @@
glass_icon_state = "crocodile_glass"
glass_name = "glass of Crocodile Guwan"
glass_desc = "The smell says no, but the pretty colors say yes."

//Preservatives

/datum/reagent/nutriment/badfood //This is just a base. It shouldn't exist or be used anywhere but just in case, I added names.
name = "Experimental Preservative"
id = "badfood"
description = "Some... strange chemical. You can swear it's moving."
nutriment_factor = 50
color = "#000000"
taste_description = "liquid heart attack"
metabolism = REM * 1 //Metabolises slower
var/damagemul = 0.5 //How much damage to deal to the heart per unit digested

/datum/reagent/nutriment/badfood/affect_ingest(var/mob/living/carbon/human/M, var/alien, var/removed)
if(istype(M))
var/obj/item/organ/F = M.internal_organs_by_name["heart"]
if(istype(F))
F.take_damage(removed * damagemul,1)
..()

/datum/reagent/nutriment/badfood/palmoil
name = "Palm Oil"
id = "palmoil"
description = "Palm oil is a common preservative used in packaged food, and is seriously unhealthy for you much like everything on this station."
nutriment_factor = 30
color = "#f4ce42"
taste_description = "oily fat"
damagemul = 0.15

/datum/reagent/nutriment/badfood/shortening
name = "Shortening"
id = "shortening"
description = "Shortening, also known as hydrogenated vegetable oil, is a preservative commonly used in packaged food. Usually made from vegetables."
nutriment_factor = 20
color = "#e2d4c9"
taste_description = "greasy fat"
damagemul = 0.05

/datum/reagent/nutriment/badfood/hfcs
name = "High Fructose Corn Syrup"
id = "hfcs"
description = "A cheap, easy to produce, unhealthy alternative to real sugar."
nutriment_factor = 20
color = "#c66119"
taste_description = "sweetness"
damagemul = 0.1

/datum/reagent/nutriment/badfood/msg
name = "Monosodium Glutamate"
id = "msg"
description = "Monosodium glutamate, also known as MSG, is a cheap flavor enhancer similiar to sodium. Causes chinese restaurant syndrome."
nutriment_factor = 5
color = "#eaf1fc"
taste_description = "flavoring"
damagemul = 0.05