De-hardcode chemical metabolism of StomachComponent (#437)
* Move chemical reaction effects into Chemistry/ReactionEffects/ subfolder * Replace hardcoded StomachComponent metabolism with IMetabolizable The benefits of this approach are that reagent metabolism effects are not hardcoded into StomachComponent, and metabolism effects can be more easily chained together in yaml prototypes, and reagents can have different metabolism rates. One problem with this approach is that getting metabolism rates slower than 1u / second is impossible. Implementing #377 should resolve that problem. * Fix DefaultFood and DefaultDrink so they remove reagent regardless of Hunger/ThirstComponent presence Previously if neither of those were present the reagents wouldn't be removed from the stomach. This fixes that. * Additional comment on function * Make metabolizer interface implementations explicit Also removed some unused using statements * Make StomachComponent._reagentDeltas readonly * Fix misleading variable names and docs for metabolizables Changes one of the arguments for `IMetabolizable.Metabolize()` to be called `tickTime` instead of `frameTime` to more accurately reflect it's purpose. It's not really the frametime, but the time since the last metabolism tick. Also updated and expanded the docs to reflect this and to be more clear.
This commit is contained in:
committed by
Pieter-Jan Briers
parent
1f177a044d
commit
3ab8036363
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using Content.Server.GameObjects.Components.Chemistry;
|
||||
using Content.Server.GameObjects.Components.Sound;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
@@ -44,9 +44,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
||||
serializer.DataField(ref _initialContents, "contents", null);
|
||||
serializer.DataField(ref _useSound, "use_sound", "/Audio/items/eatfood.ogg");
|
||||
// Default is transfer 30 units
|
||||
serializer.DataField(ref _transferAmount,
|
||||
"transfer_amount",
|
||||
30 / StomachComponent.NutrimentFactor);
|
||||
serializer.DataField(ref _transferAmount, "transfer_amount", 5);
|
||||
// E.g. empty chip packet when done
|
||||
serializer.DataField(ref _finishPrototype, "spawn_on_finish", null);
|
||||
}
|
||||
@@ -81,8 +79,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
||||
_initialContents = null;
|
||||
if (_contents.CurrentVolume == 0)
|
||||
{
|
||||
_contents.TryAddReagent("chem.Nutriment", 30 / StomachComponent.NutrimentFactor,
|
||||
out _);
|
||||
_contents.TryAddReagent("chem.Nutriment", 5, out _);
|
||||
}
|
||||
Owner.TryGetComponent(out AppearanceComponent appearance);
|
||||
_appearanceComponent = appearance;
|
||||
|
||||
Reference in New Issue
Block a user