Rework Drink/Food/FoodContainer entirely (#1009)

Co-authored-by: FL-OZ <anotherscuffed@gmail.com>
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
This commit is contained in:
FL-OZ
2020-05-29 15:50:23 -05:00
committed by GitHub
parent 7222b6d8e2
commit aa26bdfcae
107 changed files with 946 additions and 1099 deletions

View File

@@ -123,7 +123,7 @@ namespace Content.Client
"Species",
"Drink",
"Food",
"DrinkFoodContainer",
"FoodContainer",
"Stomach",
"Hunger",
"Thirst",

View File

@@ -11,11 +11,11 @@ using YamlDotNet.RepresentationModel;
namespace Content.Client.GameObjects.Components.Nutrition
{
[UsedImplicitly]
public sealed class DrinkFoodContainerVisualizer2D : AppearanceVisualizer
public sealed class FoodContainerVisualizer2D : AppearanceVisualizer
{
private string _baseState;
private int _steps;
private DrinkFoodContainerVisualMode _mode;
private FoodContainerVisualMode _mode;
public override void LoadData(YamlMappingNode node)
{
@@ -25,11 +25,11 @@ namespace Content.Client.GameObjects.Components.Nutrition
_steps = node.GetNode("steps").AsInt();
try
{
_mode = node.GetNode("mode").AsEnum<DrinkFoodContainerVisualMode>();
_mode = node.GetNode("mode").AsEnum<FoodContainerVisualMode>();
}
catch (KeyNotFoundException)
{
_mode = DrinkFoodContainerVisualMode.Rounded;
_mode = FoodContainerVisualMode.Rounded;
}
}
@@ -37,12 +37,12 @@ namespace Content.Client.GameObjects.Components.Nutrition
{
var sprite = component.Owner.GetComponent<ISpriteComponent>();
if (!component.TryGetData<int>(DrinkFoodContainerVisuals.Current, out var current))
if (!component.TryGetData<int>(FoodContainerVisuals.Current, out var current))
{
return;
}
if (!component.TryGetData<int>(DrinkFoodContainerVisuals.Capacity, out var capacity))
if (!component.TryGetData<int>(FoodContainerVisuals.Capacity, out var capacity))
{
return;
}
@@ -51,10 +51,10 @@ namespace Content.Client.GameObjects.Components.Nutrition
switch (_mode)
{
case DrinkFoodContainerVisualMode.Discrete:
case FoodContainerVisualMode.Discrete:
step = Math.Min(_steps - 1, current);
break;
case DrinkFoodContainerVisualMode.Rounded:
case FoodContainerVisualMode.Rounded:
step = ContentHelpers.RoundToLevels(current, capacity, _steps);
break;
default:

View File

@@ -241,7 +241,13 @@ namespace Content.Server.GameObjects.Components.Kitchen
return true;
}
itemEntity.TryGetComponent(typeof(ItemComponent), out var food);
if (!itemEntity.TryGetComponent(typeof(ItemComponent), out var food))
{
_notifyManager.PopupMessage(Owner, eventArgs.User, "That won't work!");
return false;
}
var ent = food.Owner; //Get the entity of the ItemComponent.
_storage.Insert(ent);
_uiDirty = true;

View File

@@ -1,148 +1,163 @@
using System;
using System.Linq;
using System;
using Content.Server.GameObjects.Components.Chemistry;
using Content.Server.GameObjects.Components.Sound;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Utility;
using Content.Shared.Audio;
using Content.Shared.Chemistry;
using Content.Shared.GameObjects.Components.Nutrition;
using Content.Shared.Interfaces;
using Content.Shared.Maths;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Nutrition
{
[RegisterComponent]
public class DrinkComponent : Component, IAfterInteract, IUse
[ComponentReference(typeof(IAfterInteract))]
public class DrinkComponent : Component, IUse, IAfterInteract, ISolutionChange,IExamine
{
#pragma warning disable 649
[Dependency] private readonly ILocalizationManager _localizationManager;
[Dependency] private readonly IPrototypeManager _prototypeManager;
[Dependency] private readonly IRobustRandom _random;
[Dependency] private readonly IEntitySystemManager _entitySystem;
#pragma warning restore 649
private AudioSystem _audioSystem;
public override string Name => "Drink";
[ViewVariables]
private SolutionComponent _contents;
private AppearanceComponent _appearanceComponent;
[ViewVariables]
private string _useSound;
[ViewVariables]
private string _finishPrototype;
public ReagentUnit TransferAmount => _transferAmount;
private bool _defaultToOpened;
[ViewVariables]
private ReagentUnit _transferAmount = ReagentUnit.New(2);
public ReagentUnit TransferAmount { get; private set; } = ReagentUnit.New(2);
public ReagentUnit MaxVolume
{
get => _contents.MaxVolume;
set => _contents.MaxVolume = value;
}
[ViewVariables]
public bool Opened => _opened;
private bool _despawnOnFinish;
private bool _drinking;
public int UsesLeft()
{
// In case transfer amount exceeds volume left
if (_contents.CurrentVolume == 0)
{
return 0;
}
return Math.Max(1, (int)Math.Ceiling((_contents.CurrentVolume / _transferAmount).Float()));
}
[ViewVariables]
public bool Empty => _contents.CurrentVolume.Float() <= 0;
private AppearanceComponent _appearanceComponent;
private bool _opened = false;
private string _soundCollection;
public override void ExposeData(ObjectSerializer serializer)
{
base.ExposeData(serializer);
serializer.DataField(ref _useSound, "use_sound", "/Audio/items/drink.ogg");
// E.g. cola can when done or clear bottle, whatever
// Currently this will enforce it has the same volume but this may change. - TODO: this should be implemented in a separate component
serializer.DataField(ref _despawnOnFinish, "despawn_empty", false);
serializer.DataField(ref _finishPrototype, "spawn_on_finish", null);
serializer.DataField(ref _useSound, "useSound", "/Audio/items/drink.ogg");
serializer.DataField(ref _defaultToOpened, "isOpen", false); //For things like cups of coffee.
serializer.DataField(ref _soundCollection, "openSounds","canOpenSounds");
}
protected override void Startup()
public override void Initialize()
{
base.Startup();
_contents = Owner.GetComponent<SolutionComponent>();
base.Initialize();
Owner.TryGetComponent(out _appearanceComponent);
if(!Owner.TryGetComponent(out _contents))
{
_contents = Owner.AddComponent<SolutionComponent>();
}
_contents.Capabilities = SolutionCaps.PourIn
| SolutionCaps.PourOut
| SolutionCaps.Injectable;
_drinking = false;
Owner.TryGetComponent(out AppearanceComponent appearance);
_appearanceComponent = appearance;
_appearanceComponent?.SetData(SharedFoodComponent.FoodVisuals.MaxUses, MaxVolume.Float());
_updateAppearance();
_opened = _defaultToOpened;
UpdateAppearance();
}
private void _updateAppearance()
void ISolutionChange.SolutionChanged(SolutionChangeEventArgs eventArgs)
{
UpdateAppearance();
}
private void UpdateAppearance()
{
_appearanceComponent?.SetData(SharedFoodComponent.FoodVisuals.Visual, _contents.CurrentVolume.Float());
}
bool IUse.UseEntity(UseEntityEventArgs eventArgs)
bool IUse.UseEntity(UseEntityEventArgs args)
{
UseDrink(eventArgs.User);
return true;
if (!_opened)
{
//Do the opening stuff like playing the sounds.
var soundCollection = _prototypeManager.Index<SoundCollectionPrototype>(_soundCollection);
var file = _random.Pick(soundCollection.PickFiles);
_audioSystem = _entitySystem.GetEntitySystem<AudioSystem>();
_audioSystem.Play(file, Owner, AudioParams.Default);
_opened = true;
return false;
}
return TryUseDrink(args.User);
}
//Force feeding a drink to someone.
void IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
{
if (!InteractionChecks.InRangeUnobstructed(eventArgs)) return;
UseDrink(eventArgs.Target);
TryUseDrink(eventArgs.Target);
}
private void UseDrink(IEntity targetEntity)
public void Examine(FormattedMessage message)
{
if (targetEntity == null)
if (!Opened)
{
return;
}
var color = Empty ? "gray" : "yellow";
var openedText = Loc.GetString(Empty ? "Empty" : "Opened");
message.AddMarkup(Loc.GetString("[color={0}]{1}[/color]", color, openedText));
if (UsesLeft() == 0 && !_despawnOnFinish)
}
private bool TryUseDrink(IEntity target)
{
if (target == null)
{
targetEntity.PopupMessage(targetEntity, _localizationManager.GetString("Empty"));
return;
return false;
}
if (targetEntity.TryGetComponent(out StomachComponent stomachComponent))
if (!_opened)
{
_drinking = true;
var transferAmount = ReagentUnit.Min(_transferAmount, _contents.CurrentVolume);
var split = _contents.SplitSolution(transferAmount);
if (stomachComponent.TryTransferSolution(split))
{
// When we split Finish gets called which may delete the can so need to use the entity system for sound
if (_useSound != null)
{
var audioSystem = EntitySystem.Get<AudioSystem>();
audioSystem.Play(_useSound, Owner, AudioParams.Default.WithVolume(-2f));
targetEntity.PopupMessage(targetEntity, _localizationManager.GetString("Slurp"));
}
}
else
{
// Add it back in
_contents.TryAddSolution(split);
targetEntity.PopupMessage(targetEntity, _localizationManager.GetString("Can't drink"));
}
_drinking = false;
target.PopupMessage(target, Loc.GetString("Open it first!"));
}
if (_contents.CurrentVolume.Float() <= 0)
{
target.PopupMessage(target, Loc.GetString("It's empty!"));
return false;
}
if (!target.TryGetComponent(out StomachComponent stomachComponent))
{
return false;
}
var transferAmount = ReagentUnit.Min(TransferAmount, _contents.CurrentVolume);
var split = _contents.SplitSolution(transferAmount);
if (stomachComponent.TryTransferSolution(split))
{
if (_useSound == null) return false;
_audioSystem.Play(_useSound, Owner, AudioParams.Default.WithVolume(-2f));
target.PopupMessage(target, Loc.GetString("Slurp"));
UpdateAppearance();
return true;
}
//Stomach was full or can't handle whatever solution we have.
_contents.TryAddSolution(split);
target.PopupMessage(target, Loc.GetString("You've had enough {0}!", Owner.Name));
return false;
}
}
}

View File

@@ -1,191 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.Components.Sound;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Components.Nutrition;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.Components.Container;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.IoC;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Nutrition
{
[RegisterComponent]
public sealed class DrinkFoodContainerComponent : SharedDrinkFoodContainerComponent, IMapInit, IUse
{
public override string Name => "DrinkFoodContainer";
private string _useSound;
private Container _foodContainer;
// Optimisation scabbed from BallisticMagazineComponent to avoid loading entities until needed
[ViewVariables] private readonly Stack<IEntity> _loadedFood = new Stack<IEntity>();
private AppearanceComponent _appearanceComponent;
[ViewVariables] public int Count => _availableSpawnCount + _loadedFood.Count;
private int _availableSpawnCount;
private Dictionary<string, int> _prototypes;
private string _finishPrototype;
public int Capacity => _capacity;
private int _capacity;
public override void ExposeData(ObjectSerializer serializer)
{
base.ExposeData(serializer);
serializer.DataField(ref _useSound, "use_sound", null);
// Is a dictionary for stuff with probabilities (mainly donut box)
serializer.DataField(ref _prototypes, "prototypes", null);
// If you want the final item to be different e.g. trash
serializer.DataField(ref _finishPrototype, "spawn_on_finish", null);
serializer.DataField(ref _availableSpawnCount, "available_spawn_count", 0);
serializer.DataField(ref _capacity, "capacity", 5);
}
public override void Initialize()
{
base.Initialize();
Owner.TryGetComponent(out AppearanceComponent appearance);
_appearanceComponent = appearance;
if (_prototypes == null)
{
throw new NullReferenceException();
}
if (_prototypes.Sum(x => x.Value) != 100)
{
throw new ArgumentOutOfRangeException();
}
}
public void MapInit()
{
_availableSpawnCount = Capacity;
}
protected override void Startup()
{
base.Startup();
_foodContainer =
ContainerManagerComponent.Ensure<Container>("food_container", Owner, out var existed);
if (existed)
{
foreach (var entity in _foodContainer.ContainedEntities)
{
_loadedFood.Push(entity);
}
}
_updateAppearance();
_appearanceComponent?.SetData(DrinkFoodContainerVisuals.Capacity, Capacity);
}
bool IUse.UseEntity(UseEntityEventArgs eventArgs)
{
// TODO: Potentially change this depending upon desired functionality
IEntity item = TakeItem(eventArgs.User);
if (item == null)
{
return false;
}
if (item.TryGetComponent(out ItemComponent itemComponent) &&
eventArgs.User.TryGetComponent(out HandsComponent handsComponent))
{
if (handsComponent.CanPutInHand(itemComponent))
{
handsComponent.PutInHand(itemComponent);
return true;
}
}
item.Transform.GridPosition = eventArgs.User.Transform.GridPosition;
return true;
}
// TODO: Somewhat shitcode
// Tried using .Prob() buuuuuttt trying that for each item wouldn't work.
private string _getProbItem(Dictionary<string, int> prototypes)
{
if (prototypes.Count == 1)
{
return prototypes.Keys.ToList()[0];
}
var prob = IoCManager.Resolve<IRobustRandom>();
var result = prob.Next(0, 100);
var runningTotal = 0;
foreach (var item in prototypes)
{
runningTotal += item.Value;
if (result < runningTotal)
{
return item.Key;
}
}
throw new Exception();
}
public IEntity TakeItem(IEntity user)
{
if (_useSound != null)
{
if (Owner.TryGetComponent(out SoundComponent soundComponent) && _useSound != null)
{
soundComponent.Play(_useSound);
}
}
IEntity item = null;
if (_loadedFood.Count > 0)
{
item = _loadedFood.Pop();
_foodContainer.Remove(item);
}
if (_availableSpawnCount > 0)
{
var prototypeName = _getProbItem(_prototypes);
item = Owner.EntityManager.SpawnEntity(prototypeName, Owner.Transform.GridPosition);
_availableSpawnCount -= 1;
}
_tryDelete(user);
_updateAppearance();
return item;
}
private void _tryDelete(IEntity user)
{
if (Count <= 0)
{
// Ideally this takes priority to be put into inventory rather than the desired item
if (_finishPrototype != null)
{
var item = Owner.EntityManager.SpawnEntity(_finishPrototype, Owner.Transform.GridPosition);
item.Transform.GridPosition = Owner.Transform.GridPosition;
Owner.Delete();
if (user.TryGetComponent(out HandsComponent handsComponent) &&
item.TryGetComponent(out ItemComponent itemComponent))
{
if (handsComponent.CanPutInHand(itemComponent))
{
handsComponent.PutInHand(itemComponent);
}
}
return;
}
Owner.Delete();
}
}
private void _updateAppearance()
{
_appearanceComponent?.SetData(DrinkFoodContainerVisuals.Current, Count);
}
}
}

View File

@@ -1,12 +1,11 @@
using System;
using System;
using Content.Server.GameObjects.Components.Chemistry;
using Content.Server.GameObjects.Components.Sound;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Utility;
using Content.Shared.Chemistry;
using Content.Shared.GameObjects.Components.Nutrition;
using Content.Shared.Interfaces;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
@@ -17,165 +16,105 @@ using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Nutrition
{
[RegisterComponent]
public class FoodComponent : Component, IAfterInteract, IUse
[ComponentReference(typeof(IAfterInteract))]
public class FoodComponent : Component, IUse, IAfterInteract
{
#pragma warning disable 649
[Dependency] private readonly ILocalizationManager _localizationManager;
[Dependency] private readonly IEntitySystemManager _entitySystem;
#pragma warning restore 649
// Currently the design is similar to drinkcomponent but it's susceptible to change so left as is for now.
public override string Name => "Food";
private AppearanceComponent _appearanceComponent;
[ViewVariables]
private string _useSound;
[ViewVariables]
private string _finishPrototype;
private string _trashPrototype;
[ViewVariables]
private SolutionComponent _contents;
[ViewVariables]
private ReagentUnit _transferAmount;
private Solution _initialContents; // This is just for loading from yaml
public int UsesRemaining => _contents.CurrentVolume == 0
?
0 : Math.Max(1, (int)Math.Ceiling((_contents.CurrentVolume / _transferAmount).Float()));
public override void ExposeData(ObjectSerializer serializer)
{
base.ExposeData(serializer);
// Default is 1 use restoring 30
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", ReagentUnit.New(5));
// E.g. empty chip packet when done
serializer.DataField(ref _finishPrototype, "spawn_on_finish", null);
serializer.DataField(ref _useSound, "useSound", "/Audio/items/eatfood.ogg");
serializer.DataField(ref _transferAmount, "transferAmount", ReagentUnit.New(5));
serializer.DataField(ref _trashPrototype, "trash", "TrashPlate");
}
public override void Initialize()
{
base.Initialize();
if (_contents == null)
{
if (Owner.TryGetComponent(out SolutionComponent solutionComponent))
{
_contents = solutionComponent;
}
else
{
_contents = Owner.AddComponent<SolutionComponent>();
}
}
_contents = Owner.GetComponent<SolutionComponent>();
_contents.MaxVolume = _initialContents.TotalVolume;
}
protected override void Startup()
{
base.Startup();
if (_initialContents != null)
{
_contents.TryAddSolution(_initialContents, true, true);
}
_initialContents = null;
if (_contents.CurrentVolume == 0)
{
_contents.TryAddReagent("chem.Nutriment", ReagentUnit.New(5), out _);
}
Owner.TryGetComponent(out AppearanceComponent appearance);
_appearanceComponent = appearance;
// UsesLeft() at the start should match the max, at least currently.
_appearanceComponent?.SetData(SharedFoodComponent.FoodVisuals.MaxUses, UsesLeft());
_updateAppearance();
}
private void _updateAppearance()
{
_appearanceComponent?.SetData(SharedFoodComponent.FoodVisuals.Visual, UsesLeft());
}
public int UsesLeft()
{
// In case transfer amount exceeds volume left
if (_contents.CurrentVolume == 0)
{
return 0;
}
return Math.Max(1, (int)Math.Ceiling((_contents.CurrentVolume / _transferAmount).Float()));
}
bool IUse.UseEntity(UseEntityEventArgs eventArgs)
{
UseFood(eventArgs.User);
return true;
return TryUseFood(eventArgs.User, null);
}
void IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
{
if (!InteractionChecks.InRangeUnobstructed(eventArgs)) return;
UseFood(eventArgs.Target);
TryUseFood(eventArgs.User, eventArgs.Target);
}
void UseFood(IEntity user)
private bool TryUseFood(IEntity user, IEntity target)
{
if (user == null)
{
return;
return false;
}
if (UsesLeft() == 0)
if (UsesRemaining <= 0)
{
user.PopupMessage(user, _localizationManager.GetString("Empty"));
user.PopupMessage(user, Loc.GetString($"The {Owner.Name} is empty!"));
return false;
}
else
var trueTarget = target ?? user;
if (trueTarget.TryGetComponent(out StomachComponent stomachComponent))
{
// TODO: Add putting food back in boxes here?
if (user.TryGetComponent(out StomachComponent stomachComponent))
var transferAmount = ReagentUnit.Min(_transferAmount, _contents.CurrentVolume);
var split = _contents.SplitSolution(transferAmount);
if (stomachComponent.TryTransferSolution(split))
{
var transferAmount = ReagentUnit.Min(_transferAmount, _contents.CurrentVolume);
var split = _contents.SplitSolution(transferAmount);
if (stomachComponent.TryTransferSolution(split))
{
if (_useSound != null)
{
Owner.GetComponent<SoundComponent>()?.Play(_useSound);
user.PopupMessage(user, _localizationManager.GetString("Nom"));
}
}
else
{
// Add it back in
_contents.TryAddSolution(split);
user.PopupMessage(user, _localizationManager.GetString("Can't eat"));
}
_entitySystem.GetEntitySystem<AudioSystem>()
.Play(_useSound, trueTarget, AudioParams.Default.WithVolume(-1f));
trueTarget.PopupMessage(user, Loc.GetString("Nom"));
}
else
{
_contents.TryAddSolution(split);
trueTarget.PopupMessage(user, Loc.GetString("You can't eat any more!"));
}
}
if (UsesLeft() > 0)
if (UsesRemaining > 0)
{
return;
return true;
}
//We're empty. Become trash.
var position = Owner.Transform.GridPosition;
Owner.Delete();
if (_finishPrototype != null)
var finisher = Owner.EntityManager.SpawnEntity(_trashPrototype, position);
if (user.TryGetComponent(out HandsComponent handsComponent) && finisher.TryGetComponent(out ItemComponent itemComponent))
{
var finisher = Owner.EntityManager.SpawnEntity(_finishPrototype, position);
if (user.TryGetComponent(out HandsComponent handsComponent) && finisher.TryGetComponent(out ItemComponent itemComponent))
if (handsComponent.CanPutInHand(itemComponent))
{
if (handsComponent.CanPutInHand(itemComponent))
{
handsComponent.PutInHand(itemComponent);
return;
}
handsComponent.PutInHand(itemComponent);
return true;
}
finisher.Transform.GridPosition = user.Transform.GridPosition;
return;
}
finisher.Transform.GridPosition = user.Transform.GridPosition;
return true;
}
}
}

View File

@@ -0,0 +1,99 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Components.Nutrition;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.IoC;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Nutrition
{
/// <summary>
/// This container acts as a master object for things like Pizza, which holds slices.
/// </summary>
/// TODO: Perhaps implement putting food back (pizza boxes) but that really isn't mandatory.
/// This doesn't even need to have an actual Container for right now.
[RegisterComponent]
public sealed class FoodContainer : SharedFoodContainerComponent, IUse
{
#pragma warning disable 649
[Dependency] private readonly IRobustRandom _random;
[Dependency] private readonly IEntityManager _entityManager;
#pragma warning restore 649
public override string Name => "FoodContainer";
private AppearanceComponent _appearance;
private Dictionary<string, int> _prototypes;
private uint _capacity;
public int Capacity => (int)_capacity;
[ViewVariables]
public int Count => _count;
private int _count = 0;
public override void ExposeData(ObjectSerializer serializer)
{
base.ExposeData(serializer);
serializer.DataField(ref _prototypes, "prototypes", null);
serializer.DataField<uint>(ref _capacity, "capacity", 5);
}
public override void Initialize()
{
base.Initialize();
Owner.TryGetComponent(out _appearance);
_count = Capacity;
UpdateAppearance();
}
bool IUse.UseEntity(UseEntityEventArgs eventArgs)
{
var hands = eventArgs.User.TryGetComponent(out HandsComponent handsComponent);
var itemToSpawn = _entityManager.SpawnEntity(GetRandomPrototype(), Owner.Transform.GridPosition);
handsComponent.PutInHandOrDrop(itemToSpawn.GetComponent<ItemComponent>());
_count--;
if (_count < 1)
{
Owner.Delete();
return false;
}
return true;
}
private string GetRandomPrototype()
{
var defaultProto = _prototypes.Keys.FirstOrDefault();
if (_prototypes.Count == 1)
{
return defaultProto;
}
var probResult = _random.Next(0, 100);
var total = 0;
foreach (var item in _prototypes)
{
total += item.Value;
if (probResult < total)
{
return item.Key;
}
}
return defaultProto;
}
private void UpdateAppearance()
{
_appearance?.SetData(FoodContainerVisuals.Current, Count);
}
}
}

View File

@@ -4,12 +4,12 @@ using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Nutrition
{
public abstract class SharedDrinkFoodContainerComponent : Component
public abstract class SharedFoodContainerComponent : Component
{
}
[NetSerializable, Serializable]
public enum DrinkFoodContainerVisualMode
public enum FoodContainerVisualMode
{
/// <summary>
/// Discrete: 50 eggs in a carton -> down to 25, will show 12/12 until it gets below max
@@ -20,7 +20,7 @@ namespace Content.Shared.GameObjects.Components.Nutrition
}
[NetSerializable, Serializable]
public enum DrinkFoodContainerVisuals
public enum FoodContainerVisuals
{
Capacity,
Current,

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -11,7 +11,6 @@
- type: Pourable
transferAmount: 5
- type: Drink
despawn_empty: false
- type: Sound
- type: Sprite
state: icon
@@ -33,7 +32,6 @@
maxVol: 50
caps: 16
- type: Drink
despawn_empty: false
- type: Pourable
transferAmount: 5
- type: TransformableContainer
@@ -769,6 +767,11 @@
description: Sweetened drink with a grape flavor and a deep purple color.
components:
- type: Drink
- type: Solution
contents:
reagents:
- ReagentId: chem.Cola
Quantity: 20
- type: Sprite
sprite: Objects/Drinks/grapesoda.rsi
- type: Icon

View File

@@ -1,5 +1,18 @@
- type: entity
parent: DrinkBase
parent: BaseItem
id: DrinkBottleBaseFull
abstract: true
components:
- type: Drink
openSounds: bottleOpenSounds
- type: Solution
- type: Sprite
state: icon
- type: Icon
state: icon
- type: entity
parent: DrinkBottleBaseFull
id: DrinkAbsintheBottleFull
name: Jailbreaker Verte
description: One sip of this and you just know you're gonna have a good time.
@@ -11,7 +24,7 @@
sprite: Objects/Drinks/absinthebottle.rsi
- type: entity
parent: DrinkBase
parent: DrinkBottleBaseFull
id: DrinkAlcoGreenFull
name: Emeraldine Melon Liquor
description: A bottle of 46 proof Emeraldine Melon Liquor. Sweet and light.
@@ -23,7 +36,7 @@
sprite: Objects/Drinks/alco-green.rsi
- type: entity
parent: DrinkBase
parent: DrinkBottleBaseFull
id: DrinkAleBottleFull
name: Magm-Ale
description: A true dorf's drink of choice.
@@ -40,7 +53,7 @@
sprite: Objects/Drinks/alebottle.rsi
- type: entity
parent: DrinkBase
parent: DrinkBottleBaseFull
id: DrinkBottleOfNothingFull
name: Bottle of nothing
description: A bottle filled with nothing
@@ -52,7 +65,7 @@
sprite: Objects/Drinks/bottleofnothing.rsi
- type: entity
parent: DrinkBase
parent: DrinkBottleBaseFull
id: DrinkCognacBottleFull
name: Cognac bottle
description: A sweet and strongly alchoholic drink, made after numerous distillations and years of maturing. You might as well not scream 'SHITCURITY' this time.
@@ -69,7 +82,7 @@
sprite: Objects/Drinks/cognacbottle.rsi
- type: entity
parent: DrinkBase
parent: DrinkBottleBaseFull
id: DrinkGinBottleFull
name: Griffeater gin bottle
description: A bottle of high quality gin, produced in the New London Space Station.
@@ -81,7 +94,7 @@
sprite: Objects/Drinks/ginbottle.rsi
- type: entity
parent: DrinkBase
parent: DrinkBottleBaseFull
id: DrinkGoldschlagerBottleFull
name: Goldschlager bottle
description: 100 proof cinnamon schnapps, made for alcoholic teen girls on spring break.
@@ -93,7 +106,7 @@
sprite: Objects/Drinks/goldschlagerbottle.rsi
- type: entity
parent: DrinkBase
parent: DrinkBottleBaseFull
id: DrinkKahluaBottleFull
name: Kahlua bottle
description: A widely known, Mexican coffee-flavoured liqueur. In production since 1936, HONK
@@ -110,7 +123,7 @@
sprite: Objects/Drinks/kahluabottle.rsi
- type: entity
parent: DrinkBase
parent: DrinkBottleBaseFull
id: DrinkPatronBottleFull
name: Wrapp artiste patron bottle
description: Silver laced tequilla, served in space night clubs across the galaxy.
@@ -122,7 +135,7 @@
sprite: Objects/Drinks/patronbottle.rsi
- type: entity
parent: DrinkBase
parent: DrinkBottleBaseFull
id: DrinkPoisonWinebottleFull
name: Warlock's velvet bottle
description: What a delightful packaging for a surely high quality wine! The vintage must be amazing!
@@ -134,7 +147,7 @@
sprite: Objects/Drinks/pwinebottle.rsi
- type: entity
parent: DrinkBase
parent: DrinkBottleBaseFull
id: DrinkRumbottleFull
name: Captain Pete's cuban spiced rum
description: This isn't just rum, oh no. It's practically GRIFF in a bottle.
@@ -146,7 +159,7 @@
sprite: Objects/Drinks/rumbottle.rsi
- type: entity
parent: DrinkBase
parent: DrinkBottleBaseFull
id: DrinkTequilabottleFull
name: Caccavo guaranteed quality tequila bottle
description: Made from premium petroleum distillates, pure thalidomide and other fine quality ingredients!
@@ -158,7 +171,7 @@
sprite: Objects/Drinks/tequillabottle.rsi
- type: entity
parent: DrinkBase
parent: DrinkBottleBaseFull
id: DrinkVermouthBottleFull
name: Goldeneye vermouth bottle
description: Sweet, sweet dryness~
@@ -170,7 +183,7 @@
sprite: Objects/Drinks/vermouthbottle.rsi
- type: entity
parent: DrinkBase
parent: DrinkBottleBaseFull
id: DrinkVodkaBottleFull
name: Vodka bottle
description: Aah, vodka. Prime choice of drink AND fuel by Russians worldwide.
@@ -187,7 +200,7 @@
sprite: Objects/Drinks/vodkabottle.rsi
- type: entity
parent: DrinkBase
parent: DrinkBottleBaseFull
id: DrinkWhiskeyBottleFull
name: Uncle Git's special reserve
description: A premium single-malt whiskey, gently matured inside the tunnels of a nuclear shelter. TUNNEL WHISKEY RULES.
@@ -204,7 +217,7 @@
sprite: Objects/Drinks/whiskeybottle.rsi
- type: entity
parent: DrinkBase
parent: DrinkBottleBaseFull
id: DrinkWineBottleFull
name: Doublebearded bearded special wine bottle
description: A faint aura of unease and asspainery surrounds the bottle.

View File

@@ -1,230 +1,103 @@
- type: entity
parent: DrinkFoodContainerBase
name: Base can
id: DrinkFoodContainerBaseCan
parent: BaseItem
id: DrinkCanBaseFull
abstract: true
components:
- type: Sound
- type: DrinkFoodContainer
use_sound: /Audio/items/canopen.ogg
capacity: 1
# Below are grouped paired as "unopened" and "opened"
- type: entity
parent: DrinkFoodContainerBaseCan
name: Space cola (unopened)
id: DrinkFoodContainerColaCanUnopened
components:
- type: Sound
- type: DrinkFoodContainer
prototypes:
DrinkColaCan: 100
- type: Sprite
sprite: Objects/Drinks/cola.rsi
- type: Icon
sprite: Objects/Drinks/cola.rsi
- type: entity
parent: DrinkBase
id: DrinkColaCan
name: Space cola
description: A refreshing beverage.
components:
- type: Drink
openSounds: canOpenSounds
- type: Solution
maxVol: 20
contents:
reagents:
- ReagentId: chem.Cola
Quantity: 20
- type: Sprite
sprite: Objects/Drinks/cola.rsi
- type: Icon
sprite: Objects/Drinks/cola.rsi
- type: Pourable
transferAmount: 5
- type: entity
parent: DrinkFoodContainerBaseCan
name: Ice tea can (unopened)
id: DrinkFoodContainerIceTeaCanUnopened
parent: DrinkCanBaseFull
id: DrinkColaCan
name: Space cola
description: A refreshing beverage.
components:
- type: Sound
- type: DrinkFoodContainer
prototypes:
DrinkIceTeaCan: 100
- type: Solution
- type: Sprite
sprite: Objects/Drinks/ice_tea_can.rsi
sprite: Objects/Drinks/cola.rsi
- type: Icon
sprite: Objects/Drinks/ice_tea_can.rsi
sprite: Objects/Drinks/cola.rsi
- type: entity
parent: DrinkBase
parent: DrinkCanBaseFull
id: DrinkIceTeaCan
name: Ice tea can
description: ''
components:
- type: Drink
- type: Sprite
sprite: Objects/Drinks/ice_tea_can.rsi
- type: Icon
sprite: Objects/Drinks/ice_tea_can.rsi
- type: entity
parent: DrinkFoodContainerBaseCan
name: Lemon-lime can (unopened)
id: DrinkFoodContainerLemonLimeCanUnopened
components:
- type: Sound
- type: DrinkFoodContainer
prototypes:
DrinkLemonLimeCan: 100
- type: Sprite
sprite: Objects/Drinks/lemon-lime.rsi
- type: Icon
sprite: Objects/Drinks/lemon-lime.rsi
- type: entity
parent: DrinkBase
parent: DrinkCanBaseFull
id: DrinkLemonLimeCan
name: Lemon-lime can
description: You wanted ORANGE. It gave you Lemon Lime.
components:
- type: Drink
- type: Sprite
sprite: Objects/Drinks/lemon-lime.rsi
- type: Icon
sprite: Objects/Drinks/lemon-lime.rsi
- type: entity
parent: DrinkFoodContainerBaseCan
name: Purple can (unopened)
id: DrinkFoodContainerPurpleCanUnopened
components:
- type: Sound
- type: DrinkFoodContainer
prototypes:
DrinkPurpleCan: 100
- type: Sprite
sprite: Objects/Drinks/purple_can.rsi
- type: Icon
sprite: Objects/Drinks/purple_can.rsi
- type: entity
parent: DrinkBase
parent: DrinkCanBaseFull
id: DrinkPurpleCan
name: Purple Can
description: ''
components:
- type: Drink
- type: Sprite
sprite: Objects/Drinks/purple_can.rsi
- type: Icon
sprite: Objects/Drinks/purple_can.rsi
- type: entity
parent: DrinkFoodContainerBaseCan
name: Space mountain wind can (unopened)
id: DrinkFoodContainerSpaceMountainWindCanUnopened
components:
- type: Sound
- type: DrinkFoodContainer
prototypes:
DrinkSpaceMountainWindCan: 100
- type: Sprite
sprite: Objects/Drinks/space_mountain_wind.rsi
- type: Icon
sprite: Objects/Drinks/space_mountain_wind.rsi
- type: entity
parent: DrinkBase
parent: DrinkCanBaseFull
id: DrinkSpaceMountainWindCan
name: Space mountain wind can
description: Blows right through you like a space wind.
components:
- type: Drink
- type: Sprite
sprite: Objects/Drinks/space_mountain_wind.rsi
- type: Icon
sprite: Objects/Drinks/space_mountain_wind.rsi
- type: entity
parent: DrinkFoodContainerBaseCan
name: Space-up can (unopened)
id: DrinkFoodContainerSpaceUpCanUnopened
components:
- type: Sound
- type: DrinkFoodContainer
prototypes:
DrinkSpaceUpCan: 100
- type: Sprite
sprite: Objects/Drinks/space-up.rsi
- type: Icon
sprite: Objects/Drinks/space-up.rsi
- type: entity
parent: DrinkBase
parent: DrinkCanBaseFull
id: DrinkSpaceUpCan
name: Space-up can
description: Tastes like a hull breach in your mouth.
components:
- type: Drink
- type: Sprite
sprite: Objects/Drinks/space-up.rsi
- type: Icon
sprite: Objects/Drinks/space-up.rsi
- type: entity
parent: DrinkFoodContainerBaseCan
name: Starkist can (unopened)
id: DrinkFoodContaineStarkistCanUnopened
components:
- type: Sound
- type: DrinkFoodContainer
prototypes:
DrinkStarkistCan: 100
- type: Sprite
sprite: Objects/Drinks/starkist.rsi
- type: Icon
sprite: Objects/Drinks/starkist.rsi
- type: entity
parent: DrinkBase
parent: DrinkCanBaseFull
id: DrinkStarkistCan
name: Starkist can
description: The taste of a star in liquid form. And, a bit of tuna...?
components:
- type: Drink
- type: Sprite
sprite: Objects/Drinks/starkist.rsi
- type: Icon
sprite: Objects/Drinks/starkist.rsi
- type: entity
parent: DrinkFoodContainerBaseCan
name: Thirteen loko can (unopened)
id: DrinkFoodContaineThirteenLokoCanUnopened
components:
- type: Sound
- type: DrinkFoodContainer
prototypes:
DrinkThirteenLokoCan: 100
- type: Sprite
sprite: Objects/Drinks/thirteen_loko.rsi
- type: Icon
sprite: Objects/Drinks/thirteen_loko.rsi
- type: entity
parent: DrinkBase
parent: DrinkCanBaseFull
id: DrinkThirteenLokoCan
name: Thirteen loko can
description: The MBO has advised crew members that consumption of Thirteen Loko may result in seizures, blindness, drunkeness, or even death. Please Drink Responsibly.
components:
- type: Drink
- type: Sprite
sprite: Objects/Drinks/thirteen_loko.rsi
- type: Icon

View File

@@ -10,7 +10,6 @@
- type: Pourable
transferAmount: 5
- type: Drink
despawn_empty: false
- type: Sound
- type: Sprite
state: icon

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,9 @@
- type: entity
parent: BaseItem
id: DrinkFoodContainerBase
id: FoodContainerBase
abstract: true
components:
- type: DrinkFoodContainer
capacity: 5
- type: FoodContainer
- type: Sprite
state: icon
netsync: false
@@ -13,435 +12,414 @@
# Containers
- type: entity
parent: DrinkFoodContainerBase
parent: FoodContainerBase
name: Apple cake
id: DrinkFoodContainerAppleCake
id: FoodContainerAppleCake
components:
- type: DrinkFoodContainer
capacity: 5
- type: FoodContainer
prototypes:
FoodAppleCakeSlice: 100
spawn_on_finish: TrashTray
trash: TrashTray
- type: Sprite
sprite: Objects/DrinkFoodContainers/apple_cake.rsi
sprite: Objects/FoodContainers/apple_cake.rsi
- type: Icon
sprite: Objects/DrinkFoodContainers/apple_cake.rsi
sprite: Objects/FoodContainers/apple_cake.rsi
- type: entity
parent: DrinkFoodContainerBase
parent: FoodContainerBase
name: Banana bread
id: DrinkFoodContainerBananaBread
id: FoodContainerBananaBread
components:
- type: DrinkFoodContainer
capacity: 5
- type: FoodContainer
prototypes:
FoodBananaBreadSlice: 100
- type: Sprite
sprite: Objects/DrinkFoodContainers/bananabread.rsi
sprite: Objects/FoodContainers/bananabread.rsi
- type: Icon
sprite: Objects/DrinkFoodContainers/bananabread.rsi
sprite: Objects/FoodContainers/bananabread.rsi
- type: entity
parent: DrinkFoodContainerBase
parent: FoodContainerBase
name: Birthday cake
id: DrinkFoodContainerBirthdayCake
id: FoodContainerBirthdayCake
components:
- type: DrinkFoodContainer
capacity: 5
- type: FoodContainer
prototypes:
FoodBirthdayCakeSlice: 100
- type: Sprite
sprite: Objects/DrinkFoodContainers/birthdaycake.rsi
sprite: Objects/FoodContainers/birthdaycake.rsi
- type: Icon
sprite: Objects/DrinkFoodContainers/birthdaycake.rsi
sprite: Objects/FoodContainers/birthdaycake.rsi
- type: entity
parent: DrinkFoodContainerBase
parent: FoodContainerBase
name: Brain cake
id: DrinkFoodContainerBrainCake
id: FoodContainerBrainCake
components:
- type: DrinkFoodContainer
capacity: 5
- type: FoodContainer
prototypes:
FoodBrainCakeSlice: 100
- type: Sprite
sprite: Objects/DrinkFoodContainers/braincake.rsi
sprite: Objects/FoodContainers/braincake.rsi
- type: Icon
sprite: Objects/DrinkFoodContainers/braincake.rsi
sprite: Objects/FoodContainers/braincake.rsi
- type: entity
parent: DrinkFoodContainerBase
parent: FoodContainerBase
name: Bread
id: DrinkFoodContainerBread
id: FoodContainerBread
components:
- type: DrinkFoodContainer
capacity: 5
- type: FoodContainer
prototypes:
FoodBreadSlice: 100
- type: Sprite
sprite: Objects/DrinkFoodContainers/bread.rsi
sprite: Objects/FoodContainers/bread.rsi
- type: Icon
sprite: Objects/DrinkFoodContainers/bread.rsi
sprite: Objects/FoodContainers/bread.rsi
- type: entity
parent: DrinkFoodContainerBase
parent: FoodContainerBase
name: Carrot cake
id: DrinkFoodContainerCarrotCake
id: FoodContainerCarrotCake
components:
- type: DrinkFoodContainer
capacity: 5
- type: FoodContainer
prototypes:
FoodCarrotCakeSlice: 100
- type: Sprite
sprite: Objects/DrinkFoodContainers/carrotcake.rsi
sprite: Objects/FoodContainers/carrotcake.rsi
- type: Icon
sprite: Objects/DrinkFoodContainers/carrotcake.rsi
sprite: Objects/FoodContainers/carrotcake.rsi
- type: entity
parent: DrinkFoodContainerBase
parent: FoodContainerBase
name: Cheesecake
id: DrinkFoodContainerCheeseCake
id: FoodContainerCheeseCake
components:
- type: DrinkFoodContainer
capacity: 5
- type: FoodContainer
prototypes:
FoodCheeseCakeSlice: 100
- type: Sprite
sprite: Objects/DrinkFoodContainers/cheesecake.rsi
sprite: Objects/FoodContainers/cheesecake.rsi
- type: Icon
sprite: Objects/DrinkFoodContainers/cheesecake.rsi
sprite: Objects/FoodContainers/cheesecake.rsi
- type: entity
parent: DrinkFoodContainerBase
parent: FoodContainerBase
name: Cheese wheel
id: DrinkFoodContainerCheeseWheel
id: FoodContainerCheeseWheel
components:
- type: DrinkFoodContainer
capacity: 5
- type: FoodContainer
prototypes:
FoodCheeseWedge: 100
- type: Sprite
sprite: Objects/DrinkFoodContainers/apple_cake.rsi
sprite: Objects/FoodContainers/apple_cake.rsi
- type: Icon
sprite: Objects/DrinkFoodContainers/apple_cake.rsi
sprite: Objects/FoodContainers/apple_cake.rsi
- type: entity
parent: DrinkFoodContainerBase
parent: FoodContainerBase
name: Chocolate cake
id: DrinkFoodContainerChocolateCake
id: FoodContainerChocolateCake
components:
- type: DrinkFoodContainer
capacity: 5
- type: FoodContainer
prototypes:
FoodChocolateCakeSlice: 100
- type: Sprite
sprite: Objects/DrinkFoodContainers/chocolatecake.rsi
sprite: Objects/FoodContainers/chocolatecake.rsi
- type: Icon
sprite: Objects/DrinkFoodContainers/chocolatecake.rsi
sprite: Objects/FoodContainers/chocolatecake.rsi
- type: entity
parent: DrinkFoodContainerBase
parent: FoodContainerBase
name: Cream cheese bread
id: DrinkFoodContainerCreamCheeseBread
id: FoodContainerCreamCheeseBread
components:
- type: DrinkFoodContainer
capacity: 5
- type: FoodContainer
prototypes:
FoodCreamCheeseBreadSlice: 100
- type: Sprite
sprite: Objects/DrinkFoodContainers/creamcheesebread.rsi
sprite: Objects/FoodContainers/creamcheesebread.rsi
- type: Icon
sprite: Objects/DrinkFoodContainers/creamcheesebread.rsi
sprite: Objects/FoodContainers/creamcheesebread.rsi
- type: entity
parent: DrinkFoodContainerBase
parent: FoodContainerBase
name: Donut box
id: DrinkFoodContainerDonutBox
id: FoodContainerDonutBox
components:
- type: DrinkFoodContainer
- type: FoodContainer
capacity: 6
prototypes:
FoodDonut: 70
FoodFrostedDonut: 30
- type: Sprite
sprite: Objects/DrinkFoodContainers/donutbox.rsi
sprite: Objects/FoodContainers/donutbox.rsi
- type: Icon
sprite: Objects/DrinkFoodContainers/donutbox.rsi
sprite: Objects/FoodContainers/donutbox.rsi
- type: Appearance
visuals:
- type: DrinkFoodContainerVisualizer2D
- type: FoodContainerVisualizer2D
mode: Discrete
base_state: donutbox
steps: 7
- type: entity
parent: DrinkFoodContainerBase
parent: FoodContainerBase
name: Egg box (shut)
id: DrinkFoodContainerEggBoxShut
id: FoodContainerEggBoxShut
components:
- type: DrinkFoodContainer
- type: FoodContainer
capacity: 1
prototypes:
DrinkFoodContainerEggBox: 100
FoodContainerEggBox: 100
- type: Sprite
sprite: Objects/DrinkFoodContainers/eggbox_shut.rsi
sprite: Objects/FoodContainers/eggbox_shut.rsi
- type: Icon
sprite: Objects/DrinkFoodContainers/eggbox_shut.rsi
sprite: Objects/FoodContainers/eggbox_shut.rsi
- type: entity
parent: DrinkFoodContainerBase
parent: FoodContainerBase
name: Egg box
id: DrinkFoodContainerEggBox
id: FoodContainerEggBox
components:
- type: DrinkFoodContainer
- type: FoodContainer
capacity: 12
prototypes:
FoodEgg: 100
- type: Sprite
sprite: Objects/DrinkFoodContainers/eggbox.rsi
sprite: Objects/FoodContainers/eggbox.rsi
state: eggbox-12
- type: Icon
sprite: Objects/DrinkFoodContainers/eggbox.rsi
sprite: Objects/FoodContainers/eggbox.rsi
state: eggbox-12
- type: Appearance
visuals:
- type: DrinkFoodContainerVisualizer2D
- type: FoodContainerVisualizer2D
mode: Discrete
base_state: eggbox
steps: 13
- type: entity
parent: DrinkFoodContainerBase
parent: FoodContainerBase
name: Lemon cake
id: DrinkFoodContainerLemonCake
id: FoodContainerLemonCake
components:
- type: DrinkFoodContainer
capacity: 5
- type: FoodContainer
prototypes:
FoodLemonCakeSlice: 100
- type: Sprite
sprite: Objects/DrinkFoodContainers/lemoncake.rsi
sprite: Objects/FoodContainers/lemoncake.rsi
- type: Icon
sprite: Objects/DrinkFoodContainers/lemoncake.rsi
sprite: Objects/FoodContainers/lemoncake.rsi
- type: entity
parent: DrinkFoodContainerBase
parent: FoodContainerBase
name: Lime cake
id: DrinkFoodContainerLimeCake
id: FoodContainerLimeCake
components:
- type: DrinkFoodContainer
capacity: 5
- type: FoodContainer
prototypes:
FoodLimeCakeSlice: 100
- type: Sprite
sprite: Objects/DrinkFoodContainers/limecake.rsi
sprite: Objects/FoodContainers/limecake.rsi
- type: Icon
sprite: Objects/DrinkFoodContainers/limecake.rsi
sprite: Objects/FoodContainers/limecake.rsi
- type: entity
parent: DrinkFoodContainerBase
parent: FoodContainerBase
name: Meat bread
id: DrinkFoodContainerMeatBread
id: FoodContainerMeatBread
components:
- type: DrinkFoodContainer
capacity: 5
- type: FoodContainer
prototypes:
FoodMeatBreadSlice: 100
- type: Sprite
sprite: Objects/DrinkFoodContainers/meatbread.rsi
sprite: Objects/FoodContainers/meatbread.rsi
- type: Icon
sprite: Objects/DrinkFoodContainers/meatbread.rsi
sprite: Objects/FoodContainers/meatbread.rsi
- type: entity
parent: DrinkFoodContainerBase
parent: FoodContainerBase
name: Meat pizza
id: DrinkFoodContainerMeatPizza
id: FoodContainerMeatPizza
components:
- type: DrinkFoodContainer
- type: FoodContainer
capacity: 6
prototypes:
FoodMeatPizzaSlice: 100
- type: Sprite
sprite: Objects/DrinkFoodContainers/meatpizza.rsi
sprite: Objects/FoodContainers/meatpizza.rsi
- type: Icon
sprite: Objects/DrinkFoodContainers/meatpizza.rsi
sprite: Objects/FoodContainers/meatpizza.rsi
# These two will probably get moved one day
- type: entity
parent: DrinkFoodContainerBase
parent: FoodContainerBase
name: Monkey cube box
id: DrinkFoodContainerMonkeyCubeBox
id: FoodContainerMonkeyCubeBox
components:
- type: DrinkFoodContainer
capacity: 5
- type: FoodContainer
prototypes:
DrinkFoodContainerMonkeyCubeWrap: 100
FoodContainerMonkeyCubeWrap: 100
- type: Sprite
sprite: Objects/DrinkFoodContainers/monkeycubebox.rsi
sprite: Objects/FoodContainers/monkeycubebox.rsi
- type: Icon
sprite: Objects/DrinkFoodContainers/monkeycubebox.rsi
sprite: Objects/FoodContainers/monkeycubebox.rsi
- type: entity
parent: DrinkFoodContainerBase
parent: FoodContainerBase
name: Monkey cube wrap
id: DrinkFoodContainerMonkeyCubeWrap
id: FoodContainerMonkeyCubeWrap
components:
- type: DrinkFoodContainer
capacity: 5
- type: FoodContainer
prototypes:
FoodMonkeyCube: 100
- type: Sprite
sprite: Objects/DrinkFoodContainers/monkeycubewrap.rsi
sprite: Objects/FoodContainers/monkeycubewrap.rsi
- type: Icon
sprite: Objects/DrinkFoodContainers/monkeycubewrap.rsi
sprite: Objects/FoodContainers/monkeycubewrap.rsi
- type: entity
parent: DrinkFoodContainerBase
parent: FoodContainerBase
name: Mushroom pizza
id: DrinkFoodContainerMushroomPizza
id: FoodContainerMushroomPizza
components:
- type: DrinkFoodContainer
- type: FoodContainer
capacity: 6
prototypes:
FoodMushroomPizzaSlice: 100
- type: Sprite
sprite: Objects/DrinkFoodContainers/mushroompizza.rsi
sprite: Objects/FoodContainers/mushroompizza.rsi
- type: Icon
sprite: Objects/DrinkFoodContainers/mushroompizza.rsi
sprite: Objects/FoodContainers/mushroompizza.rsi
- type: entity
parent: DrinkFoodContainerBase
parent: FoodContainerBase
name: Orange cake
id: DrinkFoodContainerOrangeCake
id: FoodContainerOrangeCake
components:
- type: DrinkFoodContainer
capacity: 5
- type: FoodContainer
prototypes:
FoodOrangeCakeSlice: 100
- type: Sprite
sprite: Objects/DrinkFoodContainers/orangecake.rsi
sprite: Objects/FoodContainers/orangecake.rsi
- type: Icon
sprite: Objects/DrinkFoodContainers/orangecake.rsi
sprite: Objects/FoodContainers/orangecake.rsi
# TODO: Probably replace it with a stacking thing
- type: entity
parent: DrinkFoodContainerBase
parent: FoodContainerBase
name: Pizza box stack
id: DrinkFoodContainerPizzaBoxStack
id: FoodContainerPizzaBoxStack
components:
- type: DrinkFoodContainer
capacity: 5
- type: FoodContainer
prototypes:
DrinkFoodContainerPizzaBox: 100
FoodContainerPizzaBox: 100
- type: Sprite
sprite: Objects/DrinkFoodContainers/pizzaboxstack.rsi
sprite: Objects/FoodContainers/pizzaboxstack.rsi
- type: Icon
sprite: Objects/DrinkFoodContainers/pizzaboxstack.rsi
sprite: Objects/FoodContainers/pizzaboxstack.rsi
- type: Appearance
visuals:
- type: DrinkFoodContainerVisualizer2D
- type: FoodContainerVisualizer2D
mode: Discrete
base_state: pizzaboxstack
steps: 5
- type: entity
parent: DrinkFoodContainerBase
parent: FoodContainerBase
name: Pizza box
id: DrinkFoodContainerPizzaBox
id: FoodContainerPizzaBox
components:
- type: DrinkFoodContainer
- type: FoodContainer
capacity: 1
prototypes:
DrinkFoodContainerMeatPizza: 25
DrinkFoodContainerMargheritaPizza: 25
DrinkFoodContainerMushroomPizza: 25
DrinkFoodContainerVegetablePizza: 25
FoodContainerMeatPizza: 25
FoodContainerMargheritaPizza: 25
FoodContainerMushroomPizza: 25
FoodContainerVegetablePizza: 25
- type: Sprite
sprite: Objects/DrinkFoodContainers/pizzabox_open.rsi
sprite: Objects/FoodContainers/pizzabox_open.rsi
- type: Icon
sprite: Objects/DrinkFoodContainers/pizzabox_open.rsi
sprite: Objects/FoodContainers/pizzabox_open.rsi
- type: entity
parent: DrinkFoodContainerBase
parent: FoodContainerBase
name: Margherita pizza
id: DrinkFoodContainerMargheritaPizza
id: FoodContainerMargheritaPizza
components:
- type: DrinkFoodContainer
- type: FoodContainer
capacity: 6
prototypes:
FoodMargheritaPizzaSlice: 100
- type: Sprite
sprite: Objects/DrinkFoodContainers/pizzamargherita.rsi
sprite: Objects/FoodContainers/pizzamargherita.rsi
- type: Icon
sprite: Objects/DrinkFoodContainers/pizzamargherita.rsi
sprite: Objects/FoodContainers/pizzamargherita.rsi
- type: entity
parent: DrinkFoodContainerBase
parent: FoodContainerBase
name: Plain cake
id: DrinkFoodContainerPlainCake
id: FoodContainerPlainCake
components:
- type: DrinkFoodContainer
capacity: 5
- type: FoodContainer
prototypes:
FoodPlainCakeSlice: 100
spawn_on_finish: TrashTray
trash: TrashTray
- type: Sprite
sprite: Objects/DrinkFoodContainers/plaincake.rsi
sprite: Objects/FoodContainers/plaincake.rsi
- type: Icon
sprite: Objects/DrinkFoodContainers/plaincake.rsi
sprite: Objects/FoodContainers/plaincake.rsi
- type: entity
parent: DrinkFoodContainerBase
parent: FoodContainerBase
name: Pumpkin pie
id: DrinkFoodContainerPumpkinPie
id: FoodContainerPumpkinPie
components:
- type: DrinkFoodContainer
capacity: 5
- type: FoodContainer
prototypes:
FoodPumpkinPieSlice: 100
- type: Sprite
sprite: Objects/DrinkFoodContainers/pumpkinpie.rsi
sprite: Objects/FoodContainers/pumpkinpie.rsi
- type: Icon
sprite: Objects/DrinkFoodContainers/pumpkinpie.rsi
sprite: Objects/FoodContainers/pumpkinpie.rsi
- type: entity
parent: DrinkFoodContainerBase
parent: FoodContainerBase
name: Tofu bread
id: DrinkFoodContainerTofuBread
id: FoodContainerTofuBread
components:
- type: DrinkFoodContainer
capacity: 5
- type: FoodContainer
prototypes:
FoodTofuBreadSlice: 100
- type: Sprite
sprite: Objects/DrinkFoodContainers/tofubread.rsi
sprite: Objects/FoodContainers/tofubread.rsi
- type: Icon
sprite: Objects/DrinkFoodContainers/tofubread.rsi
sprite: Objects/FoodContainers/tofubread.rsi
- type: entity
parent: DrinkFoodContainerBase
parent: FoodContainerBase
name: Vegetable pizza
id: DrinkFoodContainerVegetablePizza
id: FoodContainerVegetablePizza
components:
- type: DrinkFoodContainer
- type: FoodContainer
capacity: 6
prototypes:
FoodVegetablePizzaSlice: 100
- type: Sprite
sprite: Objects/DrinkFoodContainers/vegetablepizza.rsi
sprite: Objects/FoodContainers/vegetablepizza.rsi
- type: Icon
sprite: Objects/DrinkFoodContainers/vegetablepizza.rsi
sprite: Objects/FoodContainers/vegetablepizza.rsi
- type: entity
parent: DrinkFoodContainerBase
parent: FoodContainerBase
name: Xenomeat bread
id: DrinkFoodContainerXenomeatBread
id: FoodContainerXenomeatBread
components:
- type: DrinkFoodContainer
capacity: 5
- type: FoodContainer
prototypes:
FoodXenomeatBreadSlice: 100
- type: Sprite
sprite: Objects/DrinkFoodContainers/xenomeatbread.rsi
sprite: Objects/FoodContainers/xenomeatbread.rsi
- type: Icon
sprite: Objects/DrinkFoodContainers/xenomeatbread.rsi
sprite: Objects/FoodContainers/xenomeatbread.rsi

View File

@@ -13,7 +13,6 @@
- type: Pourable
transferAmount: 5
- type: Drink
despawn_empty: true
- type: Sprite
sprite: Objects/Food/flour.rsi
state: icon

View File

@@ -3,7 +3,7 @@
name: Base empty bottle
parent: BaseItem
abstract: true
id: DrinkBottleBase
id: DrinkBottleBaseEmpty
components:
- type: Sound
- type: Sprite
@@ -15,12 +15,13 @@
- type: Pourable
transferAmount: 5
- type: Drink
despawn_empty: false
isOpen: true
# Containers
- type: entity
name: Jailbreaker Verte bottle
parent: DrinkBottleBase
parent: DrinkBottleBaseEmpty
id: DrinkBottleAbsinthe
components:
- type: Sprite
@@ -30,7 +31,7 @@
- type: entity
name: Alcohol bottle
parent: DrinkBottleBase
parent: DrinkBottleBaseEmpty
id: DrinkBottleAlcoClear
components:
- type: Sprite
@@ -40,7 +41,7 @@
- type: entity
name: Ale bottle
parent: DrinkBottleBase
parent: DrinkBottleBaseEmpty
id: DrinkBottleAle
components:
- type: Sprite
@@ -50,7 +51,7 @@
- type: entity
name: Beer bottle
parent: DrinkBottleBase
parent: DrinkBottleBaseEmpty
id: DrinkBottleBeer
components:
- type: Sprite
@@ -60,7 +61,7 @@
- type: entity
name: Broken bottle
parent: DrinkBottleBase # Can't hold liquids
parent: DrinkBottleBaseEmpty # Can't hold liquids
id: DrinkBrokenBottle
components:
- type: Sprite
@@ -70,7 +71,7 @@
- type: entity
name: Cognac bottle
parent: DrinkBottleBase
parent: DrinkBottleBaseEmpty
id: DrinkBottleCognac
components:
- type: Sprite
@@ -80,7 +81,7 @@
- type: entity
name: Griffeater gin bottle
parent: DrinkBottleBase
parent: DrinkBottleBaseEmpty
id: DrinkBottleGin
components:
- type: Sprite
@@ -90,7 +91,7 @@
- type: entity
name: Goldschlager bottle
parent: DrinkBottleBase
parent: DrinkBottleBaseEmpty
id: DrinkBottleGoldschlager
components:
- type: Sprite
@@ -100,7 +101,7 @@
- type: entity
name: Kahlua bottle
parent: DrinkBottleBase
parent: DrinkBottleBaseEmpty
id: DrinkBottleKahlua
components:
- type: Sprite
@@ -110,7 +111,7 @@
- type: entity
name: NT Cahors bottle
parent: DrinkBottleBase
parent: DrinkBottleBaseEmpty
id: DrinkBottleNTCahors
components:
- type: Sprite
@@ -120,7 +121,7 @@
- type: entity
name: Patron bottle
parent: DrinkBottleBase
parent: DrinkBottleBaseEmpty
id: DrinkBottlePatron
components:
- type: Sprite
@@ -130,7 +131,7 @@
- type: entity
name: Poison wine bottle
parent: DrinkBottleBase
parent: DrinkBottleBaseEmpty
id: DrinkBottlePoisonWine
components:
- type: Sprite
@@ -140,7 +141,7 @@
- type: entity
name: Rum bottle
parent: DrinkBottleBase
parent: DrinkBottleBaseEmpty
id: DrinkBottleRum
components:
- type: Sprite
@@ -150,7 +151,7 @@
- type: entity
name: Tequila bottle
parent: DrinkBottleBase
parent: DrinkBottleBaseEmpty
id: DrinkBottleTequila
components:
- type: Sprite
@@ -160,7 +161,7 @@
- type: entity
name: Vermouth bottle
parent: DrinkBottleBase
parent: DrinkBottleBaseEmpty
id: DrinkBottleVermouth
components:
- type: Sprite
@@ -170,7 +171,7 @@
- type: entity
name: Vodka bottle
parent: DrinkBottleBase
parent: DrinkBottleBaseEmpty
id: DrinkBottleVodka
components:
- type: Sprite
@@ -180,7 +181,7 @@
- type: entity
name: Whiskey bottle
parent: DrinkBottleBase
parent: DrinkBottleBaseEmpty
id: DrinkBottleWhiskey
components:
- type: Sprite
@@ -190,7 +191,7 @@
- type: entity
name: Wine bottle
parent: DrinkBottleBase
parent: DrinkBottleBaseEmpty
id: DrinkBottleWine
components:
- type: Sprite

View File

@@ -59,7 +59,7 @@
- type: microwaveMealRecipe
id: RecipeBread
name: Bread Recipe
result: DrinkFoodContainerBread
result: FoodContainerBread
time: 15
reagents:
chem.Flour: 15
@@ -104,7 +104,7 @@
- type: microwaveMealRecipe
id: RecipeCreamCheeseBread
name: Cream Cheese Bread Recipe
result: DrinkFoodContainerCreamCheeseBread
result: FoodContainerCreamCheeseBread
time: 20
reagents:
chem.Flour: 15
@@ -114,7 +114,7 @@
- type: microwaveMealRecipe
id: RecipeBananaBread
name: Banana Bread Recipe
result: DrinkFoodContainerBananaBread
result: FoodContainerBananaBread
time: 25
reagents:
chem.Flour: 15
@@ -129,7 +129,7 @@
- type: microwaveMealRecipe
id: RecipeMargheritaPizza
name: Margherita Pizza Recipe
result: DrinkFoodContainerMargheritaPizza
result: FoodContainerMargheritaPizza
time: 30
reagents:
chem.Flour: 10
@@ -140,7 +140,7 @@
- type: microwaveMealRecipe
id: RecipeMushroomPizza
name: Mushroom Pizza Recipe
result: DrinkFoodContainerMushroomPizza
result: FoodContainerMushroomPizza
time: 25
reagents:
chem.Flour: 10
@@ -150,7 +150,7 @@
- type: microwaveMealRecipe
id: RecipeMeatPizza
name: Meat Pizza Recipe
result: DrinkFoodContainerMeatPizza
result: FoodContainerMeatPizza
time: 30
reagents:
chem.Flour: 10
@@ -162,7 +162,7 @@
- type: microwaveMealRecipe
id: RecipeVegetablePizza
name: Vegetable Pizza Recipe
result: DrinkFoodContainerVegetablePizza
result: FoodContainerVegetablePizza
time: 30
reagents:
chem.Flour: 10

View File

@@ -0,0 +1,11 @@
- type: soundCollection
id: canOpenSounds
files:
- /Audio/items/can_open1.ogg
- /Audio/items/can_open2.ogg
- /Audio/items/can_open3.ogg
- type: soundCollection
id: bottleOpenSounds
files:
- /Audio/items/bottle_open1.ogg

View File

@@ -5,11 +5,11 @@
animationDuration: 1.1
spriteName: cola
startingInventory:
DrinkFoodContainerColaCanUnopened: 10
DrinkFoodContainerIceTeaCanUnopened: 10
DrinkFoodContainerLemonLimeCanUnopened: 10
DrinkFoodContainerPurpleCanUnopened: 10
DrinkFoodContainerSpaceMountainWindCanUnopened: 10
DrinkFoodContainerSpaceUpCanUnopened: 10
DrinkFoodContaineStarkistCanUnopened: 10
DrinkFoodContaineThirteenLokoCanUnopened: 10
DrinkColaCan: 10
DrinkIceTeaCan: 10
DrinkLemonLimeCan: 10
DrinkPurpleCan: 10
DrinkSpaceMountainWindCan: 10
DrinkSpaceUpCan: 10
DrinkDrinkFoodContaineStarkistCan: 10
DrinkFoodContaineThirteenLokoCan: 10

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 736 B

After

Width:  |  Height:  |  Size: 736 B

View File

Before

Width:  |  Height:  |  Size: 356 B

After

Width:  |  Height:  |  Size: 356 B

View File

Before

Width:  |  Height:  |  Size: 923 B

After

Width:  |  Height:  |  Size: 923 B

View File

Before

Width:  |  Height:  |  Size: 947 B

After

Width:  |  Height:  |  Size: 947 B

View File

Before

Width:  |  Height:  |  Size: 1009 B

After

Width:  |  Height:  |  Size: 1009 B

View File

Before

Width:  |  Height:  |  Size: 906 B

After

Width:  |  Height:  |  Size: 906 B

View File

Before

Width:  |  Height:  |  Size: 974 B

After

Width:  |  Height:  |  Size: 974 B

Some files were not shown because too many files have changed in this diff Show More