* My first contribution in a while.Change AddAccent command to be case insensitive (#3112) * got rid of the bottle of nothingness. thought it was an empty bottle. * new correction * Delete SpaceStation14.sln I honestly don't know what happened here. I didn't code those lines. * Revert "Delete SpaceStation14.sln" This reverts commit 68876841dce9c6e2ce9d21996e4caef3512b1385. * new attempt at fixing * Revert "new attempt at fixing" This reverts commit 780f66fda3d66b6d4d086871d0b2ea2f6d4ee004. * Revert "My first contribution in a while.Change AddAccent command to be case insensitive (#3112)" This reverts commit 08041a30365331b82309aedaf2136d7631459887. * Revert "Revert "My first contribution in a while.Change AddAccent command to be case insensitive (#3112)"" This reverts commit b2dc76a6683e8df88188d37a836f9ab9a54287b5. * Revert "Revert "Revert "My first contribution in a while.Change AddAccent command to be case insensitive (#3112)""" This reverts commit 478d2bfe5daf6098d2f5665249ce0f161704dd73. * Revert "Revert "Revert "Revert "My first contribution in a while.Change AddAccent command to be case insensitive (#3112)"""" This reverts commit 23c195143e1e3d05cb5f344329c01754432684a9. * Revert "Revert "Revert "Revert "My first contribution in a while.Change AddAccent command to be case insensitive (#3112)"""" This reverts commit 23c195143e1e3d05cb5f344329c01754432684a9. * still having figured what happened with the sln file * please work * -Added wood as a material. -Made a few changes in the material requirements for some of the recipes. * ok. added a small correction for wood at material_stacks.yml * ok added another correction for misc.yml because for some reason a : just disappeared. * -added plastic as a material, complete with a png (credits: tgstation) -replaced glass with plastic for material requirements for some of the latherecipes * for some reason the shovel was duplicate, being in both botany.yml and in tools.yml. deleted it from tools * ok. one last try. noticed that the sprite path for shovel was weird even though it already has its own sprite at Objects/Tools/shovel.rsi . so I decided to fix the path then move the shovel back to tools.yml while deleting it from botany.yml. maybe that was the problem? * corrected the extra space on the type: material for plastic discovered by Peptide90. * noticed that wood also had a bad icon path. * another attempt * weird. I don't remember messing with the flashlight requirements. * added plastic in the SharedStakedComponent and the meta.json from materials.rsi is back to how it was * hopefully this icon is valid. * small corrections concerning double space. Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
150 lines
3.7 KiB
C#
150 lines
3.7 KiB
C#
using System;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Players;
|
|
using Robust.Shared.Reflection;
|
|
using Robust.Shared.Serialization;
|
|
using Robust.Shared.ViewVariables;
|
|
|
|
namespace Content.Shared.GameObjects.Components
|
|
{
|
|
public abstract class SharedStackComponent : Component
|
|
{
|
|
private const string SerializationCache = "stack";
|
|
|
|
public sealed override string Name => "Stack";
|
|
public sealed override uint? NetID => ContentNetIDs.STACK;
|
|
|
|
private int _count;
|
|
private int _maxCount;
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
public virtual int Count
|
|
{
|
|
get => _count;
|
|
set
|
|
{
|
|
_count = value;
|
|
if (_count <= 0)
|
|
{
|
|
Owner.Delete();
|
|
}
|
|
|
|
Dirty();
|
|
}
|
|
}
|
|
|
|
[ViewVariables]
|
|
public int MaxCount
|
|
{
|
|
get => _maxCount;
|
|
private set
|
|
{
|
|
_maxCount = value;
|
|
Dirty();
|
|
}
|
|
}
|
|
|
|
[ViewVariables] public int AvailableSpace => MaxCount - Count;
|
|
|
|
[ViewVariables] public object StackType { get; private set; }
|
|
|
|
public override void ExposeData(ObjectSerializer serializer)
|
|
{
|
|
serializer.DataFieldCached(ref _maxCount, "max", 50);
|
|
serializer.DataFieldCached(ref _count, "count", MaxCount);
|
|
|
|
if (serializer.Writing)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (serializer.TryGetCacheData(SerializationCache, out object stackType))
|
|
{
|
|
StackType = stackType;
|
|
return;
|
|
}
|
|
|
|
if (serializer.TryReadDataFieldCached("stacktype", out string raw))
|
|
{
|
|
var refl = IoCManager.Resolve<IReflectionManager>();
|
|
if (refl.TryParseEnumReference(raw, out var @enum))
|
|
{
|
|
stackType = @enum;
|
|
}
|
|
else
|
|
{
|
|
stackType = raw;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
stackType = Owner.Prototype.ID;
|
|
}
|
|
|
|
serializer.SetCacheData(SerializationCache, stackType);
|
|
StackType = stackType;
|
|
}
|
|
|
|
public override ComponentState GetComponentState(ICommonSession player)
|
|
{
|
|
return new StackComponentState(Count, MaxCount);
|
|
}
|
|
|
|
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
|
{
|
|
if (curState is not StackComponentState cast)
|
|
{
|
|
return;
|
|
}
|
|
|
|
Count = cast.Count;
|
|
MaxCount = cast.MaxCount;
|
|
}
|
|
|
|
|
|
[Serializable, NetSerializable]
|
|
private sealed class StackComponentState : ComponentState
|
|
{
|
|
public int Count { get; }
|
|
public int MaxCount { get; }
|
|
|
|
public StackComponentState(int count, int maxCount) : base(ContentNetIDs.STACK)
|
|
{
|
|
Count = count;
|
|
MaxCount = maxCount;
|
|
}
|
|
}
|
|
}
|
|
|
|
public enum StackType
|
|
{
|
|
Metal,
|
|
Glass,
|
|
ReinforcedGlass,
|
|
Plasteel,
|
|
Cable,
|
|
Wood,
|
|
Plastic,
|
|
MVCable,
|
|
HVCable,
|
|
Gold,
|
|
Plasma,
|
|
Ointment,
|
|
Gauze,
|
|
Brutepack,
|
|
FloorTileSteel,
|
|
FloorTileCarpet,
|
|
FloorTileWhite,
|
|
FloorTileDark,
|
|
FloorTileWood,
|
|
MetalRod,
|
|
PaperRolling,
|
|
CigaretteFilter,
|
|
GroundTobacco,
|
|
GroundCannabis,
|
|
LeavesTobaccoDried,
|
|
LeavesCannabisDried
|
|
}
|
|
}
|