Skip to content

Commit

Permalink
New Trait: Voracious (#668)
Browse files Browse the repository at this point in the history
# Description

**Voracious** is a 1-point Physical trait that makes you eat and drink
twice as fast.

Inspired by the SS13 trait of the same name. Roughly based on the
Parkstation implementation of Voracious by @DEATHB4DEFEAT.

## Technical Details

The new component `ConsumeDelayModifierComponent` is rather generic, and
can decrease or _increase_ the consumption speed of food and/or drinks.
This gives room to add a negative trait that includes slower
eating/drinking.

## Media


![image](https://github.com/user-attachments/assets/f8475b2a-de0b-4cae-83c6-8a280139bfd8)

# Changelog

:cl: Skubman
add: Add the Voracious trait, a 1-point trait that makes you eat and
drink twice as fast.
  • Loading branch information
angelofallars committed Aug 4, 2024
1 parent 1c26a10 commit 23fc467
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 2 deletions.
7 changes: 6 additions & 1 deletion Content.Server/Nutrition/EntitySystems/DrinkSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Content.Server.Inventory;
using Content.Server.Nutrition.Components;
using Content.Server.Popups;
using Content.Server.Traits.Assorted.Components;
using Content.Shared.Administration.Logs;
using Content.Shared.Body.Components;
using Content.Shared.CCVar;
Expand Down Expand Up @@ -279,9 +280,13 @@ private bool TryDrink(EntityUid user, EntityUid target, DrinkComponent drink, En

var flavors = _flavorProfile.GetLocalizedFlavorsMessage(user, drinkSolution);

var drinkDelay = drink.Delay;
if (TryComp<ConsumeDelayModifierComponent>(target, out var delayModifier))
drinkDelay *= delayModifier.DrinkDelayMultiplier;

var doAfterEventArgs = new DoAfterArgs(EntityManager,
user,
forceDrink ? drink.ForceFeedDelay : drink.Delay,
forceDrink ? drink.ForceFeedDelay : drinkDelay,
new ConsumeDoAfterEvent(drink.Solution, flavors),
eventTarget: item,
target: target,
Expand Down
7 changes: 6 additions & 1 deletion Content.Server/Nutrition/EntitySystems/FoodSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Content.Shared.Nutrition.Components;
using Content.Server.Popups;
using Content.Server.Stack;
using Content.Server.Traits.Assorted.Components;
using Content.Shared.Administration.Logs;
using Content.Shared.Body.Components;
using Content.Shared.Body.Organ;
Expand Down Expand Up @@ -176,9 +177,13 @@ private void OnFeedFood(Entity<FoodComponent> entity, ref AfterInteractEvent arg
_adminLogger.Add(LogType.Ingestion, LogImpact.Low, $"{ToPrettyString(target):target} is eating {ToPrettyString(food):food} {SolutionContainerSystem.ToPrettyString(foodSolution)}");
}

var foodDelay = foodComp.Delay;
if (TryComp<ConsumeDelayModifierComponent>(target, out var delayModifier))
foodDelay *= delayModifier.FoodDelayMultiplier;

var doAfterArgs = new DoAfterArgs(EntityManager,
user,
forceFeed ? foodComp.ForceFeedDelay : foodComp.Delay,
forceFeed ? foodComp.ForceFeedDelay : foodDelay,
new ConsumeDoAfterEvent(foodComp.Solution, flavors),
eventTarget: food,
target: target,
Expand Down
22 changes: 22 additions & 0 deletions Content.Server/Traits/Assorted/ConsumeDelayModifierComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Robust.Shared.GameStates;

namespace Content.Server.Traits.Assorted.Components;

/// <summary>
/// This is used for any trait that modifies how fast an entity consumes food and drinks.
/// </summary>
[RegisterComponent]
public sealed partial class ConsumeDelayModifierComponent : Component
{
/// <summary>
/// What to multiply the eating delay by.
/// </summary>
[DataField]
public float FoodDelayMultiplier { get; set; } = 1f;

/// <summary>
/// What to multiply the drinking delay by.
/// </summary>
[DataField]
public float DrinkDelayMultiplier { get; set; } = 1f;
}
5 changes: 5 additions & 0 deletions Resources/Locale/en-US/traits/traits.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,8 @@ trait-name-Foreigner = Foreigner
trait-description-Foreigner =
For one reason or another you do not speak this station's primary language.
Instead, you have a translator issued to you that only you can use.
trait-name-Voracious = Voracious
trait-description-Voracious =
Nothing gets between you and your food.
Your endless consumption of food and drinks is twice as fast.
9 changes: 9 additions & 0 deletions Resources/Prototypes/Traits/skills.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,12 @@
inverted: true
species:
- Felinid

- type: trait
id: Voracious
category: Physical
points: -1
components:
- type: ConsumeDelayModifier
foodDelayMultiplier: 0.5
drinkDelayMultiplier: 0.5

0 comments on commit 23fc467

Please sign in to comment.