Merge remote-tracking branch 'upstream/master'

This commit is contained in:
ShadowCommander
2019-08-01 17:36:19 -07:00
288 changed files with 3854 additions and 1187 deletions

5
BuildFiles/Linux/SS14.Launcher Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/bash
cd "$(dirname "$0")"
exec mono bin/SS14.Launcher.exe

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>SS14L</string>
<key>CFBundleDisplayName</key>
<string>Space Station 14 Launcher</string>
<key>CFBundleExecutable</key>
<string>SS14</string>
<!--
Just a note about this icon.
MacOS seems REALLY iffy about this and even when the file is correct,
it can take forever before it decides to actually update it and display it.
TL;DR Apple is stupid.
-->
<key>CFBundleIconFile</key>
<string>ss14</string>
</dict>
</plist>

View File

@@ -0,0 +1,8 @@
#!/bin/sh
# cd to file containing script or something?
BASEDIR=$(dirname "$0")
echo "$BASEDIR"
cd "$BASEDIR"
exec /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono ../Resources/SS14.Launcher.exe

View File

@@ -1 +0,0 @@
call Godot\godot.windows.tools.64.mono.exe --path SS14.Client.Godot

View File

@@ -0,0 +1 @@
call bin\SS14.Launcher.exe

View File

@@ -1,23 +1,49 @@
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;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Maths;
using Robust.Shared.Utility;
using Robust.Client.UserInterface.Controls;
namespace Content.Client.Chat
{
internal sealed class ChatManager : IChatManager
{
/// <summary>
/// The max amount of chars allowed to fit in a single speech bubble.
/// </summary>
private const int SingleBubbleCharLimit = 100;
/// <summary>
/// Base queue delay each speech bubble has.
/// </summary>
private const float BubbleDelayBase = 0.2f;
/// <summary>
/// Factor multiplied by speech bubble char length to add to delay.
/// </summary>
private const float BubbleDelayFactor = 0.8f / SingleBubbleCharLimit;
/// <summary>
/// The max amount of speech bubbles over a single entity at once.
/// </summary>
private const int SpeechBubbleCap = 4;
private const char ConCmdSlash = '/';
private const char OOCAlias = '[';
private const char MeAlias = '@';
public List<StoredChatMessage> filteredHistory = new List<StoredChatMessage>();
private readonly List<StoredChatMessage> filteredHistory = new List<StoredChatMessage>();
// Filter Button States
private bool _allState;
@@ -30,13 +56,76 @@ namespace Content.Client.Chat
#pragma warning disable 649
[Dependency] private readonly IClientNetManager _netManager;
[Dependency] private readonly IClientConsole _console;
[Dependency] private readonly IEntityManager _entityManager;
[Dependency] private readonly IEyeManager _eyeManager;
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager;
#pragma warning restore 649
private ChatBox _currentChatBox;
private Control _speechBubbleRoot;
/// <summary>
/// Speech bubbles that are currently visible on screen.
/// We track them to push them up when new ones get added.
/// </summary>
private readonly Dictionary<EntityUid, List<SpeechBubble>> _activeSpeechBubbles =
new Dictionary<EntityUid, List<SpeechBubble>>();
/// <summary>
/// Speech bubbles that are to-be-sent because of the "rate limit" they have.
/// </summary>
private readonly Dictionary<EntityUid, SpeechBubbleQueueData> _queuedSpeechBubbles
= new Dictionary<EntityUid, SpeechBubbleQueueData>();
public void Initialize()
{
_netManager.RegisterNetMessage<MsgChatMessage>(MsgChatMessage.NAME, _onChatMessage);
_speechBubbleRoot = new Control
{
MouseFilter = Control.MouseFilterMode.Ignore
};
_speechBubbleRoot.SetAnchorPreset(Control.LayoutPreset.Wide);
_userInterfaceManager.StateRoot.AddChild(_speechBubbleRoot);
_speechBubbleRoot.SetPositionFirst();
}
public void FrameUpdate(RenderFrameEventArgs delta)
{
// Update queued speech bubbles.
if (_queuedSpeechBubbles.Count == 0)
{
return;
}
foreach (var (entityUid, queueData) in _queuedSpeechBubbles.ShallowClone())
{
if (!_entityManager.TryGetEntity(entityUid, out var entity))
{
_queuedSpeechBubbles.Remove(entityUid);
continue;
}
queueData.TimeLeft -= delta.Elapsed;
if (queueData.TimeLeft > 0)
{
continue;
}
if (queueData.MessageQueue.Count == 0)
{
_queuedSpeechBubbles.Remove(entityUid);
continue;
}
var msg = queueData.MessageQueue.Dequeue();
queueData.TimeLeft += BubbleDelayBase + msg.Length * BubbleDelayFactor;
// We keep the queue around while it has 0 items. This allows us to keep the timer.
// When the timer hits 0 and there's no messages left, THEN we can clear it up.
CreateSpeechBubble(entity, msg);
}
}
public void SetChatBox(ChatBox chatBox)
@@ -60,6 +149,19 @@ namespace Content.Client.Chat
_currentChatBox.OOCButton.Pressed = !_oocState;
}
public void RemoveSpeechBubble(EntityUid entityUid, SpeechBubble bubble)
{
bubble.Dispose();
var list = _activeSpeechBubbles[entityUid];
list.Remove(bubble);
if (list.Count == 0)
{
_activeSpeechBubbles.Remove(entityUid);
}
}
private void WriteChatMessage(StoredChatMessage message)
{
Logger.Debug($"{message.Channel}: {message.Message}");
@@ -88,7 +190,6 @@ namespace Content.Client.Chat
}
_currentChatBox?.AddLine(messageText, message.Channel, color);
}
private void _onChatBoxTextSubmitted(ChatBox chatBox, string text)
@@ -185,15 +286,126 @@ namespace Content.Client.Chat
Logger.Debug($"{msg.Channel}: {msg.Message}");
// Log all incoming chat to repopulate when filter is un-toggled
StoredChatMessage storedMessage = new StoredChatMessage(msg);
var storedMessage = new StoredChatMessage(msg);
filteredHistory.Add(storedMessage);
WriteChatMessage(storedMessage);
// Local messages that have an entity attached get a speech bubble.
if (msg.Channel == ChatChannel.Local && msg.SenderEntity != default)
{
AddSpeechBubble(msg);
}
}
private void AddSpeechBubble(MsgChatMessage msg)
{
if (!_entityManager.TryGetEntity(msg.SenderEntity, out var entity))
{
Logger.WarningS("chat", "Got local chat message with invalid sender entity: {0}", msg.SenderEntity);
return;
}
// Split message into words separated by spaces.
var words = msg.Message.Split(' ');
var messages = new List<string>();
var currentBuffer = new List<string>();
// Really shoddy way to approximate word length.
// Yes, I am aware of all the crimes here.
// TODO: Improve this to use actual glyph width etc..
var currentWordLength = 0;
foreach (var word in words)
{
// +1 for the space.
currentWordLength += word.Length + 1;
if (currentWordLength > SingleBubbleCharLimit)
{
// Too long for the current speech bubble, flush it.
messages.Add(string.Join(" ", currentBuffer));
currentBuffer.Clear();
currentWordLength = word.Length;
if (currentWordLength > SingleBubbleCharLimit)
{
// Word is STILL too long.
// Truncate it with an ellipse.
messages.Add($"{word.Substring(0, SingleBubbleCharLimit - 3)}...");
currentWordLength = 0;
continue;
}
}
currentBuffer.Add(word);
}
if (currentBuffer.Count != 0)
{
// Don't forget the last bubble.
messages.Add(string.Join(" ", currentBuffer));
}
foreach (var message in messages)
{
EnqueueSpeechBubble(entity, message);
}
}
private void EnqueueSpeechBubble(IEntity entity, string contents)
{
if (!_queuedSpeechBubbles.TryGetValue(entity.Uid, out var queueData))
{
queueData = new SpeechBubbleQueueData();
_queuedSpeechBubbles.Add(entity.Uid, queueData);
}
queueData.MessageQueue.Enqueue(contents);
}
private void CreateSpeechBubble(IEntity entity, string contents)
{
var bubble = new SpeechBubble(contents, entity, _eyeManager, this);
if (_activeSpeechBubbles.TryGetValue(entity.Uid, out var existing))
{
// Push up existing bubbles above the mob's head.
foreach (var existingBubble in existing)
{
existingBubble.VerticalOffset += bubble.ContentHeight;
}
}
else
{
existing = new List<SpeechBubble>();
_activeSpeechBubbles.Add(entity.Uid, existing);
}
existing.Add(bubble);
_speechBubbleRoot.AddChild(bubble);
if (existing.Count > SpeechBubbleCap)
{
// Get the oldest to start fading fast.
var last = existing[0];
last.FadeNow();
}
}
private bool IsFiltered(ChatChannel channel)
{
// _ALLstate works as inverter.
// _allState works as inverter.
return _allState ^ _filteredChannels.HasFlag(channel);
}
private sealed class SpeechBubbleQueueData
{
/// <summary>
/// Time left until the next speech bubble can appear.
/// </summary>
public float TimeLeft { get; set; }
public Queue<string> MessageQueue { get; } = new Queue<string>();
}
}
}

View File

@@ -0,0 +1,137 @@
using Content.Client.Interfaces.Chat;
using Robust.Client;
using Robust.Client.Interfaces.Graphics.ClientEye;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Maths;
using Robust.Shared.Timers;
namespace Content.Client.Chat
{
public class SpeechBubble : Control
{
/// <summary>
/// The total time a speech bubble stays on screen.
/// </summary>
private const float TotalTime = 4;
/// <summary>
/// The amount of time at the end of the bubble's life at which it starts fading.
/// </summary>
private const float FadeTime = 0.25f;
/// <summary>
/// The distance in world space to offset the speech bubble from the center of the entity.
/// i.e. greater -> higher above the mob's head.
/// </summary>
private const float EntityVerticalOffset = 0.5f;
private readonly IEyeManager _eyeManager;
private readonly IEntity _senderEntity;
private readonly IChatManager _chatManager;
private Control _panel;
private float _timeLeft = TotalTime;
public float VerticalOffset { get; set; }
private float _verticalOffsetAchieved;
public float ContentHeight { get; }
public SpeechBubble(string text, IEntity senderEntity, IEyeManager eyeManager, IChatManager chatManager)
{
_chatManager = chatManager;
_senderEntity = senderEntity;
_eyeManager = eyeManager;
MouseFilter = MouseFilterMode.Ignore;
// Use text clipping so new messages don't overlap old ones being pushed up.
RectClipContent = true;
var label = new RichTextLabel
{
MaxWidth = 256,
MouseFilter = MouseFilterMode.Ignore
};
label.SetMessage(text);
_panel = new PanelContainer
{
StyleClasses = { "tooltipBox" },
Children = { label },
MouseFilter = MouseFilterMode.Ignore,
ModulateSelfOverride = Color.White.WithAlpha(0.75f)
};
AddChild(_panel);
_panel.Size = _panel.CombinedMinimumSize;
ContentHeight = _panel.Height;
Size = (_panel.Width, 0);
_verticalOffsetAchieved = -ContentHeight;
}
protected override void FrameUpdate(RenderFrameEventArgs args)
{
base.FrameUpdate(args);
_timeLeft -= args.Elapsed;
if (_timeLeft <= FadeTime)
{
// Update alpha if we're fading.
Modulate = Color.White.WithAlpha(_timeLeft / FadeTime);
}
if (_senderEntity.Deleted || _timeLeft <= 0)
{
// Timer spawn to prevent concurrent modification exception.
Timer.Spawn(0, Die);
return;
}
// Lerp to our new vertical offset if it's been modified.
if (FloatMath.CloseTo(_verticalOffsetAchieved - VerticalOffset, 0, 0.1))
{
_verticalOffsetAchieved = VerticalOffset;
}
else
{
_verticalOffsetAchieved = FloatMath.Lerp(_verticalOffsetAchieved, VerticalOffset, 10 * args.Elapsed);
}
var worldPos = _senderEntity.Transform.WorldPosition;
worldPos += (0, EntityVerticalOffset);
var lowerCenter = _eyeManager.WorldToScreen(worldPos) / UIScale;
var screenPos = lowerCenter - (Width / 2, ContentHeight + _verticalOffsetAchieved);
Position = screenPos;
var height = (lowerCenter.Y - screenPos.Y).Clamp(0, ContentHeight);
Size = (Size.X, height);
}
private void Die()
{
if (Disposed)
{
return;
}
_chatManager.RemoveSpeechBubble(_senderEntity.Uid, this);
}
/// <summary>
/// Causes the speech bubble to start fading IMMEDIATELY.
/// </summary>
public void FadeNow()
{
if (_timeLeft > FadeTime)
{
_timeLeft = FadeTime;
}
}
}
}

View File

@@ -1,44 +1,27 @@
using Content.Client.GameObjects;
using System;
using Content.Client.Chat;
using Content.Client.GameObjects.Components.Actor;
using Content.Client.GameObjects.Components.Clothing;
using Content.Client.GameObjects.Components.Construction;
using Content.Client.GameObjects.Components.Power;
using Content.Client.GameObjects.Components.IconSmoothing;
using Content.Client.GameObjects.Components.Storage;
using Content.Client.GameObjects.Components.Weapons.Ranged;
using Content.Client.GameTicking;
using Content.Client.Input;
using Content.Client.Interfaces;
using Content.Client.Interfaces.GameObjects;
using Content.Client.Interfaces.Chat;
using Content.Client.Interfaces.Parallax;
using Content.Client.Parallax;
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.Interfaces;
using Robust.Client;
using Robust.Client.Interfaces;
using Robust.Client.Interfaces.Graphics.Overlays;
using Robust.Client.Interfaces.Input;
using Robust.Client.Interfaces.UserInterface;
using Robust.Client.Player;
using Robust.Shared.ContentPack;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Prototypes;
using System;
using Content.Client.Chat;
using Content.Client.GameObjects.Components;
using Content.Client.GameObjects.Components.Mobs;
using Content.Client.GameObjects.Components.Movement;
using Content.Client.GameObjects.Components.Research;
using Content.Client.GameObjects.Components.Sound;
using Content.Client.Interfaces.Chat;
using Content.Client.UserInterface;
using Content.Shared.GameObjects.Components.Markers;
using Content.Shared.GameObjects.Components.Materials;
using Content.Shared.GameObjects.Components.Mobs;
using Content.Shared.GameObjects.Components.Movement;
using Content.Shared.GameObjects.Components.Research;
using Robust.Client.Interfaces.State;
using Robust.Client.Interfaces.UserInterface;
using Robust.Client.State.States;
namespace Content.Client
{
@@ -54,110 +37,74 @@ namespace Content.Client
var factory = IoCManager.Resolve<IComponentFactory>();
var prototypes = IoCManager.Resolve<IPrototypeManager>();
factory.RegisterIgnore("Interactable");
factory.RegisterIgnore("Destructible");
factory.RegisterIgnore("Temperature");
factory.RegisterIgnore("PowerTransfer");
factory.RegisterIgnore("PowerNode");
factory.RegisterIgnore("PowerProvider");
factory.RegisterIgnore("PowerDevice");
factory.RegisterIgnore("PowerStorage");
factory.RegisterIgnore("PowerGenerator");
factory.DoAutoRegistrations();
factory.RegisterIgnore("Explosive");
factory.RegisterIgnore("OnUseTimerTrigger");
var registerIgnore = new[]
{
"Interactable",
"Destructible",
"Temperature",
"PowerTransfer",
"PowerNode",
"PowerProvider",
"PowerDevice",
"PowerStorage",
"PowerGenerator",
"Explosive",
"OnUseTimerTrigger",
"ToolboxElectricalFill",
"ToolLockerFill",
"EmitSoundOnUse",
"FootstepModifier",
"HeatResistance",
"CombatMode",
"Teleportable",
"ItemTeleporter",
"Portal",
"EntityStorage",
"PlaceableSurface",
"Wirecutter",
"Screwdriver",
"Multitool",
"Welder",
"Wrench",
"Crowbar",
"HitscanWeapon",
"ProjectileWeapon",
"Projectile",
"MeleeWeapon",
"Storeable",
"Stack",
"Dice",
"Construction",
"Apc",
"Door",
"PoweredLight",
"Smes",
"Powercell",
"HandheldLight",
"LightBulb",
"Healing",
"Catwalk",
"BallisticMagazine",
"BallisticMagazineWeapon",
"BallisticBullet",
"HitscanWeaponCapacitor",
"PowerCell",
"AiController",
"PlayerInputMover",
};
factory.RegisterIgnore("ToolboxElectricalFill");
factory.RegisterIgnore("ToolLockerFill");
factory.RegisterIgnore("EmitSoundOnUse");
factory.RegisterIgnore("FootstepModifier");
factory.RegisterIgnore("HeatResistance");
factory.RegisterIgnore("CombatMode");
factory.RegisterIgnore("Teleportable");
factory.RegisterIgnore("ItemTeleporter");
factory.RegisterIgnore("Portal");
factory.RegisterIgnore("EntityStorage");
factory.RegisterIgnore("PlaceableSurface");
factory.RegisterIgnore("Wirecutter");
factory.RegisterIgnore("Screwdriver");
factory.RegisterIgnore("Multitool");
factory.RegisterIgnore("Welder");
factory.RegisterIgnore("Wrench");
factory.RegisterIgnore("Crowbar");
factory.Register<ClientRangedWeaponComponent>();
factory.RegisterIgnore("HitscanWeapon");
factory.RegisterIgnore("ProjectileWeapon");
factory.RegisterIgnore("Projectile");
factory.RegisterIgnore("MeleeWeapon");
factory.RegisterIgnore("Storeable");
factory.RegisterIgnore("Stack");
factory.RegisterIgnore("Dice");
factory.Register<HandsComponent>();
factory.RegisterReference<HandsComponent, IHandsComponent>();
factory.Register<ClientStorageComponent>();
factory.Register<ClientInventoryComponent>();
factory.Register<PowerDebugTool>();
factory.Register<ConstructorComponent>();
factory.Register<ConstructionGhostComponent>();
factory.Register<IconSmoothComponent>();
factory.Register<DamageableComponent>();
factory.Register<ClothingComponent>();
factory.Register<ItemComponent>();
factory.Register<MaterialComponent>();
factory.Register<SoundComponent>();
factory.Register<MaterialStorageComponent>();
factory.RegisterReference<MaterialStorageComponent, SharedMaterialStorageComponent>();
factory.RegisterReference<ClothingComponent, ItemComponent>();
factory.Register<SpeciesUI>();
factory.Register<CharacterInterface>();
factory.RegisterIgnore("Construction");
factory.RegisterIgnore("Apc");
factory.RegisterIgnore("Door");
factory.RegisterIgnore("PoweredLight");
factory.RegisterIgnore("Smes");
factory.RegisterIgnore("Powercell");
factory.RegisterIgnore("HandheldLight");
factory.RegisterIgnore("LightBulb");
factory.RegisterIgnore("Healing");
factory.RegisterIgnore("Catwalk");
factory.RegisterIgnore("BallisticMagazine");
factory.RegisterIgnore("BallisticMagazineWeapon");
factory.RegisterIgnore("BallisticBullet");
factory.RegisterIgnore("HitscanWeaponCapacitor");
prototypes.RegisterIgnore("material");
factory.RegisterIgnore("PowerCell");
factory.Register<SharedSpawnPointComponent>();
foreach (var ignoreName in registerIgnore)
{
factory.RegisterIgnore(ignoreName);
}
factory.Register<SharedLatheComponent>();
factory.Register<LatheDatabaseComponent>();
factory.Register<SharedSpawnPointComponent>();
factory.Register<SolutionComponent>();
factory.RegisterReference<LatheDatabaseComponent, SharedLatheDatabaseComponent>();
factory.Register<CameraRecoilComponent>();
factory.RegisterReference<CameraRecoilComponent, SharedCameraRecoilComponent>();
factory.Register<SubFloorHideComponent>();
factory.RegisterIgnore("AiController");
factory.RegisterIgnore("PlayerInputMover");
factory.Register<ExaminerComponent>();
factory.Register<CharacterInfoComponent>();
prototypes.RegisterIgnore("material");
IoCManager.Register<IGameHud, GameHud>();
IoCManager.Register<IClientNotifyManager, ClientNotifyManager>();
@@ -186,6 +133,7 @@ namespace Content.Client
_escapeMenuOwner.Initialize();
}
/// <summary>
/// Subscribe events to the player manager after the player manager is set up
/// </summary>
@@ -238,6 +186,7 @@ namespace Content.Client
var renderFrameEventArgs = new RenderFrameEventArgs(frameTime);
IoCManager.Resolve<IClientNotifyManager>().FrameUpdate(renderFrameEventArgs);
IoCManager.Resolve<IClientGameTicker>().FrameUpdate(renderFrameEventArgs);
IoCManager.Resolve<IChatManager>().FrameUpdate(renderFrameEventArgs);
break;
}
}

View File

@@ -10,6 +10,7 @@ using Robust.Shared.Localization;
namespace Content.Client.GameObjects.Components.Actor
{
[RegisterComponent]
public sealed class CharacterInfoComponent : Component, ICharacterUI
{
private CharacterInfoControl _control;

View File

@@ -18,6 +18,7 @@ namespace Content.Client.GameObjects.Components.Actor
/// A semi-abstract component which gets added to entities upon attachment and collects all character
/// user interfaces into a single window and keybind for the user
/// </summary>
[RegisterComponent]
public class CharacterInterface : Component
{
public override string Name => "Character Interface Component";

View File

@@ -1,13 +1,15 @@
using Content.Shared.GameObjects;
using System;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Inventory;
using Content.Shared.GameObjects.Components.Items;
using Robust.Client.Graphics;
using Robust.Shared.GameObjects;
using Robust.Shared.ViewVariables;
using System;
namespace Content.Client.GameObjects.Components.Clothing
{
[RegisterComponent]
[ComponentReference(typeof(ItemComponent))]
public class ClothingComponent : ItemComponent
{
public override string Name => "Clothing";

View File

@@ -6,6 +6,7 @@ using Robust.Shared.ViewVariables;
namespace Content.Client.GameObjects.Components.Construction
{
[RegisterComponent]
public class ConstructionGhostComponent : Component
{
public override string Name => "ConstructionGhost";

View File

@@ -15,6 +15,7 @@ using Robust.Shared.Maths;
namespace Content.Client.GameObjects.Components.Construction
{
[RegisterComponent]
public class ConstructorComponent : SharedConstructorComponent
{
#pragma warning disable 649

View File

@@ -1,6 +1,6 @@
using Content.Shared.GameObjects;
using System.Collections.Generic;
using Content.Shared.GameObjects;
using Robust.Shared.GameObjects;
using System.Collections.Generic;
namespace Content.Client.GameObjects
{
@@ -8,6 +8,7 @@ namespace Content.Client.GameObjects
/// Fuck I really hate doing this
/// TODO: make sure the client only gets damageable component on the clientside entity for its player mob
/// </summary>
[RegisterComponent]
public class DamageableComponent : SharedDamageableComponent
{
/// <inheritdoc />

View File

@@ -21,6 +21,7 @@ namespace Content.Client.GameObjects
/// <summary>
/// A character UI which shows items the user has equipped within his inventory
/// </summary>
[RegisterComponent]
public class ClientInventoryComponent : SharedInventoryComponent
{
private readonly Dictionary<Slots, IEntity> _slots = new Dictionary<Slots, IEntity>();

View File

@@ -1,10 +1,14 @@
using System.Diagnostics.CodeAnalysis;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Content.Client.GameObjects.EntitySystems;
using JetBrains.Annotations;
using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components.Transform;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
using static Robust.Client.GameObjects.SpriteComponent;
@@ -21,7 +25,8 @@ namespace Content.Client.GameObjects.Components.IconSmoothing
/// To use, set <c>base</c> equal to the prefix of the corner states in the sprite base RSI.
/// Any objects with the same <c>key</c> will connect.
/// </remarks>
public sealed class IconSmoothComponent : Component
[RegisterComponent]
public class IconSmoothComponent : Component
{
private string _smoothKey;
private string _stateBase;
@@ -76,9 +81,9 @@ namespace Content.Client.GameObjects.Components.IconSmoothing
SnapGrid.OnPositionChanged += SnapGridOnPositionChanged;
Owner.EntityManager.RaiseEvent(Owner, new IconSmoothDirtyEvent(null, SnapGrid.Offset, Mode));
var state0 = $"{StateBase}0";
if (Mode == IconSmoothingMode.Corners)
{
var state0 = $"{StateBase}0";
Sprite.LayerMapSet(CornerLayers.SE, Sprite.AddLayerState(state0));
Sprite.LayerSetDirOffset(CornerLayers.SE, DirectionOffset.None);
Sprite.LayerMapSet(CornerLayers.NE, Sprite.AddLayerState(state0));
@@ -90,6 +95,107 @@ namespace Content.Client.GameObjects.Components.IconSmoothing
}
}
internal virtual void CalculateNewSprite()
{
switch (Mode)
{
case IconSmoothingMode.Corners:
CalculateNewSpriteCorers();
break;
case IconSmoothingMode.CardinalFlags:
CalculateNewSpriteCardinal();
break;
default:
throw new ArgumentOutOfRangeException();
}
}
private void CalculateNewSpriteCardinal()
{
var dirs = CardinalConnectDirs.None;
if (MatchingEntity(SnapGrid.GetInDir(Direction.North)))
dirs |= CardinalConnectDirs.North;
if (MatchingEntity(SnapGrid.GetInDir(Direction.South)))
dirs |= CardinalConnectDirs.South;
if (MatchingEntity(SnapGrid.GetInDir(Direction.East)))
dirs |= CardinalConnectDirs.East;
if (MatchingEntity(SnapGrid.GetInDir(Direction.West)))
dirs |= CardinalConnectDirs.West;
Sprite.LayerSetState(0, $"{StateBase}{(int) dirs}");
}
private void CalculateNewSpriteCorers()
{
var n = MatchingEntity(SnapGrid.GetInDir(Direction.North));
var ne = MatchingEntity(SnapGrid.GetInDir(Direction.NorthEast));
var e = MatchingEntity(SnapGrid.GetInDir(Direction.East));
var se = MatchingEntity(SnapGrid.GetInDir(Direction.SouthEast));
var s = MatchingEntity(SnapGrid.GetInDir(Direction.South));
var sw = MatchingEntity(SnapGrid.GetInDir(Direction.SouthWest));
var w = MatchingEntity(SnapGrid.GetInDir(Direction.West));
var nw = MatchingEntity(SnapGrid.GetInDir(Direction.NorthWest));
// ReSharper disable InconsistentNaming
var cornerNE = CornerFill.None;
var cornerSE = CornerFill.None;
var cornerSW = CornerFill.None;
var cornerNW = CornerFill.None;
// ReSharper restore InconsistentNaming
if (n)
{
cornerNE |= CornerFill.CounterClockwise;
cornerNW |= CornerFill.Clockwise;
}
if (ne)
{
cornerNE |= CornerFill.Diagonal;
}
if (e)
{
cornerNE |= CornerFill.Clockwise;
cornerSE |= CornerFill.CounterClockwise;
}
if (se)
{
cornerSE |= CornerFill.Diagonal;
}
if (s)
{
cornerSE |= CornerFill.Clockwise;
cornerSW |= CornerFill.CounterClockwise;
}
if (sw)
{
cornerSW |= CornerFill.Diagonal;
}
if (w)
{
cornerSW |= CornerFill.Clockwise;
cornerNW |= CornerFill.CounterClockwise;
}
if (nw)
{
cornerNW |= CornerFill.Diagonal;
}
Sprite.LayerSetState(CornerLayers.NE, $"{StateBase}{(int) cornerNE}");
Sprite.LayerSetState(CornerLayers.SE, $"{StateBase}{(int) cornerSE}");
Sprite.LayerSetState(CornerLayers.SW, $"{StateBase}{(int) cornerSW}");
Sprite.LayerSetState(CornerLayers.NW, $"{StateBase}{(int) cornerNW}");
}
public override void Shutdown()
{
SnapGrid.OnPositionChanged -= SnapGridOnPositionChanged;
@@ -104,6 +210,52 @@ namespace Content.Client.GameObjects.Components.IconSmoothing
_lastPosition = (Owner.Transform.GridID, SnapGrid.Position);
}
[System.Diagnostics.Contracts.Pure]
protected bool MatchingEntity(IEnumerable<IEntity> candidates)
{
foreach (var entity in candidates)
{
if (!entity.TryGetComponent(out IconSmoothComponent other))
{
continue;
}
if (other.SmoothKey == SmoothKey)
{
return true;
}
}
return false;
}
[Flags]
private enum CardinalConnectDirs : byte
{
None = 0,
North = 1,
South = 2,
East = 4,
West = 8
}
[Flags]
public enum CornerFill : byte
{
// These values are pulled from Baystation12.
// I'm too lazy to convert the state names.
None = 0,
// The cardinal tile counter-clockwise of this corner is filled.
CounterClockwise = 1,
// The diagonal tile in the direction of this corner.
Diagonal = 2,
// The cardinal tile clockwise of this corner is filled.
Clockwise = 4,
}
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum CornerLayers
{

View File

@@ -15,6 +15,8 @@ using Robust.Shared.ViewVariables;
namespace Content.Client.GameObjects
{
[RegisterComponent]
[ComponentReference(typeof(IHandsComponent))]
public class HandsComponent : SharedHandsComponent, IHandsComponent
{
private HandsGui _gui;

View File

@@ -1,4 +1,5 @@
using Content.Shared.GameObjects;
using System;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Items;
using Robust.Client.Graphics;
using Robust.Client.Interfaces.ResourceManagement;
@@ -9,10 +10,10 @@ using Robust.Shared.IoC;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables;
using System;
namespace Content.Client.GameObjects
{
[RegisterComponent]
public class ItemComponent : Component
{
public override string Name => "Item";

View File

@@ -0,0 +1,209 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Content.Client.GameObjects.Components.IconSmoothing;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Maths;
using static Robust.Client.GameObjects.SpriteComponent;
namespace Content.Client.GameObjects.Components
{
// TODO: Over layers should be placed ABOVE the window itself too.
// This is gonna require a client entity & parenting,
// so IsMapTransform being naive is gonna be a problem.
/// <summary>
/// Override of icon smoothing to handle the specific complexities of low walls.
/// </summary>
[RegisterComponent]
[ComponentReference(typeof(IconSmoothComponent))]
public class LowWallComponent : IconSmoothComponent
{
public override string Name => "LowWall";
public CornerFill LastCornerNE { get; private set; }
public CornerFill LastCornerSE { get; private set; }
public CornerFill LastCornerSW { get; private set; }
public CornerFill LastCornerNW { get; private set; }
public override void Startup()
{
base.Startup();
var overState0 = $"{StateBase}over_0";
Sprite.LayerMapSet(OverCornerLayers.SE, Sprite.AddLayerState(overState0));
Sprite.LayerSetDirOffset(OverCornerLayers.SE, DirectionOffset.None);
Sprite.LayerMapSet(OverCornerLayers.NE, Sprite.AddLayerState(overState0));
Sprite.LayerSetDirOffset(OverCornerLayers.NE, DirectionOffset.CounterClockwise);
Sprite.LayerMapSet(OverCornerLayers.NW, Sprite.AddLayerState(overState0));
Sprite.LayerSetDirOffset(OverCornerLayers.NW, DirectionOffset.Flip);
Sprite.LayerMapSet(OverCornerLayers.SW, Sprite.AddLayerState(overState0));
Sprite.LayerSetDirOffset(OverCornerLayers.SW, DirectionOffset.Clockwise);
}
internal override void CalculateNewSprite()
{
base.CalculateNewSprite();
var (n, nl) = MatchingWall(SnapGrid.GetInDir(Direction.North));
var (ne, nel) = MatchingWall(SnapGrid.GetInDir(Direction.NorthEast));
var (e, el) = MatchingWall(SnapGrid.GetInDir(Direction.East));
var (se, sel) = MatchingWall(SnapGrid.GetInDir(Direction.SouthEast));
var (s, sl) = MatchingWall(SnapGrid.GetInDir(Direction.South));
var (sw, swl) = MatchingWall(SnapGrid.GetInDir(Direction.SouthWest));
var (w, wl) = MatchingWall(SnapGrid.GetInDir(Direction.West));
var (nw, nwl) = MatchingWall(SnapGrid.GetInDir(Direction.NorthWest));
// ReSharper disable InconsistentNaming
var cornerNE = CornerFill.None;
var cornerSE = CornerFill.None;
var cornerSW = CornerFill.None;
var cornerNW = CornerFill.None;
var lowCornerNE = CornerFill.None;
var lowCornerSE = CornerFill.None;
var lowCornerSW = CornerFill.None;
var lowCornerNW = CornerFill.None;
// ReSharper restore InconsistentNaming
if (n)
{
cornerNE |= CornerFill.CounterClockwise;
cornerNW |= CornerFill.Clockwise;
if (!nl)
{
lowCornerNE |= CornerFill.CounterClockwise;
lowCornerNW |= CornerFill.Clockwise;
}
}
if (ne)
{
cornerNE |= CornerFill.Diagonal;
if (!nel && (nl || el || n && e))
{
lowCornerNE |= CornerFill.Diagonal;
}
}
if (e)
{
cornerNE |= CornerFill.Clockwise;
cornerSE |= CornerFill.CounterClockwise;
if (!el)
{
lowCornerNE |= CornerFill.Clockwise;
lowCornerSE |= CornerFill.CounterClockwise;
}
}
if (se)
{
cornerSE |= CornerFill.Diagonal;
if (!sel && (sl || el || s && e))
{
lowCornerSE |= CornerFill.Diagonal;
}
}
if (s)
{
cornerSE |= CornerFill.Clockwise;
cornerSW |= CornerFill.CounterClockwise;
if (!sl)
{
lowCornerSE |= CornerFill.Clockwise;
lowCornerSW |= CornerFill.CounterClockwise;
}
}
if (sw)
{
cornerSW |= CornerFill.Diagonal;
if (!swl && (sl || wl || s && w))
{
lowCornerSW |= CornerFill.Diagonal;
}
}
if (w)
{
cornerSW |= CornerFill.Clockwise;
cornerNW |= CornerFill.CounterClockwise;
if (!wl)
{
lowCornerSW |= CornerFill.Clockwise;
lowCornerNW |= CornerFill.CounterClockwise;
}
}
if (nw)
{
cornerNW |= CornerFill.Diagonal;
if (!nwl && (nl || wl || n && w))
{
lowCornerNW |= CornerFill.Diagonal;
}
}
Sprite.LayerSetState(CornerLayers.NE, $"{StateBase}{(int) cornerNE}");
Sprite.LayerSetState(CornerLayers.SE, $"{StateBase}{(int) cornerSE}");
Sprite.LayerSetState(CornerLayers.SW, $"{StateBase}{(int) cornerSW}");
Sprite.LayerSetState(CornerLayers.NW, $"{StateBase}{(int) cornerNW}");
Sprite.LayerSetState(OverCornerLayers.NE, $"{StateBase}over_{(int) lowCornerNE}");
Sprite.LayerSetState(OverCornerLayers.SE, $"{StateBase}over_{(int) lowCornerSE}");
Sprite.LayerSetState(OverCornerLayers.SW, $"{StateBase}over_{(int) lowCornerSW}");
Sprite.LayerSetState(OverCornerLayers.NW, $"{StateBase}over_{(int) lowCornerNW}");
LastCornerNE = cornerNE;
LastCornerSE = cornerSE;
LastCornerSW = cornerSW;
LastCornerNW = cornerNW;
foreach (var entity in SnapGrid.GetLocal())
{
if (entity.TryGetComponent(out WindowComponent window))
{
window.UpdateSprite();
}
}
}
[System.Diagnostics.Contracts.Pure]
private (bool connected, bool lowWall) MatchingWall(IEnumerable<IEntity> candidates)
{
foreach (var entity in candidates)
{
if (!entity.TryGetComponent(out IconSmoothComponent other))
{
continue;
}
if (other.SmoothKey == SmoothKey)
{
return (true, other is LowWallComponent);
}
}
return (false, false);
}
[SuppressMessage("ReSharper", "InconsistentNaming")]
private enum OverCornerLayers
{
SE,
NE,
NW,
SW,
}
}
}

View File

@@ -8,6 +8,8 @@ using Robust.Shared.Maths;
namespace Content.Client.GameObjects.Components.Mobs
{
[RegisterComponent]
[ComponentReference(typeof(SharedCameraRecoilComponent))]
public sealed class CameraRecoilComponent : SharedCameraRecoilComponent
{
// Maximum rate of magnitude restore towards 0 kick.

View File

@@ -1,31 +1,31 @@
using Content.Client.GameObjects.Components.Actor;
using Content.Client.GameObjects.Components.Mobs;
using System.Collections.Generic;
using Content.Client.GameObjects.Components.Actor;
using Content.Client.Graphics.Overlays;
using Content.Client.UserInterface;
using Content.Client.Utility;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Mobs;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Graphics.Overlays;
using Robust.Client.Interfaces.Graphics.Overlays;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.Interfaces.UserInterface;
using Robust.Client.Player;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components.Renderable;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.IoC;
using System.Collections.Generic;
using Content.Client.UserInterface;
using Content.Client.Utility;
using Content.Shared.GameObjects.Components.Mobs;
using Robust.Client.Graphics;
using Robust.Client.Graphics.Overlays;
using Robust.Client.Interfaces.UserInterface;
using Robust.Shared.GameObjects.Components.Renderable;
namespace Content.Client.GameObjects
{
/// <summary>
/// A character UI component which shows the current damage state of the mob (living/dead)
/// </summary>
[RegisterComponent]
public class SpeciesUI : SharedSpeciesComponent//, ICharacterUI
{
private StatusEffectsUI _ui;

View File

@@ -1,14 +1,13 @@
using Content.Shared.GameObjects.Components.Power;
using Robust.Client.Interfaces.Graphics;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.IoC;
namespace Content.Client.GameObjects.Components.Power
{
[RegisterComponent]
public class PowerDebugTool : SharedPowerDebugTool
{
SS14Window LastWindow;

View File

@@ -1,13 +1,13 @@
using Content.Shared.GameObjects.Components.Research;
using Content.Shared.Research;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.IoC;
using Robust.Shared.Prototypes;
namespace Content.Client.GameObjects.Components.Research
{
[RegisterComponent]
[ComponentReference(typeof(SharedLatheDatabaseComponent))]
public class LatheDatabaseComponent : SharedLatheDatabaseComponent
{
#pragma warning disable CS0649

View File

@@ -2,11 +2,11 @@ using System;
using System.Collections.Generic;
using Content.Shared.GameObjects.Components.Research;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Network;
namespace Content.Client.GameObjects.Components.Research
{
[RegisterComponent]
[ComponentReference(typeof(SharedMaterialStorageComponent))]
public class MaterialStorageComponent : SharedMaterialStorageComponent
{
protected override Dictionary<string, int> Storage { get; set; } = new Dictionary<string, int>();

View File

@@ -5,14 +5,13 @@ using Robust.Client.GameObjects.EntitySystems;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.Interfaces.Timers;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Serialization;
using Robust.Shared.Timers;
namespace Content.Client.GameObjects.Components.Sound
{
[RegisterComponent]
public class SoundComponent : SharedSoundComponent
{
private readonly List<ScheduledSound> _schedules = new List<ScheduledSound>();

View File

@@ -1,4 +1,6 @@
using Content.Shared.GameObjects.Components.Storage;
using System;
using System.Collections.Generic;
using Content.Shared.GameObjects.Components.Storage;
using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
@@ -7,19 +9,15 @@ using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.IoC;
using Robust.Shared.Utility;
using System;
using System.Collections.Generic;
using Robust.Client.Interfaces.Graphics;
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
namespace Content.Client.GameObjects.Components.Storage
{
/// <summary>
/// Client version of item storage containers, contains a UI which displays stored entities and their size
/// </summary>
[RegisterComponent]
public class ClientStorageComponent : SharedStorageComponent
{
private Dictionary<EntityUid, int> StoredEntities { get; set; } = new Dictionary<EntityUid, int>();
@@ -118,7 +116,6 @@ namespace Content.Client.GameObjects.Components.Storage
base.Initialize();
Title = "Storage Item";
Visible = false;
RectClipContent = true;
VSplitContainer = new VBoxContainer("VSplitContainer");

View File

@@ -10,6 +10,7 @@ namespace Content.Client.GameObjects.Components
/// is not a sub floor (plating).
/// </summary>
/// <seealso cref="ContentTileDefinition.IsSubFloor"/>
[RegisterComponent]
public sealed class SubFloorHideComponent : Component
{
private SnapGridComponent _snapGridComponent;

View File

@@ -1,12 +1,13 @@
using System;
using Content.Shared.GameObjects.Components.Weapons.Ranged;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.Timing;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Map;
namespace Content.Client.GameObjects.Components.Weapons.Ranged
{
[RegisterComponent]
public sealed class ClientRangedWeaponComponent : SharedRangedWeaponComponent
{
private TimeSpan _lastFireTime;

View File

@@ -0,0 +1,92 @@
using Content.Client.GameObjects.EntitySystems;
using Robust.Client.GameObjects;
using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components.Transform;
using Robust.Shared.Serialization;
using static Content.Client.GameObjects.Components.IconSmoothing.IconSmoothComponent;
namespace Content.Client.GameObjects.Components
{
[RegisterComponent]
public sealed class WindowComponent : Component
{
public override string Name => "Window";
private string _stateBase;
private ISpriteComponent _sprite;
private SnapGridComponent _snapGrid;
public override void Initialize()
{
base.Initialize();
_sprite = Owner.GetComponent<ISpriteComponent>();
_snapGrid = Owner.GetComponent<SnapGridComponent>();
}
public override void Startup()
{
base.Startup();
_snapGrid.OnPositionChanged += SnapGridOnPositionChanged;
Owner.EntityManager.RaiseEvent(Owner, new WindowSmoothDirtyEvent());
var state0 = $"{_stateBase}0";
_sprite.LayerMapSet(CornerLayers.SE, _sprite.AddLayerState(state0));
_sprite.LayerSetDirOffset(CornerLayers.SE, SpriteComponent.DirectionOffset.None);
_sprite.LayerMapSet(CornerLayers.NE, _sprite.AddLayerState(state0));
_sprite.LayerSetDirOffset(CornerLayers.NE, SpriteComponent.DirectionOffset.CounterClockwise);
_sprite.LayerMapSet(CornerLayers.NW, _sprite.AddLayerState(state0));
_sprite.LayerSetDirOffset(CornerLayers.NW, SpriteComponent.DirectionOffset.Flip);
_sprite.LayerMapSet(CornerLayers.SW, _sprite.AddLayerState(state0));
_sprite.LayerSetDirOffset(CornerLayers.SW, SpriteComponent.DirectionOffset.Clockwise);
}
public override void Shutdown()
{
_snapGrid.OnPositionChanged -= SnapGridOnPositionChanged;
base.Shutdown();
}
private void SnapGridOnPositionChanged()
{
Owner.EntityManager.RaiseEvent(Owner, new WindowSmoothDirtyEvent());
}
public void UpdateSprite()
{
var lowWall = FindLowWall();
if (lowWall == null)
{
return;
}
_sprite.LayerSetState(CornerLayers.NE, $"{_stateBase}{(int) lowWall.LastCornerNE}");
_sprite.LayerSetState(CornerLayers.SE, $"{_stateBase}{(int) lowWall.LastCornerSE}");
_sprite.LayerSetState(CornerLayers.SW, $"{_stateBase}{(int) lowWall.LastCornerSW}");
_sprite.LayerSetState(CornerLayers.NW, $"{_stateBase}{(int) lowWall.LastCornerNW}");
}
private LowWallComponent FindLowWall()
{
foreach (var entity in _snapGrid.GetLocal())
{
if (entity.TryGetComponent(out LowWallComponent lowWall))
{
return lowWall;
}
}
return null;
}
public override void ExposeData(ObjectSerializer serializer)
{
base.ExposeData(serializer);
serializer.DataField(ref _stateBase, "base", null);
}
}
}

View File

@@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Client.GameObjects.Components.IconSmoothing;
using JetBrains.Annotations;
using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components.Transform;
using Robust.Shared.GameObjects.Systems;
@@ -132,157 +130,10 @@ namespace Content.Client.GameObjects.EntitySystems
return;
}
var sprite = smoothing.Sprite;
var snapGrid = smoothing.SnapGrid;
switch (smoothing.Mode)
{
case IconSmoothingMode.Corners:
_calculateNewSpriteCorers(smoothing, snapGrid, sprite);
break;
case IconSmoothingMode.CardinalFlags:
_calculateNewSpriteCardinal(smoothing, snapGrid, sprite);
break;
default:
throw new ArgumentOutOfRangeException();
}
smoothing.CalculateNewSprite();
smoothing.UpdateGeneration = _generation;
}
private static void _calculateNewSpriteCardinal(IconSmoothComponent smoothing, SnapGridComponent snapGrid,
ISpriteComponent sprite)
{
var dirs = CardinalConnectDirs.None;
if (MatchingEntity(smoothing, snapGrid.GetInDir(Direction.North)))
dirs |= CardinalConnectDirs.North;
if (MatchingEntity(smoothing, snapGrid.GetInDir(Direction.South)))
dirs |= CardinalConnectDirs.South;
if (MatchingEntity(smoothing, snapGrid.GetInDir(Direction.East)))
dirs |= CardinalConnectDirs.East;
if (MatchingEntity(smoothing, snapGrid.GetInDir(Direction.West)))
dirs |= CardinalConnectDirs.West;
sprite.LayerSetState(0, $"{smoothing.StateBase}{(int) dirs}");
}
private static void _calculateNewSpriteCorers(IconSmoothComponent smoothing, SnapGridComponent snapGrid,
ISpriteComponent sprite)
{
var n = MatchingEntity(smoothing, snapGrid.GetInDir(Direction.North));
var ne = MatchingEntity(smoothing, snapGrid.GetInDir(Direction.NorthEast));
var e = MatchingEntity(smoothing, snapGrid.GetInDir(Direction.East));
var se = MatchingEntity(smoothing, snapGrid.GetInDir(Direction.SouthEast));
var s = MatchingEntity(smoothing, snapGrid.GetInDir(Direction.South));
var sw = MatchingEntity(smoothing, snapGrid.GetInDir(Direction.SouthWest));
var w = MatchingEntity(smoothing, snapGrid.GetInDir(Direction.West));
var nw = MatchingEntity(smoothing, snapGrid.GetInDir(Direction.NorthWest));
// ReSharper disable InconsistentNaming
var cornerNE = CornerFill.None;
var cornerSE = CornerFill.None;
var cornerSW = CornerFill.None;
var cornerNW = CornerFill.None;
// ReSharper restore InconsistentNaming
if (n)
{
cornerNE |= CornerFill.CounterClockwise;
cornerNW |= CornerFill.Clockwise;
}
if (ne)
{
cornerNE |= CornerFill.Diagonal;
}
if (e)
{
cornerNE |= CornerFill.Clockwise;
cornerSE |= CornerFill.CounterClockwise;
}
if (se)
{
cornerSE |= CornerFill.Diagonal;
}
if (s)
{
cornerSE |= CornerFill.Clockwise;
cornerSW |= CornerFill.CounterClockwise;
}
if (sw)
{
cornerSW |= CornerFill.Diagonal;
}
if (w)
{
cornerSW |= CornerFill.Clockwise;
cornerNW |= CornerFill.CounterClockwise;
}
if (nw)
{
cornerNW |= CornerFill.Diagonal;
}
sprite.LayerSetState(IconSmoothComponent.CornerLayers.NE, $"{smoothing.StateBase}{(int) cornerNE}");
sprite.LayerSetState(IconSmoothComponent.CornerLayers.SE, $"{smoothing.StateBase}{(int) cornerSE}");
sprite.LayerSetState(IconSmoothComponent.CornerLayers.SW, $"{smoothing.StateBase}{(int) cornerSW}");
sprite.LayerSetState(IconSmoothComponent.CornerLayers.NW, $"{smoothing.StateBase}{(int) cornerNW}");
}
[System.Diagnostics.Contracts.Pure]
private static bool MatchingEntity(IconSmoothComponent source, IEnumerable<IEntity> candidates)
{
foreach (var entity in candidates)
{
if (!entity.TryGetComponent(out IconSmoothComponent other))
{
return false;
}
if (other.SmoothKey == source.SmoothKey)
{
return true;
}
}
return false;
}
[Flags]
private enum CardinalConnectDirs : byte
{
None = 0,
North = 1,
South = 2,
East = 4,
West = 8
}
[Flags]
private enum CornerFill : byte
{
// These values are pulled from Baystation12.
// I'm too lazy to convert the state names.
None = 0,
// The cardinal tile counter-clockwise of this corner is filled.
CounterClockwise = 1,
// The diagonal tile in the direction of this corner.
Diagonal = 2,
// The cardinal tile clockwise of this corner is filled.
Clockwise = 4,
}
}
/// <summary>

View File

@@ -0,0 +1,51 @@
using System.Collections.Generic;
using Content.Client.GameObjects.Components;
using Content.Client.GameObjects.Components.IconSmoothing;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components.Transform;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Map;
namespace Content.Client.GameObjects.EntitySystems
{
[UsedImplicitly]
public sealed class WindowSystem : EntitySystem
{
private readonly Queue<IEntity> _dirtyEntities = new Queue<IEntity>();
public override void Initialize()
{
base.Initialize();
SubscribeEvent<WindowSmoothDirtyEvent>(HandleDirtyEvent);
}
private void HandleDirtyEvent(object sender, WindowSmoothDirtyEvent ev)
{
if (sender is IEntity senderEnt && senderEnt.HasComponent<WindowComponent>())
{
_dirtyEntities.Enqueue(senderEnt);
}
}
public override void FrameUpdate(float frameTime)
{
base.FrameUpdate(frameTime);
// Performance: This could be spread over multiple updates, or made parallel.
while (_dirtyEntities.Count > 0)
{
_dirtyEntities.Dequeue().GetComponent<WindowComponent>().UpdateSprite();
}
}
}
/// <summary>
/// Event raised by a <see cref="WindowComponent"/> when it needs to be recalculated.
/// </summary>
public sealed class WindowSmoothDirtyEvent : EntitySystemMessage
{
}
}

View File

@@ -91,6 +91,7 @@ namespace Content.Client.GameTicking
_lobby = null;
_gameChat?.Dispose();
_gameChat = null;
_gameHud.RootControl.Orphan();
}
public void FrameUpdate(RenderFrameEventArgs renderFrameEventArgs)
@@ -171,7 +172,7 @@ namespace Content.Client.GameTicking
_gameChat = null;
}
_gameHud.RootControl.Parent?.RemoveChild(_gameHud.RootControl);
_gameHud.RootControl.Orphan();
_tickerState = TickerState.InLobby;

View File

@@ -1,4 +1,6 @@
using Content.Client.Chat;
using Robust.Client;
using Robust.Shared.GameObjects;
namespace Content.Client.Interfaces.Chat
{
@@ -6,6 +8,10 @@ namespace Content.Client.Interfaces.Chat
{
void Initialize();
void FrameUpdate(RenderFrameEventArgs delta);
void SetChatBox(ChatBox chatBox);
void RemoveSpeechBubble(EntityUid entityUid, SpeechBubble bubble);
}
}

View File

@@ -3,8 +3,6 @@ using System.IO;
using System.Threading.Tasks;
using Content.Client.Interfaces.Parallax;
using Nett;
using SixLabors.ImageSharp;
using SixLabors.Primitives;
using Robust.Client.Graphics;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Shared.Interfaces.Configuration;
@@ -12,6 +10,8 @@ using Robust.Shared.Interfaces.Log;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Utility;
using SixLabors.ImageSharp;
using SixLabors.Primitives;
namespace Content.Client.Parallax
{
@@ -39,7 +39,7 @@ namespace Content.Client.Parallax
return;
}
MemoryStream configStream = null;
Stream configStream = null;
string contents;
TomlTable table;
try

View File

@@ -371,6 +371,11 @@ namespace Content.Client.UserInterface
new StyleProperty(PanelContainer.StylePropertyPanel, tooltipBox)
}),
new StyleRule(new SelectorElement(typeof(PanelContainer), new []{"tooltipBox"}, null, null), new[]
{
new StyleProperty(PanelContainer.StylePropertyPanel, tooltipBox)
}),
// Entity tooltip
new StyleRule(
new SelectorElement(typeof(PanelContainer), new[] {ExamineSystem.StyleClassEntityTooltip}, null,

View File

@@ -28,5 +28,5 @@
<PropertyGroup>
<RobustToolsPath>..\RobustToolbox\Tools\</RobustToolsPath>
</PropertyGroup>
<Target Name="RobustAfterBuild" DependsOnTargets="CopySS14Noise;CopyMiscDependencies" AfterTargets="Build" />
<Target Name="RobustAfterBuild" DependsOnTargets="CopySS14Noise;CopyMiscDependencies;CopySwnfd" AfterTargets="Build" />
</Project>

View File

@@ -1,13 +1,10 @@
using System.Linq;
using System.Net.Http;
using Content.Server.Interfaces;
using Content.Server.Interfaces.Chat;
using Content.Shared.Chat;
using Robust.Server.Interfaces.Player;
using Robust.Shared.Interfaces.Configuration;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.Interfaces.Resources;
using Robust.Shared.IoC;
namespace Content.Server.Chat
@@ -57,6 +54,7 @@ namespace Content.Server.Chat
msg.Channel = ChatChannel.Local;
msg.Message = message;
msg.MessageWrap = $"{source.Name} says, \"{{0}}\"";
msg.SenderEntity = source.Uid;
_netManager.ServerSendToMany(msg, clients.ToList());
}

View File

@@ -1,71 +1,22 @@
using Content.Server.Chat;
using Content.Server.GameObjects;
using Content.Server.GameObjects.Components;
using Content.Server.GameObjects.Components.Power;
using Content.Server.GameObjects.Components.Interactable.Tools;
using Content.Server.Interfaces.GameObjects;
using Content.Server.Placement;
using Robust.Server;
using Robust.Server.Interfaces;
using Robust.Server.Interfaces.Maps;
using Robust.Server.Interfaces.Player;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.ContentPack;
using Robust.Shared.Enums;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.Interfaces.Timers;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Map;
using Robust.Shared.Timers;
using Robust.Shared.Interfaces.Timing;
using Robust.Shared.Maths;
using Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan;
using Content.Server.GameObjects.Components.Weapon.Ranged.Projectile;
using Content.Server.GameObjects.Components.Projectiles;
using Content.Server.GameObjects.Components.Weapon.Melee;
using Content.Server.GameObjects.Components.Stack;
using Content.Server.GameObjects.Components.Construction;
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Mobs;
using Content.Server.Players;
using Content.Server.GameObjects.Components.Interactable;
using Content.Server.GameObjects.Components.Markers;
using Content.Server.GameObjects.Components.Sound;
using Content.Server.GameObjects.Components.Weapon.Ranged;
using Content.Server.GameTicking;
using Content.Server.Interfaces;
using Content.Server.Interfaces.GameTicking;
using Content.Shared.GameObjects.Components.Materials;
using Content.Shared.GameObjects.Components.Inventory;
using Content.Shared.GameObjects.Components.Markers;
using Content.Shared.GameObjects.Components.Mobs;
using Content.Shared.Interfaces;
using Robust.Server.Interfaces.ServerStatus;
using Robust.Shared.Timing;
using Content.Server.GameObjects.Components.Destructible;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.Components.Items.Storage.Fill;
using Content.Server.GameObjects.Components.Movement;
using Content.Server.Interfaces.Chat;
using Content.Server.Interfaces.GameObjects.Components.Movement;
using Content.Server.GameObjects.Components.Research;
using Content.Shared.GameObjects.Components.Research;
using Content.Server.Interfaces.GameTicking;
using Content.Shared.Interfaces;
using Robust.Server.Interfaces.Player;
using Robust.Shared.ContentPack;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Log;
using Content.Server.GameObjects.Components.Explosive;
using Content.Server.GameObjects.Components.Items;
using Content.Server.GameObjects.Components.Triggers;
using Content.Shared.GameObjects.Components.Movement;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Timing;
namespace Content.Server
{
public class EntryPoint : GameServer
{
private IGameTicker _gameTicker;
private IMoMMILink _mommiLink;
private StatusShell _statusShell;
/// <inheritdoc />
@@ -75,127 +26,22 @@ namespace Content.Server
var factory = IoCManager.Resolve<IComponentFactory>();
factory.Register<HandsComponent>();
factory.RegisterReference<HandsComponent, IHandsComponent>();
factory.DoAutoRegistrations();
factory.Register<InventoryComponent>();
var registerIgnore = new[]
{
"ConstructionGhost",
"IconSmooth",
"SubFloorHide",
"LowWall",
"Window",
"CharacterInfo"
};
factory.Register<StoreableComponent>();
factory.Register<ItemComponent>();
factory.RegisterReference<ItemComponent, StoreableComponent>();
factory.Register<ClothingComponent>();
factory.RegisterReference<ClothingComponent, ItemComponent>();
factory.RegisterReference<ClothingComponent, StoreableComponent>();
factory.Register<PlaceableSurfaceComponent>();
factory.Register<DamageableComponent>();
factory.Register<DestructibleComponent>();
factory.Register<TemperatureComponent>();
factory.Register<ServerDoorComponent>();
factory.RegisterReference<ServerDoorComponent, IActivate>();
//Power Components
factory.Register<PowerTransferComponent>();
factory.Register<PowerProviderComponent>();
factory.RegisterReference<PowerProviderComponent, PowerDeviceComponent>();
factory.Register<PowerNodeComponent>();
factory.Register<PowerStorageNetComponent>();
factory.RegisterReference<PowerStorageNetComponent, PowerStorageComponent>();
factory.Register<PowerCellComponent>();
factory.RegisterReference<PowerCellComponent, PowerStorageComponent>();
factory.Register<PowerDeviceComponent>();
factory.Register<PowerGeneratorComponent>();
factory.Register<LightBulbComponent>();
//Tools
factory.Register<MultitoolComponent>();
factory.Register<WirecutterComponent>();
factory.Register<WrenchComponent>();
factory.Register<WelderComponent>();
factory.Register<ScrewdriverComponent>();
factory.Register<CrowbarComponent>();
factory.Register<HitscanWeaponComponent>();
factory.Register<RangedWeaponComponent>();
factory.Register<BallisticMagazineWeaponComponent>();
factory.Register<ProjectileComponent>();
factory.Register<ThrownItemComponent>();
factory.Register<MeleeWeaponComponent>();
factory.Register<HealingComponent>();
factory.Register<SoundComponent>();
factory.Register<HandheldLightComponent>();
factory.Register<ServerStorageComponent>();
factory.RegisterReference<ServerStorageComponent, IStorageComponent>();
factory.RegisterReference<ServerStorageComponent, IActivate>();
factory.Register<EntityStorageComponent>();
factory.RegisterReference<EntityStorageComponent, IStorageComponent>();
factory.RegisterReference<EntityStorageComponent, IActivate>();
factory.Register<ToolLockerFillComponent>();
factory.Register<ToolboxElectricalFillComponent>();
factory.Register<PowerDebugTool>();
factory.Register<PoweredLightComponent>();
factory.Register<SmesComponent>();
factory.Register<ApcComponent>();
factory.RegisterReference<ApcComponent, IActivate>();
factory.Register<MaterialComponent>();
factory.Register<StackComponent>();
factory.Register<MaterialStorageComponent>();
factory.RegisterReference<MaterialStorageComponent, SharedMaterialStorageComponent>();
factory.Register<ConstructionComponent>();
factory.Register<ConstructorComponent>();
factory.RegisterIgnore("ConstructionGhost");
factory.Register<MindComponent>();
factory.Register<SpeciesComponent>();
factory.Register<HeatResistanceComponent>();
factory.Register<SpawnPointComponent>();
factory.RegisterReference<SpawnPointComponent, SharedSpawnPointComponent>();
factory.Register<LatheComponent>();
factory.RegisterReference<LatheComponent, IActivate>();
factory.Register<LatheDatabaseComponent>();
factory.RegisterReference<LatheDatabaseComponent, SharedLatheDatabaseComponent>();
factory.Register<BallisticBulletComponent>();
factory.Register<BallisticMagazineComponent>();
factory.Register<HitscanWeaponCapacitorComponent>();
factory.Register<CameraRecoilComponent>();
factory.RegisterReference<CameraRecoilComponent, SharedCameraRecoilComponent>();
factory.RegisterIgnore("IconSmooth");
factory.RegisterIgnore("SubFloorHide");
factory.Register<PlayerInputMoverComponent>();
factory.RegisterReference<PlayerInputMoverComponent, IMoverComponent>();
factory.Register<AiControllerComponent>();
factory.Register<ServerPortalComponent>();
factory.Register<ServerTeleporterComponent>();
factory.Register<TeleportableComponent>();
factory.Register<CatwalkComponent>();
factory.Register<DiceComponent>();
factory.Register<ExplosiveComponent>();
factory.Register<OnUseTimerTriggerComponent>();
factory.Register<FootstepModifierComponent>();
factory.Register<EmitSoundOnUseComponent>();
factory.Register<CombatModeComponent>();
factory.Register<ExaminerComponent>();
foreach (var ignoreName in registerIgnore)
{
factory.RegisterIgnore(ignoreName);
}
IoCManager.Register<ISharedNotifyManager, ServerNotifyManager>();
IoCManager.Register<IServerNotifyManager, ServerNotifyManager>();
@@ -214,8 +60,6 @@ namespace Content.Server
IoCManager.Resolve<IServerNotifyManager>().Initialize();
IoCManager.Resolve<IChatManager>().Initialize();
_mommiLink = IoCManager.Resolve<IMoMMILink>();
var playerManager = IoCManager.Resolve<IPlayerManager>();
_statusShell = new StatusShell();

View File

@@ -5,6 +5,7 @@ namespace Content.Server.GameObjects.Components
/// <summary>
/// Literally just a marker component for footsteps for now.
/// </summary>
[RegisterComponent]
public sealed class CatwalkComponent : Component
{
public override string Name => "Catwalk";

View File

@@ -0,0 +1,142 @@
using System;
using Content.Shared.Chemistry;
using Content.Shared.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
namespace Content.Server.GameObjects.Components.Chemistry
{
/// <summary>
/// Shared ECS component that manages a liquid solution of reagents.
/// </summary>
[RegisterComponent]
internal class SolutionComponent : Shared.GameObjects.Components.Chemistry.SolutionComponent
{
/// <summary>
/// Transfers solution from the held container to the target container.
/// </summary>
[Verb]
private sealed class FillTargetVerb : Verb<SolutionComponent>
{
protected override string GetText(IEntity user, SolutionComponent component)
{
if(!user.TryGetComponent<HandsComponent>(out var hands))
return "<I SHOULD BE INVISIBLE>";
if(hands.GetActiveHand == null)
return "<I SHOULD BE INVISIBLE>";
var heldEntityName = hands.GetActiveHand.Owner?.Prototype?.Name ?? "<Item>";
var myName = component.Owner.Prototype?.Name ?? "<Item>";
return $"Transfer liquid from [{heldEntityName}] to [{myName}].";
}
protected override VerbVisibility GetVisibility(IEntity user, SolutionComponent component)
{
if (user.TryGetComponent<HandsComponent>(out var hands))
{
if (hands.GetActiveHand != null)
{
if (hands.GetActiveHand.Owner.TryGetComponent<SolutionComponent>(out var solution))
{
if ((solution.Capabilities & SolutionCaps.PourOut) != 0 && (component.Capabilities & SolutionCaps.PourIn) != 0)
return VerbVisibility.Visible;
}
}
}
return VerbVisibility.Invisible;
}
protected override void Activate(IEntity user, SolutionComponent component)
{
if (!user.TryGetComponent<HandsComponent>(out var hands))
return;
if (hands.GetActiveHand == null)
return;
if (!hands.GetActiveHand.Owner.TryGetComponent<SolutionComponent>(out var handSolutionComp))
return;
if ((handSolutionComp.Capabilities & SolutionCaps.PourOut) == 0 || (component.Capabilities & SolutionCaps.PourIn) == 0)
return;
var transferQuantity = Math.Min(component.MaxVolume - component.CurrentVolume, handSolutionComp.CurrentVolume);
transferQuantity = Math.Min(transferQuantity, 10);
// nothing to transfer
if (transferQuantity <= 0)
return;
var transferSolution = handSolutionComp.SplitSolution(transferQuantity);
component.TryAddSolution(transferSolution);
}
}
/// <summary>
/// Transfers solution from a target container to the held container.
/// </summary>
[Verb]
private sealed class EmptyTargetVerb : Verb<SolutionComponent>
{
protected override string GetText(IEntity user, SolutionComponent component)
{
if (!user.TryGetComponent<HandsComponent>(out var hands))
return "<I SHOULD BE INVISIBLE>";
if (hands.GetActiveHand == null)
return "<I SHOULD BE INVISIBLE>";
var heldEntityName = hands.GetActiveHand.Owner?.Prototype?.Name ?? "<Item>";
var myName = component.Owner.Prototype?.Name ?? "<Item>";
return $"Transfer liquid from [{myName}] to [{heldEntityName}].";
}
protected override VerbVisibility GetVisibility(IEntity user, SolutionComponent component)
{
if (user.TryGetComponent<HandsComponent>(out var hands))
{
if (hands.GetActiveHand != null)
{
if (hands.GetActiveHand.Owner.TryGetComponent<SolutionComponent>(out var solution))
{
if ((solution.Capabilities & SolutionCaps.PourIn) != 0 && (component.Capabilities & SolutionCaps.PourOut) != 0)
return VerbVisibility.Visible;
}
}
}
return VerbVisibility.Invisible;
}
protected override void Activate(IEntity user, SolutionComponent component)
{
if (!user.TryGetComponent<HandsComponent>(out var hands))
return;
if (hands.GetActiveHand == null)
return;
if(!hands.GetActiveHand.Owner.TryGetComponent<SolutionComponent>(out var handSolutionComp))
return;
if ((handSolutionComp.Capabilities & SolutionCaps.PourIn) == 0 || (component.Capabilities & SolutionCaps.PourOut) == 0)
return;
var transferQuantity = Math.Min(handSolutionComp.MaxVolume - handSolutionComp.CurrentVolume, component.CurrentVolume);
transferQuantity = Math.Min(transferQuantity, 10);
// pulling from an empty container, pointless to continue
if (transferQuantity <= 0)
return;
var transferSolution = component.SplitSolution(transferQuantity);
handSolutionComp.TryAddSolution(transferSolution);
}
}
}
}

View File

@@ -17,6 +17,7 @@ using static Content.Shared.Construction.ConstructionStepTool;
namespace Content.Server.GameObjects.Components.Construction
{
[RegisterComponent]
public class ConstructionComponent : Component, IAttackBy
{
public override string Name => "Construction";

View File

@@ -3,13 +3,11 @@ using Content.Server.GameObjects.Components.Stack;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.Construction;
using Content.Shared.GameObjects.Components.Construction;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.IoC;
using Robust.Shared.Map;
@@ -18,6 +16,7 @@ using Robust.Shared.Prototypes;
namespace Content.Server.GameObjects.Components.Construction
{
[RegisterComponent]
public class ConstructorComponent : SharedConstructorComponent
{
#pragma warning disable 649

View File

@@ -1,12 +1,9 @@
using Content.Server.Interfaces.GameObjects;
using System;
using System;
using System.Collections.Generic;
using Robust.Shared.Maths;
using Robust.Shared.GameObjects;
using Robust.Shared.Utility;
using YamlDotNet.RepresentationModel;
using Content.Server.Interfaces;
using Content.Server.Interfaces.GameObjects;
using Content.Shared.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
@@ -18,6 +15,7 @@ namespace Content.Server.GameObjects
/// A component that handles receiving damage and healing,
/// as well as informing other components of it.
/// </summary>
[RegisterComponent]
public class DamageableComponent : SharedDamageableComponent, IDamageableComponent
{
/// <inheritdoc />

View File

@@ -1,21 +1,21 @@
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.Serialization;
using Robust.Shared.ViewVariables;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Maths;
using Content.Server.Interfaces;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Destructible
{
/// <summary>
/// Deletes the entity once a certain damage threshold has been reached.
/// </summary>
[RegisterComponent]
public class DestructibleComponent : Component, IOnDamageBehavior, IDestroyAct, IExAct
{
#pragma warning disable 649
@@ -63,7 +63,7 @@ namespace Content.Server.GameObjects.Components.Destructible
/// <inheritdoc />
void IOnDamageBehavior.OnDamageThresholdPassed(object obj, DamageThresholdPassedEventArgs e)
{
{
if (e.Passed && e.DamageThreshold == Threshold && destroyed == false)
{
destroyed = true;

View File

@@ -10,6 +10,8 @@ using Robust.Shared.Timers;
namespace Content.Server.GameObjects
{
[RegisterComponent]
[ComponentReference(typeof(IActivate))]
public class ServerDoorComponent : Component, IActivate
{
public override string Name => "Door";

View File

@@ -1,28 +1,27 @@
using System;
using System.Linq;
using System.Collections.Generic;
using Content.Server.GameObjects.Components.Mobs;
using Robust.Server.Interfaces.GameObjects;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.Maps;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Shared.GameObjects.EntitySystemMessages;
using Robust.Server.Interfaces.GameObjects;
using Robust.Server.Interfaces.Player;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.Timing;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.GameObjects.EntitySystemMessages;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.Interfaces.Timing;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects;
using Content.Shared.Maps;
using Robust.Server.Interfaces.Player;
namespace Content.Server.GameObjects.Components.Explosive
{
[RegisterComponent]
public class ExplosiveComponent : Component, ITimerTrigger, IDestroyAct
{
#pragma warning disable 649
#pragma warning disable 649
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager;
[Dependency] private readonly IMapManager _mapManager;
[Dependency] private readonly IServerEntityManager _serverEntityManager;
@@ -66,7 +65,7 @@ namespace Content.Server.GameObjects.Components.Explosive
if (distanceFromEntity < DevastationRange)
{
severity = ExplosionSeverity.Destruction;
}
}
else if (distanceFromEntity < HeavyImpactRange)
{
severity = ExplosionSeverity.Heavy;

View File

@@ -5,8 +5,8 @@ using Content.Shared.GameObjects;
using Robust.Server.GameObjects.Components.Container;
using Robust.Server.Interfaces.Player;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.IoC;
using Robust.Shared.Utility;
@@ -16,6 +16,7 @@ using static Content.Shared.GameObjects.SharedInventoryComponent.ClientInventory
namespace Content.Server.GameObjects
{
[RegisterComponent]
public class InventoryComponent : SharedInventoryComponent
{
[ViewVariables]

View File

@@ -3,16 +3,12 @@ using System.Collections.Generic;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects;
using Content.Shared.GameObjects;
using Content.Shared.Input;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.Components.Container;
using Robust.Server.GameObjects.EntitySystemMessages;
using Robust.Server.Interfaces.Player;
using Robust.Shared.GameObjects;
using Robust.Shared.Input;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.IoC;
using Robust.Shared.Log;
@@ -24,6 +20,8 @@ using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects
{
[RegisterComponent]
[ComponentReference(typeof(IHandsComponent))]
public class HandsComponent : SharedHandsComponent, IHandsComponent
{
#pragma warning disable 649

View File

@@ -1,21 +1,12 @@
using System;
using Content.Server.GameObjects.Components.Stack;
using Robust.Shared.GameObjects;
using Content.Server.GameObjects.Components.Stack;
using Content.Server.GameObjects.EntitySystems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.IoC;
using Robust.Server.GameObjects;
using Robust.Shared.Maths;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Timing;
using Robust.Shared.GameObjects.EntitySystemMessages;
using Robust.Shared.Serialization;
using Robust.Shared.Interfaces.GameObjects.Components;
using Content.Shared.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Server.GameObjects.Components.Weapon.Melee
{
[RegisterComponent]
public class HealingComponent : Component, IAfterAttack, IUse
{
public override string Name => "Healing";

View File

@@ -1,11 +1,11 @@
using Content.Server.GameObjects.Components.Power;
using Content.Server.GameObjects.Components.Sound;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects;
using Content.Shared.GameObjects;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.Components.Container;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.Enums;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Utility;
@@ -16,6 +16,7 @@ namespace Content.Server.GameObjects.Components.Interactable
/// <summary>
/// Component that represents a handheld lightsource which can be toggled on and off.
/// </summary>
[RegisterComponent]
internal class HandheldLightComponent : Component, IUse, IExamine, IAttackBy, IMapInit
{
public const float Wattage = 10;
@@ -50,9 +51,20 @@ namespace Content.Server.GameObjects.Components.Interactable
if (Cell != null) return false;
eventArgs.User.GetComponent<IHandsComponent>().Drop(eventArgs.AttackWith, _cellContainer);
var handsComponent = eventArgs.User.GetComponent<IHandsComponent>();
if (!handsComponent.Drop(eventArgs.AttackWith, _cellContainer))
{
return false;
}
if (Owner.TryGetComponent(out SoundComponent soundComponent))
{
soundComponent.Play("/Audio/items/weapons/pistol_magin.ogg");
}
return true;
return _cellContainer.Insert(eventArgs.AttackWith);
}
void IExamine.Examine(FormattedMessage message)
@@ -85,17 +97,14 @@ namespace Content.Server.GameObjects.Components.Interactable
/// <returns>True if the light's status was toggled, false otherwise.</returns>
public bool ToggleStatus()
{
// Update the activation state.
Activated = !Activated;
// Update sprite and light states to match the activation.
if (Activated)
{
SetState(LightState.On);
TurnOff();
}
else
{
SetState(LightState.Off);
TurnOn();
}
// Toggle always succeeds.
@@ -104,34 +113,66 @@ namespace Content.Server.GameObjects.Components.Interactable
public void TurnOff()
{
if (!Activated) return;
if (!Activated)
{
return;
}
SetState(LightState.Off);
SetState(false);
Activated = false;
if (Owner.TryGetComponent(out SoundComponent soundComponent))
{
soundComponent.Play("/Audio/items/flashlight_toggle.ogg");
}
}
public void TurnOn()
{
if (Activated) return;
if (Activated)
{
return;
}
var cell = Cell;
if (cell == null) return;
SoundComponent soundComponent;
if (cell == null)
{
if (Owner.TryGetComponent(out soundComponent))
{
soundComponent.Play("/Audio/machines/button.ogg");
}
return;
}
// To prevent having to worry about frame time in here.
// Let's just say you need a whole second of charge before you can turn it on.
// Simple enough.
if (cell.AvailableCharge(1) < Wattage) return;
if (cell.AvailableCharge(1) < Wattage)
{
if (Owner.TryGetComponent(out soundComponent))
{
soundComponent.Play("/Audio/machines/button.ogg");
}
return;
}
SetState(LightState.On);
Activated = true;
SetState(true);
if (Owner.TryGetComponent(out soundComponent))
{
soundComponent.Play("/Audio/items/flashlight_toggle.ogg");
}
}
private void SetState(LightState newState)
private void SetState(bool on)
{
_spriteComponent.LayerSetVisible(1, newState == LightState.On);
_pointLight.State = newState;
_spriteComponent.LayerSetVisible(1, on);
_pointLight.Enabled = on;
if (_clothingComponent != null)
{
_clothingComponent.ClothingEquippedPrefix = newState.ToString();
_clothingComponent.ClothingEquippedPrefix = on ? "On" : "Off";
}
}
@@ -145,15 +186,32 @@ namespace Content.Server.GameObjects.Components.Interactable
private void EjectCell(IEntity user)
{
if (Cell == null) return;
if (Cell == null)
{
return;
}
var cell = Cell;
if (!_cellContainer.Remove(cell.Owner)) return;
if (!_cellContainer.Remove(cell.Owner))
{
return;
}
if (!user.TryGetComponent(out HandsComponent hands)
|| !hands.PutInHand(cell.Owner.GetComponent<ItemComponent>()))
if (!user.TryGetComponent(out HandsComponent hands))
{
return;
}
if (!hands.PutInHand(cell.Owner.GetComponent<ItemComponent>()))
{
cell.Owner.Transform.GridPosition = user.Transform.GridPosition;
}
if (Owner.TryGetComponent(out SoundComponent soundComponent))
{
soundComponent.Play("/Audio/items/weapons/pistol_magout.ogg");
}
}
[Verb]

View File

@@ -1,6 +1,7 @@
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.Maps;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.IoC;
@@ -8,6 +9,7 @@ using Robust.Shared.Map;
namespace Content.Server.GameObjects.Components.Interactable.Tools
{
[RegisterComponent]
public class CrowbarComponent : ToolComponent, IAfterAttack
{
#pragma warning disable 649

View File

@@ -1,10 +1,13 @@
namespace Content.Server.GameObjects.Components.Interactable.Tools
using Robust.Shared.GameObjects;
namespace Content.Server.GameObjects.Components.Interactable.Tools
{
/// <summary>
/// Tool used for interfacing/hacking into configurable computers
/// </summary>
[RegisterComponent]
public class MultitoolComponent : ToolComponent
{
public override string Name => "Multitool";
}
}
}

View File

@@ -1,5 +1,8 @@
namespace Content.Server.GameObjects.Components.Interactable.Tools
using Robust.Shared.GameObjects;
namespace Content.Server.GameObjects.Components.Interactable.Tools
{
[RegisterComponent]
public class ScrewdriverComponent : ToolComponent
{
/// <summary>
@@ -7,4 +10,4 @@
/// </summary>
public override string Name => "Screwdriver";
}
}
}

View File

@@ -1,12 +1,10 @@
using System;
using System.Text;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Utility;
using YamlDotNet.RepresentationModel;
using Robust.Server.GameObjects;
using Content.Server.GameObjects.EntitySystems;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Interactable.Tools
@@ -14,6 +12,7 @@ namespace Content.Server.GameObjects.Components.Interactable.Tools
/// <summary>
/// Tool used to weld metal together, light things on fire, or melt into constituent parts
/// </summary>
[RegisterComponent]
class WelderComponent : ToolComponent, EntitySystems.IUse, EntitySystems.IExamine
{
SpriteComponent spriteComponent;

View File

@@ -1,10 +1,13 @@
namespace Content.Server.GameObjects.Components.Interactable.Tools
using Robust.Shared.GameObjects;
namespace Content.Server.GameObjects.Components.Interactable.Tools
{
/// <summary>
/// Tool that can be used for some cutting interactions such as wires or hacking
/// </summary>
[RegisterComponent]
public class WirecutterComponent : ToolComponent
{
public override string Name => "Wirecutter";
}
}
}

View File

@@ -1,10 +1,13 @@
namespace Content.Server.GameObjects.Components.Interactable.Tools
using Robust.Shared.GameObjects;
namespace Content.Server.GameObjects.Components.Interactable.Tools
{
/// <summary>
/// Wrenches bolts, and interacts with things that have been bolted
/// </summary>
[RegisterComponent]
public class WrenchComponent : ToolComponent
{
public override string Name => "Wrench";
}
}
}

View File

@@ -1,15 +1,18 @@
using System;
using System.Collections.Generic;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Items;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
using System;
using System.Collections.Generic;
using Content.Server.GameObjects.EntitySystems;
using Robust.Shared.Utility;
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
namespace Content.Server.GameObjects
{
[RegisterComponent]
[ComponentReference(typeof(ItemComponent))]
[ComponentReference(typeof(StoreableComponent))]
public class ClothingComponent : ItemComponent, IUse
{
public override string Name => "Clothing";

View File

@@ -6,7 +6,6 @@ using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
@@ -15,6 +14,7 @@ using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Items
{
[RegisterComponent]
public class DiceComponent : Component, IActivate, IUse, ILand, IExamine
{
#pragma warning disable 649

View File

@@ -1,4 +1,9 @@
using Content.Server.GameObjects.EntitySystems;
using System.Linq;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.Components.Sound;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Components.Storage;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.Components.Container;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
@@ -7,13 +12,12 @@ using Robust.Shared.Interfaces.Network;
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
using System.Linq;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Shared.GameObjects.Components.Storage;
using Robust.Server.GameObjects;
namespace Content.Server.GameObjects.Components
{
[RegisterComponent]
[ComponentReference(typeof(IActivate))]
[ComponentReference(typeof(IStorageComponent))]
public class EntityStorageComponent : Component, IActivate, IStorageComponent
{
public override string Name => "EntityStorage";
@@ -70,7 +74,12 @@ namespace Content.Server.GameObjects.Components
break;
}
}
ModifyComponents();
if (Owner.TryGetComponent(out SoundComponent soundComponent))
{
soundComponent.Play("/Audio/machines/closetclose.ogg");
}
}
private void OpenStorage()
@@ -78,10 +87,14 @@ namespace Content.Server.GameObjects.Components
Open = true;
EmptyContents();
ModifyComponents();
if (Owner.TryGetComponent(out SoundComponent soundComponent))
{
soundComponent.Play("/Audio/machines/closetopen.ogg");
}
}
private void ModifyComponents()
{
{
if (Owner.TryGetComponent<ICollidableComponent>(out var collidableComponent))
{
collidableComponent.CollisionEnabled = IsCollidableWhenOpen || !Open;

View File

@@ -7,6 +7,7 @@ using Robust.Shared.Maths;
namespace Content.Server.GameObjects.Components.Items.Storage.Fill
{
[RegisterComponent]
internal sealed class ToolLockerFillComponent : Component, IMapInit
{
public override string Name => "ToolLockerFill";

View File

@@ -7,6 +7,7 @@ using Robust.Shared.Maths;
namespace Content.Server.GameObjects.Components.Items.Storage.Fill
{
[RegisterComponent]
internal sealed class ToolboxElectricalFillComponent : Component, IMapInit
{
public override string Name => "ToolboxElectricalFill";

View File

@@ -1,17 +1,18 @@
using Content.Server.Interfaces.GameObjects;
using Robust.Server.Interfaces.GameObjects;
using Content.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using System;
using Content.Server.GameObjects.EntitySystems;
using Robust.Shared.GameObjects;
using System;
using Content.Server.Interfaces.GameObjects;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Items;
using Content.Server.GameObjects.Components;
using Robust.Server.GameObjects;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Maths;
namespace Content.Server.GameObjects
{
[RegisterComponent]
[ComponentReference(typeof(StoreableComponent))]
public class ItemComponent : StoreableComponent, IAttackHand
{
public override string Name => "Item";

View File

@@ -1,32 +1,33 @@
using System.Linq;
using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.Components;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Components.Storage;
using Content.Shared.Interfaces;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.Components.Container;
using Robust.Server.GameObjects.EntitySystemMessages;
using Robust.Server.Interfaces.Player;
using Robust.Server.Player;
using Robust.Shared.Enums;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Serialization;
using System.Collections.Generic;
using Content.Shared.Interfaces;
using Robust.Shared.GameObjects.EntitySystemMessages;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.ViewVariables;
using Content.Server.GameObjects.Components;
using Content.Server.GameObjects.Components.Items.Storage;
using Robust.Server.GameObjects.EntitySystemMessages;
namespace Content.Server.GameObjects
{
/// <summary>
/// Storage component for containing entities within this one, matches a UI on the client which shows stored entities
/// </summary>
[RegisterComponent]
[ComponentReference(typeof(IActivate))]
[ComponentReference(typeof(IStorageComponent))]
public class ServerStorageComponent : SharedStorageComponent, IAttackBy, IUse, IActivate, IStorageComponent, IDestroyAct
{
#pragma warning disable 649
@@ -150,7 +151,7 @@ namespace Content.Server.GameObjects
{
return false;
}
//Check that we can drop the item from our hands first otherwise we obviously cant put it inside
if (CanInsert(hands.GetActiveHand.Owner) && hands.Drop(hands.ActiveIndex))
{

View File

@@ -3,6 +3,7 @@ using Robust.Shared.Serialization;
namespace Content.Server.GameObjects
{
[RegisterComponent]
public class StoreableComponent : Component
{
public override string Name => "Storeable";

View File

@@ -1,4 +1,3 @@
using System;
using Content.Shared.GameObjects.Components.Markers;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
@@ -6,6 +5,8 @@ using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Markers
{
[RegisterComponent]
[ComponentReference(typeof(SharedSpawnPointComponent))]
public sealed class SpawnPointComponent : SharedSpawnPointComponent
{
private SpawnPointType _spawnType;

View File

@@ -1,8 +1,11 @@
using Content.Shared.GameObjects.Components.Mobs;
using Robust.Shared.GameObjects;
using Robust.Shared.Maths;
namespace Content.Server.GameObjects.Components.Mobs
{
[RegisterComponent]
[ComponentReference(typeof(SharedCameraRecoilComponent))]
public sealed class CameraRecoilComponent : SharedCameraRecoilComponent
{
public override void Kick(Vector2 recoil)

View File

@@ -8,6 +8,7 @@ namespace Content.Server.GameObjects.Components.Mobs
/// This is used to differentiate between regular item interactions or
/// using *everything* as a weapon.
/// </summary>
[RegisterComponent]
public sealed class CombatModeComponent : Component
{
public override string Name => "CombatMode";

View File

@@ -1,9 +1,10 @@
using System;
using Robust.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Inventory;
using Robust.Shared.GameObjects;
namespace Content.Server.GameObjects
{
[RegisterComponent]
public class HeatResistanceComponent : Component
{
public override string Name => "HeatResistance";

View File

@@ -1,14 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Content.Server.Mobs;
using Robust.Server.GameObjects;
using Content.Server.Mobs;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.Log;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Mobs
@@ -16,6 +8,7 @@ namespace Content.Server.GameObjects.Components.Mobs
/// <summary>
/// Stores a <see cref="Server.Mobs.Mind"/> on a mob.
/// </summary>
[RegisterComponent]
public class MindComponent : Component
{
/// <inheritdoc />

View File

@@ -12,6 +12,7 @@ using Robust.Shared.Serialization;
namespace Content.Server.GameObjects
{
[RegisterComponent]
public class SpeciesComponent : SharedSpeciesComponent, IActionBlocker, IOnDamageBehavior, IExAct
{
/// <summary>

View File

@@ -5,6 +5,7 @@ using Robust.Shared.Serialization;
namespace Content.Server.GameObjects.Components.Movement
{
[RegisterComponent]
public class AiControllerComponent : Component, IMoverComponent
{
private string _logicName;

View File

@@ -12,6 +12,8 @@ namespace Content.Server.GameObjects.Components.Movement
/// <summary>
/// Moves the entity based on input from a KeyBindingInputComponent.
/// </summary>
[RegisterComponent]
[ComponentReference(typeof(IMoverComponent))]
public class PlayerInputMoverComponent : Component, IMoverComponent
{
private bool _movingUp;

View File

@@ -4,6 +4,7 @@ using Content.Shared.GameObjects.Components.Movement;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Serialization;
@@ -12,6 +13,7 @@ using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Movement
{
[RegisterComponent]
public class ServerPortalComponent : SharedPortalComponent
{
#pragma warning disable 649

View File

@@ -9,7 +9,6 @@ using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
@@ -19,6 +18,7 @@ using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Movement
{
[RegisterComponent]
public class ServerTeleporterComponent : Component, IAfterAttack
{
#pragma warning disable 649

View File

@@ -1,8 +1,8 @@
using Robust.Shared.GameObjects;
using Robust.Shared.Log;
namespace Content.Server.GameObjects.Components.Movement
{
[RegisterComponent]
public class TeleportableComponent : Component
{
public override string Name => "Teleportable";

View File

@@ -4,6 +4,7 @@ using Robust.Shared.Serialization;
namespace Content.Server.GameObjects.Components
{
[RegisterComponent]
public class PlaceableSurfaceComponent : Component, IAttackBy
{
public override string Name => "PlaceableSurface";

View File

@@ -3,15 +3,15 @@ using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Components.Power;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.Components.UserInterface;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components.UserInterface;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
namespace Content.Server.GameObjects.Components.Power
{
[RegisterComponent]
[ComponentReference(typeof(IActivate))]
public sealed class ApcComponent : SharedApcComponent, IActivate
{
PowerStorageComponent Storage;

View File

@@ -1,9 +1,9 @@
using System;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
using SpriteComponent = Robust.Server.GameObjects.SpriteComponent;
namespace Content.Server.GameObjects.Components.Power
{
@@ -23,6 +23,7 @@ namespace Content.Server.GameObjects.Components.Power
/// <summary>
/// Component that represents a light bulb. Can be broken, or burned, which turns them mostly useless.
/// </summary>
[RegisterComponent]
public class LightBulbComponent : Component
{

View File

@@ -1,8 +1,11 @@
using Content.Shared.GameObjects.Components.Power;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
namespace Content.Server.GameObjects.Components.Power
{
[RegisterComponent]
[ComponentReference(typeof(PowerStorageComponent))]
public class PowerCellComponent : PowerStorageComponent
{
public override string Name => "PowerCell";

View File

@@ -3,12 +3,13 @@ using System.Text;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Components.Power;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.Map;
namespace Content.Server.GameObjects.Components.Power
{
[RegisterComponent]
public class PowerDebugTool : SharedPowerDebugTool, IAfterAttack
{
void IAfterAttack.AfterAttack(AfterAttackEventArgs eventArgs)

View File

@@ -1,22 +1,19 @@
using Content.Server.GameObjects.EntitySystems;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.IoC;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.EntitySystems;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables;
using YamlDotNet.RepresentationModel;
namespace Content.Server.GameObjects.Components.Power
{
/// <summary>
/// Component that requires power to function
/// </summary>
[RegisterComponent]
public class PowerDeviceComponent : Component, EntitySystems.IExamine
{
public override string Name => "PowerDevice";

View File

@@ -1,18 +1,13 @@
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
using System;
using Robust.Shared.ViewVariables;
using YamlDotNet.RepresentationModel;
namespace Content.Server.GameObjects.Components.Power
{
/// <summary>
/// Component that creates power and supplies it to the powernet
/// </summary>
[RegisterComponent]
public class PowerGeneratorComponent : Component
{
public override string Name => "PowerGenerator";

View File

@@ -1,10 +1,9 @@
using Robust.Server.GameObjects;
using System;
using System.Linq;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.IoC;
using System;
using System.Linq;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Power
@@ -12,6 +11,7 @@ namespace Content.Server.GameObjects.Components.Power
/// <summary>
/// Component that connects to the powernet
/// </summary>
[RegisterComponent]
public class PowerNodeComponent : Component
{
public override string Name => "PowerNode";

View File

@@ -1,22 +1,20 @@
using Robust.Server.GameObjects;
using System.Collections.Generic;
using System.Linq;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using Robust.Shared.ViewVariables;
using YamlDotNet.RepresentationModel;
namespace Content.Server.GameObjects.Components.Power
{
/// <summary>
/// Component that wirelessly connects and powers devices, connects to powernet via node and can be combined with internal storage component
/// </summary>
[RegisterComponent]
[ComponentReference(typeof(PowerDeviceComponent))]
public class PowerProviderComponent : PowerDeviceComponent
{
public override string Name => "PowerProvider";

View File

@@ -1,3 +1,4 @@
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
@@ -6,6 +7,8 @@ namespace Content.Server.GameObjects.Components.Power
/// <summary>
/// Feeds energy from the powernet and may have the ability to supply back into it
/// </summary>
[RegisterComponent]
[ComponentReference(typeof(PowerStorageComponent))]
public class PowerStorageNetComponent : PowerStorageComponent
{
public override string Name => "PowerStorage";

View File

@@ -1,20 +1,18 @@
using Content.Server.GameObjects.EntitySystems;
using Robust.Server.GameObjects;
using System.Linq;
using Content.Server.GameObjects.Components.Interactable.Tools;
using Content.Server.GameObjects.EntitySystems;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using System.Linq;
using Robust.Shared.Interfaces.GameObjects;
using Content.Server.GameObjects.Components.Interactable.Tools;
using Robust.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.IoC;
using Robust.Shared.ViewVariables;
using System;
namespace Content.Server.GameObjects.Components.Power
{
/// <summary>
/// Component to transfer power to nearby components, can create powernets and connect to nodes
/// </summary>
[RegisterComponent]
public class PowerTransferComponent : Component, IAttackBy
{
public override string Name => "PowerTransfer";

View File

@@ -5,7 +5,6 @@ using Content.Shared.GameObjects;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.Components.Container;
using Robust.Shared.Audio;
using Robust.Shared.Enums;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Timing;
@@ -18,6 +17,7 @@ namespace Content.Server.GameObjects.Components.Power
/// <summary>
/// Component that represents a wall light. It has a light bulb that can be replaced when broken.
/// </summary>
[RegisterComponent]
public class PoweredLightComponent : Component, IAttackHand, IAttackBy
{
public override string Name => "PoweredLight";
@@ -68,7 +68,7 @@ namespace Content.Server.GameObjects.Components.Power
bool CanBurn(int heatResistance)
{
return _lightState == LightState.On && heatResistance < LightBulb.BurningTemperature;
return _lightState && heatResistance < LightBulb.BurningTemperature;
}
void Burn()
@@ -135,8 +135,8 @@ namespace Content.Server.GameObjects.Components.Power
UpdateLight();
}
private LightState _lightState => Owner.GetComponent<PointLightComponent>().State;
private bool _lightState => Owner.GetComponent<PointLightComponent>().Enabled;
/// <summary>
/// Updates the light's power drain, sprite and actual light state.
/// </summary>
@@ -149,7 +149,7 @@ namespace Content.Server.GameObjects.Components.Power
{
device.Load = 0;
sprite.LayerSetState(0, "empty");
light.State = LightState.Off;
light.Enabled = false;
return;
}
@@ -160,7 +160,7 @@ namespace Content.Server.GameObjects.Components.Power
if (device.Powered)
{
sprite.LayerSetState(0, "on");
light.State = LightState.On;
light.Enabled = true;
light.Color = LightBulb.Color;
var time = IoCManager.Resolve<IGameTiming>().CurTime;
if (time > _lastThunk + _thunkDelay)
@@ -172,18 +172,18 @@ namespace Content.Server.GameObjects.Components.Power
else
{
sprite.LayerSetState(0, "off");
light.State = LightState.Off;
light.Enabled = false;
}
break;
case LightBulbState.Broken:
device.Load = 0;
sprite.LayerSetState(0, "broken");
light.State = LightState.Off;
light.Enabled = false;
break;
case LightBulbState.Burned:
device.Load = 0;
sprite.LayerSetState(0, "burned");
light.State = LightState.Off;
light.Enabled = false;
break;
}
}

View File

@@ -1,5 +1,4 @@
using System;
using Content.Shared.GameObjects.Components.Power;
using Content.Shared.GameObjects.Components.Power;
using Content.Shared.Utility;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
@@ -11,6 +10,7 @@ namespace Content.Server.GameObjects.Components.Power
/// This is operations that are specific to the SMES, like UI and visuals.
/// Code interfacing with the powernet is handled in <see cref="PowerStorageComponent" />.
/// </summary>
[RegisterComponent]
public class SmesComponent : Component
{
public override string Name => "Smes";

View File

@@ -1,14 +1,15 @@
using System.Collections.Generic;
using Content.Server.GameObjects.Components.Mobs;
using Content.Shared.GameObjects;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Physics;
using Robust.Shared.Interfaces.GameObjects.Components;
using Content.Server.GameObjects.Components.Mobs;
using Content.Shared.GameObjects;
using Robust.Shared.Interfaces.Physics;
namespace Content.Server.GameObjects.Components.Projectiles
{
[RegisterComponent]
public class ProjectileComponent : Component, ICollideSpecial, ICollideBehavior
{
public override string Name => "Projectile";

View File

@@ -11,6 +11,7 @@ using Robust.Shared.IoC;
namespace Content.Server.GameObjects.Components
{
[RegisterComponent]
class ThrownItemComponent : ProjectileComponent, ICollideBehavior
{
#pragma warning disable 649

View File

@@ -6,15 +6,16 @@ using Content.Shared.GameObjects.Components.Research;
using Content.Shared.Research;
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.Timers;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Research
{
[RegisterComponent]
[ComponentReference(typeof(IActivate))]
public class LatheComponent : SharedLatheComponent, IAttackBy, IActivate
{
public const int VolumePerSheet = 3750;

View File

@@ -1,4 +1,3 @@
using System.Collections.Generic;
using Content.Shared.GameObjects.Components.Research;
using Content.Shared.Research;
using Robust.Shared.GameObjects;
@@ -6,6 +5,8 @@ using Robust.Shared.Serialization;
namespace Content.Server.GameObjects.Components.Research
{
[RegisterComponent]
[ComponentReference(typeof(SharedLatheDatabaseComponent))]
public class LatheDatabaseComponent : SharedLatheDatabaseComponent
{
/// <summary>

View File

@@ -1,11 +1,12 @@
using System.Collections.Generic;
using Content.Shared.GameObjects.Components.Research;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.Serialization;
namespace Content.Server.GameObjects.Components.Research
{
[RegisterComponent]
[ComponentReference(typeof(SharedMaterialStorageComponent))]
public class MaterialStorageComponent : SharedMaterialStorageComponent
{
protected override Dictionary<string, int> Storage { get; set; } = new Dictionary<string, int>();

View File

@@ -1,29 +1,18 @@
using System;
using System.Collections.Generic;
using Robust.Shared.GameObjects;
using Robust.Shared.Log;
using Robust.Shared.Utility;
using YamlDotNet.RepresentationModel;
using Content.Server.Interfaces;
using Content.Shared.GameObjects;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
using Content.Server.GameObjects.EntitySystems;
using Robust.Server.GameObjects.EntitySystems;
using Content.Shared.Audio;
using Robust.Shared.Prototypes;
using Robust.Shared.IoC;
using Content.Server.GameObjects.EntitySystems;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Server.GameObjects.Components.Sound
{
/// <summary>
/// Simple sound emitter that emits sound on use in hand
/// </summary>
[RegisterComponent]
public class EmitSoundOnUseComponent : Component, IUse
{
/// <inheritdoc />
///
///
public override string Name => "EmitSoundOnUse";
public string _soundName;

View File

@@ -1,33 +1,25 @@
using System;
using System.Collections.Generic;
using Robust.Shared.GameObjects;
using Robust.Shared.Log;
using Robust.Shared.Utility;
using YamlDotNet.RepresentationModel;
using Content.Server.Interfaces;
using Content.Shared.GameObjects;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
using Content.Server.GameObjects.EntitySystems;
using Robust.Server.GameObjects.EntitySystems;
using Content.Shared.Audio;
using Robust.Shared.Prototypes;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Maths;
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
namespace Content.Server.GameObjects.Components.Sound
{
/// <summary>
/// Changes footstep sound
/// </summary>
[RegisterComponent]
public class FootstepModifierComponent : Component
{
#pragma warning disable 649
[Dependency] private readonly IPrototypeManager _prototypeManager;
#pragma warning restore 649
/// <inheritdoc />
///
///
private Random _footstepRandom;
public override string Name => "FootstepModifier";

View File

@@ -1,16 +1,11 @@
using System.Collections.Generic;
using Content.Shared.GameObjects.Components.Sound;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.Log;
using Robust.Shared.Map;
using Robust.Shared.Serialization;
namespace Content.Server.GameObjects.Components.Sound
{
[RegisterComponent]
public class SoundComponent : SharedSoundComponent
{
/// <summary>

View File

@@ -10,6 +10,7 @@ using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Stack
{
// TODO: Naming and presentation and such could use some improvement.
[RegisterComponent]
public class StackComponent : Component, IAttackBy, IExamine
{
private const string SerializationCache = "stack";

View File

@@ -1,10 +1,8 @@
using Content.Server.Interfaces.GameObjects;
using Content.Shared.Maths;
using System;
using Robust.Shared.GameObjects;
using Robust.Shared.Utility;
using YamlDotNet.RepresentationModel;
using System;
using Content.Server.Interfaces.GameObjects;
using Content.Shared.GameObjects;
using Content.Shared.Maths;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
@@ -15,6 +13,7 @@ namespace Content.Server.GameObjects
/// informing others of the current temperature,
/// and taking fire damage from high temperature.
/// </summary>
[RegisterComponent]
public class TemperatureComponent : Component, ITemperatureComponent
{
/// <inheritdoc />

View File

@@ -1,14 +1,15 @@
using System;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Components.Triggers;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Serialization;
using Robust.Shared.GameObjects;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Components.Triggers;
namespace Content.Server.GameObjects.Components.Triggers
{
[RegisterComponent]
public class OnUseTimerTriggerComponent : Component, IUse
{
#pragma warning disable 649
@@ -28,7 +29,7 @@ namespace Content.Server.GameObjects.Components.Triggers
public override void Initialize()
{
base.Initialize();
base.Initialize();
}
bool IUse.UseEntity(UseEntityEventArgs eventArgs)
@@ -41,4 +42,4 @@ namespace Content.Server.GameObjects.Components.Triggers
return true;
}
}
}
}

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