This commit is contained in:
Julian Giebel
2020-08-16 13:16:06 +02:00
844 changed files with 11970 additions and 5397 deletions

View File

@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using BenchmarkDotNet.Attributes;
using Moq;
using Robust.Shared.Exceptions;

View File

@@ -1,25 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Client.GameObjects.EntitySystems;
using Content.Client.Utility;
using JetBrains.Annotations;
using Robust.Client.Graphics;
using Content.Client.GameObjects.EntitySystems;
using Robust.Client.Graphics.ClientEye;
using Robust.Client.Graphics.Drawing;
using Robust.Client.Graphics.Overlays;
using Robust.Client.Interfaces.Graphics;
using Robust.Client.Interfaces.Graphics.ClientEye;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.Interfaces.Resources;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
namespace Content.Client.Atmos
{

View File

@@ -1,5 +1,4 @@
using System.Collections.Generic;
using Content.Shared.Chat;
using Content.Shared.Chat;
using Robust.Client.Console;
using Robust.Client.Graphics.Drawing;
using Robust.Client.UserInterface;

View File

@@ -122,7 +122,7 @@ namespace Content.Client.Chat
var screenPos = lowerCenter - (Width / 2, ContentHeight + _verticalOffsetAchieved);
LayoutContainer.SetPosition(this, screenPos);
var height = (lowerCenter.Y - screenPos.Y).Clamp(0, ContentHeight);
var height = FloatMath.Clamp(lowerCenter.Y - screenPos.Y, 0, ContentHeight);
LayoutContainer.SetSize(this, (Size.X, height));
}

View File

@@ -8,9 +8,7 @@ using Content.Client.Sandbox;
using Content.Client.UserInterface;
using Content.Client.UserInterface.Stylesheets;
using Content.Client.Utility;
using Content.Shared.Chemistry;
using Content.Shared.Interfaces;
using Content.Shared.Interfaces.Chemistry;
using Robust.Shared.IoC;
namespace Content.Client

View File

@@ -5,7 +5,6 @@ using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Log;
using Robust.Shared.Maths;
using Timer = Robust.Shared.Timers.Timer;

View File

@@ -1,10 +1,7 @@
using Content.Client.GameObjects.EntitySystems.AI;
using JetBrains.Annotations;
using Robust.Client.Interfaces.Console;
using Robust.Client.Player;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
namespace Content.Client.Commands
{

View File

@@ -1,15 +1,12 @@
using Content.Client.GameObjects.Components;
using Content.Client.GameObjects.EntitySystems;
using Content.Client.Interfaces;
using Content.Shared.GameObjects.Components.Markers;
using Robust.Client.Console.Commands;
using Content.Shared.GameObjects;
using Robust.Client.Interfaces.Console;
using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
using DrawDepth = Content.Shared.GameObjects.DrawDepth;
namespace Content.Client.Commands
{

View File

@@ -2,8 +2,6 @@ using Content.Client.GameObjects.EntitySystems.AI;
using JetBrains.Annotations;
using Robust.Client.Interfaces.Console;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
namespace Content.Client.Commands
{

View File

@@ -12,6 +12,8 @@ using Content.Client.UserInterface.Stylesheets;
using Content.Shared.GameObjects.Components;
using Content.Shared.GameObjects.Components.Cargo;
using Content.Shared.GameObjects.Components.Chemistry;
using Content.Shared.GameObjects.Components.Chemistry.ChemMaster;
using Content.Shared.GameObjects.Components.Chemistry.ReagentDispenser;
using Content.Shared.GameObjects.Components.Gravity;
using Content.Shared.GameObjects.Components.Markers;
using Content.Shared.GameObjects.Components.Research;

View File

@@ -9,7 +9,6 @@ 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.Actor

View File

@@ -1,8 +1,5 @@
using Robust.Client.GameObjects.Components.UserInterface;
using Robust.Shared.GameObjects.Components.UserInterface;
using System;
using System.Collections.Generic;
using System.Text;
using static Content.Shared.GameObjects.Components.SharedGasAnalyzerComponent;
namespace Content.Client.GameObjects.Components.Atmos

View File

@@ -1,6 +1,6 @@
using Content.Client.UserInterface.Stylesheets;
using System;
using Content.Client.UserInterface.Stylesheets;
using Content.Client.Utility;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
@@ -8,9 +8,6 @@ using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using Robust.Shared.Timing;
using Robust.Shared.ViewVariables;
using System;
using System.Collections.Generic;
using System.Text;
namespace Content.Client.GameObjects.Components.Atmos
{

View File

@@ -1,19 +1,11 @@
using System;
using Content.Client.Animations;
using Content.Client.GameObjects.EntitySystems;
using Content.Client.UserInterface.Stylesheets;
using Content.Client.UserInterface.Stylesheets;
using Content.Client.Utility;
using Content.Shared.GameObjects.Components;
using Content.Shared.Utility;
using Robust.Client.Animations;
using Robust.Client.Graphics;
using Robust.Client.Graphics.Drawing;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.Animations;
using Robust.Shared.Input;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Maths;

View File

@@ -1,8 +1,8 @@
using Content.Shared.GameObjects.Components.Cargo;
using System;
using System.Collections.Generic;
using Content.Shared.GameObjects.Components.Cargo;
using Content.Shared.Prototypes.Cargo;
using Robust.Shared.GameObjects;
using System;
using System.Collections.Generic;
namespace Content.Client.GameObjects.Components.Cargo
{

View File

@@ -1,9 +1,9 @@
using Content.Shared.GameObjects.Components.Cargo;
using System;
using Content.Shared.GameObjects.Components.Cargo;
using Content.Shared.Prototypes.Cargo;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Prototypes;
using System;
namespace Content.Client.GameObjects.Components.Cargo
{

View File

@@ -1,13 +1,12 @@
#nullable enable
using Content.Client.GameObjects.Components.Chemistry.ChemMaster;
using Content.Shared.GameObjects.Components.Chemistry;
using Content.Shared.GameObjects.Components.Chemistry.ReagentDispenser;
using JetBrains.Annotations;
using Robust.Client.GameObjects.Components.UserInterface;
using Robust.Shared.GameObjects.Components.UserInterface;
using Robust.Shared.Localization;
using static Content.Shared.GameObjects.Components.Chemistry.SharedChemMasterComponent;
using static Content.Shared.GameObjects.Components.Chemistry.ChemMaster.SharedChemMasterComponent;
namespace Content.Client.GameObjects.Components.Chemistry
namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
{
/// <summary>
/// Initializes a <see cref="ChemMasterWindow"/> and updates it when new server messages are received.

View File

@@ -1,10 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Client.UserInterface;
using Content.Client.UserInterface.Stylesheets;
using Content.Shared.Chemistry;
using Content.Shared.GameObjects.Components.Chemistry;
using Content.Shared.GameObjects.Components.Chemistry.ChemMaster;
using Robust.Client.Graphics.Drawing;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
@@ -12,10 +10,9 @@ using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.GameObjects.Components.UserInterface;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Log;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
using static Content.Shared.GameObjects.Components.Chemistry.SharedChemMasterComponent;
using static Content.Shared.GameObjects.Components.Chemistry.ChemMaster.SharedChemMasterComponent;
namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
{

View File

@@ -1,14 +1,13 @@
using Content.Client.UserInterface;
using Content.Client.UserInterface.Stylesheets;
using Content.Client.UserInterface.Stylesheets;
using Content.Client.Utility;
using Robust.Shared.Timing;
using Content.Shared.Chemistry;
using Content.Shared.GameObjects.Components.Chemistry;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using Robust.Shared.Timing;
using Robust.Shared.ViewVariables;
using Content.Shared.Chemistry;
namespace Content.Client.GameObjects.Components.Chemistry
{

View File

@@ -1,15 +1,15 @@
using System.Collections.Generic;
using System.Linq;
using Content.Shared.GameObjects.Components.Chemistry;
using Content.Shared.GameObjects.Components.Chemistry.ReagentDispenser;
using JetBrains.Annotations;
using Robust.Client.GameObjects.Components.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.GameObjects.Components.UserInterface;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using static Content.Shared.GameObjects.Components.Chemistry.SharedReagentDispenserComponent;
using static Content.Shared.GameObjects.Components.Chemistry.ReagentDispenser.SharedReagentDispenserComponent;
namespace Content.Client.GameObjects.Components.Chemistry
namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
{
/// <summary>
/// Initializes a <see cref="ReagentDispenserWindow"/> and updates it when new server messages are received.

View File

@@ -1,8 +1,7 @@
using System.Collections.Generic;
using Content.Client.UserInterface;
using Content.Client.UserInterface.Stylesheets;
using Content.Shared.Chemistry;
using Content.Shared.GameObjects.Components.Chemistry;
using Content.Shared.GameObjects.Components.Chemistry.ReagentDispenser;
using Robust.Client.Graphics.Drawing;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
@@ -12,9 +11,9 @@ using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
using static Content.Shared.GameObjects.Components.Chemistry.SharedReagentDispenserComponent;
using static Content.Shared.GameObjects.Components.Chemistry.ReagentDispenser.SharedReagentDispenserComponent;
namespace Content.Client.GameObjects.Components.Chemistry
namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
{
/// <summary>
/// Client-side UI used to control a <see cref="SharedReagentDispenserComponent"/>

View File

@@ -1,8 +1,8 @@
using System.Collections.Generic;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Damage;
using Robust.Shared.GameObjects;
namespace Content.Client.GameObjects
namespace Content.Client.GameObjects.Components
{
/// <summary>
/// Fuck I really hate doing this

View File

@@ -2,7 +2,6 @@
using JetBrains.Annotations;
using Robust.Client.GameObjects.Components.UserInterface;
using Robust.Shared.GameObjects.Components.UserInterface;
using Robust.Shared.Localization;
using static Content.Shared.GameObjects.Components.Disposal.SharedDisposalUnitComponent;
namespace Content.Client.GameObjects.Components.Disposal

View File

@@ -1,5 +1,4 @@
using System.Runtime.CompilerServices;
using Content.Shared.GameObjects.Components.Disposal;
using Content.Shared.GameObjects.Components.Disposal;
using Robust.Client.Graphics.Drawing;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;

View File

@@ -3,8 +3,10 @@ using System;
using System.Collections.Generic;
using Content.Client.GameObjects.EntitySystems.DoAfter;
using Content.Shared.GameObjects.Components;
using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.Interfaces.Timing;
using Robust.Shared.IoC;
@@ -38,6 +40,18 @@ namespace Content.Client.GameObjects.Components
}
}
public override void HandleMessage(ComponentMessage message, IComponent? component)
{
base.HandleMessage(message, component);
switch (message)
{
case PlayerDetachedMsg _:
_doAfters.Clear();
CancelledDoAfters.Clear();
break;
}
}
/// <summary>
/// Remove a DoAfter without showing a cancellation graphic.
/// </summary>

View File

@@ -0,0 +1,22 @@
using Content.Client.GameObjects.Components.Items;
using Content.Client.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.GameObjects.Components.GUI;
using Robust.Shared.GameObjects;
namespace Content.Client.GameObjects.Components.GUI
{
[RegisterComponent]
public class StrippableComponent : SharedStrippableComponent, IClientDraggable
{
public bool ClientCanDropOn(CanDropEventArgs eventArgs)
{
return eventArgs.Target.HasComponent<HandsComponent>()
&& eventArgs.Target != eventArgs.Dragged && eventArgs.Target == eventArgs.User;
}
public bool ClientCanDrag(CanDragEventArgs eventArgs)
{
return true;
}
}
}

View File

@@ -1,4 +1,3 @@
using System;
using Content.Shared.GameObjects.Components.Gravity;
using Robust.Client.GameObjects.Components.UserInterface;
using Robust.Client.UserInterface.Controls;

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using Content.Client.GameObjects.Components.Clothing;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Inventory;
using Content.Shared.Preferences.Appearance;
using Robust.Client.GameObjects;
using Robust.Client.Interfaces.GameObjects.Components;
@@ -10,9 +10,9 @@ using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.ViewVariables;
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
using static Content.Shared.GameObjects.SharedInventoryComponent.ClientInventoryMessage;
using static Content.Shared.GameObjects.Components.Inventory.SharedInventoryComponent.ClientInventoryMessage;
namespace Content.Client.GameObjects
namespace Content.Client.GameObjects.Components.HUD.Inventory
{
/// <summary>
/// A character UI which shows items the user has equipped within his inventory

View File

@@ -1,4 +1,6 @@
using Content.Client.Utility;
using System.Collections.Generic;
using Content.Client.UserInterface;
using Content.Client.Utility;
using JetBrains.Annotations;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.UserInterface;
@@ -9,10 +11,8 @@ using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
using Content.Client.UserInterface;
using System.Collections.Generic;
namespace Content.Client.GameObjects
namespace Content.Client.GameObjects.Components.HUD.Inventory
{
// Dynamically instantiated by ClientInventoryComponent.
[UsedImplicitly]

View File

@@ -8,7 +8,7 @@ using Robust.Shared.Input;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
namespace Content.Client.GameObjects
namespace Content.Client.GameObjects.Components.HUD.Inventory
{
public abstract class InventoryInterfaceController : IDisposable
{

View File

@@ -0,0 +1,81 @@
using System.Collections.Generic;
using Content.Client.UserInterface;
using Content.Shared.GameObjects.Components.GUI;
using Content.Shared.GameObjects.Components.Inventory;
using JetBrains.Annotations;
using Robust.Client.GameObjects.Components.UserInterface;
using Robust.Shared.GameObjects.Components.UserInterface;
using Robust.Shared.ViewVariables;
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
namespace Content.Client.GameObjects.Components.HUD.Inventory
{
[UsedImplicitly]
public class StrippableBoundUserInterface : BoundUserInterface
{
public Dictionary<Slots, string> Inventory { get; private set; }
public Dictionary<string, string> Hands { get; private set; }
[ViewVariables]
private StrippingMenu _strippingMenu;
public StrippableBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
{
}
protected override void Open()
{
base.Open();
_strippingMenu = new StrippingMenu($"{Owner.Owner.Name}'s inventory");
_strippingMenu.OpenCentered();
UpdateMenu();
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing) return;
_strippingMenu.Dispose();
_strippingMenu.Close();
}
private void UpdateMenu()
{
if (_strippingMenu == null) return;
_strippingMenu.ClearButtons();
if(Inventory != null)
foreach (var (slot, name) in Inventory)
{
_strippingMenu.AddButton(EquipmentSlotDefines.SlotNames[slot], name, (ev) =>
{
SendMessage(new StrippingInventoryButtonPressed(slot));
});
}
if(Hands != null)
foreach (var (hand, name) in Hands)
{
_strippingMenu.AddButton(hand, name, (ev) =>
{
SendMessage(new StrippingHandButtonPressed(hand));
});
}
}
protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
if (!(state is StrippingBoundUserInterfaceState stripState)) return;
Inventory = stripState.Inventory;
Hands = stripState.Hands;
UpdateMenu();
}
}
}

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Content.Client.GameObjects.EntitySystems;
using JetBrains.Annotations;
using Robust.Client.Interfaces.GameObjects.Components;

View File

@@ -4,16 +4,16 @@ using System.Collections.Generic;
using System.Linq;
using Content.Shared.GameObjects.Components.Instruments;
using Content.Shared.Physics;
using Robust.Shared.GameObjects;
using Robust.Client.Audio.Midi;
using Robust.Shared.Audio.Midi;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.Interfaces.Timing;
using Robust.Shared.IoC;
using Robust.Shared.Players;
using Robust.Shared.Serialization;
using Robust.Shared.Timers;
using Robust.Shared.ViewVariables;
using MidiEvent = Robust.Shared.Audio.Midi.MidiEvent;
using Timer = Robust.Shared.Timers.Timer;
namespace Content.Client.GameObjects.Components.Instruments
{

View File

@@ -1,12 +1,10 @@
using System;
using Content.Client.UserInterface.Stylesheets;
using Content.Client.UserInterface.Stylesheets;
using Content.Client.Utility;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Interactable;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using Robust.Shared.Serialization;
using Robust.Shared.Timing;
using Robust.Shared.ViewVariables;

View File

@@ -23,6 +23,7 @@ namespace Content.Client.GameObjects.Components.Items
[Dependency] private readonly IGameHud _gameHud = default!;
#pragma warning restore 649
/// <inheritdoc />
private readonly List<Hand> _hands = new List<Hand>();
[ViewVariables] public IReadOnlyList<Hand> Hands => _hands;

View File

@@ -1,6 +1,6 @@
using Robust.Shared.GameObjects;
namespace Content.Client.GameObjects
namespace Content.Client.GameObjects.Components.Items
{
[RegisterComponent]
public class ItemStatusComponent : Component

View File

@@ -1,21 +1,20 @@
using System;
using Robust.Client.GameObjects.Components.UserInterface;
using Content.Shared.Kitchen;
using Robust.Shared.GameObjects.Components.UserInterface;
using Robust.Shared.IoC;
using Robust.Shared.Prototypes;
using Content.Shared.Chemistry;
using Robust.Shared.GameObjects;
using System.Collections.Generic;
using Robust.Shared.Interfaces.GameObjects;
using Content.Shared.Chemistry;
using Content.Shared.Kitchen;
using Robust.Client.GameObjects;
using Robust.Client.GameObjects.Components.UserInterface;
using Robust.Client.Graphics.Drawing;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components.UserInterface;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
namespace Content.Client.GameObjects.Components.Kitchen
{

View File

@@ -7,7 +7,6 @@ using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Shared.Audio;
using Robust.Shared.Log;
namespace Content.Client.GameObjects.Components.Kitchen
{
public sealed class MicrowaveVisualizer : AppearanceVisualizer

View File

@@ -1,6 +1,5 @@
using System;
using System.Linq;
using Content.Client.UserInterface;
using Content.Client.UserInterface.Stylesheets;
using Content.Shared.Preferences.Appearance;
using JetBrains.Annotations;
@@ -244,7 +243,7 @@ namespace Content.Client.GameObjects.Components
if (int.TryParse(ev.Text, out var result))
{
result = result.Clamp(0, byte.MaxValue);
result = FloatMath.Clamp(result, 0, byte.MaxValue);
_ignoreEvents = true;
_colorValue = (byte) result;

View File

@@ -2,7 +2,6 @@
using Content.Shared.GameObjects.Components.Mobs;
using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.Log;
using Robust.Shared.Maths;

View File

@@ -1,13 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Content.Shared.GameObjects.Components.Mobs;
using Content.Shared.Interfaces;
using Robust.Client.GameObjects;
using Robust.Client.Graphics.Overlays;
using Robust.Client.Interfaces.Graphics.Overlays;
using Robust.Client.Player;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Network;
@@ -15,7 +13,6 @@ using Robust.Shared.Interfaces.Reflection;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Players;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables;
namespace Content.Client.GameObjects.Components.Mobs

View File

@@ -152,7 +152,7 @@ namespace Content.Client.GameObjects.Components.Mobs
var progress = (_gameTiming.CurTime - start).TotalSeconds / length;
var ratio = (progress <= 1 ? (1 - progress) : (_gameTiming.CurTime - end).TotalSeconds * -5);
cooldownGraphic.Progress = (float)ratio.Clamp(-1, 1);
cooldownGraphic.Progress = FloatMath.Clamp((float)ratio, -1, 1);
cooldownGraphic.Visible = ratio > -1f;
}
}

View File

@@ -1,13 +1,10 @@
using System;
using Content.Client.UserInterface;
using Content.Client.UserInterface;
using Content.Shared.GameObjects.Components.Mobs;
using Robust.Client.GameObjects;
using Robust.Client.Player;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.IoC;
using Robust.Shared.Players;
namespace Content.Client.GameObjects.Components.Mobs
{

View File

@@ -1,12 +1,11 @@
using System.Collections.Generic;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Mobs;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.Utility;
using YamlDotNet.RepresentationModel;
using DrawDepth = Content.Shared.GameObjects.DrawDepth;
namespace Content.Client.GameObjects.Components.Mobs
{

View File

@@ -4,7 +4,6 @@ using Robust.Client.GameObjects;
using Robust.Client.Player;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.IoC;
using Robust.Shared.ViewVariables;

View File

@@ -3,7 +3,7 @@ using Robust.Client.GameObjects.Components.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.GameObjects.Components.UserInterface;
namespace Content.Client.GameObjects.Components
namespace Content.Client.GameObjects.Components.Paper
{
public class PaperBoundUserInterface : BoundUserInterface
{

View File

@@ -4,7 +4,7 @@ using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.Maths;
using Robust.Shared.Utility;
namespace Content.Client.GameObjects.Components
namespace Content.Client.GameObjects.Components.Paper
{
public class PaperWindow : SS14Window
{

View File

@@ -1,5 +1,4 @@
using System;
using Content.Shared.GameObjects.Components.Mobs;
using Content.Shared.GameObjects.Components.Pointing;
using JetBrains.Annotations;
using Robust.Client.Animations;

View File

@@ -1,5 +1,4 @@
using System;
using Content.Client.UserInterface;
using Content.Client.UserInterface.Stylesheets;
using Content.Shared.GameObjects.Components.Power;
using Robust.Client.GameObjects.Components.UserInterface;

View File

@@ -1,6 +1,4 @@
using System;
using Content.Client.UserInterface;
using Content.Client.UserInterface.Stylesheets;
using Content.Shared.GameObjects.Components.Power;
using Robust.Client.GameObjects.Components.UserInterface;
using Robust.Client.Graphics.Drawing;

View File

@@ -4,7 +4,6 @@ using Robust.Client.GameObjects;
using Robust.Client.GameObjects.Components.Animations;
using Robust.Shared.Animations;
using Robust.Shared.GameObjects;
using Robust.Shared.Maths;
namespace Content.Client.GameObjects.Components
{

View File

@@ -4,14 +4,12 @@ using Content.Shared.Physics;
using Robust.Client.GameObjects.EntitySystems;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.IoC;
using Robust.Shared.Players;
using Robust.Shared.Serialization;
using Robust.Shared.Timers;
using Robust.Shared.Utility;
namespace Content.Client.GameObjects.Components.Sound
{

View File

@@ -0,0 +1,24 @@
#nullable enable
using System;
using Content.Shared.GameObjects.Components;
using Robust.Shared.GameObjects;
namespace Content.Client.GameObjects.Components.StationEvents
{
[RegisterComponent]
public sealed class RadiationPulseComponent : SharedRadiationPulseComponent
{
public TimeSpan EndTime { get; private set; }
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
{
base.HandleComponentState(curState, nextState);
if (!(curState is RadiationPulseMessage state))
{
return;
}
EndTime = state.EndTime;
}
}
}

View File

@@ -1,14 +1,14 @@
using System;
using System.Collections.Generic;
using Content.Client.GameObjects.Components.Items;
using Content.Shared.GameObjects.Components.Storage;
using Content.Client.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.GameObjects.Components.Storage;
using Robust.Client.Graphics.Drawing;
using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Client.Player;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.Player;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Network;

View File

@@ -1,5 +1,5 @@
using System;
using Content.Shared.GameObjects.Components.Triggers;
using Content.Shared.GameObjects.Components.Trigger;
using Robust.Client.Animations;
using Robust.Client.GameObjects;
using Robust.Client.GameObjects.Components.Animations;
@@ -8,7 +8,7 @@ using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Utility;
using YamlDotNet.RepresentationModel;
namespace Content.Client.GameObjects.Components.Doors
namespace Content.Client.GameObjects.Components.Trigger
{
public class TimerTriggerVisualizer : AppearanceVisualizer
{

View File

@@ -1,44 +1,109 @@
using System;
using System.Collections.Generic;
using JetBrains.Annotations;
using Robust.Client.Animations;
using Robust.Client.GameObjects;
using Robust.Client.GameObjects.Components.Animations;
using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Utility;
using YamlDotNet.RepresentationModel;
using static Content.Shared.GameObjects.Components.VendingMachines.SharedVendingMachineComponent;
namespace Content.Client.GameObjects.Components.VendingMachines
{
public class VendingMachineVisualizer : AppearanceVisualizer
[UsedImplicitly]
public sealed class VendingMachineVisualizer : AppearanceVisualizer
{
// TODO: Should default to off or broken if damaged
//
// TODO: The length of these animations is supposed to be dictated
// by the vending machine's pack prototype's `AnimationDuration`
// but we have no good way of passing that data from the server
// to the client at the moment. Rework Visualizers?
private const string DeniedAnimationKey = "deny";
private const string EjectAnimationKey = "eject";
private Animation _deniedAnimation;
private Animation _ejectAnimation;
private Dictionary<string, bool> _baseStates;
private static readonly Dictionary<string, VendingMachineVisualLayers> LayerMap =
new Dictionary<string, VendingMachineVisualLayers>
{
{"off", VendingMachineVisualLayers.Unlit},
{"screen", VendingMachineVisualLayers.Screen},
{"normal", VendingMachineVisualLayers.Base},
{"normal-unshaded", VendingMachineVisualLayers.BaseUnshaded},
{"eject", VendingMachineVisualLayers.Base},
{"eject-unshaded", VendingMachineVisualLayers.BaseUnshaded},
{"deny", VendingMachineVisualLayers.Base},
{"deny-unshaded", VendingMachineVisualLayers.BaseUnshaded},
{"broken", VendingMachineVisualLayers.Unlit},
};
private Dictionary<string, Animation> _animations = new Dictionary<string, Animation>();
public override void LoadData(YamlMappingNode node)
{
base.LoadData(node);
_deniedAnimation = new Animation {Length = TimeSpan.FromSeconds(1.2f)};
_baseStates = new Dictionary<string, bool>
{
var flick = new AnimationTrackSpriteFlick();
_deniedAnimation.AnimationTracks.Add(flick);
flick.LayerKey = VendingMachineVisualLayers.Base;
flick.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame("deny", 0f));
{"off", true},
};
// Used a dictionary so the yaml can adhere to the style-guide and the texture states can be clear
var states = new Dictionary<string, string>
{
{"screen", "screen"},
{"normal", "normal"},
{"normalUnshaded", "normal-unshaded"},
{"eject", "eject"},
{"ejectUnshaded", "eject-unshaded"},
{"deny", "deny"},
{"denyUnshaded", "deny-unshaded"},
{"broken", "broken"},
{"brokenUnshaded", "broken-unshaded"},
};
foreach (var (state, textureState) in states)
{
if (!node.TryGetNode(state, out var yamlNode))
{
_baseStates[textureState] = false;
continue;
}
_baseStates.Add(textureState, yamlNode.AsBool());
}
_ejectAnimation = new Animation {Length = TimeSpan.FromSeconds(1.2f)};
if (_baseStates["deny"])
{
var flick = new AnimationTrackSpriteFlick();
_ejectAnimation.AnimationTracks.Add(flick);
flick.LayerKey = VendingMachineVisualLayers.Base;
flick.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame("eject", 0f));
InitializeAnimation("deny");
}
if (_baseStates["deny-unshaded"])
{
InitializeAnimation("deny-unshaded", true);
}
if (_baseStates["eject"])
{
InitializeAnimation("eject");
}
if (_baseStates["eject-unshaded"])
{
InitializeAnimation("eject-unshaded", true);
}
}
private void InitializeAnimation(string key, bool unshaded = false)
{
_animations.Add(key, new Animation {Length = TimeSpan.FromSeconds(1.2f)});
var flick = new AnimationTrackSpriteFlick();
_animations[key].AnimationTracks.Add(flick);
flick.LayerKey = unshaded ? VendingMachineVisualLayers.BaseUnshaded : VendingMachineVisualLayers.Base;
flick.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame(key, 0f));
}
public override void InitializeEntity(IEntity entity)
@@ -51,6 +116,16 @@ namespace Content.Client.GameObjects.Components.VendingMachines
}
}
private void HideLayers(ISpriteComponent spriteComponent)
{
foreach (var layer in spriteComponent.AllLayers)
{
layer.Visible = false;
}
spriteComponent.LayerSetVisible(VendingMachineVisualLayers.Unlit, true);
}
public override void OnChangeData(AppearanceComponent component)
{
var sprite = component.Owner.GetComponent<ISpriteComponent>();
@@ -59,40 +134,81 @@ namespace Content.Client.GameObjects.Components.VendingMachines
{
state = VendingMachineVisualState.Normal;
}
// Hide last state
HideLayers(sprite);
ActivateState(sprite, "off");
switch (state)
{
case VendingMachineVisualState.Normal:
sprite.LayerSetState(VendingMachineVisualLayers.Base, "normal");
ActivateState(sprite, "screen");
ActivateState(sprite, "normal-unshaded");
ActivateState(sprite, "normal");
break;
case VendingMachineVisualState.Off:
sprite.LayerSetState(VendingMachineVisualLayers.Base, "off");
break;
case VendingMachineVisualState.Broken:
sprite.LayerSetState(VendingMachineVisualLayers.Base, "broken");
ActivateState(sprite, "broken-unshaded");
ActivateState(sprite, "broken");
break;
case VendingMachineVisualState.Deny:
if (!animPlayer.HasRunningAnimation(DeniedAnimationKey))
{
animPlayer.Play(_deniedAnimation, DeniedAnimationKey);
}
ActivateState(sprite, "screen");
ActivateAnimation(sprite, animPlayer, "deny-unshaded");
ActivateAnimation(sprite, animPlayer, "deny");
break;
case VendingMachineVisualState.Eject:
if (!animPlayer.HasRunningAnimation(EjectAnimationKey))
{
animPlayer.Play(_ejectAnimation, EjectAnimationKey);
}
ActivateState(sprite, "screen");
ActivateAnimation(sprite, animPlayer, "eject-unshaded");
ActivateAnimation(sprite, animPlayer, "eject");
break;
default:
throw new ArgumentOutOfRangeException();
}
}
// Helper methods just to avoid all of that hard-to-read-indented code
private void ActivateState(ISpriteComponent spriteComponent, string stateId)
{
// No state for it on the rsi :(
if (!_baseStates[stateId])
{
return;
}
var stateLayer = LayerMap[stateId];
spriteComponent.LayerSetVisible(stateLayer, true);
spriteComponent.LayerSetState(stateLayer, stateId);
}
private void ActivateAnimation(ISpriteComponent spriteComponent, AnimationPlayerComponent animationPlayer, string key)
{
if (!_animations.TryGetValue(key, out var animation))
{
return;
}
if (!animationPlayer.HasRunningAnimation(key))
{
spriteComponent.LayerSetVisible(LayerMap[key], true);
animationPlayer.Play(animation, key);
}
}
public enum VendingMachineVisualLayers
{
// Off / Broken. The other layers will overlay this if the machine is on.
Unlit,
// Normal / Deny / Eject
Base,
BaseUnshaded,
// Screens that are persistent (where the machine is not off or broken)
Screen,
}
}
}

View File

@@ -141,7 +141,7 @@ namespace Content.Client.GameObjects.Components.Weapons
const float xOffset = 0.0f;
// Overkill but easy to adjust if you want to mess around with the design
var result = (float) Math.Clamp(slope * (float) Math.Pow(ratio - xOffset, exponent) + yOffset, 0.0, 1.0);
var result = (float) FloatMath.Clamp(slope * (float) Math.Pow(ratio - xOffset, exponent) + yOffset, 0.0, 1.0);
DebugTools.Assert(!float.IsNaN(result));
return result;
}

View File

@@ -5,7 +5,6 @@ using Content.Client.UserInterface.Stylesheets;
using Content.Client.Utility;
using Content.Shared.GameObjects.Components;
using Robust.Client.Animations;
using Robust.Client.Graphics;
using Robust.Client.Graphics.Drawing;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.UserInterface;

View File

@@ -1,25 +1,16 @@
using Content.Client.GameObjects.Components.Mobs;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
namespace Content.Client.GameObjects.EntitySystems
{
public sealed class CameraRecoilSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
EntityQuery = new TypeEntityQuery(typeof(CameraRecoilComponent));
}
public override void FrameUpdate(float frameTime)
{
base.FrameUpdate(frameTime);
foreach (var entity in RelevantEntities)
foreach (var recoil in EntityManager.ComponentManager.EntityQuery<CameraRecoilComponent>())
{
var recoil = entity.GetComponent<CameraRecoilComponent>();
recoil.FrameUpdate(frameTime);
}
}

View File

@@ -1,11 +1,9 @@
using Content.Client.GameObjects.Components.Actor;
using Content.Client.UserInterface;
using Content.Shared.Input;
using Robust.Client.GameObjects.EntitySystems;
using Robust.Client.Player;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Input;
using Robust.Shared.Input.Binding;
using Robust.Shared.IoC;

View File

@@ -1,10 +1,9 @@
using Content.Client.GameObjects.Components.HUD.Inventory;
using Content.Client.UserInterface;
using Content.Shared.Input;
using Robust.Client.GameObjects.EntitySystems;
using Robust.Client.Player;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Input;
using Robust.Shared.Input.Binding;
using Robust.Shared.IoC;

View File

@@ -1,25 +1,16 @@
using Content.Client.GameObjects.Components.Mobs;
using Content.Client.UserInterface;
using Content.Client.Utility;
using Content.Shared.GameObjects.Components.Mobs;
using Content.Shared.GameObjects.EntitySystemMessages;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Input;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.GameObjects.EntitySystems;
using Robust.Client.Graphics.Drawing;
using Robust.Client.Graphics.Overlays;
using Robust.Client.Interfaces.Graphics.Overlays;
using Robust.Client.Interfaces.Input;
using Robust.Client.Player;
using Robust.Shared.Input;
using Robust.Shared.Input.Binding;
using Robust.Shared.Interfaces.Timing;
using Robust.Shared.IoC;
using Robust.Shared.Maths;
using Robust.Shared.Players;
using static Content.Client.StaticIoC;
namespace Content.Client.GameObjects.EntitySystems
{

View File

@@ -3,6 +3,7 @@ using Content.Client.Construction;
using Content.Client.GameObjects.Components.Construction;
using Content.Client.UserInterface;
using Content.Shared.Construction;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Input;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
@@ -21,7 +22,7 @@ namespace Content.Client.GameObjects.EntitySystems
/// The client-side implementation of the construction system, which is used for constructing entities in game.
/// </summary>
[UsedImplicitly]
public class ConstructionSystem : Shared.GameObjects.EntitySystems.SharedConstructionSystem
public class ConstructionSystem : SharedConstructionSystem
{
#pragma warning disable 649
[Dependency] private readonly IGameHud _gameHud;

View File

@@ -20,20 +20,20 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
{
[Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
private Dictionary<byte, PanelContainer> _doAfterControls = new Dictionary<byte, PanelContainer>();
private Dictionary<byte, DoAfterBar> _doAfterBars = new Dictionary<byte, DoAfterBar>();
// We'll store cancellations for a little bit just so we can flash the graphic to indicate it's cancelled
private Dictionary<byte, TimeSpan> _cancelledDoAfters = new Dictionary<byte, TimeSpan>();
public IEntity? AttachedEntity { get; set; }
private ScreenCoordinates _playerPosition;
// This behavior probably shouldn't be happening; so for whatever reason the control position is set the frame after
// I got NFI why because I don't know the UI internals
private bool _firstDraw = true;
public DoAfterGui()
{
IoCManager.InjectDependencies(this);
@@ -43,6 +43,25 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
LayoutContainer.SetGrowVertical(this, LayoutContainer.GrowDirection.Begin);
}
/// <summary>
/// Called when the mind is detached from an entity
/// </summary>
/// Rather than just dispose of the Gui we'll just remove its child controls and re-use the control.
public void Detached()
{
foreach (var (_, control) in _doAfterControls)
{
control.Dispose();
}
_doAfterControls.Clear();
foreach (var (_, control) in _doAfterBars)
{
control.Dispose();
}
_doAfterBars.Clear();
_cancelledDoAfters.Clear();
}
/// <summary>
/// Add the necessary control for a DoAfter progress bar.
/// </summary>
@@ -71,7 +90,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
TextureScale = Vector2.One * DoAfterBar.DoAfterBarScale,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
},
doAfterBar
}
};
@@ -79,9 +98,9 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
AddChild(control);
_doAfterControls.Add(message.ID, control);
}
// NOTE THAT THE BELOW ONLY HANDLES THE UI SIDE
/// <summary>
/// Removes a DoAfter without showing a cancel graphic.
/// </summary>
@@ -92,7 +111,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
{
return;
}
var control = _doAfterControls[id];
RemoveChild(control);
_doAfterControls.Remove(id);
@@ -114,7 +133,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
{
return;
}
var control = _doAfterControls[id];
_doAfterBars[id].Cancelled = true;
_cancelledDoAfters.Add(id, _gameTiming.CurTime);
@@ -124,13 +143,13 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
{
base.FrameUpdate(args);
if (AttachedEntity == null || !AttachedEntity.TryGetComponent(out DoAfterComponent doAfterComponent))
if (AttachedEntity?.IsValid() != true || !AttachedEntity.TryGetComponent(out DoAfterComponent doAfterComponent))
{
return;
}
var doAfters = doAfterComponent.DoAfters;
// Nothing to render so we'll hide.
if (doAfters.Count == 0 && _cancelledDoAfters.Count == 0)
{
@@ -138,7 +157,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
Visible = false;
return;
}
// Set position ready for 2nd+ frames.
_playerPosition = _eyeManager.WorldToScreen(AttachedEntity.Transform.GridPosition);
LayoutContainer.SetPosition(this, new Vector2(_playerPosition.X - Width / 2, _playerPosition.Y - Height - 30.0f));
@@ -152,7 +171,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
Visible = true;
var currentTime = _gameTiming.CurTime;
var toCancel = new List<byte>();
// Cleanup cancelled DoAfters
foreach (var (id, cancelTime) in _cancelledDoAfters)
{
@@ -166,7 +185,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
{
RemoveDoAfter(id);
}
// Update 0 -> 1.0f of the things
foreach (var (id, message) in doAfters)
{
@@ -174,11 +193,11 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
{
continue;
}
var doAfterBar = _doAfterBars[id];
doAfterBar.Ratio = MathF.Min(1.0f,
(float) (currentTime - message.StartTime).TotalSeconds / message.Delay);
}
}
}
}
}

View File

@@ -50,19 +50,20 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
base.Shutdown();
Gui?.Dispose();
Gui = null;
_player = null;
}
private void HandlePlayerAttached(IEntity? entity)
{
_player = entity;
// Setup the GUI and pass the new data to it if applicable.
Gui?.Dispose();
Gui?.Detached();
if (entity == null)
{
return;
}
Gui ??= new DoAfterGui();
Gui.AttachedEntity = entity;
@@ -81,24 +82,29 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
var currentTime = _gameTiming.CurTime;
if (_player == null || !_player.TryGetComponent(out DoAfterComponent doAfterComponent))
if (_player?.IsValid() != true)
{
return;
}
if (!_player.TryGetComponent(out DoAfterComponent doAfterComponent))
{
return;
}
var doAfters = doAfterComponent.DoAfters.ToList();
if (doAfters.Count == 0)
{
return;
}
var userGrid = _player.Transform.GridPosition;
// Check cancellations / finishes
foreach (var (id, doAfter) in doAfters)
{
var elapsedTime = (currentTime - doAfter.StartTime).TotalSeconds;
// If we've passed the final time (after the excess to show completion graphic) then remove.
if (elapsedTime > doAfter.Delay + ExcessTime)
{
@@ -106,7 +112,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
doAfterComponent.Remove(doAfter);
continue;
}
// Don't predict cancellation if it's already finished.
if (elapsedTime > doAfter.Delay)
{
@@ -147,4 +153,4 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
}
}
}
}
}

View File

@@ -95,8 +95,8 @@ namespace Content.Client.GameObjects.EntitySystems
_dropTargetInRangeShader = _prototypeManager.Index<ShaderPrototype>(ShaderDropTargetInRange).Instance();
_dropTargetOutOfRangeShader = _prototypeManager.Index<ShaderPrototype>(ShaderDropTargetOutOfRange).Instance();
_interactionSystem = EntitySystem.Get<SharedInteractionSystem>();
_inputSystem = EntitySystem.Get<InputSystem>();
_interactionSystem = Get<SharedInteractionSystem>();
_inputSystem = Get<InputSystem>();
// needs to fire on mouseup and mousedown so we can detect a drag / drop
CommandBinds.Builder
.Bind(EngineKeyFunctions.Use, new PointerInputCmdHandler(OnUse, false))

View File

@@ -5,7 +5,6 @@ using Content.Shared.GameObjects.EntitySystemMessages;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Input;
using JetBrains.Annotations;
using Robust.Client.GameObjects.EntitySystems;
using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Client.Interfaces.Input;
using Robust.Client.Interfaces.UserInterface;
@@ -13,7 +12,6 @@ using Robust.Client.Player;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.GameObjects;
using Robust.Shared.Input;
using Robust.Shared.Input.Binding;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
@@ -109,7 +107,7 @@ namespace Content.Client.GameObjects.EntitySystems
FormattedMessage message;
if (entity.Uid.IsClientSide())
{
message = ExamineSystem.GetExamineText(entity, _playerManager.LocalPlayer.ControlledEntity);
message = GetExamineText(entity, _playerManager.LocalPlayer.ControlledEntity);
}
else
{

View File

@@ -1,22 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Client.Atmos;
using Content.Client.Utility;
using Content.Shared.Atmos;
using Content.Shared.GameObjects.EntitySystems;
using JetBrains.Annotations;
using Robust.Client.Graphics;
using Robust.Client.Interfaces.Graphics.Overlays;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.ResourceManagement;
using Robust.Client.Utility;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
namespace Content.Client.GameObjects.EntitySystems

View File

@@ -1,6 +1,5 @@
using Content.Client.GameObjects.Components.Instruments;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.Timing;
using Robust.Shared.IoC;
@@ -12,12 +11,6 @@ namespace Content.Client.GameObjects.EntitySystems
{
[Dependency] private readonly IGameTiming _gameTiming = default;
public override void Initialize()
{
base.Initialize();
EntityQuery = new TypeEntityQuery(typeof(InstrumentComponent));
}
public override void Update(float frameTime)
{
base.Update(frameTime);
@@ -27,9 +20,9 @@ namespace Content.Client.GameObjects.EntitySystems
return;
}
foreach (var entity in RelevantEntities)
foreach (var instrumentComponent in EntityManager.ComponentManager.EntityQuery<InstrumentComponent>())
{
entity.GetComponent<InstrumentComponent>().Update(frameTime);
instrumentComponent.Update(frameTime);
}
}
}

View File

@@ -1,5 +1,4 @@
using Content.Client.GameObjects.Components.Markers;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
namespace Content.Client.GameObjects.EntitySystems
@@ -8,13 +7,6 @@ namespace Content.Client.GameObjects.EntitySystems
{
private bool _markersVisible;
public override void Initialize()
{
base.Initialize();
EntityQuery = new TypeEntityQuery<MarkerComponent>();
}
public bool MarkersVisible
{
get => _markersVisible;
@@ -27,9 +19,9 @@ namespace Content.Client.GameObjects.EntitySystems
private void UpdateMarkers()
{
foreach (var entity in RelevantEntities)
foreach (var markerComponent in EntityManager.ComponentManager.EntityQuery<MarkerComponent>())
{
entity.GetComponent<MarkerComponent>().UpdateVisibility();
markerComponent.UpdateVisibility();
}
}
}

View File

@@ -1,6 +1,5 @@
using Content.Client.GameObjects.Components.Mobs;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
namespace Content.Client.GameObjects.EntitySystems
@@ -8,20 +7,13 @@ namespace Content.Client.GameObjects.EntitySystems
[UsedImplicitly]
public sealed class MeleeLungeSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
EntityQuery = new TypeEntityQuery<MeleeLungeComponent>();
}
public override void FrameUpdate(float frameTime)
{
base.FrameUpdate(frameTime);
foreach (var entity in RelevantEntities)
foreach (var meleeLungeComponent in EntityManager.ComponentManager.EntityQuery<MeleeLungeComponent>())
{
entity.GetComponent<MeleeLungeComponent>().Update(frameTime);
meleeLungeComponent.Update(frameTime);
}
}
}

View File

@@ -24,16 +24,15 @@ namespace Content.Client.GameObjects.EntitySystems
public override void Initialize()
{
SubscribeNetworkEvent<PlayMeleeWeaponAnimationMessage>(PlayWeaponArc);
EntityQuery = new TypeEntityQuery(typeof(MeleeWeaponArcAnimationComponent));
}
public override void FrameUpdate(float frameTime)
{
base.FrameUpdate(frameTime);
foreach (var entity in RelevantEntities)
foreach (var arcAnimationComponent in EntityManager.ComponentManager.EntityQuery<MeleeWeaponArcAnimationComponent>())
{
entity.GetComponent<MeleeWeaponArcAnimationComponent>().Update(frameTime);
arcAnimationComponent.Update(frameTime);
}
}

View File

@@ -1,7 +1,6 @@
#nullable enable
using Content.Shared.GameObjects.Components.Movement;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Physics;
using JetBrains.Annotations;
using Robust.Client.Physics;
using Robust.Client.Player;
@@ -31,11 +30,10 @@ namespace Content.Client.GameObjects.EntitySystems
return;
}
var physics = playerEnt.GetComponent<IPhysicsComponent>();
playerEnt.TryGetComponent(out ICollidableComponent? collidable);
physics.Predict = true;
var collidable = playerEnt.GetComponent<ICollidableComponent>();
collidable.Predict = true;
UpdateKinematics(playerEnt.Transform, mover, physics, collidable);
UpdateKinematics(playerEnt.Transform, mover, collidable);
}
public override void Update(float frameTime)

View File

@@ -1,6 +1,4 @@
using Content.Client.GameObjects.Components.Mobs;
using Content.Shared.GameObjects.Components.Mobs;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.Timing;
using Robust.Shared.IoC;
@@ -13,11 +11,6 @@ namespace Content.Client.GameObjects.EntitySystems
[Dependency] private IGameTiming _gameTiming;
#pragma warning restore 649
public StatusEffectsSystem()
{
EntityQuery = new TypeEntityQuery(typeof(ClientStatusEffectsComponent));
}
public override void FrameUpdate(float frameTime)
{
base.FrameUpdate(frameTime);
@@ -25,9 +18,9 @@ namespace Content.Client.GameObjects.EntitySystems
if (!_gameTiming.IsFirstTimePredicted)
return;
foreach (var entity in RelevantEntities)
foreach (var clientStatusEffectsComponent in EntityManager.ComponentManager.EntityQuery<ClientStatusEffectsComponent>())
{
entity.GetComponent<ClientStatusEffectsComponent>().FrameUpdate(frameTime);
clientStatusEffectsComponent.FrameUpdate(frameTime);
}
}
}

View File

@@ -6,8 +6,8 @@ using System.Threading;
using Content.Client.State;
using Content.Client.UserInterface;
using Content.Client.Utility;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.EntitySystemMessages;
using Content.Shared.GameObjects.Verbs;
using Content.Shared.Input;
using JetBrains.Annotations;
using Robust.Client.GameObjects.EntitySystems;
@@ -210,6 +210,9 @@ namespace Content.Client.GameObjects.EntitySystems
if (verb.RequireInteractionRange && !VerbUtility.InVerbUseRange(user, entity))
continue;
if (verb.BlockedByContainers && !user.IsInSameOrNoContainer(entity))
continue;
var verbData = verb.GetData(user, component);
if (verbData.IsInvisible)
@@ -232,6 +235,9 @@ namespace Content.Client.GameObjects.EntitySystems
if (globalVerb.RequireInteractionRange && !VerbUtility.InVerbUseRange(user, entity))
continue;
if (globalVerb.BlockedByContainers && !user.IsInSameOrNoContainer(entity))
continue;
var verbData = globalVerb.GetData(user, entity);
if (verbData.IsInvisible)

View File

@@ -1,5 +1,5 @@
using Content.Client.GameObjects.EntitySystems;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Verbs;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Localization;
@@ -11,6 +11,8 @@ namespace Content.Client.GlobalVerbs
{
public override bool RequireInteractionRange => false;
public override bool BlockedByContainers => false;
public override void GetData(IEntity user, IEntity target, VerbData data)
{
data.Visibility = VerbVisibility.Visible;

View File

@@ -1,4 +1,4 @@
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Verbs;
using Robust.Client.Console;
using Robust.Client.ViewVariables;
using Robust.Shared.Interfaces.GameObjects;
@@ -13,6 +13,7 @@ namespace Content.Client.GlobalVerbs
class ViewVariablesVerb : GlobalVerb
{
public override bool RequireInteractionRange => false;
public override bool BlockedByContainers => false;
public override void GetData(IEntity user, IEntity target, VerbData data)
{

View File

@@ -1,20 +1,16 @@
using System.Net.Mime;
using Content.Shared.GameObjects.Components.Mobs;
using Content.Shared.GameObjects.Components.Mobs;
using Content.Shared.Interfaces;
using Robust.Client.Graphics;
using Robust.Client.Graphics.Drawing;
using Robust.Client.Graphics.Overlays;
using Robust.Client.Graphics.Shaders;
using Robust.Client.Interfaces.Graphics;
using Robust.Client.Interfaces.Graphics.ClientEye;
using Robust.Shared.Interfaces.Timing;
using Robust.Shared.IoC;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using Color = Robust.Shared.Maths.Color;
namespace Content.Client.Graphics.Overlays
{

View File

@@ -1,12 +1,10 @@
using Content.Client.UserInterface;
using Content.Shared.BodySystem;
using System.Collections.Generic;
using Content.Shared.Health.BodySystem.BodyScanner;
using Robust.Client.GameObjects.Components.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.GameObjects.Components.UserInterface;
using Robust.Shared.ViewVariables;
using System.Collections.Generic;
namespace Content.Client.BodySystem
namespace Content.Client.Health.BodySystem.BodyScanner
{
public class BodyScannerBoundUserInterface : BoundUserInterface
{
@@ -40,7 +38,7 @@ namespace Content.Client.BodySystem
_template = scannerState.Template;
_parts = scannerState.Parts;
_display.UpdateDisplay(_template, _parts);
}

View File

@@ -1,20 +1,14 @@
using Content.Client.BodySystem;
using Content.Shared.BodySystem;
using Robust.Client.Graphics.Drawing;
using Robust.Client.Interfaces.ResourceManagement;
using System.Collections.Generic;
using System.Globalization;
using Content.Shared.Health.BodySystem.BodyScanner;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.Utility;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
using Robust.Shared.Utility;
using System;
using System.Collections.Generic;
using System.Globalization;
using static Robust.Client.UserInterface.Controls.ItemList;
namespace Content.Client.UserInterface
namespace Content.Client.Health.BodySystem.BodyScanner
{
public sealed class BodyScannerDisplay : SS14Window
{
@@ -33,7 +27,7 @@ namespace Content.Client.UserInterface
private BodyScannerTemplateData _template;
private Dictionary<string, BodyScannerBodyPartData> _parts;
private List<string> _slots;
private List<string> _slots;
private BodyScannerBodyPartData _currentBodyPart;
@@ -100,7 +94,7 @@ namespace Content.Client.UserInterface
public void UpdateDisplay(BodyScannerTemplateData template, Dictionary<string, BodyScannerBodyPartData> parts)
{
_template = template;
_template = template;
_parts = parts;
_slots = new List<string>();
BodyPartList.Clear();

View File

@@ -1,15 +1,8 @@
using System;
using System.Collections.Generic;
using Content.Shared.Health.BodySystem.Surgery;
using Robust.Client.GameObjects.Components.UserInterface;
using Robust.Shared.GameObjects.Components.UserInterface;
using Robust.Shared.IoC;
using Robust.Shared.Prototypes;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.Players;
using Content.Shared.BodySystem;
namespace Content.Client.BodySystem
namespace Content.Client.Health.BodySystem.Surgery
{
//TODO : Make window close if target or surgery tool gets too far away from user.

View File

@@ -1,14 +1,13 @@
using Robust.Client.UserInterface;
using System;
using System.Collections.Generic;
using System.Globalization;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
namespace Content.Client.BodySystem
namespace Content.Client.Health.BodySystem.Surgery
{
public class GenericSurgeryWindow : SS14Window
{

View File

@@ -136,6 +136,8 @@
"TrashSpawner",
"Pill",
"RCD",
"RCDDeconstructWhitelist",
"RCDAmmo",
"Pullable",
"CursedEntityStorage",
"Listening",

View File

@@ -1,4 +1,3 @@
using System.Threading.Tasks;
using Content.Client.GameObjects.Components.Instruments;
using Content.Client.UserInterface.Stylesheets;
using Content.Shared.GameObjects.EntitySystems;

View File

@@ -1,4 +1,4 @@
using Content.Server.Jobs;
using Content.Shared.Roles;
using JetBrains.Annotations;
namespace Content.Client.Jobs

View File

@@ -9,12 +9,8 @@ using Robust.Shared.Maths;
using Robust.Shared.Noise;
using Robust.Shared.Random;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.PixelFormats;
using Color = Robust.Shared.Maths.Color;
using CannyFastMath;
using Math = CannyFastMath.Math;
using MathF = CannyFastMath.MathF;
namespace Content.Client.Parallax
{
@@ -81,7 +77,7 @@ namespace Content.Client.Parallax
private readonly NoiseGenerator.NoiseType NoiseType = NoiseGenerator.NoiseType.Fbm;
private readonly uint Seed = 1234;
private readonly float Persistence = 0.5f;
private readonly float Lacunarity = (float) (Math.TAU / 3);
private readonly float Lacunarity = (float) (Math.PI / 3);
private readonly float Frequency = 1;
private readonly uint Octaves = 3;
private readonly float Threshold;

View File

@@ -8,6 +8,7 @@ using Robust.Client.Graphics;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Shared.Interfaces.Configuration;
using Robust.Shared.Interfaces.Log;
using Robust.Shared.Interfaces.Resources;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Utility;
@@ -59,16 +60,11 @@ namespace Content.Client.Parallax
if (!debugParallax && _resourceCache.UserData.Exists(ParallaxConfigOld))
{
bool match;
using (var data = _resourceCache.UserData.Open(ParallaxConfigOld, FileMode.Open))
using (var reader = new StreamReader(data, EncodingHelpers.UTF8))
{
match = reader.ReadToEnd() == contents;
}
var match = _resourceCache.UserData.ReadAllText(ParallaxConfigOld) == contents;
if (match)
{
using (var stream = _resourceCache.UserData.Open(ParallaxPath, FileMode.Open))
using (var stream = _resourceCache.UserData.OpenRead(ParallaxPath))
{
ParallaxTexture = Texture.LoadFromPNGStream(stream, "Parallax");
}
@@ -95,7 +91,7 @@ namespace Content.Client.Parallax
ParallaxTexture = Texture.LoadFromImage(image, "Parallax");
// Store it and CRC so further game starts don't need to regenerate it.
using (var stream = _resourceCache.UserData.Open(ParallaxPath, FileMode.Create))
using (var stream = _resourceCache.UserData.Create(ParallaxPath))
{
image.SaveAsPng(stream);
}
@@ -105,8 +101,7 @@ namespace Content.Client.Parallax
var i = 0;
foreach (var debugImage in debugImages)
{
using (var stream = _resourceCache.UserData.Open(new ResourcePath($"/parallax_debug_{i}.png"),
FileMode.Create))
using (var stream = _resourceCache.UserData.Create(new ResourcePath($"/parallax_debug_{i}.png")))
{
debugImage.SaveAsPng(stream);
}
@@ -117,7 +112,7 @@ namespace Content.Client.Parallax
image.Dispose();
using (var stream = _resourceCache.UserData.Open(ParallaxConfigOld, FileMode.Create))
using (var stream = _resourceCache.UserData.Create(ParallaxConfigOld))
using (var writer = new StreamWriter(stream, EncodingHelpers.UTF8))
{
writer.Write(contents);

View File

@@ -1,13 +1,16 @@
using System;
using Content.Client.UserInterface;
using Content.Client.GameObjects.EntitySystems;
using Content.Shared.Input;
using Content.Shared.Sandbox;
using Robust.Client.Console;
using Robust.Client.Interfaces.Console;
using Robust.Client.Interfaces.Input;
using Robust.Client.Interfaces.Graphics.Lighting;
using Robust.Client.Interfaces.Placement;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.Input;
using Robust.Shared.Input.Binding;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.Interfaces.Network;
@@ -17,9 +20,64 @@ using Robust.Shared.Prototypes;
namespace Content.Client.Sandbox
{
internal sealed class SandboxManager : SharedSandboxManager, ISandboxManager
// Layout for the SandboxWindow
public class SandboxWindow : SS14Window
{
public Button RespawnButton;
public Button SpawnEntitiesButton;
public Button SpawnTilesButton;
public Button GiveFullAccessButton; //A button that just puts a captain's ID in your hands.
public Button GiveAghostButton;
public Button ToggleLightButton;
public Button SuicideButton;
public Button ToggleSubfloorButton;
public Button ShowMarkersButton; //Shows spawn points
public Button ShowBbButton; //Shows bounding boxes
public SandboxWindow(ILocalizationManager loc)
{
Resizable = false;
Title = "Sandbox Panel";
var vBox = new VBoxContainer { SeparationOverride = 4 };
Contents.AddChild(vBox);
RespawnButton = new Button { Text = loc.GetString("Respawn") };
vBox.AddChild(RespawnButton);
SpawnEntitiesButton = new Button { Text = loc.GetString("Spawn Entities") };
vBox.AddChild(SpawnEntitiesButton);
SpawnTilesButton = new Button { Text = loc.GetString("Spawn Tiles") };
vBox.AddChild(SpawnTilesButton);
GiveFullAccessButton = new Button { Text = loc.GetString("Give AA Id") };
vBox.AddChild(GiveFullAccessButton);
GiveAghostButton = new Button { Text = loc.GetString("Ghost") };
vBox.AddChild(GiveAghostButton);
ToggleLightButton = new Button { Text = loc.GetString("Toggle Lights"), ToggleMode = true };
vBox.AddChild(ToggleLightButton);
ToggleSubfloorButton = new Button { Text = loc.GetString("Toggle Subfloor"), ToggleMode = true };
vBox.AddChild(ToggleSubfloorButton);
SuicideButton = new Button { Text = loc.GetString("Suicide") };
vBox.AddChild(SuicideButton);
ShowMarkersButton = new Button { Text = loc.GetString("Show Spawns"), ToggleMode = true };
vBox.AddChild(ShowMarkersButton);
ShowBbButton = new Button { Text = loc.GetString("Show Bb"), ToggleMode = true };
vBox.AddChild(ShowBbButton);
}
}
internal class SandboxManager : SharedSandboxManager, ISandboxManager
{
#pragma warning disable 649
[Dependency] private readonly IClientConsole _console;
[Dependency] private readonly IGameHud _gameHud;
[Dependency] private readonly IClientNetManager _netManager;
[Dependency] private readonly ILocalizationManager _localization;
@@ -38,6 +96,7 @@ namespace Content.Client.Sandbox
private EntitySpawnWindow _spawnWindow;
private TileSpawnWindow _tilesSpawnWindow;
private bool _sandboxWindowToggled;
bool SpawnEntitiesButton { get; set; }
public void Initialize()
{
@@ -48,6 +107,10 @@ namespace Content.Client.Sandbox
_netManager.RegisterNetMessage<MsgSandboxRespawn>(nameof(MsgSandboxRespawn));
_netManager.RegisterNetMessage<MsgSandboxGiveAghost>(nameof(MsgSandboxGiveAghost));
_netManager.RegisterNetMessage<MsgSandboxSuicide>(nameof(MsgSandboxSuicide));
_gameHud.SandboxButtonToggled = SandboxButtonPressed;
_inputManager.SetInputCommand(ContentKeyFunctions.OpenEntitySpawnWindow,
@@ -112,12 +175,16 @@ namespace Content.Client.Sandbox
_window.SpawnTilesButton.OnPressed += OnSpawnTilesButtonClicked;
_window.SpawnEntitiesButton.OnPressed += OnSpawnEntitiesButtonClicked;
_window.GiveFullAccessButton.OnPressed += OnGiveAdminAccessButtonClicked;
_window.GiveAghostButton.OnPressed += OnGiveAghostButtonClicked;
_window.ToggleLightButton.OnToggled += OnToggleLightButtonClicked;
_window.SuicideButton.OnPressed += OnSuicideButtonClicked;
_window.ToggleSubfloorButton.OnPressed += OnToggleSubfloorButtonClicked;
_window.ShowMarkersButton.OnPressed += OnShowMarkersButtonClicked;
_window.ShowBbButton.OnPressed += OnShowBbButtonClicked;
_window.OpenCentered();
}
private void WindowOnOnClose()
{
_window = null;
@@ -140,13 +207,44 @@ namespace Content.Client.Sandbox
ToggleTilesWindow();
}
private void OnToggleLightButtonClicked(BaseButton.ButtonEventArgs args)
{
ToggleLight();
}
private void OnToggleSubfloorButtonClicked(BaseButton.ButtonEventArgs args)
{
ToggleSubfloor();
}
private void OnShowMarkersButtonClicked(BaseButton.ButtonEventArgs args)
{
ShowMarkers();
}
private void OnShowBbButtonClicked(BaseButton.ButtonEventArgs args)
{
ShowBb();
}
private void OnGiveAdminAccessButtonClicked(BaseButton.ButtonEventArgs args)
{
_netManager.ClientSendMessage(_netManager.CreateNetMessage<MsgSandboxGiveAccess>());
}
private void OnGiveAghostButtonClicked(BaseButton.ButtonEventArgs args)
{
_netManager.ClientSendMessage(_netManager.CreateNetMessage<MsgSandboxGiveAghost>());
}
private void OnSuicideButtonClicked(BaseButton.ButtonEventArgs args)
{
_netManager.ClientSendMessage(_netManager.CreateNetMessage<MsgSandboxSuicide>());
}
private void ToggleEntitySpawnWindow()
{
if(_spawnWindow == null)
if (_spawnWindow == null)
_spawnWindow = new EntitySpawnWindow(_placementManager, _prototypeManager, _resourceCache, _localization);
if (_spawnWindow.IsOpen)
@@ -162,7 +260,7 @@ namespace Content.Client.Sandbox
private void ToggleTilesWindow()
{
if(_tilesSpawnWindow == null)
if (_tilesSpawnWindow == null)
_tilesSpawnWindow = new TileSpawnWindow(_tileDefinitionManager, _placementManager, _resourceCache);
if (_tilesSpawnWindow.IsOpen)
@@ -175,5 +273,25 @@ namespace Content.Client.Sandbox
_tilesSpawnWindow.OpenToLeft();
}
}
private void ToggleLight()
{
_console.ProcessCommand("togglelight");
}
private void ToggleSubfloor()
{
_console.ProcessCommand("showsubfloor");
}
private void ShowMarkers()
{
_console.ProcessCommand("showmarkers");
}
private void ShowBb()
{
_console.ProcessCommand("showbb");
}
}
}

View File

@@ -1,51 +0,0 @@
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.Localization;
namespace Content.Client.Sandbox
{
public sealed class SandboxWindow : SS14Window
{
public Button RespawnButton { get; }
public Button SpawnEntitiesButton { get; }
public Button SpawnTilesButton { get; }
public Button GiveFullAccessButton { get; } //A button that just puts a captain's ID in your hands.
public SandboxWindow(ILocalizationManager loc)
{
Title = loc.GetString("Sandbox Panel");
RespawnButton = new Button
{
Text = loc.GetString("Respawn")
};
SpawnEntitiesButton = new Button
{
Text = loc.GetString("Spawn Entities")
};
SpawnTilesButton = new Button
{
Text = loc.GetString("Spawn Tiles")
};
GiveFullAccessButton = new Button
{
Text = loc.GetString("Give Full Access ID")
};
Contents.AddChild(new VBoxContainer
{
Children =
{
RespawnButton,
SpawnEntitiesButton,
SpawnTilesButton,
GiveFullAccessButton
}
});
}
}
}

View File

@@ -4,7 +4,6 @@ using System.Threading.Tasks;
using Content.Shared.Input;
using Robust.Client.Interfaces.Graphics;
using Robust.Client.Interfaces.Input;
using Robust.Shared.Input;
using Robust.Shared.Input.Binding;
using Robust.Shared.Interfaces.Resources;
using Robust.Shared.IoC;
@@ -58,7 +57,7 @@ namespace Content.Client
}
await using var file =
_resourceManager.UserData.Open(BaseScreenshotPath / $"{filename}.png", FileMode.CreateNew);
_resourceManager.UserData.Open(BaseScreenshotPath / $"{filename}.png", FileMode.CreateNew, FileAccess.Read, FileShare.None);
await Task.Run(() =>
{

View File

@@ -1,20 +1,13 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using Content.Client.Chat;
using Content.Client.Interfaces.Chat;
using Content.Client.UserInterface;
using Content.Shared.Input;
using Robust.Client.Console;
using Robust.Client.Interfaces.Input;
using Robust.Client.Interfaces.State;
using Robust.Client.Interfaces.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Input;
using Robust.Shared.Input.Binding;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Map;
using Robust.Shared.ViewVariables;
namespace Content.Client.State

View File

@@ -5,11 +5,10 @@ using Content.Client.GameObjects.Components;
using Content.Shared.GameObjects.EntitySystems;
using Robust.Client.GameObjects.EntitySystems;
using Robust.Client.Interfaces.GameObjects;
using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Client.Interfaces.Graphics.ClientEye;
using Robust.Client.Interfaces.Input;
using Robust.Client.Interfaces.UserInterface;
using Robust.Client.Interfaces.State;
using Robust.Client.Interfaces.UserInterface;
using Robust.Client.Player;
using Robust.Shared.GameObjects;
using Robust.Shared.Input;

View File

@@ -9,10 +9,8 @@ using Robust.Client.Interfaces;
using Robust.Client.Interfaces.Input;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.Interfaces.UserInterface;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.Player;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Input;
using Robust.Shared.Input.Binding;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
@@ -20,9 +18,6 @@ using Robust.Shared.Localization;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
using Robust.Shared.ViewVariables;
using CannyFastMath;
using Math = CannyFastMath.Math;
using MathF = CannyFastMath.MathF;
namespace Content.Client.State
{

View File

@@ -0,0 +1,152 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Client.GameObjects.Components.StationEvents;
using Content.Shared.GameObjects.Components.Mobs;
using JetBrains.Annotations;
using Robust.Client.Graphics.Drawing;
using Robust.Client.Graphics.Overlays;
using Robust.Client.Interfaces.Graphics.ClientEye;
using Robust.Client.Player;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.Interfaces.Timing;
using Robust.Shared.IoC;
using Color = Robust.Shared.Maths.Color;
namespace Content.Client.StationEvents
{
[UsedImplicitly]
public sealed class RadiationPulseOverlay : Overlay
{
[Dependency] private readonly IComponentManager _componentManager = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IEyeManager _eyeManager = default!;
/// <summary>
/// Current color of a pulse
/// </summary>
private readonly Dictionary<IEntity, Color> _colors = new Dictionary<IEntity, Color>();
/// <summary>
/// Whether our alpha is increasing or decreasing and at what time does it flip (or stop)
/// </summary>
private readonly Dictionary<IEntity, (bool EasingIn, TimeSpan TransitionTime)> _transitions =
new Dictionary<IEntity, (bool EasingIn, TimeSpan TransitionTime)>();
/// <summary>
/// How much the alpha changes per second for each pulse
/// </summary>
private readonly Dictionary<IEntity, float> _alphaRateOfChange = new Dictionary<IEntity, float>();
private TimeSpan _lastTick;
// TODO: When worldHandle can do DrawCircle change this.
public override OverlaySpace Space => OverlaySpace.ScreenSpace;
public RadiationPulseOverlay() : base(nameof(SharedOverlayID.RadiationPulseOverlay))
{
IoCManager.InjectDependencies(this);
_lastTick = _gameTiming.CurTime;
}
/// <summary>
/// Get the current color for the entity,
/// accounting for what its alpha should be and whether it should be transitioning in or out
/// </summary>
/// <param name="entity"></param>
/// <param name="elapsedTime">frametime</param>
/// <param name="endTime"></param>
/// <returns></returns>
private Color GetColor(IEntity entity, float elapsedTime, TimeSpan endTime)
{
var currentTime = _gameTiming.CurTime;
// New pulse
if (!_colors.ContainsKey(entity))
{
UpdateTransition(entity, currentTime, endTime);
}
var currentColor = _colors[entity];
var alphaChange = _alphaRateOfChange[entity] * elapsedTime;
if (!_transitions[entity].EasingIn)
{
alphaChange *= -1;
}
if (currentTime > _transitions[entity].TransitionTime)
{
UpdateTransition(entity, currentTime, endTime);
}
_colors[entity] = _colors[entity].WithAlpha(currentColor.A + alphaChange);
return _colors[entity];
}
private void UpdateTransition(IEntity entity, TimeSpan currentTime, TimeSpan endTime)
{
bool easingIn;
TimeSpan transitionTime;
if (!_transitions.TryGetValue(entity, out var transition))
{
// Start as false because it will immediately be flipped
easingIn = false;
transitionTime = (endTime - currentTime) / 2 + currentTime;
}
else
{
easingIn = transition.EasingIn;
transitionTime = endTime;
}
_transitions[entity] = (!easingIn, transitionTime);
_colors[entity] = Color.Green.WithAlpha(0.0f);
_alphaRateOfChange[entity] = 1.0f / (float) (transitionTime - currentTime).TotalSeconds;
}
protected override void Draw(DrawingHandleBase handle, OverlaySpace currentSpace)
{
// PVS should control the overlay pretty well so the overlay doesn't get instantiated unless we're near one...
var playerEntity = _playerManager.LocalPlayer?.ControlledEntity;
if (playerEntity == null)
{
return;
}
var elapsedTime = (float) (_gameTiming.CurTime - _lastTick).TotalSeconds;
_lastTick = _gameTiming.CurTime;
var radiationPulses = _componentManager
.EntityQuery<RadiationPulseComponent>()
.ToList();
var screenHandle = (DrawingHandleScreen) handle;
var viewport = _eyeManager.GetWorldViewport();
foreach (var grid in _mapManager.FindGridsIntersecting(playerEntity.Transform.MapID, viewport))
{
foreach (var pulse in radiationPulses)
{
if (grid.Index != pulse.Owner.Transform.GridID) continue;
// TODO: Check if viewport intersects circle
var circlePosition = _eyeManager.WorldToScreen(pulse.Owner.Transform.WorldPosition);
var comp = (RadiationPulseComponent) pulse;
// change to worldhandle when implemented
screenHandle.DrawCircle(
circlePosition,
comp.Range * 64,
GetColor(pulse.Owner, elapsedTime, comp.EndTime));
}
}
}
}
}

View File

@@ -1,4 +1,7 @@
using Content.Client.GameObjects.Components.Cargo;
using System;
using System.Collections.Generic;
using Content.Client.GameObjects.Components.Cargo;
using Content.Client.UserInterface.Stylesheets;
using Content.Shared.Prototypes.Cargo;
using Robust.Client.Graphics.Drawing;
using Robust.Client.UserInterface.Controls;
@@ -7,9 +10,6 @@ using Robust.Client.Utility;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
using System;
using System.Collections.Generic;
using Content.Client.UserInterface.Stylesheets;
namespace Content.Client.UserInterface.Cargo
{

View File

@@ -1,10 +1,8 @@
using Robust.Client.UserInterface.Controls;
using System.Collections.Generic;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
using System;
using System.Collections.Generic;
namespace Content.Client.UserInterface.Cargo
{

View File

@@ -5,8 +5,6 @@ using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
using System;
using static Robust.Client.UserInterface.Controls.ItemList;
namespace Content.Client.UserInterface.Cargo
{

View File

@@ -3,8 +3,8 @@ using Content.Client.GameObjects.Components.Mobs;
using Content.Client.Interfaces;
using Content.Client.UserInterface.Stylesheets;
using Content.Client.Utility;
using Content.Shared.Jobs;
using Content.Shared.Preferences;
using Content.Shared.Roles;
using Robust.Client.GameObjects;
using Robust.Client.Graphics.Drawing;
using Robust.Client.Interfaces.ResourceManagement;

View File

@@ -1,16 +1,12 @@
using Robust.Client.Graphics.Drawing;
using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Client.Interfaces.Graphics;
using Robust.Shared.Maths;
using System;
using System;
using Robust.Client.Graphics.Drawing;
using Robust.Client.Graphics.Shaders;
using Robust.Client.UserInterface;
using Robust.Shared.IoC;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
using CannyFastMath;
using Math = CannyFastMath.Math;
using MathF = CannyFastMath.MathF;
namespace Robust.Client.UserInterface.Controls
namespace Content.Client.UserInterface
{
public class CooldownGraphic : Control
@@ -45,7 +41,7 @@ namespace Robust.Client.UserInterface.Controls
}
else
{
var alpha = MathF.Clamp(0.5f * lerp, 0f, 0.5f);
var alpha = FloatMath.Clamp(0.5f * lerp, 0f, 0.5f);
color = new Color(1f, 1f, 1f, alpha);
}

View File

@@ -1,5 +1,4 @@
using Content.Client.Sandbox;
using Robust.Client.Console;
using Robust.Client.Console;
using Robust.Client.Interfaces.Placement;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.UserInterface.Controls;
@@ -15,16 +14,12 @@ namespace Content.Client.UserInterface
internal sealed class EscapeMenu : SS14Window
{
private readonly IClientConsole _console;
private readonly ITileDefinitionManager __tileDefinitionManager;
private readonly ITileDefinitionManager _tileDefinitionManager;
private readonly IPlacementManager _placementManager;
private readonly IPrototypeManager _prototypeManager;
private readonly IResourceCache _resourceCache;
private readonly IConfigurationManager _configSystem;
private readonly ILocalizationManager _localizationManager;
#pragma warning disable 649
[Dependency] private readonly ISandboxManager _sandboxManager;
[Dependency] private readonly IClientConGroupController _conGroupController;
#pragma warning restore 649
private BaseButton DisconnectButton;
private BaseButton QuitButton;
@@ -41,7 +36,7 @@ namespace Content.Client.UserInterface
_configSystem = configSystem;
_localizationManager = localizationManager;
_console = console;
__tileDefinitionManager = tileDefinitionManager;
_tileDefinitionManager = tileDefinitionManager;
_placementManager = placementManager;
_prototypeManager = prototypeManager;
_resourceCache = resourceCache;

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