Skip to content

Commit

Permalink
More food effects (tgstation#84889)
Browse files Browse the repository at this point in the history
## About The Pull Request

In tgstation#77887 I have introduced a food buff system with placeholder buffs to
not bloat that PR with balance-related things to allow people to add
their own effects and discuss the particular effects in separate PRs.

The goal is to have:

- Some default buffs for all food. Currently there's only Haste that
scales with food complexity.
- Some interesting buffs tied to food categories or specific dishes

This PR is a first part of this change.

- Adding an indicator to Cooking UI that food does something special
- Added **Spaghetti Carbonara** dish that gives Italian speech.

![image](https://github.com/user-attachments/assets/2035a97a-6048-4636-bd49-d1ea3390a50e)

- Added **Jupiter Cup Cake** that gives shock immunity instead of it
being randomly given by high-complexity dishes.

![image](https://github.com/user-attachments/assets/3260339d-0167-4840-9b76-10371959e16c)

- Made **Omelette Du Fromage** give French speech.
- Made **Mime Tart** give Mute trait
- Made **Clown Cake** give Waddle Walk trait
- Made **Stuffed Legion** give Ashstorm Immune trait

## Why It's Good For The Game

Foodening PR was incomplete, this PR is a step towards the completion.

## TODO

- [X] Pick a certain dish to give the French speech
- [X] Pick a certain pasta to give the Italian speech
- [X] Pick a certain dish for the shock immunity buff
- [x] Add an indicator to the cooking UI that a dish has a special
effect
- [x] Add more food effects per suggestions

## Changelog

:cl:
qol: Dishes with a special food effect are marked in the Cooking UI
add: New Spaghetti Carbonara dish that makes people Italian temporarily
add: Omelette Du Fromage makes people French temporarily
add: Shock Immunity is no longer a random level 4-5 food buff, but a
buff given by a new Jupiter-Cup-Cake
add: Mime Tart gives Mute trait
add: Clown Cake gives Waddle Walk trait
add: Stuffed Legion gives Ashstorm Immune trait
/:cl:
  • Loading branch information
MTandi authored Aug 14, 2024
1 parent e635121 commit 6fbc9a2
Show file tree
Hide file tree
Showing 21 changed files with 181 additions and 34 deletions.
4 changes: 1 addition & 3 deletions code/__DEFINES/food.dm
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ GLOBAL_LIST_INIT(food_quality_events, list(
FOOD_QUALITY_TOP = /datum/mood_event/food/top,
))

/// Crafted food buffs grouped by crafting_complexity
/// Weighted lists of crafted food buffs randomly given according to crafting_complexity unless the food has a specific buff
GLOBAL_LIST_INIT(food_buffs, list(
FOOD_COMPLEXITY_1 = list(
/datum/status_effect/food/haste = 1,
Expand All @@ -152,11 +152,9 @@ GLOBAL_LIST_INIT(food_buffs, list(
),
FOOD_COMPLEXITY_4 = list(
/datum/status_effect/food/haste = 1,
/datum/status_effect/food/trait/shockimmune = 1,
),
FOOD_COMPLEXITY_5 = list(
/datum/status_effect/food/haste = 1,
/datum/status_effect/food/trait/shockimmune = 2,
),
))

Expand Down
3 changes: 3 additions & 0 deletions code/datums/components/crafting/crafting.dm
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,9 @@
data["name"] = "[data["name"]] [recipe.result_amount]x"
data["desc"] = recipe.desc || initial(atom.desc)

if(ispath(recipe.result, /obj/item/food))
var/obj/item/food/food = recipe.result
data["has_food_effect"] = !!food.crafted_food_buff

// Crafting
if(recipe.non_craftable)
Expand Down
6 changes: 6 additions & 0 deletions code/datums/components/speechmod.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@

var/atom/owner = parent

if (istype(parent, /datum/status_effect))
var/datum/status_effect/effect = parent
targeted = effect.owner
RegisterSignal(targeted, COMSIG_MOB_SAY, PROC_REF(handle_speech))
return

if (ismob(parent))
targeted = parent
RegisterSignal(targeted, COMSIG_MOB_SAY, PROC_REF(handle_speech))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
/// Buffs given by eating hand-crafted food. The duration scales with consumable reagents purity.
/datum/status_effect/food
id = "food_buff"
id = "food_effect"
duration = 5 MINUTES // Same as food mood buffs
status_type = STATUS_EFFECT_REPLACE // Only one food buff allowed
alert_type = /atom/movable/screen/alert/status_effect/food
show_duration = TRUE
/// Buff power
/// Buff power equal to food complexity (1 to 5)
var/strength

/datum/status_effect/food/on_creation(mob/living/new_owner, timeout_mod = 1, strength = 1)
. = ..()
src.strength = strength
//Generate alert when not specified
if(isnum(timeout_mod))
duration *= timeout_mod
. = ..()
if(istype(linked_alert, /atom/movable/screen/alert/status_effect/food))
linked_alert.icon_state = "[linked_alert.base_icon_state]_[strength]"

Expand All @@ -22,19 +21,3 @@
desc = "Eating it made me feel better."
icon_state = "food_buff_1"
base_icon_state = "food_buff"

/// Makes you gain a trait
/datum/status_effect/food/trait
var/trait = TRAIT_DUMB // You need to override this

/datum/status_effect/food/trait/on_apply()
ADD_TRAIT(owner, trait, type)
return ..()

/datum/status_effect/food/trait/be_replaced()
REMOVE_TRAIT(owner, trait, type)
return ..()

/datum/status_effect/food/trait/on_remove()
REMOVE_TRAIT(owner, trait, type)
return ..()
7 changes: 0 additions & 7 deletions code/datums/status_effects/buffs/food/food_traits.dm

This file was deleted.

56 changes: 56 additions & 0 deletions code/datums/status_effects/buffs/food/grant_trait.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/// Makes you gain a trait
/datum/status_effect/food/trait
var/trait = TRAIT_DUMB // You need to override this

/datum/status_effect/food/trait/on_apply()
if(!HAS_TRAIT_FROM(owner, trait, type)) // Check if trait was already applied
ADD_TRAIT(owner, trait, type)
return ..()

/datum/status_effect/food/trait/be_replaced()
REMOVE_TRAIT(owner, trait, type)
return ..()

/datum/status_effect/food/trait/on_remove()
REMOVE_TRAIT(owner, trait, type)
return ..()

/datum/status_effect/food/trait/shockimmune
alert_type = /atom/movable/screen/alert/status_effect/shockimmune
trait = TRAIT_SHOCKIMMUNE

/atom/movable/screen/alert/status_effect/shockimmune
name = "Grounded"
desc = "That meal made me feel like a superconductor..."
icon_state = "shock_immune"

/datum/status_effect/food/trait/mute
alert_type = /atom/movable/screen/alert/status_effect/mute
trait = TRAIT_MUTE

/atom/movable/screen/alert/status_effect/mute
name = "..."
desc = "..."
icon_state = "mute"

/datum/status_effect/food/trait/ashstorm_immune
alert_type = /atom/movable/screen/alert/status_effect/ashstorm_immune
trait = TRAIT_ASHSTORM_IMMUNE

/atom/movable/screen/alert/status_effect/ashstorm_immune
name = "Ashstorm-proof"
desc = "That meal makes me feel born on Lavaland."
icon_state = "ashstorm_immune"

/datum/status_effect/food/trait/waddle
alert_type = /atom/movable/screen/alert/status_effect/waddle
trait = TRAIT_WADDLING

/datum/status_effect/food/trait/waddle/on_apply()
owner.AddElementTrait(trait, type, /datum/element/waddling)
return ..()

/atom/movable/screen/alert/status_effect/waddle
name = "Waddling"
desc = "That meal makes me want to joke around."
icon_state = "waddle"
45 changes: 45 additions & 0 deletions code/datums/status_effects/buffs/food/speech.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
///Temporary modifies the speech using the /datum/component/speechmod
/datum/status_effect/food/speech

/datum/status_effect/food/speech/italian
alert_type = /atom/movable/screen/alert/status_effect/italian_speech

/datum/status_effect/food/speech/italian/on_apply()
AddComponent( \
/datum/component/speechmod, \
replacements = strings("italian_replacement.json", "italian"), \
end_string = list(
" Ravioli, ravioli, give me the formuoli!",
" Mamma-mia!",
" Mamma-mia! That's a spicy meat-ball!",
" La la la la la funiculi funicula!"
), \
end_string_chance = 3 \
)
return ..()

/atom/movable/screen/alert/status_effect/italian_speech
name = "Linguini Embrace"
desc = "You feel a sudden urge to gesticulate wildly."
icon_state = "food_italian"

/datum/status_effect/food/speech/french
alert_type = /atom/movable/screen/alert/status_effect/french_speech

/datum/status_effect/food/speech/french/on_apply()
AddComponent( \
/datum/component/speechmod, \
replacements = strings("french_replacement.json", "french"), \
end_string = list(
" Honh honh honh!",
" Honh!",
" Zut Alors!"
), \
end_string_chance = 3, \
)
return ..()

/atom/movable/screen/alert/status_effect/french_speech
name = "Café Chic"
desc = "Suddenly, everything seems worthy of a passionate debate."
icon_state = "food_french"
2 changes: 2 additions & 0 deletions code/game/objects/items/food/cake.dm
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@
foodtypes = GRAIN | SUGAR | DAIRY
slice_type = /obj/item/food/cakeslice/clown_slice
crafting_complexity = FOOD_COMPLEXITY_5
crafted_food_buff = /datum/status_effect/food/trait/waddle

/obj/item/food/cakeslice/clown_slice
name = "clown cake slice"
Expand All @@ -534,6 +535,7 @@
tastes = list("cake" = 1, "sugar" = 1, "joy" = 10)
foodtypes = GRAIN | SUGAR | DAIRY
crafting_complexity = FOOD_COMPLEXITY_5
crafted_food_buff = /datum/status_effect/food/trait/waddle

/obj/item/food/cake/trumpet
name = "spaceman's cake"
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items/food/egg.dm
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ GLOBAL_VAR_INIT(chicks_from_eggs, 0)
foodtypes = MEAT | BREAKFAST | DAIRY
venue_value = FOOD_PRICE_CHEAP
crafting_complexity = FOOD_COMPLEXITY_2
crafted_food_buff = /datum/status_effect/food/speech/french

/obj/item/food/omelette/attackby(obj/item/item, mob/user, params)
if(istype(item, /obj/item/kitchen/fork))
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items/food/mexican.dm
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@
w_class = WEIGHT_CLASS_SMALL
venue_value = FOOD_PRICE_LEGENDARY
crafting_complexity = FOOD_COMPLEXITY_5
crafted_food_buff = /datum/status_effect/food/trait/ashstorm_immune

/obj/item/food/chipsandsalsa
name = "chips and salsa"
Expand Down
14 changes: 14 additions & 0 deletions code/game/objects/items/food/pastries.dm
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,20 @@
tastes = list("cake" = 3, "blue cherry" = 1)
crafting_complexity = FOOD_COMPLEXITY_3

/obj/item/food/jupitercupcake
name = "jupiter-cup-cake"
desc = "A static dessert."
icon_state = "jupitercupcake"
food_reagents = list(
/datum/reagent/consumable/nutriment = 6,
/datum/reagent/consumable/nutriment/vitamin = 2,
/datum/reagent/consumable/caramel = 3,
/datum/reagent/consumable/liquidelectricity/enriched = 3,
)
tastes = list("cake" = 3, "caramel" = 2, "zap" = 1)
crafting_complexity = FOOD_COMPLEXITY_3
crafted_food_buff = /datum/status_effect/food/trait/shockimmune

/obj/item/food/honeybun
name = "honey bun"
desc = "A sticky pastry bun glazed with honey."
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items/food/pie.dm
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@
)
tastes = list("nothing" = 3)
foodtypes = GRAIN
crafted_food_buff = /datum/status_effect/food/trait/mute

/obj/item/food/pie/berrytart
name = "berry tart"
Expand Down
14 changes: 14 additions & 0 deletions code/game/objects/items/food/spaghetti.dm
Original file line number Diff line number Diff line change
Expand Up @@ -249,3 +249,17 @@
tastes = list("noodles" = 5, "fried tofu" = 4, "lime" = 2, "peanut" = 3, "onion" = 2)
foodtypes = GRAIN | VEGETABLES | NUTS | FRUIT
crafting_complexity = FOOD_COMPLEXITY_4

/obj/item/food/spaghetti/carbonara
name = "spaghetti carbonara"
desc = "Silky eggs, crispy pork, cheesy bliss. Mamma mia!"
icon_state = "carbonara"
food_reagents = list(
/datum/reagent/consumable/nutriment = 10,
/datum/reagent/consumable/nutriment/protein = 6,
/datum/reagent/consumable/nutriment/vitamin = 4,
)
tastes = list("spaghetti" = 1, "parmigiano reggiano" = 1, "guanciale" = 1)
foodtypes = GRAIN | MEAT | DAIRY
crafting_complexity = FOOD_COMPLEXITY_4
crafted_food_buff = /datum/status_effect/food/speech/italian
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
category = CAT_EGG

/datum/crafting_recipe/food/omelette
name = "Omelette"
name = "Omelette du fromage"
reqs = list(
/obj/item/food/egg = 2,
/obj/item/food/cheese/wedge = 2
Expand Down
10 changes: 10 additions & 0 deletions code/modules/food_and_drinks/recipes/tablecraft/recipes_pastry.dm
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,16 @@
result = /obj/item/food/cherrycupcake/blue
category = CAT_PASTRY

/datum/crafting_recipe/food/jupitercupcake
name = "Jupiter-cup-cake"
reqs = list(
/obj/item/food/pastrybase = 1,
/obj/item/food/grown/mushroom/jupitercup = 1,
/datum/reagent/consumable/caramel = 3,
)
result = /obj/item/food/jupitercupcake
category = CAT_PASTRY

/datum/crafting_recipe/food/honeybun
name = "Honey bun"
reqs = list(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,15 @@
)
result = /obj/item/food/spaghetti/pad_thai
category = CAT_SPAGHETTI

/datum/crafting_recipe/food/carbonara
name = "Spaghetti Carbonara"
reqs = list(
/obj/item/food/spaghetti/boiledspaghetti = 1,
/obj/item/food/cheese/firm_cheese_slice = 1,
/obj/item/food/meat/bacon = 1,
/obj/item/food/egg = 1,
/datum/reagent/consumable/blackpepper = 2,
)
result = /obj/item/food/spaghetti/carbonara
category = CAT_SPAGHETTI
Binary file modified icons/hud/screen_alert.dmi
Binary file not shown.
Binary file modified icons/obj/food/food.dmi
Binary file not shown.
Binary file modified icons/obj/food/spaghetti.dmi
Binary file not shown.
5 changes: 3 additions & 2 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1853,7 +1853,6 @@
#include "code\datums\status_effects\agent_pinpointer.dm"
#include "code\datums\status_effects\buffs.dm"
#include "code\datums\status_effects\drug_effects.dm"
#include "code\datums\status_effects\food_effects.dm"
#include "code\datums\status_effects\gas.dm"
#include "code\datums\status_effects\grouped_effect.dm"
#include "code\datums\status_effects\limited_effect.dm"
Expand All @@ -1868,9 +1867,11 @@
#include "code\datums\status_effects\buffs\bioware\cortex.dm"
#include "code\datums\status_effects\buffs\bioware\ligaments.dm"
#include "code\datums\status_effects\buffs\bioware\nerves.dm"
#include "code\datums\status_effects\buffs\food\_food_effect.dm"
#include "code\datums\status_effects\buffs\food\chilling.dm"
#include "code\datums\status_effects\buffs\food\food_traits.dm"
#include "code\datums\status_effects\buffs\food\grant_trait.dm"
#include "code\datums\status_effects\buffs\food\haste.dm"
#include "code\datums\status_effects\buffs\food\speech.dm"
#include "code\datums\status_effects\debuffs\blindness.dm"
#include "code\datums\status_effects\debuffs\choke.dm"
#include "code\datums\status_effects\debuffs\confusion.dm"
Expand Down
9 changes: 8 additions & 1 deletion tgui/packages/tgui/interfaces/PersonalCrafting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ type Recipe = {
structures: string[];
steps: string[];
foodtypes: string[];
has_food_effect: BooleanLike;
};

type Diet = {
Expand Down Expand Up @@ -792,10 +793,16 @@ const RecipeContent = ({ item, craftable, busy, mode, diet }) => {
<Stack.Item grow>
<Stack>
<Stack.Item grow={5}>
<Box mb={0.5} bold style={{ textTransform: 'capitalize' }}>
<Box mb={1} bold style={{ textTransform: 'capitalize' }}>
{item.name}
</Box>
{item.desc && <Box color={'gray'}>{item.desc}</Box>}
{!!item.has_food_effect && (
<Box my={2} color={'pink'}>
<Icon name="wand-magic-sparkles" mr={1} />
Special effect on consumption.
</Box>
)}
<Box style={{ textTransform: 'capitalize' }}>
{item.reqs && (
<Box>
Expand Down

0 comments on commit 6fbc9a2

Please sign in to comment.