This commit is contained in:
ShadowCommander
2019-08-16 15:46:06 -07:00
423 changed files with 3133 additions and 936 deletions

View File

@@ -1,15 +1,26 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
#if NETCOREAPP
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;
#endif
using BenchmarkDotNet.Attributes;
using Robust.Shared.Maths;
using SysVector4 = System.Numerics.Vector4;
namespace Content.Benchmarks
{
[DisassemblyDiagnoser]
public class ColorInterpolateBenchmark
{
private readonly List<(Color, Color)> _colors = new List<(Color, Color)>();
#if NETCOREAPP
private const MethodImplOptions AggressiveOpt = MethodImplOptions.AggressiveOptimization;
#else
private const MethodImplOptions AggressiveOpt = default;
#endif
private (Color, Color)[] _colors;
private Color[] _output;
[Params(100)] public int N { get; set; }
@@ -18,6 +29,9 @@ namespace Content.Benchmarks
{
var random = new Random(3005);
_colors = new (Color, Color)[N];
_output = new Color[N];
for (var i = 0; i < N; i++)
{
var r1 = random.NextFloat();
@@ -30,123 +44,122 @@ namespace Content.Benchmarks
var b2 = random.NextFloat();
var a2 = random.NextFloat();
_colors.Add((new Color(r1, g1, b1, a1), new Color(r2, g2, b2, a2)));
_colors[i] = (new Color(r1, g1, b1, a1), new Color(r2, g2, b2, a2));
}
}
[Benchmark]
public void BenchSimple()
{
foreach (var (a, b) in _colors)
for (var i = 0; i < N; i++)
{
InterpolateSimple(a, b, 0.5f);
ref var tuple = ref _colors[i];
_output[i] = InterpolateSimple(tuple.Item1, tuple.Item2, 0.5f);
}
}
//[Benchmark]
public void BenchSysVector4()
{
foreach (var (a, b) in _colors)
{
InterpolateSysVector4(a, b, 0.5f);
}
}
//[Benchmark]
public void BenchSysVector4Blit()
[Benchmark]
public void BenchSysVector4In()
{
foreach (var (a, b) in _colors)
for (var i = 0; i < N; i++)
{
InterpolateSysVector4Blit(a, b, 0.5f);
}
}
//[Benchmark]
public void BenchSysVector4BlitNoException()
{
foreach (var (a, b) in _colors)
{
InterpolateSysVector4BlitNoException(a, b, 0.5f);
ref var tuple = ref _colors[i];
_output[i] = InterpolateSysVector4In(tuple.Item1, tuple.Item2, 0.5f);
}
}
[Benchmark]
public void BenchSysVector4AsRefNoException()
public void BenchSysVector4()
{
foreach (var (a, b) in _colors)
for (var i = 0; i < N; i++)
{
InterpolateSysVector4BlitNoExceptionAsRef(a, b, 0.5f);
ref var tuple = ref _colors[i];
_output[i] = InterpolateSysVector4(tuple.Item1, tuple.Item2, 0.5f);
}
}
public static Color InterpolateSimple(Color endPoint1, Color endPoint2, float lambda)
#if NETCOREAPP
[Benchmark]
public void BenchSimd()
{
for (var i = 0; i < N; i++)
{
ref var tuple = ref _colors[i];
_output[i] = InterpolateSimd(tuple.Item1, tuple.Item2, 0.5f);
}
}
[Benchmark]
public void BenchSimdIn()
{
for (var i = 0; i < N; i++)
{
ref var tuple = ref _colors[i];
_output[i] = InterpolateSimdIn(tuple.Item1, tuple.Item2, 0.5f);
}
}
#endif
[MethodImpl(AggressiveOpt)]
public static Color InterpolateSimple(Color a, Color b, float lambda)
{
if (lambda < 0 || lambda > 1)
throw new ArgumentOutOfRangeException(nameof(lambda));
return new Color(
endPoint1.R * lambda + endPoint2.R * (1 - lambda),
endPoint1.G * lambda + endPoint2.G * (1 - lambda),
endPoint1.B * lambda + endPoint2.B * (1 - lambda),
endPoint1.A * lambda + endPoint2.A * (1 - lambda)
a.R + (b.R - a.R) * lambda,
a.G + (b.G - a.G) * lambda,
a.B + (b.G - a.B) * lambda,
a.A + (b.A - a.A) * lambda
);
}
public static Color InterpolateSysVector4(Color endPoint1, Color endPoint2, float lambda)
{
if (lambda < 0 || lambda > 1)
throw new ArgumentOutOfRangeException(nameof(lambda));
var vec1 = new SysVector4(endPoint1.R, endPoint1.G, endPoint1.B, endPoint1.A);
var vec2 = new SysVector4(endPoint2.R, endPoint2.G, endPoint2.B, endPoint2.A);
var res = SysVector4.Lerp(vec1, vec2, 1 - lambda);
return new Color(
res.X, res.Y, res.Z, res.W);
}
public static unsafe Color InterpolateSysVector4Blit(in Color endPoint1, in Color endPoint2, float lambda)
{
if (lambda < 0 || lambda > 1)
throw new ArgumentOutOfRangeException(nameof(lambda));
fixed (Color* p1 = &endPoint1)
fixed (Color* p2 = &endPoint2)
{
var vp1 = (SysVector4*) p1;
var vp2 = (SysVector4*) p2;
var res = SysVector4.Lerp(*vp1, *vp2, 1 - lambda);
return *(Color*) (&res);
}
}
public static unsafe Color InterpolateSysVector4BlitNoException(in Color endPoint1, in Color endPoint2,
[MethodImpl(AggressiveOpt)]
public static Color InterpolateSysVector4(Color a, Color b,
float lambda)
{
fixed (Color* p1 = &endPoint1)
fixed (Color* p2 = &endPoint2)
{
var vp1 = (SysVector4*) p1;
var vp2 = (SysVector4*) p2;
ref var sva = ref Unsafe.As<Color, SysVector4>(ref a);
ref var svb = ref Unsafe.As<Color, SysVector4>(ref b);
var res = SysVector4.Lerp(*vp2, *vp1, lambda);
return *(Color*) (&res);
}
}
public static unsafe Color InterpolateSysVector4BlitNoExceptionAsRef(in Color endPoint1, in Color endPoint2,
float lambda)
{
ref var sv1 = ref Unsafe.As<Color, SysVector4>(ref Unsafe.AsRef(endPoint1));
ref var sv2 = ref Unsafe.As<Color, SysVector4>(ref Unsafe.AsRef(endPoint2));
var res = SysVector4.Lerp(sv2, sv1, lambda);
var res = SysVector4.Lerp(sva, svb, lambda);
return Unsafe.As<SysVector4, Color>(ref res);
}
[MethodImpl(AggressiveOpt)]
public static Color InterpolateSysVector4In(in Color endPoint1, in Color endPoint2,
float lambda)
{
ref var sva = ref Unsafe.As<Color, SysVector4>(ref Unsafe.AsRef(endPoint1));
ref var svb = ref Unsafe.As<Color, SysVector4>(ref Unsafe.AsRef(endPoint2));
var res = SysVector4.Lerp(svb, sva, lambda);
return Unsafe.As<SysVector4, Color>(ref res);
}
#if NETCOREAPP
[MethodImpl(AggressiveOpt)]
public static Color InterpolateSimd(Color a, Color b,
float lambda)
{
var vecA = Unsafe.As<Color, Vector128<float>>(ref a);
var vecB = Unsafe.As<Color, Vector128<float>>(ref b);
vecB = Fma.MultiplyAdd(Sse.Subtract(vecB, vecA), Vector128.Create(lambda), vecA);
return Unsafe.As<Vector128<float>, Color>(ref vecB);
}
[MethodImpl(AggressiveOpt)]
public static Color InterpolateSimdIn(in Color a, in Color b,
float lambda)
{
var vecA = Unsafe.As<Color, Vector128<float>>(ref Unsafe.AsRef(a));
var vecB = Unsafe.As<Color, Vector128<float>>(ref Unsafe.AsRef(b));
vecB = Fma.MultiplyAdd(Sse.Subtract(vecB, vecA), Vector128.Create(lambda), vecA);
return Unsafe.As<Vector128<float>, Color>(ref vecB);
}
#endif
}
}

View File

@@ -25,12 +25,12 @@ namespace Content.Client.Chat
private ILocalizationManager localize = IoCManager.Resolve<ILocalizationManager>();
public LineEdit Input { get; private set; }
public OutputPanel contents;
public OutputPanel Contents { get; }
// Buttons for filtering
public Button AllButton;
public Button LocalButton;
public Button OOCButton;
public Button AllButton { get; }
public Button LocalButton { get; }
public Button OOCButton { get; }
/// <summary>
/// Index while cycling through the input history. -1 means not going through history.
@@ -49,10 +49,8 @@ namespace Content.Client.Chat
public bool ReleaseFocusOnEnter { get; set; } = true;
protected override void Initialize()
public ChatBox()
{
base.Initialize();
MarginLeft = -475.0f;
MarginTop = 10.0f;
MarginRight = -10.0f;
@@ -80,8 +78,8 @@ namespace Content.Client.Chat
MarginLeftOverride = 4, MarginRightOverride = 4,
SizeFlagsVertical = SizeFlags.FillExpand
};
contents = new OutputPanel();
contentMargin.AddChild(contents);
Contents = new OutputPanel();
contentMargin.AddChild(Contents);
vBox.AddChild(contentMargin);
Input = new LineEdit();
@@ -182,18 +180,6 @@ namespace Content.Client.Chat
}
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (disposing)
{
TextSubmitted = null;
Input = null;
contents = null;
}
}
public event TextSubmitHandler TextSubmitted;
public event FilterToggledHandler FilterToggled;
@@ -209,7 +195,7 @@ namespace Content.Client.Chat
formatted.PushColor(color);
formatted.AddText(message);
formatted.Pop();
contents.AddMessage(formatted);
Contents.AddMessage(formatted);
}
private void Input_OnTextEntered(LineEdit.LineEditEventArgs args)

View File

@@ -1,7 +1,6 @@
using System.Collections.Generic;
using Content.Client.Interfaces.Chat;
using Content.Shared.Chat;
using Robust.Client;
using Robust.Client.Console;
using Robust.Client.Interfaces.Graphics.ClientEye;
using Robust.Client.Interfaces.UserInterface;
@@ -274,7 +273,7 @@ namespace Content.Client.Chat
private void RepopulateChat(IEnumerable<StoredChatMessage> filteredMessages)
{
_currentChatBox.contents.Clear();
_currentChatBox.Contents.Clear();
foreach (var msg in filteredMessages)
{

View File

@@ -1,5 +1,4 @@
using Content.Client.Interfaces.Chat;
using Robust.Client;
using Robust.Client.Interfaces.Graphics.ClientEye;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
@@ -32,14 +31,14 @@ namespace Content.Client.Chat
private readonly IEntity _senderEntity;
private readonly IChatManager _chatManager;
private Control _panel;
private readonly Control _panel;
private float _timeLeft = TotalTime;
public float VerticalOffset { get; set; }
private float _verticalOffsetAchieved;
public float ContentHeight { get; }
public float ContentHeight { get; private set; }
public SpeechBubble(string text, IEntity senderEntity, IEyeManager eyeManager, IChatManager chatManager)
{
@@ -68,6 +67,8 @@ namespace Content.Client.Chat
AddChild(_panel);
ForceRunStyleUpdate();
_panel.Size = _panel.CombinedMinimumSize;
ContentHeight = _panel.Height;
Size = (_panel.Width, 0);

View File

@@ -85,14 +85,11 @@ namespace Content.Client
private float _timeLeft;
public Vector2 InitialPos { get; set; }
protected override void Initialize()
public PopupLabel()
{
base.Initialize();
ShadowOffsetXOverride = 1;
ShadowOffsetYOverride = 1;
FontColorShadowOverride = Color.Black;
}
public void Update(FrameEventArgs eventArgs)

View File

@@ -3,60 +3,48 @@ using System.Collections.Generic;
using System.Linq;
using Content.Client.GameObjects.Components.Construction;
using Content.Shared.Construction;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Interfaces.GameObjects;
using Robust.Client.Interfaces.Graphics;
using Robust.Client.Interfaces.Placement;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.Placement;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.Utility;
using Robust.Shared.Enums;
using Robust.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
namespace Content.Client.Construction
{
public class ConstructionMenu : SS14Window
{
#pragma warning disable CS0649
[Dependency]
readonly IPrototypeManager PrototypeManager;
[Dependency]
readonly IResourceCache ResourceCache;
[Dependency] readonly IPrototypeManager PrototypeManager;
[Dependency] readonly IResourceCache ResourceCache;
#pragma warning restore
public ConstructorComponent Owner { get; set; }
Button BuildButton;
Button EraseButton;
LineEdit SearchBar;
Tree RecipeList;
TextureRect InfoIcon;
Label InfoLabel;
ItemList StepList;
private readonly Button BuildButton;
private readonly Button EraseButton;
private readonly LineEdit SearchBar;
private readonly Tree RecipeList;
private readonly TextureRect InfoIcon;
private readonly Label InfoLabel;
private readonly ItemList StepList;
private CategoryNode RootCategory;
CategoryNode RootCategory;
// This list is flattened in such a way that the top most deepest category is first.
List<CategoryNode> FlattenedCategories;
PlacementManager Placement;
private List<CategoryNode> FlattenedCategories;
private readonly PlacementManager Placement;
public ConstructionMenu()
{
Size = new Vector2(500.0f, 350.0f);
}
Size = (500, 350);
protected override void Initialize()
{
base.Initialize();
IoCManager.InjectDependencies(this);
Placement = (PlacementManager) IoCManager.Resolve<IPlacementManager>();
Placement.PlacementCanceled += OnPlacementCanceled;
@@ -66,18 +54,18 @@ namespace Content.Client.Construction
var hSplitContainer = new HSplitContainer();
// Left side
var recipes = new VBoxContainer("Recipes") {CustomMinimumSize = new Vector2(150.0f, 0.0f)};
SearchBar = new LineEdit("Search") {PlaceHolder = "Search"};
RecipeList = new Tree("Tree") {SizeFlagsVertical = SizeFlags.FillExpand, HideRoot = true};
var recipes = new VBoxContainer {CustomMinimumSize = new Vector2(150.0f, 0.0f)};
SearchBar = new LineEdit {PlaceHolder = "Search"};
RecipeList = new Tree {SizeFlagsVertical = SizeFlags.FillExpand, HideRoot = true};
recipes.AddChild(SearchBar);
recipes.AddChild(RecipeList);
hSplitContainer.AddChild(recipes);
// Right side
var guide = new VBoxContainer("Guide");
var info = new HBoxContainer("Info");
InfoIcon = new TextureRect("TextureRect");
InfoLabel = new Label("Label")
var guide = new VBoxContainer();
var info = new HBoxContainer();
InfoIcon = new TextureRect();
InfoLabel = new Label
{
SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.ShrinkCenter
};
@@ -85,7 +73,7 @@ namespace Content.Client.Construction
info.AddChild(InfoLabel);
guide.AddChild(info);
var stepsLabel = new Label("Label")
var stepsLabel = new Label
{
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
@@ -93,14 +81,14 @@ namespace Content.Client.Construction
};
guide.AddChild(stepsLabel);
StepList = new ItemList("StepsList")
StepList = new ItemList
{
SizeFlagsVertical = SizeFlags.FillExpand, SelectMode = ItemList.ItemListSelectMode.None
};
guide.AddChild(StepList);
var buttonsContainer = new HBoxContainer("Buttons");
BuildButton = new Button("BuildButton")
var buttonsContainer = new HBoxContainer();
BuildButton = new Button
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
TextAlign = Button.AlignMode.Center,
@@ -108,7 +96,7 @@ namespace Content.Client.Construction
Disabled = true,
ToggleMode = false
};
EraseButton = new Button("EraseButton")
EraseButton = new Button
{
TextAlign = Button.AlignMode.Center, Text = "Clear Ghosts", ToggleMode = true
};
@@ -163,6 +151,7 @@ namespace Content.Client.Construction
{
continue;
}
Texture icon;
string text;
switch (forward)
@@ -171,20 +160,24 @@ namespace Content.Client.Construction
switch (mat.Material)
{
case ConstructionStepMaterial.MaterialType.Metal:
icon = ResourceCache.GetResource<TextureResource>("/Textures/Objects/sheet_metal.png");
icon = ResourceCache.GetResource<TextureResource>(
"/Textures/Objects/sheet_metal.png");
text = $"Metal x{mat.Amount}";
break;
case ConstructionStepMaterial.MaterialType.Glass:
icon = ResourceCache.GetResource<TextureResource>("/Textures/Objects/sheet_glass.png");
icon = ResourceCache.GetResource<TextureResource>(
"/Textures/Objects/sheet_glass.png");
text = $"Glass x{mat.Amount}";
break;
case ConstructionStepMaterial.MaterialType.Cable:
icon = ResourceCache.GetResource<TextureResource>("/Textures/Objects/cable_coil.png");
icon = ResourceCache.GetResource<TextureResource>(
"/Textures/Objects/cable_coil.png");
text = $"Cable Coil x{mat.Amount}";
break;
default:
throw new NotImplementedException();
}
break;
case ConstructionStepTool tool:
switch (tool.Tool)
@@ -198,20 +191,24 @@ namespace Content.Client.Construction
text = "Crowbar";
break;
case ConstructionStepTool.ToolType.Screwdriver:
icon = ResourceCache.GetResource<TextureResource>("/Textures/Objects/screwdriver.png");
icon = ResourceCache.GetResource<TextureResource>(
"/Textures/Objects/screwdriver.png");
text = "Screwdriver";
break;
case ConstructionStepTool.ToolType.Welder:
icon = ResourceCache.GetResource<RSIResource>("/Textures/Objects/tools.rsi").RSI["welder"].Frame0;
icon = ResourceCache.GetResource<RSIResource>("/Textures/Objects/tools.rsi")
.RSI["welder"].Frame0;
text = $"Welding tool ({tool.Amount} fuel)";
break;
case ConstructionStepTool.ToolType.Wirecutters:
icon = ResourceCache.GetResource<TextureResource>("/Textures/Objects/wirecutter.png");
icon = ResourceCache.GetResource<TextureResource>(
"/Textures/Objects/wirecutter.png");
text = "Wirecutters";
break;
default:
throw new NotImplementedException();
}
break;
default:
throw new NotImplementedException();
@@ -278,6 +275,7 @@ namespace Content.Client.Construction
subNode = new CategoryNode(category, currentNode);
currentNode.ChildCategories.Add(category, subNode);
}
currentNode = subNode;
}
@@ -356,6 +354,7 @@ namespace Content.Client.Construction
continue;
}
}
var subItem = RecipeList.CreateItem(ItemForNode(node));
subItem.Text = prototype.Name;
subItem.Metadata = prototype;
@@ -377,7 +376,10 @@ namespace Content.Client.Construction
{
public readonly string Name;
public readonly CategoryNode Parent;
public SortedDictionary<string, CategoryNode> ChildCategories = new SortedDictionary<string, CategoryNode>();
public SortedDictionary<string, CategoryNode>
ChildCategories = new SortedDictionary<string, CategoryNode>();
public List<ConstructionPrototype> Prototypes = new List<ConstructionPrototype>();
public int FlattenedIndex = -1;

View File

@@ -11,8 +11,8 @@ using Content.Client.UserInterface;
using Content.Shared.GameObjects.Components.Chemistry;
using Content.Shared.GameObjects.Components.Markers;
using Content.Shared.GameObjects.Components.Research;
using Content.Shared.GameObjects.Components.VendingMachines;
using Content.Shared.Interfaces;
using Robust.Client;
using Robust.Client.Interfaces;
using Robust.Client.Interfaces.Graphics.Overlays;
using Robust.Client.Interfaces.Input;
@@ -42,6 +42,7 @@ namespace Content.Client
var registerIgnore = new[]
{
"Breakable",
"Interactable",
"Destructible",
"Temperature",
@@ -94,6 +95,7 @@ namespace Content.Client
"PowerCell",
"AiController",
"PlayerInputMover",
"Computer"
};
foreach (var ignoreName in registerIgnore)
@@ -105,6 +107,8 @@ namespace Content.Client
factory.Register<SharedSpawnPointComponent>();
factory.Register<SolutionComponent>();
factory.Register<SharedVendingMachineComponent>();
prototypes.RegisterIgnore("material");
IoCManager.Register<IGameHud, GameHud>();

View File

@@ -0,0 +1,76 @@
using Content.Shared.GameObjects.Components;
using Robust.Client.GameObjects;
using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Utility;
using YamlDotNet.RepresentationModel;
namespace Content.Client.GameObjects.Components
{
public sealed class ComputerVisualizer2D : AppearanceVisualizer
{
private string KeyboardState = "generic_key";
private string ScreenState = "generic";
public override void LoadData(YamlMappingNode node)
{
base.LoadData(node);
if (node.TryGetNode("key", out var scalar))
{
KeyboardState = scalar.AsString();
}
if (node.TryGetNode("screen", out scalar))
{
ScreenState = scalar.AsString();
}
}
public override void InitializeEntity(IEntity entity)
{
base.InitializeEntity(entity);
var sprite = entity.GetComponent<ISpriteComponent>();
sprite.LayerSetState(Layers.Screen, ScreenState);
sprite.LayerSetState(Layers.Keyboard, $"{KeyboardState}_off");
sprite.LayerSetState(Layers.KeyboardOn, KeyboardState);
}
public override void OnChangeData(AppearanceComponent component)
{
base.OnChangeData(component);
var sprite = component.Owner.GetComponent<ISpriteComponent>();
if (!component.TryGetData(ComputerVisuals.Powered, out bool powered))
{
powered = true;
}
component.TryGetData(ComputerVisuals.Broken, out bool broken);
if (broken)
{
sprite.LayerSetState(Layers.Body, "broken");
sprite.LayerSetState(Layers.Screen, "computer_broken");
}
else
{
sprite.LayerSetState(Layers.Body, "computer");
sprite.LayerSetState(Layers.Screen, ScreenState);
}
sprite.LayerSetVisible(Layers.Screen, powered);
sprite.LayerSetVisible(Layers.KeyboardOn, powered);
}
public enum Layers
{
Body,
Screen,
Keyboard,
KeyboardOn
}
}
}

View File

@@ -43,7 +43,7 @@ namespace Content.Client.GameObjects
base.Initialize();
_window = new HumanInventoryWindow(_loc, _resourceCache);
_window.OnClose += () => GameHud.InventoryButtonDown = false;
foreach (var (slot, button) in _window.Buttons)
{
button.OnPressed = AddToInventory;
@@ -185,7 +185,7 @@ namespace Content.Client.GameObjects
// Right column
AddButton(Slots.EARS, "ears", (2 * (size + sep), 0));
AddButton(Slots.IDCARD, "mask", (2 * (size + sep), size + sep));
AddButton(Slots.IDCARD, "id", (2 * (size + sep), size + sep));
AddButton(Slots.GLOVES, "gloves", (2 * (size + sep), 2 * (size + sep)));
// Far right column.

View File

@@ -1,18 +1,13 @@
using System;
using Content.Client.UserInterface;
using Content.Shared.GameObjects.Components.Power;
using NJsonSchema.Validation;
using OpenTK.Graphics.OpenGL4;
using Robust.Client.GameObjects.Components.UserInterface;
using Robust.Client.Graphics.Drawing;
using Robust.Client.Interfaces.Graphics;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.GameObjects.Components.UserInterface;
using Robust.Shared.IoC;
using Robust.Shared.Maths;
using Robust.Shared.Utility;
namespace Content.Client.GameObjects.Components.Power
{
@@ -72,24 +67,24 @@ namespace Content.Client.GameObjects.Components.Power
_chargeBar.Value = castState.Charge;
UpdateChargeBarColor(castState.Charge);
float ChargePercentage = (castState.Charge / _chargeBar.MaxValue) * 100.0f;
_window.ChargePercentage.Text = " " + ChargePercentage.ToString("0.00") + "%";
var chargePercentage = (castState.Charge / _chargeBar.MaxValue) * 100.0f;
_window.ChargePercentage.Text = " " + chargePercentage.ToString("0.00") + "%";
}
private void UpdateChargeBarColor(float charge)
{
float normalizedCharge = charge / _chargeBar.MaxValue;
var normalizedCharge = charge / _chargeBar.MaxValue;
float leftHue = 0.0f;// Red
float middleHue = 0.066f;// Orange
float rightHue = 0.33f;// Green
float saturation = 1.0f;// Uniform saturation
float value = 0.8f;// Uniform value / brightness
float alpha = 1.0f;// Uniform alpha
const float leftHue = 0.0f; // Red
const float middleHue = 0.066f; // Orange
const float rightHue = 0.33f; // Green
const float saturation = 1.0f; // Uniform saturation
const float value = 0.8f; // Uniform value / brightness
const float alpha = 1.0f; // Uniform alpha
// These should add up to 1.0 or your transition won't be smooth
float leftSideSize = 0.5f;// Fraction of _chargeBar lerped from leftHue to middleHue
float rightSideSize = 0.5f;// Fraction of _chargeBar lerped from middleHue to rightHue
const float leftSideSize = 0.5f; // Fraction of _chargeBar lerped from leftHue to middleHue
const float rightSideSize = 0.5f; // Fraction of _chargeBar lerped from middleHue to rightHue
float finalHue;
if (normalizedCharge <= leftSideSize)
@@ -134,29 +129,29 @@ namespace Content.Client.GameObjects.Components.Power
public ApcWindow()
{
Title = "APC";
var rows = new VBoxContainer("Rows");
var rows = new VBoxContainer();
var statusHeader = new Label("StatusHeader") { Text = "Power Status: " };
var statusHeader = new Label {Text = "Power Status: "};
rows.AddChild(statusHeader);
var breaker = new HBoxContainer("Breaker");
var breakerLabel = new Label("Label") { Text = "Main Breaker: " };
BreakerButton = new CheckButton {Name = "Breaker", Text = "Toggle"};
var breaker = new HBoxContainer();
var breakerLabel = new Label {Text = "Main Breaker: "};
BreakerButton = new CheckButton {Text = "Toggle"};
breaker.AddChild(breakerLabel);
breaker.AddChild(BreakerButton);
rows.AddChild(breaker);
var externalStatus = new HBoxContainer("ExternalStatus");
var externalStatusLabel = new Label("Label") { Text = "External Power: " };
ExternalPowerStateLabel = new Label("Status") { Text = "Good" };
var externalStatus = new HBoxContainer();
var externalStatusLabel = new Label {Text = "External Power: "};
ExternalPowerStateLabel = new Label {Text = "Good"};
ExternalPowerStateLabel.SetOnlyStyleClass(NanoStyle.StyleClassPowerStateGood);
externalStatus.AddChild(externalStatusLabel);
externalStatus.AddChild(ExternalPowerStateLabel);
rows.AddChild(externalStatus);
var charge = new HBoxContainer("Charge");
var chargeLabel = new Label("Label") { Text = "Charge:" };
ChargeBar = new ProgressBar("Charge")
var charge = new HBoxContainer();
var chargeLabel = new Label {Text = "Charge:"};
ChargeBar = new ProgressBar
{
SizeFlagsHorizontal = Control.SizeFlags.FillExpand,
MinValue = 0.0f,
@@ -164,7 +159,7 @@ namespace Content.Client.GameObjects.Components.Power
Page = 0.0f,
Value = 0.5f
};
ChargePercentage = new Label("ChargePercentage");
ChargePercentage = new Label();
charge.AddChild(chargeLabel);
charge.AddChild(ChargeBar);
charge.AddChild(ChargePercentage);

View File

@@ -44,7 +44,8 @@ namespace Content.Client.GameObjects.Components.Storage
base.ExposeData(serializer);
}
public override void HandleMessage(ComponentMessage message, INetChannel netChannel = null, IComponent component = null)
public override void HandleMessage(ComponentMessage message, INetChannel netChannel = null,
IComponent component = null)
{
switch (message)
{
@@ -108,32 +109,27 @@ namespace Content.Client.GameObjects.Components.Storage
public StorageWindow()
{
Size = new Vector2(180.0f, 320.0f);
}
protected override void Initialize()
{
base.Initialize();
Size = (180, 320);
Title = "Storage Item";
RectClipContent = true;
VSplitContainer = new VBoxContainer("VSplitContainer");
Information = new Label("Information")
VSplitContainer = new VBoxContainer();
Information = new Label
{
Text = "Items: 0 Volume: 0/0 Stuff",
SizeFlagsVertical = SizeFlags.ShrinkCenter
};
VSplitContainer.AddChild(Information);
var listScrollContainer = new ScrollContainer("ListScrollContainer")
var listScrollContainer = new ScrollContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
HScrollEnabled = true,
VScrollEnabled = true
};
EntityList = new VBoxContainer("EntityList")
EntityList = new VBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand
};
@@ -182,7 +178,8 @@ namespace Content.Client.GameObjects.Components.Storage
//Sets information about entire storage container current capacity
if (StorageEntity.StorageCapacityMax != 0)
{
Information.Text = String.Format("Items: {0}, Stored: {1}/{2}", storagelist.Count, StorageEntity.StorageSizeUsed, StorageEntity.StorageCapacityMax);
Information.Text = String.Format("Items: {0}, Stored: {1}/{2}", storagelist.Count,
StorageEntity.StorageSizeUsed, StorageEntity.StorageCapacityMax);
}
else
{
@@ -208,17 +205,15 @@ namespace Content.Client.GameObjects.Components.Storage
private class EntityButton : PanelContainer
{
public EntityUid EntityuID { get; set; }
public Button ActualButton { get; private set; }
public SpriteView EntitySpriteView { get; private set; }
public Control EntityControl { get; private set; }
public Label EntityName { get; private set; }
public Label EntitySize { get; private set; }
public Button ActualButton { get; }
public SpriteView EntitySpriteView { get; }
public Control EntityControl { get; }
public Label EntityName { get; }
public Label EntitySize { get; }
protected override void Initialize()
public EntityButton()
{
base.Initialize();
ActualButton = new Button("Button")
ActualButton = new Button
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
@@ -227,12 +222,12 @@ namespace Content.Client.GameObjects.Components.Storage
};
AddChild(ActualButton);
var hBoxContainer = new HBoxContainer("HBoxContainer") {MouseFilter = MouseFilterMode.Ignore};
EntitySpriteView = new SpriteView("SpriteView")
var hBoxContainer = new HBoxContainer {MouseFilter = MouseFilterMode.Ignore};
EntitySpriteView = new SpriteView
{
CustomMinimumSize = new Vector2(32.0f, 32.0f), MouseFilter = MouseFilterMode.Ignore
};
EntityName = new Label("Name")
EntityName = new Label
{
SizeFlagsVertical = SizeFlags.ShrinkCenter,
Text = "Backpack",
@@ -241,11 +236,11 @@ namespace Content.Client.GameObjects.Components.Storage
hBoxContainer.AddChild(EntitySpriteView);
hBoxContainer.AddChild(EntityName);
EntityControl = new Control("Control")
EntityControl = new Control
{
SizeFlagsHorizontal = SizeFlags.FillExpand, MouseFilter = MouseFilterMode.Ignore
};
EntitySize = new Label("Size")
EntitySize = new Label
{
SizeFlagsVertical = SizeFlags.ShrinkCenter,
Text = "Size 6",

View File

@@ -0,0 +1,68 @@
using Content.Client.VendingMachines;
using Content.Shared.GameObjects.Components.VendingMachines;
using Robust.Client.GameObjects.Components.UserInterface;
using Robust.Shared.GameObjects.Components.UserInterface;
using Robust.Shared.IoC;
using Robust.Shared.Prototypes;
using Robust.Shared.ViewVariables;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Content.Client.GameObjects.Components.VendingMachines
{
class VendingMachineBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private VendingMachineMenu _menu;
public SharedVendingMachineComponent VendingMachine { get; private set; }
public VendingMachineBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
{
SendMessage(new SharedVendingMachineComponent.InventorySyncRequestMessage());
}
protected override void Open()
{
base.Open();
if(!Owner.Owner.TryGetComponent(out SharedVendingMachineComponent vendingMachine))
{
return;
}
VendingMachine = vendingMachine;
_menu = new VendingMachineMenu() { Owner = this, Title = Owner.Owner.Name };
_menu.Populate(VendingMachine.Inventory);
_menu.OnClose += Close;
_menu.OpenCentered();
}
public void Eject(string ID)
{
SendMessage(new SharedVendingMachineComponent.VendingMachineEjectMessage(ID));
}
protected override void ReceiveMessage(BoundUserInterfaceMessage message)
{
switch(message)
{
case SharedVendingMachineComponent.VendingMachineInventoryMessage msg:
_menu.Populate(msg.Inventory);
break;
}
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if(!disposing) { return; }
_menu?.Dispose();
}
}
}

View File

@@ -0,0 +1,99 @@
using System;
using Content.Client.GameObjects.Components.Doors;
using Robust.Client.Animations;
using Robust.Client.GameObjects;
using Robust.Client.GameObjects.Components.Animations;
using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Shared.Interfaces.GameObjects;
using YamlDotNet.RepresentationModel;
using static Content.Shared.GameObjects.Components.VendingMachines.SharedVendingMachineComponent;
namespace Content.Client.GameObjects.Components.VendingMachines
{
public class VendingMachineVisualizer2D : AppearanceVisualizer
{
// TODO: The length of these animations is supposed to be dictated
// by the vending machine's pack prototype's `AnimationDuration`
// but we have no good way of passing that data from the server
// to the client at the moment. Rework Visualizers?
private const string DeniedAnimationKey = "deny";
private const string EjectAnimationKey = "eject";
private Animation _deniedAnimation;
private Animation _ejectAnimation;
public override void LoadData(YamlMappingNode node)
{
base.LoadData(node);
_deniedAnimation = new Animation {Length = TimeSpan.FromSeconds(1.2f)};
{
var flick = new AnimationTrackSpriteFlick();
_deniedAnimation.AnimationTracks.Add(flick);
flick.LayerKey = VendingMachineVisualLayers.Base;
flick.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame("deny", 0f));
}
_ejectAnimation = new Animation {Length = TimeSpan.FromSeconds(1.2f)};
{
var flick = new AnimationTrackSpriteFlick();
_ejectAnimation.AnimationTracks.Add(flick);
flick.LayerKey = VendingMachineVisualLayers.Base;
flick.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame("eject", 0f));
}
}
public override void InitializeEntity(IEntity entity)
{
base.InitializeEntity(entity);
if (!entity.HasComponent<AnimationPlayerComponent>())
{
entity.AddComponent<AnimationPlayerComponent>();
}
}
public override void OnChangeData(AppearanceComponent component)
{
var sprite = component.Owner.GetComponent<ISpriteComponent>();
var animPlayer = component.Owner.GetComponent<AnimationPlayerComponent>();
if (!component.TryGetData(VendingMachineVisuals.VisualState, out VendingMachineVisualState state))
{
state = VendingMachineVisualState.Normal;
}
switch (state)
{
case VendingMachineVisualState.Normal:
sprite.LayerSetState(VendingMachineVisualLayers.Base, "normal");
break;
case VendingMachineVisualState.Off:
sprite.LayerSetState(VendingMachineVisualLayers.Base, "off");
break;
case VendingMachineVisualState.Broken:
sprite.LayerSetState(VendingMachineVisualLayers.Base, "broken");
break;
case VendingMachineVisualState.Deny:
if (!animPlayer.HasRunningAnimation(DeniedAnimationKey))
{
animPlayer.Play(_deniedAnimation, DeniedAnimationKey);
}
break;
case VendingMachineVisualState.Eject:
if (!animPlayer.HasRunningAnimation(EjectAnimationKey))
{
animPlayer.Play(_ejectAnimation, EjectAnimationKey);
}
break;
default:
throw new ArgumentOutOfRangeException();
}
}
public enum VendingMachineVisualLayers
{
Base,
}
}
}

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.EntitySystemMessages;
using Content.Shared.Input;
@@ -66,7 +65,7 @@ namespace Content.Client.GameObjects.EntitySystems
_currentPopup = new Popup();
_currentPopup.UserInterfaceManager.StateRoot.AddChild(_currentPopup);
_currentPopup.OnPopupHide += _closeContextMenu;
var vBox = new VBoxContainer("ButtonBox");
var vBox = new VBoxContainer();
_currentPopup.AddChild(vBox);
vBox.AddChild(new Label {Text = "Waiting on Server..."});
@@ -94,7 +93,7 @@ namespace Content.Client.GameObjects.EntitySystems
_currentPopup = new Popup();
_currentPopup.OnPopupHide += _closeContextMenu;
var vBox = new VBoxContainer("ButtonBox");
var vBox = new VBoxContainer();
_currentPopup.AddChild(vBox);
foreach (var entity in entities)
{

View File

@@ -2,8 +2,6 @@ using System.Collections.Generic;
using Content.Client.GameObjects.Components.Research;
using Content.Shared.Materials;
using Content.Shared.Research;
using Robust.Client.Interfaces.Graphics;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
@@ -19,8 +17,7 @@ namespace Content.Client.Research
public class LatheMenu : SS14Window
{
#pragma warning disable CS0649
[Dependency]
private IPrototypeManager PrototypeManager;
[Dependency] private IPrototypeManager PrototypeManager;
#pragma warning restore
private ItemList Items;
@@ -37,15 +34,6 @@ namespace Content.Client.Research
public LatheMenu()
{
}
public LatheMenu(string name) : base(name)
{
}
protected override void Initialize()
{
base.Initialize();
IoCManager.InjectDependencies(this);
Title = "Lathe Menu";
@@ -62,15 +50,15 @@ namespace Content.Client.Research
margin.SetAnchorAndMarginPreset(LayoutPreset.Wide);
var vbox = new VBoxContainer()
var vBox = new VBoxContainer()
{
SizeFlagsVertical = SizeFlags.FillExpand,
SeparationOverride = 5,
};
vbox.SetAnchorAndMarginPreset(LayoutPreset.Wide);
vBox.SetAnchorAndMarginPreset(LayoutPreset.Wide);
var hboxButtons = new HBoxContainer()
var hBoxButtons = new HBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
@@ -93,7 +81,7 @@ namespace Content.Client.Research
spacer.SetAnchorAndMarginPreset(LayoutPreset.Wide);
var hboxFilter = new HBoxContainer()
var hBoxFilter = new HBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
@@ -124,8 +112,6 @@ namespace Content.Client.Research
SizeFlagsVertical = SizeFlags.FillExpand,
};
Items.OnItemSelected += ItemSelected;
AmountLineEdit = new LineEdit()
@@ -143,19 +129,19 @@ namespace Content.Client.Research
SizeFlagsStretchRatio = 3
};
hboxButtons.AddChild(spacer);
hboxButtons.AddChild(QueueButton);
hBoxButtons.AddChild(spacer);
hBoxButtons.AddChild(QueueButton);
hboxFilter.AddChild(SearchBar);
hboxFilter.AddChild(filterButton);
hBoxFilter.AddChild(SearchBar);
hBoxFilter.AddChild(filterButton);
vbox.AddChild(hboxButtons);
vbox.AddChild(hboxFilter);
vbox.AddChild(Items);
vbox.AddChild(AmountLineEdit);
vbox.AddChild(Materials);
vBox.AddChild(hBoxButtons);
vBox.AddChild(hBoxFilter);
vBox.AddChild(Items);
vBox.AddChild(AmountLineEdit);
vBox.AddChild(Materials);
margin.AddChild(vbox);
margin.AddChild(vBox);
Contents.AddChild(margin);
}

View File

@@ -1,13 +1,9 @@
using Content.Client.GameObjects.Components.Research;
using Content.Shared.Research;
using Robust.Client.Graphics;
using Robust.Client.Graphics.Drawing;
using Robust.Client.Interfaces.Graphics;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.Utility;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Maths;
using Robust.Shared.ViewVariables;
@@ -25,10 +21,8 @@ namespace Content.Client.Research
private Label Description;
private TextureRect Icon;
protected override void Initialize()
public LatheQueueMenu()
{
base.Initialize();
Title = "Lathe Queue";
var margin = new MarginContainer()
@@ -41,9 +35,9 @@ namespace Content.Client.Research
margin.SetAnchorAndMarginPreset(LayoutPreset.Wide);
var vbox = new VBoxContainer();
var vBox = new VBoxContainer();
vbox.SetAnchorAndMarginPreset(LayoutPreset.Wide);
vBox.SetAnchorAndMarginPreset(LayoutPreset.Wide);
var descMargin = new MarginContainer()
{
@@ -55,7 +49,7 @@ namespace Content.Client.Research
SizeFlagsStretchRatio = 2,
};
var hbox = new HBoxContainer()
var hBox = new HBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
};
@@ -66,7 +60,7 @@ namespace Content.Client.Research
SizeFlagsStretchRatio = 2,
};
var vboxInfo = new VBoxContainer()
var vBoxInfo = new VBoxContainer()
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsStretchRatio = 3,
@@ -94,18 +88,18 @@ namespace Content.Client.Research
SelectMode = ItemList.ItemListSelectMode.None
};
vboxInfo.AddChild(NameLabel);
vboxInfo.AddChild(Description);
vBoxInfo.AddChild(NameLabel);
vBoxInfo.AddChild(Description);
hbox.AddChild(Icon);
hbox.AddChild(vboxInfo);
hBox.AddChild(Icon);
hBox.AddChild(vBoxInfo);
descMargin.AddChild(hbox);
descMargin.AddChild(hBox);
vbox.AddChild(descMargin);
vbox.AddChild(QueueList);
vBox.AddChild(descMargin);
vBox.AddChild(QueueList);
margin.AddChild(vbox);
margin.AddChild(vBox);
Contents.AddChild(margin);

View File

@@ -39,14 +39,12 @@ namespace Content.Client.UserInterface
private UIBox2i _handL;
private UIBox2i _handR;
private SpriteView LeftSpriteView;
private SpriteView RightSpriteView;
private TextureRect ActiveHandRect;
private readonly SpriteView LeftSpriteView;
private readonly SpriteView RightSpriteView;
private readonly TextureRect ActiveHandRect;
protected override void Initialize()
public HandsGui()
{
base.Initialize();
IoCManager.InjectDependencies(this);
ToolTip = _loc.GetString("Your hands");

View File

@@ -0,0 +1,65 @@
using Content.Client.GameObjects.Components.VendingMachines;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.IoC;
using Robust.Shared.Maths;
using System.Collections.Generic;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Shared.GameObjects;
using Robust.Shared.Prototypes;
using static Content.Shared.GameObjects.Components.VendingMachines.SharedVendingMachineComponent;
namespace Content.Client.VendingMachines
{
class VendingMachineMenu : SS14Window
{
protected override Vector2? CustomSize => (300, 450);
private readonly ItemList _items;
private List<VendingMachineInventoryEntry> _cachedInventory;
#pragma warning disable CS0649
[Dependency]
private IResourceCache _resourceCache;
[Dependency]
private readonly IPrototypeManager _prototypeManager;
#pragma warning restore
public VendingMachineBoundUserInterface Owner { get; set; }
public VendingMachineMenu()
{
IoCManager.InjectDependencies(this);
_items = new ItemList()
{
SizeFlagsStretchRatio = 8,
SizeFlagsVertical = SizeFlags.FillExpand,
};
_items.OnItemSelected += ItemSelected;
Contents.AddChild(_items);
}
public void Populate(List<VendingMachineInventoryEntry> inventory)
{
_items.Clear();
_cachedInventory = inventory;
foreach (VendingMachineInventoryEntry entry in inventory)
{
Texture icon = null;
if(_prototypeManager.TryIndex(entry.ID, out EntityPrototype prototype))
{
icon = IconComponent.GetPrototypeIcon(prototype, _resourceCache).TextureFor(Direction.South);
}
_items.AddItem($"{entry.ID} ({entry.Amount} left)", icon);
}
}
public void ItemSelected(ItemList.ItemListSelectedEventArgs args)
{
Owner.Eject(_cachedInventory[args.ItemIndex].ID);
}
}
}

View File

@@ -0,0 +1,34 @@
using Content.Server.GameObjects.Components.Power;
using Content.Shared.GameObjects.Components;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
namespace Content.Server.GameObjects.Components
{
[RegisterComponent]
public sealed class ComputerComponent : SharedComputerComponent
{
public override void Initialize()
{
base.Initialize();
if (Owner.TryGetComponent(out PowerDeviceComponent powerDevice))
{
powerDevice.OnPowerStateChanged += PowerDeviceOnOnPowerStateChanged;
if (Owner.TryGetComponent(out AppearanceComponent appearance))
{
appearance.SetData(ComputerVisuals.Powered, powerDevice.Powered);
}
}
}
private void PowerDeviceOnOnPowerStateChanged(object sender, PowerStateEventArgs e)
{
if (Owner.TryGetComponent(out AppearanceComponent appearance))
{
appearance.SetData(ComputerVisuals.Powered, e.Powered);
}
}
}
}

View File

@@ -0,0 +1,79 @@
using System;
using System.Collections.Generic;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces;
using Content.Shared.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
namespace Content.Server.GameObjects.Components.Damage
{
[RegisterComponent]
public class BreakableComponent : Component, IOnDamageBehavior, IExAct
{
#pragma warning disable 649
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
#pragma warning restore 649
/// <inheritdoc />
public override string Name => "Breakable";
public DamageThreshold Threshold { get; private set; }
public DamageType damageType = DamageType.Total;
public int damageValue = 0;
public bool broken = false;
private ActSystem _actSystem;
public override void ExposeData(ObjectSerializer serializer)
{
base.ExposeData(serializer);
serializer.DataField(ref damageValue, "thresholdvalue", 100);
serializer.DataField(ref damageType, "thresholdtype", DamageType.Total);
}
public override void Initialize()
{
base.Initialize();
_actSystem = _entitySystemManager.GetEntitySystem<ActSystem>();
}
public List<DamageThreshold> GetAllDamageThresholds()
{
Threshold = new DamageThreshold(damageType, damageValue, ThresholdType.Breakage);
return new List<DamageThreshold>() {Threshold};
}
public void OnDamageThresholdPassed(object obj, DamageThresholdPassedEventArgs e)
{
if (e.Passed && e.DamageThreshold == Threshold && broken == false)
{
broken = true;
_actSystem.HandleBreakage(Owner);
}
}
public void OnExplosion(ExplosionEventArgs eventArgs)
{
var prob = new Random();
switch (eventArgs.Severity)
{
case ExplosionSeverity.Destruction:
_actSystem.HandleBreakage(Owner);
break;
case ExplosionSeverity.Heavy:
_actSystem.HandleBreakage(Owner);
break;
case ExplosionSeverity.Light:
if(prob.Prob(40))
_actSystem.HandleBreakage(Owner);
break;
}
}
}
}

View File

@@ -43,7 +43,8 @@ namespace Content.Server.GameObjects
Destruction,
Death,
Critical,
HUDUpdate
HUDUpdate,
Breakage,
}
public class DamageThresholdPassedEventArgs : EventArgs

View File

@@ -43,6 +43,8 @@ namespace Content.Server.GameObjects
{
base.ExposeData(serializer);
serializer.DataField(ref _clothingEquippedPrefix, "ClothingPrefix", null);
// TODO: Writing.
serializer.DataReadFunction("Slots", new List<string>(0), list =>
{

View File

@@ -8,6 +8,7 @@ using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
namespace Content.Server.GameObjects
{
@@ -50,6 +51,13 @@ namespace Content.Server.GameObjects
}
}
public override void ExposeData(ObjectSerializer serializer)
{
base.ExposeData(serializer);
serializer.DataField(ref _equippedPrefix, "HeldPrefix", null);
}
public bool AttackHand(AttackHandEventArgs eventArgs)
{
var hands = eventArgs.User.GetComponent<IHandsComponent>();

View File

@@ -20,6 +20,8 @@ namespace Content.Server.GameObjects.Components.Projectiles
public Dictionary<DamageType, int> damages = new Dictionary<DamageType, int>();
public float TimeLeft { get; set; } = 10;
/// <summary>
/// Function that makes the collision of this object ignore a specific entity so we don't collide with ourselves
/// </summary>

View File

@@ -0,0 +1,194 @@
using System;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Components.VendingMachines;
using Content.Shared.VendingMachines;
using Robust.Server.GameObjects.Components.UserInterface;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components.UserInterface;
using Robust.Shared.IoC;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Timers;
using Robust.Shared.Utility;
using System.Collections.Generic;
using Content.Server.GameObjects.Components.Power;
using Robust.Server.GameObjects;
using Robust.Shared.Log;
namespace Content.Server.GameObjects.Components.VendingMachines
{
[RegisterComponent]
[ComponentReference(typeof(IActivate))]
public class VendingMachineComponent : SharedVendingMachineComponent, IActivate, IExamine, IBreakAct
{
private AppearanceComponent _appearance;
private BoundUserInterface _userInterface;
private PowerDeviceComponent _powerDevice;
private bool _ejecting = false;
private TimeSpan _animationDuration = TimeSpan.Zero;
private string _packPrototypeId;
private string _description;
private string _spriteName;
private bool Powered => _powerDevice.Powered;
private bool _broken = false;
public void Activate(ActivateEventArgs eventArgs)
{
if(!eventArgs.User.TryGetComponent(out IActorComponent actor))
{
return;
}
_userInterface.Open(actor.playerSession);
}
public override void ExposeData(ObjectSerializer serializer)
{
base.ExposeData(serializer);
serializer.DataField(ref _packPrototypeId, "pack", string.Empty);
}
private void InitializeFromPrototype()
{
if (string.IsNullOrEmpty(_packPrototypeId)) { return; }
var prototypeManger = IoCManager.Resolve<IPrototypeManager>();
if (!prototypeManger.TryIndex(_packPrototypeId, out VendingMachineInventoryPrototype packPrototype))
{
return;
}
Owner.Name = packPrototype.Name;
_description = packPrototype.Description;
_animationDuration = TimeSpan.FromSeconds(packPrototype.AnimationDuration);
_spriteName = packPrototype.SpriteName;
if (!string.IsNullOrEmpty(_spriteName))
{
var spriteComponent = Owner.GetComponent<SpriteComponent>();
const string vendingMachineRSIPath = "Buildings/VendingMachines/{0}.rsi";
spriteComponent.BaseRSIPath = string.Format(vendingMachineRSIPath, _spriteName);
}
var inventory = new List<VendingMachineInventoryEntry>();
foreach(var (id, amount) in packPrototype.StartingInventory)
{
inventory.Add(new VendingMachineInventoryEntry(id, amount));
}
Inventory = inventory;
}
public override void Initialize()
{
base.Initialize();
_appearance = Owner.GetComponent<AppearanceComponent>();
_userInterface = Owner.GetComponent<ServerUserInterfaceComponent>()
.GetBoundUserInterface(VendingMachineUiKey.Key);
_userInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
_powerDevice = Owner.GetComponent<PowerDeviceComponent>();
_powerDevice.OnPowerStateChanged += UpdatePower;
InitializeFromPrototype();
}
public override void OnRemove()
{
_appearance = null;
_powerDevice.OnPowerStateChanged -= UpdatePower;
_powerDevice = null;
base.OnRemove();
}
private void UpdatePower(object sender, PowerStateEventArgs args)
{
var state = args.Powered ? VendingMachineVisualState.Normal : VendingMachineVisualState.Off;
TrySetVisualState(state);
}
private void UserInterfaceOnOnReceiveMessage(BoundUserInterfaceMessage message)
{
switch (message)
{
case VendingMachineEjectMessage msg:
TryEject(msg.ID);
break;
case InventorySyncRequestMessage msg:
_userInterface.SendMessage(new VendingMachineInventoryMessage(Inventory));
break;
}
}
public void Examine(FormattedMessage message)
{
if(_description == null) { return; }
message.AddText(_description);
}
private void TryEject(string id)
{
if (_ejecting || _broken)
{
return;
}
VendingMachineInventoryEntry entry = Inventory.Find(x => x.ID == id);
if (entry == null)
{
FlickDenyAnimation();
return;
}
if (entry.Amount <= 0)
{
FlickDenyAnimation();
return;
}
_ejecting = true;
entry.Amount--;
_userInterface.SendMessage(new VendingMachineInventoryMessage(Inventory));
TrySetVisualState(VendingMachineVisualState.Eject);
Timer.Spawn(_animationDuration, () =>
{
TrySetVisualState(VendingMachineVisualState.Normal);
_ejecting = false;
Owner.EntityManager.SpawnEntityAt(id, Owner.Transform.GridPosition);
});
}
private void FlickDenyAnimation()
{
TrySetVisualState(VendingMachineVisualState.Deny);
//TODO: This duration should be a distinct value specific to the deny animation
Timer.Spawn(_animationDuration, () =>
{
TrySetVisualState(VendingMachineVisualState.Normal);
});
}
private void TrySetVisualState(VendingMachineVisualState state)
{
var finalState = state;
if (_broken)
{
finalState = VendingMachineVisualState.Broken;
} else if (_ejecting)
{
finalState = VendingMachineVisualState.Eject;
} else if (!Powered)
{
finalState = VendingMachineVisualState.Off;
}
_appearance.SetData(VendingMachineVisuals.VisualState, finalState);
}
public void OnBreak(BreakageEventArgs eventArgs)
{
_broken = true;
TrySetVisualState(VendingMachineVisualState.Broken);
}
}
}

View File

@@ -24,6 +24,19 @@ namespace Content.Server.GameObjects.EntitySystems
public bool IsSpawnWreck { get; set; }
}
public class BreakageEventArgs : EventArgs
{
public IEntity Owner { get; set; }
}
public interface IBreakAct
{
/// <summary>
/// Called when object is broken
/// </summary>
void OnBreak(BreakageEventArgs eventArgs);
}
public interface IExAct
{
/// <summary>
@@ -73,6 +86,19 @@ namespace Content.Server.GameObjects.EntitySystems
exAct.OnExplosion(eventArgs);
}
}
public void HandleBreakage(IEntity owner)
{
var eventArgs = new BreakageEventArgs
{
Owner = owner,
};
var breakActs = owner.GetAllComponents<IBreakAct>().ToList();
foreach (var breakAct in breakActs)
{
breakAct.OnBreak(eventArgs);
}
}
}
public enum ExplosionSeverity
{

View File

@@ -0,0 +1,34 @@
using Content.Server.GameObjects.Components.Projectiles;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
namespace Content.Server.GameObjects.EntitySystems
{
[UsedImplicitly]
internal sealed class ProjectileSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
EntityQuery = new TypeEntityQuery(typeof(ProjectileComponent));
}
public override void Update(float frameTime)
{
base.Update(frameTime);
foreach (var entity in RelevantEntities)
{
var component = entity.GetComponent<ProjectileComponent>();
component.TimeLeft -= frameTime;
if (component.TimeLeft <= 0)
{
entity.Delete();
}
}
}
}
}

View File

@@ -0,0 +1,21 @@
using System;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components
{
public class SharedComputerComponent : Component
{
public override string Name => "Computer";
}
[Serializable, NetSerializable]
public enum ComputerVisuals
{
// Bool
Powered,
// Bool
Broken
}
}

View File

@@ -0,0 +1,78 @@
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components.UserInterface;
using Robust.Shared.IoC;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
namespace Content.Shared.GameObjects.Components.VendingMachines
{
public class SharedVendingMachineComponent : Component
{
public override string Name => "VendingMachine";
public override uint? NetID => ContentNetIDs.VENDING_MACHINE;
public List<VendingMachineInventoryEntry> Inventory = new List<VendingMachineInventoryEntry>();
[Serializable, NetSerializable]
public enum VendingMachineVisuals
{
VisualState,
}
[Serializable, NetSerializable]
public enum VendingMachineVisualState
{
Normal,
Off,
Broken,
Eject,
Deny,
}
[Serializable, NetSerializable]
public class VendingMachineEjectMessage : BoundUserInterfaceMessage
{
public readonly string ID;
public VendingMachineEjectMessage(string id)
{
ID = id;
}
}
[Serializable, NetSerializable]
public enum VendingMachineUiKey
{
Key,
}
[Serializable, NetSerializable]
public class InventorySyncRequestMessage : BoundUserInterfaceMessage
{
}
[Serializable, NetSerializable]
public class VendingMachineInventoryMessage : BoundUserInterfaceMessage
{
public readonly List<VendingMachineInventoryEntry> Inventory;
public VendingMachineInventoryMessage(List<VendingMachineInventoryEntry> inventory)
{
Inventory = inventory;
}
}
[Serializable, NetSerializable]
public class VendingMachineInventoryEntry
{
public string ID;
public uint Amount;
public VendingMachineInventoryEntry(string id, uint amount)
{
ID = id;
Amount = amount;
}
}
}
}

View File

@@ -23,5 +23,6 @@
public const uint LATHE_DATABASE = 1017;
public const uint MATERIAL_STORAGE = 1018;
public const uint HAND_TELEPORTER = 1019;
public const uint VENDING_MACHINE = 1020;
}
}

View File

@@ -114,7 +114,7 @@ namespace Content.Shared.GameObjects
// This works for now though.
public static IEnumerable<(IComponent, Verb)> GetVerbs(IEntity entity)
{
foreach (var component in entity.GetComponentInstances())
foreach (var component in entity.GetAllComponents())
{
var type = component.GetType();
foreach (var nestedType in type.GetNestedTypes(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static))

View File

@@ -0,0 +1,41 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YamlDotNet.RepresentationModel;
namespace Content.Shared.VendingMachines
{
[Serializable, NetSerializable, Prototype("vendingMachineInventory")]
public class VendingMachineInventoryPrototype : IPrototype, IIndexedPrototype
{
private string _id;
private string _name;
private string _description;
private double _animationDuration;
private string _spriteName;
private Dictionary<string, uint> _startingInventory;
public string ID => _id;
public string Name => _name;
public string Description => _description;
public double AnimationDuration => _animationDuration;
public string SpriteName => _spriteName;
public Dictionary<string, uint> StartingInventory => _startingInventory;
public void LoadFrom(YamlMappingNode mapping)
{
var serializer = YamlObjectSerializer.NewReader(mapping);
serializer.DataField(ref _id, "id", string.Empty);
serializer.DataField(ref _name, "name", string.Empty);
serializer.DataField(ref _description, "description", string.Empty);
serializer.DataField<double>(ref _animationDuration, "animationDuration", 0);
serializer.DataField(ref _spriteName, "spriteName", string.Empty);
serializer.DataField(ref _startingInventory, "startingInventory", new Dictionary<string, uint>());
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,117 @@
- type: entity
id: computerBase
name: Computer
components:
- type: Clickable
- type: Collidable
- type: BoundingBox
- type: Icon
sprite: Buildings/computer.rsi
state: computer
- type: Computer
- type: PowerDevice
priority: High
- type: Sprite
sprite: Buildings/computer.rsi
layers:
- state: computer
map: ["enum.ComputerVisualizer2D+Layers.Body"]
- state: generic_key_off
map: ["enum.ComputerVisualizer2D+Layers.Keyboard"]
- state: generic
shader: unshaded
map: ["enum.ComputerVisualizer2D+Layers.Screen"]
- state: generic_key
shader: unshaded
map: ["enum.ComputerVisualizer2D+Layers.KeyboardOn"]
- type: Appearance
visuals:
- type: ComputerVisualizer2D
key: generic_key
screen: generic
- type: entity
id: computerAlert
parent: computerBase
name: Alerts Computer
components:
- type: Appearance
visuals:
- type: ComputerVisualizer2D
key: atmos_key
screen: "alert-2"
- type: entity
id: computerPowerMonitoring
parent: computerBase
name: Power Monitoring Computer
components:
- type: Appearance
visuals:
- type: ComputerVisualizer2D
key: power_key
screen: power_monitor
- type: entity
id: computerSupplyOrdering
parent: computerBase
name: Supply Ordering Computer
components:
- type: Appearance
visuals:
- type: ComputerVisualizer2D
key: tech_key
screen: supply
- type: entity
id: computerMedicalRecords
parent: computerBase
name: Medical Records Computer
components:
- type: Appearance
visuals:
- type: ComputerVisualizer2D
key: med_key
screen: medcomp
- type: entity
id: computerResearchAndDevelopment
parent: computerBase
name: R&D Computer
components:
- type: Appearance
visuals:
- type: ComputerVisualizer2D
key: rd_key
screen: rdcomp
- type: entity
id: computerId
parent: computerBase
name: ID Card Computer
components:
- type: Appearance
visuals:
- type: ComputerVisualizer2D
key: id_key
screen: id
- type: entity
id: computerComms
parent: computerBase
name: Communications Computer
components:
- type: Appearance
visuals:
- type: ComputerVisualizer2D
key: generic_key
screen: comm

View File

@@ -0,0 +1,53 @@
- type: entity
name: Stool
id: stool
components:
- type: Clickable
- type: BoundingBox
- type: Sprite
sprite: Buildings/furniture.rsi
state: stool_base
color: "#8e9799"
- type: Icon
sprite: Buildings/furniture.rsi
state: stool_base
- type: entity
name: White Office Chair
id: chairOfficeLight
components:
- type: Clickable
- type: BoundingBox
- type: Sprite
sprite: Buildings/furniture.rsi
state: officechair_white
- type: Icon
sprite: Buildings/furniture.rsi
state: officechair_white
- type: entity
name: Dark Office Chair
id: chairOfficeDark
components:
- type: Clickable
- type: BoundingBox
- type: Sprite
sprite: Buildings/furniture.rsi
state: officechair_dark
- type: Icon
sprite: Buildings/furniture.rsi
state: officechair_dark
- type: entity
name: Chair
id: chair
components:
- type: Clickable
- type: BoundingBox
- type: Sprite
sprite: Buildings/furniture.rsi
state: chair
color: "#8e9799"
- type: Icon
sprite: Buildings/furniture.rsi
state: chair

View File

@@ -0,0 +1,338 @@
- type: entity
id: VendingMachine
name: vending machine
components:
- type: Clickable
- type: Sprite
sprite: Buildings/VendingMachines/empty.rsi
layers:
- state: normal
map: ["enum.VendingMachineVisualLayers.Base"]
- type: Icon
sprite: Buildings/VendingMachines/empty.rsi
state: normal
- type: BoundingBox
- type: Collidable
- type: SnapGrid
offset: Center
- type: Damageable
- type: Breakable
- type: Appearance
visuals:
- type: VendingMachineVisualizer2D
- type: UserInterface
interfaces:
- key: enum.VendingMachineUiKey.Key
type: VendingMachineBoundUserInterface
- type: PowerDevice
priority: Low
- type: entity
parent: VendingMachine
id: vending_machine_ammo
name: AmmoVend
components:
- type: VendingMachine
pack: AmmoVend
- type: Icon
sprite: Buildings/VendingMachines/ammo.rsi
- type: entity
parent: VendingMachine
id: vending_machine_booze
name: Booze-O-Mat
components:
- type: VendingMachine
pack: Booze-O-Mat
- type: Icon
sprite: Buildings/VendingMachines/boozeomat.rsi
- type: entity
parent: VendingMachine
id: vending_machine_cart
name: PTech
components:
- type: VendingMachine
pack: PTech
- type: Icon
sprite: Buildings/VendingMachines/cart.rsi
- type: entity
parent: VendingMachine
id: vending_machine_chapel
name: PietyVend
components:
- type: VendingMachine
pack: PietyVend
- type: Icon
sprite: Buildings/VendingMachines/chapel.rsi
- type: entity
parent: VendingMachine
id: vending_machine_cigs
name: Cigarette machine
components:
- type: VendingMachine
pack: Cigarette machine
- type: Icon
sprite: Buildings/VendingMachines/cigs.rsi
- type: entity
parent: VendingMachine
id: vending_machine_coffee
name: Hot Drinks machine
components:
- type: VendingMachine
pack: Hot Drinks machine
- type: Icon
sprite: Buildings/VendingMachines/dinnerware.rsi
- type: entity
parent: VendingMachine
id: vending_machine_cola
name: Robust Softdrinks
components:
- type: VendingMachine
pack: Robust Softdrinks
- type: Icon
sprite: Buildings/VendingMachines/discount.rsi
- type: entity
parent: VendingMachine
id: vending_machine_dinnerware
name: Dinnerware
components:
- type: VendingMachine
pack: Dinnerware
- type: Icon
sprite: Buildings/VendingMachines/dinnerware.rsi
- type: entity
parent: VendingMachine
id: vending_machine_discount
name: Discount Dan's
components:
- type: VendingMachine
pack: Discount Dan's
- type: Icon
sprite: Buildings/VendingMachines/discount.rsi
- type: entity
parent: VendingMachine
id: vending_machine_engivend
name: Engi-Vend
components:
- type: VendingMachine
pack: Engi-Vend
- type: Icon
sprite: Buildings/VendingMachines/engivend.rsi
- type: entity
parent: VendingMachine
id: vending_machine_hats
name: Hatlord 9000
components:
- type: VendingMachine
pack: Hatlord 9000
- type: Icon
sprite: Buildings/VendingMachines/hats.rsi
- type: entity
parent: VendingMachine
id: vending_machine_magivend
name: MagiVend
components:
- type: VendingMachine
pack: MagiVend
- type: Icon
sprite: Buildings/VendingMachines/magivend.rsi
- type: entity
parent: VendingMachine
id: vending_machine_medical
name: NanoMed Plus
components:
- type: VendingMachine
pack: NanoMed Plus
- type: Icon
sprite: Buildings/VendingMachines/medical.rsi
- type: entity
parent: VendingMachine
id: vending_machine_mining
name: Dwarven Mining Equipment
components:
- type: VendingMachine
pack: Dwarven Mining Equipment
- type: Icon
sprite: Buildings/VendingMachines/mining.rsi
- type: entity
parent: VendingMachine
id: vending_machine_nazi
name: Nazivend
components:
- type: VendingMachine
pack: Nazivend
- type: Icon
sprite: Buildings/VendingMachines/nazi.rsi
- type: entity
parent: VendingMachine
id: vending_machine_nutri
name: NutriMax
components:
- type: VendingMachine
pack: NutriMax
- type: Icon
sprite: Buildings/VendingMachines/nutri.rsi
- type: entity
parent: VendingMachine
id: vending_machine_robotics
name: Robotech Deluxe
components:
- type: VendingMachine
pack: Robotech Deluxe
- type: Icon
sprite: Buildings/VendingMachines/robotics.rsi
- type: entity
parent: VendingMachine
id: vending_machine_sales
name: Sales
components:
- type: VendingMachine
pack: Sales
- type: Icon
sprite: Buildings/VendingMachines/sale.rsi
- type: entity
parent: VendingMachine
id: vending_machine_sec
name: SecTech
components:
- type: VendingMachine
pack: SecTech
- type: Icon
sprite: Buildings/VendingMachines/sec.rsi
- type: entity
parent: VendingMachine
id: vending_machine_seeds
name: MegaSeed Servitor
components:
- type: VendingMachine
pack: MegaSeed Servitor
- type: Icon
sprite: Buildings/VendingMachines/seeds.rsi
- type: entity
parent: VendingMachine
id: vending_machine_shoes
name: Shoelord 9000
components:
- type: VendingMachine
pack: Shoelord 9000
- type: Icon
sprite: Buildings/VendingMachines/shoes.rsi
- type: entity
parent: VendingMachine
id: vending_machine_smartfridge
name: SmartFridge
components:
- type: VendingMachine
pack: SmartFridge
- type: Icon
sprite: Buildings/VendingMachines/smartfridge.rsi
- type: entity
parent: VendingMachine
id: vending_machine_snack
name: Getmore Chocolate Corp
components:
- type: VendingMachine
pack: Getmore Chocolate Corp
- type: Icon
sprite: Buildings/VendingMachines/snack.rsi
- type: entity
parent: VendingMachine
id: vending_machine_soviet
name: KomradeVendtink
components:
- type: VendingMachine
pack: KomradeVendtink
- type: Icon
sprite: Buildings/VendingMachines/soviet.rsi
- type: entity
parent: VendingMachine
id: vending_machine_sovietsoda
name: BODA
components:
- type: VendingMachine
pack: BODA
- type: Icon
sprite: Buildings/VendingMachines/sovietsoda.rsi
- type: entity
parent: VendingMachine
id: vending_machine_suits
name: Suitlord 9000
components:
- type: VendingMachine
pack: Suitlord 9000
- type: Icon
sprite: Buildings/VendingMachines/suits.rsi
- type: entity
parent: VendingMachine
id: vending_machine_theater
name: AutoDrobe
components:
- type: VendingMachine
pack: AutoDrobe
- type: Icon
sprite: Buildings/VendingMachines/theater.rsi
- type: entity
parent: VendingMachine
id: vending_machine_vendomat
name: Vendomat
components:
- type: VendingMachine
pack: Vendomat
- type: Icon
sprite: Buildings/VendingMachines/vendomat.rsi
- type: entity
parent: VendingMachine
id: vending_machine_vox
name: Trader Supply
components:
- type: VendingMachine
pack: Trader Supply
- type: Icon
sprite: Buildings/VendingMachines/vox.rsi
- type: entity
parent: VendingMachine
id: vending_machine_wallmed
name: NanoMed
components:
- type: VendingMachine
pack: NanoMed
- type: Icon
sprite: Buildings/VendingMachines/wallmed.rsi
- type: entity
parent: VendingMachine
id: vending_machine_youtool
name: YouTool
components:
- type: VendingMachine
pack: YouTool
- type: Icon
sprite: Buildings/VendingMachines/youtool.rsi

View File

@@ -5,17 +5,18 @@
description: A convenient storage pack
components:
- type: Sprite
sprite: Clothing/backpack.rsi
sprite: Clothing/backpacks.rsi
state: backpack
- type: Icon
sprite: Clothing/backpack.rsi
sprite: Clothing/backpacks.rsi
state: backpack
- type: Clothing
Size: 9999
QuickEquip: false
Slots:
- back
sprite: Clothing/backpack.rsi
sprite: Clothing/backpacks.rsi
HeldPrefix: backpack
- type: Storage
Capacity: 100
@@ -26,15 +27,13 @@
description: It's a backpack made by Honk! Co.
components:
- type: Sprite
sprite: Clothing/backpack_clown.rsi
state: icon
state: clown
- type: Icon
sprite: Clothing/backpack_clown.rsi
state: icon
state: clown
- type: Clothing
sprite: Clothing/backpack_clown.rsi
HeldPrefix: clown
- type: entity
parent: BackpackClothing
@@ -43,12 +42,374 @@
description: It's a very robust backpack.
components:
- type: Sprite
sprite: Clothing/backpack_sec.rsi
state: icon
state: security
- type: Icon
sprite: Clothing/backpack_sec.rsi
state: icon
state: security
- type: Clothing
sprite: Clothing/backpack_sec.rsi
HeldPrefix: security
- type: entity
parent: BackpackClothing
id: BackpackEngineering
name: Engineering Backpack
components:
- type: Sprite
state: engineering
- type: Icon
state: engineering
- type: Clothing
HeldPrefix: engineering
- type: entity
parent: BackpackClothing
id: BackpackMedical
name: Medical Backpack
components:
- type: Sprite
state: medical
- type: Icon
state: medical
- type: Clothing
HeldPrefix: medical
- type: entity
parent: BackpackClothing
id: BackpackCaptain
name: Captain's Backpack
components:
- type: Sprite
state: captain
- type: Icon
state: captain
- type: Clothing
HeldPrefix: captain
- type: entity
parent: BackpackClothing
id: BackpackHolding
name: Bag of Holding
components:
- type: Sprite
layers:
- state: holding
- state: holding-unlit
shader: unshaded
- type: Icon
state: holding
- type: Clothing
HeldPrefix: holding
- type: entity
parent: BackpackClothing
id: Satchel
name: Satchel
components:
- type: Sprite
state: satchel
- type: Icon
state: satchel
- type: Clothing
ClothingPrefix: satchel
- type: Storage
Capacity: 300
- type: entity
parent: BackpackClothing
id: SatchelEngineering
name: Engineering Satchel
components:
- type: Sprite
state: satchel-engineering
- type: Icon
state: satchel-engineering
- type: Clothing
HeldPrefix: engineering
ClothingPrefix: satchel-engineering
- type: entity
parent: BackpackClothing
id: SatchelMedical
name: Medical Satchel
components:
- type: Sprite
state: satchel-medical
- type: Icon
state: satchel-medical
- type: Clothing
HeldPrefix: medical
ClothingPrefix: satchel-medical
- type: entity
parent: BackpackClothing
id: SatchelChemistry
name: Chemistry Satchel
components:
- type: Sprite
state: satchel-chemistry
- type: Icon
state: satchel-chemistry
- type: Clothing
HeldPrefix: medical
ClothingPrefix: satchel-chemistry
- type: entity
parent: BackpackClothing
id: SatchelGenetics
name: Genetics Satchel
components:
- type: Sprite
state: satchel-genetics
- type: Icon
state: satchel-genetics
- type: Clothing
HeldPrefix: medical
ClothingPrefix: satchel-genetics
- type: entity
parent: BackpackClothing
id: SatchelVirology
name: Virology Satchel
components:
- type: Sprite
state: satchel-virology
- type: Icon
state: satchel-virology
- type: Clothing
HeldPrefix: medical
ClothingPrefix: satchel-virology
- type: entity
parent: BackpackClothing
id: SatchelScience
name: Science Satchel
components:
- type: Sprite
state: satchel-science
- type: Icon
state: satchel-science
- type: Clothing
ClothingPrefix: satchel-science
- type: entity
parent: BackpackClothing
id: SatchelSecurity
name: Security Satchel
components:
- type: Sprite
state: satchel-security
- type: Icon
state: satchel-security
- type: Clothing
HeldPrefix: security
ClothingPrefix: satchel-security
- type: entity
parent: BackpackClothing
id: SatchelCaptain
name: Captain's Satchel
components:
- type: Sprite
state: satchel-captain
- type: Icon
state: satchel-captain
- type: Clothing
HeldPrefix: captain
ClothingPrefix: satchel-captain
- type: entity
parent: BackpackClothing
id: SatchelHydroponics
name: Hydroponics Satchel
components:
- type: Sprite
state: satchel-hydroponics
- type: Icon
state: satchel-hydroponics
- type: Clothing
ClothingPrefix: satchel-hydroponics
- type: entity
parent: BackpackClothing
id: MessengerBag
name: Messenger Bag
components:
- type: Sprite
state: courier
- type: Icon
state: courier
- type: Clothing
ClothingPrefix: courier
- type: entity
parent: BackpackClothing
id: MessengerBagChemistry
name: Chemistry Messenger Bag
components:
- type: Sprite
state: courier-chemistry
- type: Icon
state: courier-chemistry
- type: Clothing
HeldPrefix: medical
ClothingPrefix: courier-chemistry
- type: entity
parent: BackpackClothing
id: MessengerBagMedical
name: Medical Messenger Bag
components:
- type: Sprite
state: courier-medical
- type: Icon
state: courier-medical
- type: Clothing
HeldPrefix: medical
ClothingPrefix: courier-medical
- type: entity
parent: BackpackClothing
id: MessengerBagVirology
name: Virology Messenger Bag
components:
- type: Sprite
state: courier-virology
- type: Icon
state: courier-virology
- type: Clothing
HeldPrefix: medical
ClothingPrefix: courier-virology
- type: entity
parent: BackpackClothing
id: MessengerBagEngineering
name: Engineering Messenger Bag
components:
- type: Sprite
state: courier-engineering
- type: Icon
state: courier-engineering
- type: Clothing
HeldPrefix: engineering
ClothingPrefix: courier-engineering
- type: entity
parent: BackpackClothing
id: MessengerBagScience
name: Science Messenger Bag
components:
- type: Sprite
state: courier-science
- type: Icon
state: courier-science
- type: Clothing
ClothingPrefix: courier-science
- type: entity
parent: BackpackClothing
id: MessengerBagCaptain
name: Captain's Messenger Bag
components:
- type: Sprite
state: courier-captain
- type: Icon
state: courier-captain
- type: Clothing
HeldPrefix: captain
ClothingPrefix: courier-captain
- type: entity
parent: BackpackClothing
id: MessengerBagHydroponics
name: Hydroponics Messenger Bag
components:
- type: Sprite
state: courier-hydroponics
- type: Icon
state: courier-hydroponics
- type: Clothing
ClothingPrefix: courier-hydroponics
- type: entity
parent: BackpackClothing
id: MessengerBagSecurity
name: Security Messenger Bag
components:
- type: Sprite
state: courier-security
- type: Icon
state: courier-security
- type: Clothing
HeldPrefix: security
ClothingPrefix: courier-security

View File

@@ -24,5 +24,3 @@
sprite: Clothing/belt_utility.rsi
- type: Storage
Capacity: 30

View File

@@ -54,18 +54,3 @@
- type: Clothing
sprite: Clothing/gloves_leather.rsi
HeatResistance: 1500
- type: entity
parent: GlovesBase
id: WhiteGloves
name: White Gloves
description: These look pretty fancy.
components:
- type: Sprite
sprite: Clothing/gloves_white.rsi
state: white
- type: Icon
sprite: Clothing/gloves_white.rsi
state: white
- type: Clothing
sprite: Clothing/gloves_white.rsi

View File

@@ -40,37 +40,3 @@
sprite: Clothing/captain_hat.rsi
Slots:
- helmet
- type: entity
parent: HatBase
id: HatHOP
name: Head of Personnel's Hat
description: Papers, please.
components:
- type: Sprite
sprite: Clothing/hop_hat.rsi
state: hop
- type: Icon
sprite: Clothing/hop_hat.rsi
state: hop
- type: Clothing
sprite: Clothing/hop_hat.rsi
Slots:
- helmet
- type: entity
parent: HatBase
id: HatBeret
name: Beret
description: A beret, an artists favorite headwear.
components:
- type: Sprite
sprite: Clothing/beret.rsi
state: beret
- type: Icon
sprite: Clothing/beret.rsi
state: beret
- type: Clothing
sprite: Clothing/beret.rsi
Slots:
- helmet

View File

@@ -48,18 +48,3 @@
state: icon
- type: Clothing
sprite: Clothing/mask_clown.rsi
- type: entity
parent: MasksBase
id: MaskMime
name: Mime Mask
description: The traditional mime's mask. It has an eerie facial posture.
components:
- type: Sprite
sprite: Clothing/mask_mime.rsi
state: mime
- type: Icon
sprite: Clothing/mask_mime.rsi
state: mime
- type: Clothing
sprite: Clothing/mask_mime.rsi

View File

@@ -101,20 +101,3 @@
- type: Clothing
sprite: Clothing/shoes_brown.rsi
- type: entity
parent: ShoesBase
id: ShoesMime
name: Mime Shoes
description: Comfortable-looking shoes.
components:
- type: Sprite
sprite: Clothing/shoes_mime.rsi
state: mime
- type: Icon
sprite: Clothing/shoes_mime.rsi
state: mime
- type: Clothing
sprite: Clothing/shoes_mime.rsi

View File

@@ -58,18 +58,3 @@
- type: Clothing
sprite: Clothing/chef_apron.rsi
- type: entity
parent: SuitBase
id: BeltSuspenders
name: Suspenders
description: They suspend the illusion of the mime's play.
components:
- type: Sprite
sprite: Clothing/suspenders.rsi
state: suspenders
- type: Icon
sprite: Clothing/suspenders.rsi
state: suspenders
- type: Clothing
sprite: Clothing/suspenders.rsi

View File

@@ -142,37 +142,3 @@
- type: Clothing
sprite: Clothing/captain_uniform.rsi
- type: entity
parent: UniformBase
id: UniformHOP
name: Head of Personnel's Jumpsuit
description: It's a jumpsuit worn by someone who works in the position of "Head of Personnel".
components:
- type: Sprite
sprite: Clothing/hop_jumpsuit.rsi
state: hop
- type: Icon
sprite: Clothing/hop_jumpsuit.rsi
state: hop
- type: Clothing
sprite: Clothing/hop_jumpsuit.rsi
- type: entity
parent: UniformBase
id: UniformMime
name: Mime's Outfit
description: It's not very colourful.
components:
- type: Sprite
sprite: Clothing/mime_outfit.rsi
state: mime
- type: Icon
sprite: Clothing/mime_outfit.rsi
state: mime
- type: Clothing
sprite: Clothing/mime_outfit.rsi

View File

@@ -0,0 +1,5 @@
- type: vendingMachineInventory
id: AmmoVend
name: AmmoVend
description: A generic ammunition vending machine.
spriteName: ammo

View File

@@ -0,0 +1,5 @@
- type: vendingMachineInventory
id: Booze-O-Mat
name: Booze-O-Mat
description: A vending machine containing multiple drinks for bartending.
spriteName: boozeomat

View File

@@ -0,0 +1,5 @@
- type: vendingMachineInventory
id: PTech
name: PTech
description: A vending machine containing Personal Data Assistant cartridges.
spriteName: cart

View File

@@ -0,0 +1,5 @@
- type: vendingMachineInventory
id: PietyVend
name: PietyVend
description: "A vending machine containing religious supplies and clothing. A label reads: \"A holy vendor for a pious man.\""
spriteName: chapel

View File

@@ -0,0 +1,6 @@
- type: vendingMachineInventory
id: Cigarette machine
name: Cigarette machine
description: A vending machine containing smoking supplies.
animationDuration: 2.1
spriteName: cigs

View File

@@ -0,0 +1,6 @@
- type: vendingMachineInventory
id: Hot Drinks machine
name: Hot Drinks machine
description: A vending machine that dispenses hot drinks.
animationDuration: 3.4
spriteName: coffee

View File

@@ -0,0 +1,6 @@
- type: vendingMachineInventory
id: Robust Softdrinks
name: Robust Softdrinks
description: A softdrink vendor provided by Robust Industries, LLC.
animationDuration: 1.1
spriteName: cola

View File

@@ -0,0 +1,5 @@
- type: vendingMachineInventory
id: Dinnerware
name: Dinnerware
description: A vending machine containing kitchen and restaurant equipment.
spriteName: dinnerware

View File

@@ -0,0 +1,5 @@
- type: vendingMachineInventory
id: Discount Dan's
name: Discount Dan's
description: A vending machine containing discount snacks from the infamous 'Discount Dan' franchise.
spriteName: discount

View File

@@ -0,0 +1,5 @@
- type: vendingMachineInventory
id: empty vending machine
name: empty vending machine
description: Just add capitalism!
spriteName: empty

View File

@@ -0,0 +1,6 @@
- type: vendingMachineInventory
id: Engi-Vend
name: Engi-Vend
description: Spare tool vending. What? Did you expect some witty description?
animationDuration: 2.1
spriteName: engivend

View File

@@ -0,0 +1,5 @@
- type: vendingMachineInventory
id: Hatlord 9000
name: Hatlord 9000
description: A vending machine containing hats.
spriteName: hats

View File

@@ -0,0 +1,6 @@
- type: vendingMachineInventory
id: MagiVend
name: MagiVend
description: A mystical vending machine containing magical garments and magic supplies.
animationDuration: 1.5
spriteName: magivend

View File

@@ -0,0 +1,6 @@
- type: vendingMachineInventory
id: NanoMed Plus
name: NanoMed Plus
description: A vending machine containing medical supplies.
animationDuration: 1.8
spriteName: medical

View File

@@ -0,0 +1,5 @@
- type: vendingMachineInventory
id: Dwarven Mining Equipment
name: Dwarven Mining Equipment
description: Get your mining equipment here, and above all keep digging!
spriteName: mining

View File

@@ -0,0 +1,5 @@
- type: vendingMachineInventory
id: Nazivend
name: Nazivend
description: "A vending machine containing Nazi German supplies. A label reads: \"Remember the gorillions lost.\""
spriteName: nazi

View File

@@ -0,0 +1,5 @@
- type: vendingMachineInventory
id: NutriMax
name: NutriMax
description: A vending machine containing nutritional substances for plants and botanical tools.
spriteName: nutri

View File

@@ -0,0 +1,5 @@
- type: vendingMachineInventory
id: Robotech Deluxe
name: Robotech Deluxe
description: A vending machine containing nutritional substances for plants and botanical tools.
spriteName: robotics

View File

@@ -0,0 +1,5 @@
- type: vendingMachineInventory
id: Sales
name: Sales
description: Buy, sell, repeat.
spriteName: sale

View File

@@ -0,0 +1,6 @@
- type: vendingMachineInventory
id: SecTech
name: SecTech
description: "A vending machine containing Security equipment. A label reads \"SECURITY PERSONNEL ONLY\"."
animationDuration: 1.4
spriteName: sec

View File

@@ -0,0 +1,6 @@
- type: vendingMachineInventory
id: MegaSeed Servitor
name: MegaSeed Servitor
description: "A vending machine containing Security equipment. A label reads \"SECURITY PERSONNEL ONLY\"."
animationDuration: 1.3
spriteName: seeds

View File

@@ -0,0 +1,5 @@
- type: vendingMachineInventory
id: Shoelord 9000
name: Shoelord 9000
description: A vending machine containing footwear.
spriteName: shoes

View File

@@ -0,0 +1,5 @@
- type: vendingMachineInventory
id: SmartFridge
name: SmartFridge
description: A refrigerated storage unit for storing medicine and chemicals.
spriteName: smartfridge

View File

@@ -0,0 +1,5 @@
- type: vendingMachineInventory
id: Getmore Chocolate Corp
name: Getmore Chocolate Corp
description: A vending machine containing snacks.
spriteName: snack

View File

@@ -0,0 +1,5 @@
- type: vendingMachineInventory
id: KomradeVendtink
name: KomradeVendtink
description: Rodina-mat' zovyot!
spriteName: soviet

View File

@@ -0,0 +1,5 @@
- type: vendingMachineInventory
id: BODA
name: BODA
description: An old vending machine containing sweet water.
spriteName: sovietsoda

View File

@@ -0,0 +1,5 @@
- type: vendingMachineInventory
id: Suitlord 9000
name: Suitlord 9000
description: A vending machine containing jumpsuits and dress garments.
spriteName: suits

View File

@@ -0,0 +1,5 @@
- type: vendingMachineInventory
id: AutoDrobe
name: AutoDrobe
description: A vending machine containing costumes.
spriteName: theater

View File

@@ -0,0 +1,5 @@
- type: vendingMachineInventory
id: Vendomat
name: Vendomat
description: A vending machine containing generic parts.
spriteName: vendomat

View File

@@ -0,0 +1,5 @@
- type: vendingMachineInventory
id: Trader Supply
name: Trader Supply
description: Make much coin.
spriteName: vox

View File

@@ -0,0 +1,5 @@
- type: vendingMachineInventory
id: NanoMed
name: NanoMed
description: Wall-mounted medical equipment dispenser.
spriteName: wallmed

View File

@@ -0,0 +1,13 @@
- type: vendingMachineInventory
id: YouTool
name: YouTool
description: "A vending machine containing standard tools. A label reads: \"Tools for tools.\""
animationDuration: 1.1
spriteName: youtool
startingInventory:
CableStack: 10
Crowbar: 5
Welder: 3
Wirecutter: 5
Wrench: 5
Screwdriver: 5

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1 @@
{"version": 1, "size": {"x": 32, "y": 32}, "states": [{"name": "broken", "directions": 1, "delays": [[1.0]]}, {"name": "normal", "directions": 1, "delays": [[1.0]]}, {"name": "off", "directions": 1, "delays": [[1.0]]}]}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -0,0 +1 @@
{"version": 1, "size": {"x": 32, "y": 32}, "states": [{"name": "broken", "directions": 1, "delays": [[1.0]]}, {"name": "deny", "directions": 1, "delays": [[0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2]]}, {"name": "normal", "directions": 1, "delays": [[0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2]]}, {"name": "off", "directions": 1, "delays": [[1.0]]}]}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 988 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -0,0 +1 @@
{"version": 1, "size": {"x": 32, "y": 32}, "states": [{"name": "broken", "directions": 1, "delays": [[1.0]]}, {"name": "deny", "directions": 1, "delays": [[0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]]}, {"name": "eject", "directions": 1, "delays": [[1.0, 0.5, 0.1, 0.1, 0.1, 1.0, 0.1, 0.1, 0.1, 0.3]]}, {"name": "normal", "directions": 1, "delays": [[1.0]]}, {"name": "off", "directions": 1, "delays": [[1.0]]}]}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 967 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 969 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@@ -0,0 +1 @@
{"version": 1, "size": {"x": 32, "y": 32}, "states": [{"name": "broken", "directions": 1, "delays": [[1.0]]}, {"name": "deny", "directions": 1, "delays": [[0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05]]}, {"name": "normal", "directions": 1, "delays": [[2.0, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 2.0, 0.05, 0.05, 2.0, 0.05, 0.05, 0.05, 2.0, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 2.0, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.5, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 1.0, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05]]}, {"name": "off", "directions": 1, "delays": [[1.0]]}]}

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 651 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -0,0 +1 @@
{"version": 1, "size": {"x": 32, "y": 32}, "states": [{"name": "broken", "directions": 1, "delays": [[1.0]]}, {"name": "eject", "directions": 1, "delays": [[1.0, 0.2, 0.1, 0.1, 0.1, 0.1, 1.0, 0.1, 0.1, 0.1]]}, {"name": "normal", "directions": 1, "delays": [[1.0]]}, {"name": "off", "directions": 1, "delays": [[1.0]]}]}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

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