Merge branches 'pseudo-classes', 'input-refactor' and '19-08-21-update-submodule'
3
BuildChecker/.gitignore
vendored
@@ -1,2 +1,5 @@
|
||||
INSTALLED_HOOKS_VERSION
|
||||
DISABLE_SUBMODULE_AUTOUPDATE
|
||||
*.nuget*
|
||||
project.assets.json
|
||||
project.packagespec.json
|
||||
@@ -5,7 +5,10 @@ using System.Runtime.Intrinsics;
|
||||
using System.Runtime.Intrinsics.X86;
|
||||
#endif
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Random;
|
||||
using SysVector4 = System.Numerics.Vector4;
|
||||
|
||||
namespace Content.Benchmarks
|
||||
|
||||
@@ -8,6 +8,7 @@ using Robust.Shared.Maths;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Input;
|
||||
|
||||
namespace Content.Client.Chat
|
||||
{
|
||||
@@ -82,7 +83,7 @@ namespace Content.Client.Chat
|
||||
vBox.AddChild(contentMargin);
|
||||
|
||||
Input = new LineEdit();
|
||||
Input.OnKeyDown += InputKeyDown;
|
||||
Input.OnKeyBindDown += InputKeyBindDown;
|
||||
Input.OnTextEntered += Input_OnTextEntered;
|
||||
vBox.AddChild(Input);
|
||||
|
||||
@@ -119,23 +120,27 @@ namespace Content.Client.Chat
|
||||
AddChild(outerVBox);
|
||||
}
|
||||
|
||||
protected override void MouseDown(GUIMouseButtonEventArgs e)
|
||||
protected override void KeyBindDown(GUIBoundKeyEventArgs args)
|
||||
{
|
||||
base.MouseDown(e);
|
||||
base.KeyBindDown(args);
|
||||
|
||||
if (!args.CanFocus)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Input.GrabKeyboardFocus();
|
||||
}
|
||||
|
||||
private void InputKeyDown(GUIKeyEventArgs e)
|
||||
private void InputKeyBindDown(GUIBoundKeyEventArgs args)
|
||||
{
|
||||
if (e.Key == Keyboard.Key.Escape)
|
||||
if (args.Function == EngineKeyFunctions.TextReleaseFocus)
|
||||
{
|
||||
Input.ReleaseKeyboardFocus();
|
||||
e.Handle();
|
||||
args.Handle();
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.Key == Keyboard.Key.Up)
|
||||
else if (args.Function == EngineKeyFunctions.TextHistoryPrev)
|
||||
{
|
||||
if (_inputIndex == -1 && _inputHistory.Count != 0)
|
||||
{
|
||||
@@ -151,12 +156,12 @@ namespace Content.Client.Chat
|
||||
{
|
||||
Input.Text = _inputHistory[_inputIndex];
|
||||
}
|
||||
Input.CursorPos = Input.Text.Length;
|
||||
|
||||
e.Handle();
|
||||
args.Handle();
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.Key == Keyboard.Key.Down)
|
||||
else if (args.Function == EngineKeyFunctions.TextHistoryNext)
|
||||
{
|
||||
if (_inputIndex == 0)
|
||||
{
|
||||
@@ -169,8 +174,9 @@ namespace Content.Client.Chat
|
||||
_inputIndex--;
|
||||
Input.Text = _inputHistory[_inputIndex];
|
||||
}
|
||||
Input.CursorPos = Input.Text.Length;
|
||||
|
||||
e.Handle();
|
||||
args.Handle();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Client.UserInterface;
|
||||
using Content.Client.UserInterface;
|
||||
using Robust.Client.Console;
|
||||
using Robust.Client.Interfaces.Input;
|
||||
using Robust.Client.Interfaces.Placement;
|
||||
@@ -49,9 +49,8 @@ namespace Content.Client
|
||||
|
||||
_escapeMenu.OnClose += () => _gameHud.EscapeButtonDown = false;
|
||||
|
||||
var escapeMenuCommand = InputCmdHandler.FromDelegate(Enabled);
|
||||
|
||||
_inputManager.SetInputCommand(EngineKeyFunctions.EscapeMenu, escapeMenuCommand);
|
||||
_inputManager.SetInputCommand(EngineKeyFunctions.EscapeMenu,
|
||||
InputCmdHandler.FromDelegate(s => Enabled()));
|
||||
}
|
||||
else if (obj.OldState is GameScreen)
|
||||
{
|
||||
@@ -63,7 +62,7 @@ namespace Content.Client
|
||||
}
|
||||
}
|
||||
|
||||
private void Enabled(ICommonSession session)
|
||||
private void Enabled()
|
||||
{
|
||||
if (_escapeMenu.IsOpen)
|
||||
{
|
||||
|
||||
@@ -127,18 +127,18 @@ namespace Content.Client.GameObjects
|
||||
_sprite?.LayerSetVisible(slot, false);
|
||||
}
|
||||
|
||||
public void SendUnequipMessage(Slots slot)
|
||||
{
|
||||
var unequipmessage = new ClientInventoryMessage(slot, ClientInventoryUpdate.Unequip);
|
||||
SendNetworkMessage(unequipmessage);
|
||||
}
|
||||
|
||||
public void SendEquipMessage(Slots slot)
|
||||
{
|
||||
var equipmessage = new ClientInventoryMessage(slot, ClientInventoryUpdate.Equip);
|
||||
SendNetworkMessage(equipmessage);
|
||||
}
|
||||
|
||||
public void SendUseMessage(Slots slot)
|
||||
{
|
||||
var equipmessage = new ClientInventoryMessage(slot, ClientInventoryUpdate.Use);
|
||||
SendNetworkMessage(equipmessage);
|
||||
}
|
||||
|
||||
public void SendOpenStorageUIMessage(Slots slot)
|
||||
{
|
||||
SendNetworkMessage(new OpenSlotStorageUIMessage(slot));
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Content.Client.GameObjects
|
||||
base.Initialize();
|
||||
|
||||
_window = new HumanInventoryWindow(_loc, _resourceCache);
|
||||
|
||||
_window.OnClose += () => GameHud.InventoryButtonDown = false;
|
||||
foreach (var (slot, button) in _window.Buttons)
|
||||
{
|
||||
button.OnPressed = AddToInventory;
|
||||
@@ -97,7 +97,7 @@ namespace Content.Client.GameObjects
|
||||
foreach (var button in buttons)
|
||||
{
|
||||
button.SpriteView.Sprite = sprite;
|
||||
button.OnPressed = RemoveFromInventory;
|
||||
button.OnPressed = HandleInventoryKeybind;
|
||||
button.StorageButton.Visible = hasInventory;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,8 @@ namespace Content.Client.GameObjects
|
||||
AddChild(Button = new TextureButton
|
||||
{
|
||||
TextureNormal = texture,
|
||||
Scale = (2, 2)
|
||||
Scale = (2, 2),
|
||||
EnableAllKeybinds = true
|
||||
});
|
||||
|
||||
Button.OnPressed += e => OnPressed?.Invoke(e);
|
||||
@@ -44,7 +45,8 @@ namespace Content.Client.GameObjects
|
||||
Scale = (0.75f, 0.75f),
|
||||
SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
|
||||
SizeFlagsVertical = SizeFlags.ShrinkEnd,
|
||||
Visible = false
|
||||
Visible = false,
|
||||
EnableAllKeybinds = true
|
||||
});
|
||||
|
||||
StorageButton.OnPressed += e => OnStoragePressed?.Invoke(e);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System;
|
||||
using Content.Client.UserInterface;
|
||||
using Content.Shared.GameObjects.Components.Inventory;
|
||||
using Content.Shared.Input;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
@@ -60,24 +61,44 @@ namespace Content.Client.GameObjects
|
||||
{
|
||||
}
|
||||
|
||||
protected void RemoveFromInventory(BaseButton.ButtonEventArgs args)
|
||||
protected void HandleInventoryKeybind(BaseButton.ButtonEventArgs args)
|
||||
{
|
||||
args.Button.Pressed = false;
|
||||
var control = (InventoryButton) args.Button.Parent;
|
||||
|
||||
Owner.SendUnequipMessage(control.Slot);
|
||||
if (args.Event.Function == ContentKeyFunctions.ActivateItemInWorld)
|
||||
{
|
||||
OpenStorage(args);
|
||||
}
|
||||
else if (args.Event.CanFocus)
|
||||
{
|
||||
UseItemOnInventory(args);
|
||||
}
|
||||
}
|
||||
|
||||
protected void AddToInventory(BaseButton.ButtonEventArgs args)
|
||||
{
|
||||
if (!args.Event.CanFocus)
|
||||
{
|
||||
return;
|
||||
}
|
||||
args.Button.Pressed = false;
|
||||
var control = (InventoryButton) args.Button.Parent;
|
||||
|
||||
Owner.SendEquipMessage(control.Slot);
|
||||
}
|
||||
|
||||
protected void UseItemOnInventory(BaseButton.ButtonEventArgs args)
|
||||
{
|
||||
args.Button.Pressed = false;
|
||||
var control = (InventoryButton)args.Button.Parent;
|
||||
|
||||
Owner.SendUseMessage(control.Slot);
|
||||
}
|
||||
|
||||
protected void OpenStorage(BaseButton.ButtonEventArgs args)
|
||||
{
|
||||
if (!args.Event.CanFocus && args.Event.Function != ContentKeyFunctions.ActivateItemInWorld)
|
||||
{
|
||||
return;
|
||||
}
|
||||
args.Button.Pressed = false;
|
||||
var control = (InventoryButton)args.Button.Parent;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using Robust.Client.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Network;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Timers;
|
||||
@@ -16,7 +17,9 @@ namespace Content.Client.GameObjects.Components.Sound
|
||||
{
|
||||
private readonly List<ScheduledSound> _schedules = new List<ScheduledSound>();
|
||||
private AudioSystem _audioSystem;
|
||||
private Random Random;
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IRobustRandom _random;
|
||||
#pragma warning restore 649
|
||||
|
||||
public override void StopAllSounds()
|
||||
{
|
||||
@@ -46,9 +49,8 @@ namespace Content.Client.GameObjects.Components.Sound
|
||||
public void Play(ScheduledSound schedule)
|
||||
{
|
||||
if (!schedule.Play) return;
|
||||
if (Random == null) Random = new Random(Owner.Uid.GetHashCode() ^ DateTime.Now.GetHashCode());
|
||||
|
||||
Timer.Spawn((int) schedule.Delay + (Random.Next((int) schedule.RandomDelay)),() =>
|
||||
Timer.Spawn((int) schedule.Delay + (_random.Next((int) schedule.RandomDelay)),() =>
|
||||
{
|
||||
if (!schedule.Play) return; // We make sure this hasn't changed.
|
||||
if (_audioSystem == null) _audioSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AudioSystem>();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Client.GameObjects.Components.Weapons.Ranged;
|
||||
using Content.Client.GameObjects.Components.Weapons.Ranged;
|
||||
using Content.Client.Interfaces.GameObjects;
|
||||
using Content.Shared.Input;
|
||||
using Robust.Client.GameObjects.EntitySystems;
|
||||
@@ -37,7 +37,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
base.Update(frameTime);
|
||||
|
||||
var canFireSemi = _isFirstShot;
|
||||
var state = _inputSystem.CmdStates.GetState(ContentKeyFunctions.UseItemInHand);
|
||||
var state = _inputSystem.CmdStates.GetState(EngineKeyFunctions.Use);
|
||||
if (state != BoundKeyState.Down)
|
||||
{
|
||||
_isFirstShot = true;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Content.Client.Chat;
|
||||
using Content.Client.Interfaces;
|
||||
@@ -18,6 +18,7 @@ using Robust.Shared.Input;
|
||||
using Robust.Shared.Interfaces.Network;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
@@ -188,11 +189,7 @@ namespace Content.Client.GameTicking
|
||||
_lobby.ServerName.Text = _baseClient.GameInfo.ServerName;
|
||||
|
||||
_inputManager.SetInputCommand(ContentKeyFunctions.FocusChat,
|
||||
InputCmdHandler.FromDelegate(session =>
|
||||
{
|
||||
_lobby.Chat.Input.IgnoreNext = true;
|
||||
_lobby.Chat.Input.GrabKeyboardFocus();
|
||||
}));
|
||||
InputCmdHandler.FromDelegate(s => _focusChat(_lobby.Chat)));
|
||||
|
||||
_updateLobbyUi();
|
||||
|
||||
@@ -237,19 +234,25 @@ namespace Content.Client.GameTicking
|
||||
_lobby = null;
|
||||
}
|
||||
|
||||
_inputManager.SetInputCommand(ContentKeyFunctions.FocusChat,
|
||||
InputCmdHandler.FromDelegate(session =>
|
||||
{
|
||||
_gameChat.Input.IgnoreNext = true;
|
||||
_gameChat.Input.GrabKeyboardFocus();
|
||||
}));
|
||||
|
||||
_gameChat = new ChatBox();
|
||||
_userInterfaceManager.StateRoot.AddChild(_gameChat);
|
||||
_userInterfaceManager.StateRoot.AddChild(_gameHud.RootControl);
|
||||
_chatManager.SetChatBox(_gameChat);
|
||||
_gameChat.DefaultChatFormat = "say \"{0}\"";
|
||||
_gameChat.Input.PlaceHolder = _localization.GetString("Say something! [ for OOC");
|
||||
|
||||
_inputManager.SetInputCommand(ContentKeyFunctions.FocusChat,
|
||||
InputCmdHandler.FromDelegate(s => _focusChat(_gameChat)));
|
||||
}
|
||||
|
||||
private void _focusChat(ChatBox chat)
|
||||
{
|
||||
if (_userInterfaceManager.KeyboardFocused != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
chat.Input.IgnoreNext = true;
|
||||
chat.Input.GrabKeyboardFocus();
|
||||
}
|
||||
|
||||
private enum TickerState
|
||||
|
||||
@@ -21,12 +21,12 @@ namespace Content.Client.Input
|
||||
human.AddFunction(ContentKeyFunctions.Drop);
|
||||
human.AddFunction(ContentKeyFunctions.ActivateItemInHand);
|
||||
human.AddFunction(ContentKeyFunctions.OpenCharacterMenu);
|
||||
human.AddFunction(ContentKeyFunctions.UseItemInHand);
|
||||
human.AddFunction(ContentKeyFunctions.ActivateItemInWorld);
|
||||
human.AddFunction(ContentKeyFunctions.ThrowItemInHand);
|
||||
human.AddFunction(ContentKeyFunctions.OpenContextMenu);
|
||||
human.AddFunction(ContentKeyFunctions.OpenCraftingMenu);
|
||||
human.AddFunction(ContentKeyFunctions.OpenInventoryMenu);
|
||||
human.AddFunction(ContentKeyFunctions.MouseMiddle);
|
||||
// Disabled until there is feedback, so hitting tab doesn't suddenly break interaction.
|
||||
// human.AddFunction(ContentKeyFunctions.ToggleCombatMode);
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ using Robust.Client.Utility;
|
||||
using Robust.Shared.Interfaces.Log;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Noise;
|
||||
using Robust.Shared.Random;
|
||||
using SixLabors.ImageSharp.Advanced;
|
||||
using BlendFactor = Robust.Shared.Maths.Color.BlendFactor;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Timers;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Client.Research
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Content.Client.GameObjects.EntitySystems;
|
||||
using Content.Client.Interfaces.GameObjects;
|
||||
using Content.Client.Utility;
|
||||
using Content.Shared.Input;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Input;
|
||||
using Robust.Client.Interfaces.GameObjects.Components;
|
||||
@@ -9,6 +10,7 @@ using Robust.Client.Interfaces.ResourceManagement;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.Input;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
@@ -199,12 +201,17 @@ namespace Content.Client.UserInterface
|
||||
return _handL.Contains((Vector2i) point) || _handR.Contains((Vector2i) point);
|
||||
}
|
||||
|
||||
protected override void MouseDown(GUIMouseButtonEventArgs args)
|
||||
protected override void KeyBindDown(GUIBoundKeyEventArgs args)
|
||||
{
|
||||
base.MouseDown(args);
|
||||
base.KeyBindDown(args);
|
||||
|
||||
var leftHandContains = _handL.Contains((Vector2i) args.RelativePosition);
|
||||
var rightHandContains = _handR.Contains((Vector2i) args.RelativePosition);
|
||||
if (!args.CanFocus)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var leftHandContains = _handL.Contains((Vector2i)args.RelativePosition);
|
||||
var rightHandContains = _handR.Contains((Vector2i)args.RelativePosition);
|
||||
|
||||
string handIndex;
|
||||
if (leftHandContains)
|
||||
@@ -220,7 +227,7 @@ namespace Content.Client.UserInterface
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Button == Mouse.Button.Left)
|
||||
if (args.Function == EngineKeyFunctions.Use)
|
||||
{
|
||||
if (!TryGetHands(out var hands))
|
||||
return;
|
||||
@@ -236,12 +243,12 @@ namespace Content.Client.UserInterface
|
||||
}
|
||||
}
|
||||
|
||||
else if (args.Button == Mouse.Button.Middle)
|
||||
else if (args.Function == ContentKeyFunctions.MouseMiddle)
|
||||
{
|
||||
SendSwitchHandTo(handIndex);
|
||||
}
|
||||
|
||||
else if (args.Button == Mouse.Button.Right)
|
||||
else if (args.Function == ContentKeyFunctions.OpenContextMenu)
|
||||
{
|
||||
if (!TryGetHands(out var hands))
|
||||
{
|
||||
@@ -255,7 +262,7 @@ namespace Content.Client.UserInterface
|
||||
}
|
||||
|
||||
var esm = IoCManager.Resolve<IEntitySystemManager>();
|
||||
esm.GetEntitySystem<VerbSystem>().OpenContextMenu(entity, new ScreenCoordinates(args.GlobalPosition));
|
||||
esm.GetEntitySystem<VerbSystem>().OpenContextMenu(entity, new ScreenCoordinates(args.PointerLocation.Position));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using static Content.Shared.Construction.ConstructionStepMaterial;
|
||||
@@ -29,7 +30,9 @@ namespace Content.Server.GameObjects.Components.Construction
|
||||
|
||||
SpriteComponent Sprite;
|
||||
ITransformComponent Transform;
|
||||
Random random;
|
||||
#pragma warning disable 649
|
||||
[Dependency] private IRobustRandom _random;
|
||||
#pragma warning restore 649
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -38,7 +41,6 @@ namespace Content.Server.GameObjects.Components.Construction
|
||||
Sprite = Owner.GetComponent<SpriteComponent>();
|
||||
Transform = Owner.GetComponent<ITransformComponent>();
|
||||
var systemman = IoCManager.Resolve<IEntitySystemManager>();
|
||||
random = new Random();
|
||||
}
|
||||
|
||||
public bool AttackBy(AttackByEventArgs eventArgs)
|
||||
@@ -127,7 +129,7 @@ namespace Content.Server.GameObjects.Components.Construction
|
||||
case ToolType.Welder:
|
||||
if (slapped.TryGetComponent(out WelderComponent welder) && welder.TryUse(toolStep.Amount))
|
||||
{
|
||||
if (random.NextDouble() > 0.5)
|
||||
if (_random.NextDouble() > 0.5)
|
||||
sound.Play("/Audio/items/welder.ogg", Transform.GridPosition);
|
||||
else
|
||||
sound.Play("/Audio/items/welder2.ogg", Transform.GridPosition);
|
||||
@@ -144,7 +146,7 @@ namespace Content.Server.GameObjects.Components.Construction
|
||||
case ToolType.Screwdriver:
|
||||
if (slapped.HasComponent<ScrewdriverComponent>())
|
||||
{
|
||||
if (random.NextDouble() > 0.5)
|
||||
if (_random.NextDouble() > 0.5)
|
||||
sound.Play("/Audio/items/screwdriver.ogg", Transform.GridPosition);
|
||||
else
|
||||
sound.Play("/Audio/items/screwdriver2.ogg", Transform.GridPosition);
|
||||
|
||||
@@ -5,8 +5,10 @@ using Content.Server.Interfaces;
|
||||
using Content.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Damage
|
||||
@@ -59,7 +61,7 @@ namespace Content.Server.GameObjects.Components.Damage
|
||||
|
||||
public void OnExplosion(ExplosionEventArgs eventArgs)
|
||||
{
|
||||
var prob = new Random();
|
||||
var prob = IoCManager.Resolve<IRobustRandom>();
|
||||
switch (eventArgs.Severity)
|
||||
{
|
||||
case ExplosionSeverity.Destruction:
|
||||
|
||||
@@ -5,8 +5,10 @@ using Content.Server.Interfaces;
|
||||
using Content.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
@@ -74,7 +76,7 @@ namespace Content.Server.GameObjects.Components.Destructible
|
||||
|
||||
void IExAct.OnExplosion(ExplosionEventArgs eventArgs)
|
||||
{
|
||||
var prob = new Random();
|
||||
var prob = IoCManager.Resolve<IRobustRandom>();
|
||||
switch (eventArgs.Severity)
|
||||
{
|
||||
case ExplosionSeverity.Destruction:
|
||||
@@ -84,7 +86,7 @@ namespace Content.Server.GameObjects.Components.Destructible
|
||||
_actSystem.HandleDestruction(Owner, true);
|
||||
break;
|
||||
case ExplosionSeverity.Light:
|
||||
if (RandomExtensions.Prob(prob, 40))
|
||||
if (prob.Prob(40))
|
||||
_actSystem.HandleDestruction(Owner, true);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -10,10 +10,12 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.EntitySystemMessages;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.Interfaces.Timing;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Explosive
|
||||
@@ -26,6 +28,7 @@ namespace Content.Server.GameObjects.Components.Explosive
|
||||
[Dependency] private readonly IMapManager _mapManager;
|
||||
[Dependency] private readonly IServerEntityManager _serverEntityManager;
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom;
|
||||
#pragma warning restore 649
|
||||
|
||||
public override string Name => "Explosive";
|
||||
@@ -96,7 +99,7 @@ namespace Content.Server.GameObjects.Components.Explosive
|
||||
mapGrid.SetTile(tileLoc, new Tile(_tileDefinitionManager["space"].TileId));
|
||||
if (distanceFromTile < HeavyImpactRange)
|
||||
{
|
||||
if (new Random().Prob(80))
|
||||
if (_robustRandom.Prob(80))
|
||||
{
|
||||
mapGrid.SetTile(tileLoc, new Tile(_tileDefinitionManager[tileDef.SubFloor].TileId));
|
||||
}
|
||||
@@ -107,7 +110,7 @@ namespace Content.Server.GameObjects.Components.Explosive
|
||||
}
|
||||
if (distanceFromTile < LightImpactRange)
|
||||
{
|
||||
if (new Random().Prob(50))
|
||||
if (_robustRandom.Prob(50))
|
||||
{
|
||||
mapGrid.SetTile(tileLoc, new Tile(_tileDefinitionManager[tileDef.SubFloor].TileId));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.GameObjects;
|
||||
using Robust.Server.GameObjects.Components.Container;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
@@ -19,6 +20,10 @@ namespace Content.Server.GameObjects
|
||||
[RegisterComponent]
|
||||
public class InventoryComponent : SharedInventoryComponent
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
|
||||
#pragma warning restore 649
|
||||
|
||||
[ViewVariables]
|
||||
private readonly Dictionary<Slots, ContainerSlot> SlotContainers = new Dictionary<Slots, ContainerSlot>();
|
||||
|
||||
@@ -223,27 +228,41 @@ namespace Content.Server.GameObjects
|
||||
/// <param name="msg"></param>
|
||||
private void HandleInventoryMessage(ClientInventoryMessage msg)
|
||||
{
|
||||
if (msg.Updatetype == ClientInventoryUpdate.Equip)
|
||||
switch (msg.Updatetype)
|
||||
{
|
||||
var hands = Owner.GetComponent<HandsComponent>();
|
||||
var activehand = hands.GetActiveHand;
|
||||
if (activehand != null && activehand.Owner.TryGetComponent(out ClothingComponent clothing))
|
||||
case ClientInventoryUpdate.Equip:
|
||||
{
|
||||
hands.Drop(hands.ActiveIndex);
|
||||
if (!Equip(msg.Inventoryslot, clothing))
|
||||
var hands = Owner.GetComponent<HandsComponent>();
|
||||
var activeHand = hands.GetActiveHand;
|
||||
if (activeHand != null && activeHand.Owner.TryGetComponent(out ClothingComponent clothing))
|
||||
{
|
||||
hands.PutInHand(clothing);
|
||||
hands.Drop(hands.ActiveIndex);
|
||||
if (!Equip(msg.Inventoryslot, clothing))
|
||||
{
|
||||
hands.PutInHand(clothing);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (msg.Updatetype == ClientInventoryUpdate.Unequip)
|
||||
{
|
||||
var hands = Owner.GetComponent<HandsComponent>();
|
||||
var activehand = hands.GetActiveHand;
|
||||
var itemcontainedinslot = GetSlotItem(msg.Inventoryslot);
|
||||
if (activehand == null && itemcontainedinslot != null && Unequip(msg.Inventoryslot))
|
||||
case ClientInventoryUpdate.Use:
|
||||
{
|
||||
hands.PutInHand(itemcontainedinslot);
|
||||
var interactionSystem = _entitySystemManager.GetEntitySystem<InteractionSystem>();
|
||||
var hands = Owner.GetComponent<HandsComponent>();
|
||||
var activeHand = hands.GetActiveHand;
|
||||
var itemContainedInSlot = GetSlotItem(msg.Inventoryslot);
|
||||
if (itemContainedInSlot != null)
|
||||
{
|
||||
if (activeHand != null)
|
||||
{
|
||||
interactionSystem.Interaction(Owner, activeHand.Owner, itemContainedInSlot.Owner,
|
||||
new Robust.Shared.Map.GridCoordinates());
|
||||
}
|
||||
else if (Unequip(msg.Inventoryslot))
|
||||
{
|
||||
hands.PutInHand(itemContainedInSlot);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -472,11 +472,18 @@ namespace Content.Server.GameObjects
|
||||
var playerEntity = session.AttachedEntity;
|
||||
var used = GetActiveHand?.Owner;
|
||||
|
||||
if (playerEntity == Owner && used != null && slot.ContainedEntity != null)
|
||||
{
|
||||
if (playerEntity == Owner && slot.ContainedEntity != null)
|
||||
{
|
||||
var interactionSystem = _entitySystemManager.GetEntitySystem<InteractionSystem>();
|
||||
interactionSystem.Interaction(Owner, used, slot.ContainedEntity,
|
||||
GridCoordinates.Nullspace);
|
||||
if (used != null)
|
||||
{
|
||||
interactionSystem.Interaction(Owner, used, slot.ContainedEntity,
|
||||
GridCoordinates.Nullspace);
|
||||
}
|
||||
else
|
||||
{
|
||||
interactionSystem.Interaction(Owner, slot.ContainedEntity);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -161,6 +161,7 @@ namespace Content.Server.GameObjects.Components.Interactable.Tools
|
||||
message.AddText("Fuel: ");
|
||||
message.PushColor(Fuel < FuelCapacity / 4f ? Color.DarkOrange : Color.Orange);
|
||||
message.AddText($"{Math.Round(Fuel)}/{FuelCapacity}");
|
||||
message.AddText(".");
|
||||
message.Pop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,11 @@ using Content.Shared.Audio;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
@@ -19,11 +21,11 @@ namespace Content.Server.GameObjects.Components.Items
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager;
|
||||
[Dependency] private readonly IRobustRandom _random;
|
||||
#pragma warning restore 649
|
||||
|
||||
public override string Name => "Dice";
|
||||
|
||||
private Random _random;
|
||||
private int _step = 1;
|
||||
private int _sides = 20;
|
||||
private int _currentSide = 20;
|
||||
@@ -45,12 +47,6 @@ namespace Content.Server.GameObjects.Components.Items
|
||||
_currentSide = _sides;
|
||||
}
|
||||
|
||||
public override void OnAdd()
|
||||
{
|
||||
base.OnAdd();
|
||||
_random = new Random(Owner.Uid.GetHashCode() ^ DateTime.Now.GetHashCode());
|
||||
}
|
||||
|
||||
public void Roll()
|
||||
{
|
||||
_currentSide = _random.Next(1, (_sides/_step)+1) * _step;
|
||||
|
||||
@@ -2,8 +2,10 @@ using System;
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Items.Storage.Fill
|
||||
{
|
||||
@@ -19,7 +21,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage.Fill
|
||||
void IMapInit.MapInit()
|
||||
{
|
||||
var storage = Owner.GetComponent<IStorageComponent>();
|
||||
var random = new Random(DateTime.Now.GetHashCode() ^ Owner.Uid.GetHashCode());
|
||||
var random = IoCManager.Resolve<IRobustRandom>();
|
||||
|
||||
void Spawn(string prototype)
|
||||
{
|
||||
|
||||
@@ -2,8 +2,10 @@ using System;
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Items.Storage.Fill
|
||||
{
|
||||
@@ -19,7 +21,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage.Fill
|
||||
void IMapInit.MapInit()
|
||||
{
|
||||
var storage = Owner.GetComponent<IStorageComponent>();
|
||||
var random = new Random(DateTime.Now.GetHashCode() ^ Owner.Uid.GetHashCode());
|
||||
var random = IoCManager.Resolve<IRobustRandom>();
|
||||
|
||||
void Spawn(string prototype)
|
||||
{
|
||||
|
||||
@@ -7,7 +7,10 @@ using Robust.Server.GameObjects;
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.GameObjects
|
||||
@@ -20,6 +23,10 @@ namespace Content.Server.GameObjects
|
||||
public override uint? NetID => ContentNetIDs.ITEM;
|
||||
public override Type StateType => typeof(ItemComponentState);
|
||||
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IRobustRandom _robustRandom;
|
||||
#pragma warning restore 649
|
||||
|
||||
private string _equippedPrefix;
|
||||
|
||||
public string EquippedPrefix
|
||||
@@ -115,7 +122,7 @@ namespace Content.Server.GameObjects
|
||||
float RandomOffset()
|
||||
{
|
||||
var size = 15.0F;
|
||||
return (new Random().NextFloat() * size) - size / 2;
|
||||
return (_robustRandom.NextFloat() * size) - size / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ namespace Content.Server.GameObjects
|
||||
[Dependency] private readonly IMapManager _mapManager;
|
||||
[Dependency] private readonly IPlayerManager _playerManager;
|
||||
[Dependency] private readonly IEntityManager _entityManager;
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
|
||||
#pragma warning restore 649
|
||||
|
||||
private Container storage;
|
||||
|
||||
@@ -8,6 +8,7 @@ using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
@@ -24,6 +25,7 @@ namespace Content.Server.GameObjects.Components.Movement
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IMapManager _mapManager;
|
||||
[Dependency] private readonly IServerEntityManager _serverEntityManager;
|
||||
[Dependency] private readonly IRobustRandom _spreadRandom;
|
||||
#pragma warning restore 649
|
||||
// TODO: Look at MapManager.Map for Beacons to get all entities on grid
|
||||
public ItemTeleporterState State => _state;
|
||||
@@ -44,8 +46,6 @@ namespace Content.Server.GameObjects.Components.Movement
|
||||
|
||||
private AppearanceComponent _appearanceComponent;
|
||||
|
||||
private Random _spreadRandom;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
@@ -149,7 +149,6 @@ namespace Content.Server.GameObjects.Components.Movement
|
||||
public override void Initialize()
|
||||
{
|
||||
_appearanceComponent = Owner.GetComponent<AppearanceComponent>();
|
||||
_spreadRandom = new Random(Owner.Uid.GetHashCode() ^ DateTime.Now.GetHashCode());
|
||||
_state = ItemTeleporterState.Off;
|
||||
base.Initialize();
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ namespace Content.Server.GameObjects.Components.Power
|
||||
{
|
||||
if (!Powered)
|
||||
{
|
||||
message.AddText("The device is not powered");
|
||||
message.AddText("The device is not powered.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
using Content.Shared.Audio;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Sound
|
||||
@@ -17,10 +19,10 @@ namespace Content.Server.GameObjects.Components.Sound
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager;
|
||||
[Dependency] private readonly IRobustRandom _footstepRandom;
|
||||
#pragma warning restore 649
|
||||
/// <inheritdoc />
|
||||
///
|
||||
private Random _footstepRandom;
|
||||
|
||||
public override string Name => "FootstepModifier";
|
||||
|
||||
@@ -32,12 +34,6 @@ namespace Content.Server.GameObjects.Components.Sound
|
||||
serializer.DataField(ref _soundCollectionName, "footstepSoundCollection", "");
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
_footstepRandom = new Random(Owner.Uid.GetHashCode() ^ DateTime.Now.GetHashCode());
|
||||
}
|
||||
|
||||
public void PlayFootstep()
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(_soundCollectionName))
|
||||
|
||||
@@ -10,7 +10,10 @@ using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
@@ -34,8 +37,9 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
|
||||
[ViewVariables]
|
||||
private IEntity Magazine => _magazineSlot.ContainedEntity;
|
||||
|
||||
[ViewVariables]
|
||||
private Random _bulletDropRandom;
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IRobustRandom _bulletDropRandom;
|
||||
#pragma warning restore 649
|
||||
[ViewVariables]
|
||||
private string _magInSound;
|
||||
[ViewVariables]
|
||||
@@ -74,7 +78,6 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
|
||||
base.Initialize();
|
||||
|
||||
_appearance = Owner.GetComponent<AppearanceComponent>();
|
||||
_bulletDropRandom = new Random(Owner.Uid.GetHashCode() ^ DateTime.Now.GetHashCode());
|
||||
}
|
||||
|
||||
public override void Startup()
|
||||
|
||||
@@ -8,10 +8,12 @@ using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
@@ -23,7 +25,9 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
|
||||
private float _spreadStdDev = 3;
|
||||
private bool _spread = true;
|
||||
|
||||
private Random _spreadRandom;
|
||||
#pragma warning disable 649
|
||||
[Dependency] private IRobustRandom _spreadRandom;
|
||||
#pragma warning restore 649
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool Spread
|
||||
@@ -45,8 +49,6 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
|
||||
|
||||
var rangedWeapon = Owner.GetComponent<RangedWeaponComponent>();
|
||||
rangedWeapon.FireHandler = Fire;
|
||||
|
||||
_spreadRandom = new Random(Owner.Uid.GetHashCode() ^ DateTime.Now.GetHashCode());
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
|
||||
@@ -62,20 +62,19 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
|
||||
message.PushColor(Color.DarkGray);
|
||||
|
||||
var subMessage = new FormattedMessage();
|
||||
//Add component statuses from components that report one
|
||||
foreach (var examineComponents in entity.GetAllComponents<IExamine>())
|
||||
{
|
||||
var subMessage = new FormattedMessage();
|
||||
examineComponents.Examine(subMessage);
|
||||
if (subMessage.Tags.Count == 0)
|
||||
continue;
|
||||
|
||||
if (doNewline)
|
||||
{
|
||||
message.AddText("\n");
|
||||
doNewline = false;
|
||||
}
|
||||
|
||||
message.AddMessage(subMessage);
|
||||
doNewline = true;
|
||||
}
|
||||
|
||||
message.Pop();
|
||||
|
||||
@@ -200,7 +200,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
public override void Initialize()
|
||||
{
|
||||
var inputSys = EntitySystemManager.GetEntitySystem<InputSystem>();
|
||||
inputSys.BindMap.BindFunction(ContentKeyFunctions.UseItemInHand,
|
||||
inputSys.BindMap.BindFunction(EngineKeyFunctions.Use,
|
||||
new PointerInputCmdHandler(HandleUseItemInHand));
|
||||
inputSys.BindMap.BindFunction(ContentKeyFunctions.ActivateItemInWorld,
|
||||
new PointerInputCmdHandler(HandleActivateItemInWorld));
|
||||
|
||||
@@ -23,7 +23,9 @@ using Robust.Shared.Players;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Content.Server.GameObjects.Components.Sound;
|
||||
using Content.Shared.GameObjects.Components.Inventory;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.GameObjects.EntitySystems
|
||||
{
|
||||
@@ -35,10 +37,10 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager;
|
||||
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager;
|
||||
[Dependency] private readonly IMapManager _mapManager;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom;
|
||||
#pragma warning restore 649
|
||||
|
||||
private AudioSystem _audioSystem;
|
||||
private Random _footstepRandom;
|
||||
|
||||
private const float StepSoundMoveDistanceRunning = 2;
|
||||
private const float StepSoundMoveDistanceWalking = 1.5f;
|
||||
@@ -47,7 +49,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
public override void Initialize()
|
||||
{
|
||||
EntityQuery = new TypeEntityQuery(typeof(IMoverComponent));
|
||||
|
||||
|
||||
var moveUpCmdHandler = InputCmdHandler.FromDelegate(
|
||||
session => HandleDirChange(session, Direction.North, true),
|
||||
session => HandleDirChange(session, Direction.North, false));
|
||||
@@ -75,7 +77,6 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
SubscribeEvent<PlayerAttachSystemMessage>(PlayerAttached);
|
||||
SubscribeEvent<PlayerDetachedSystemMessage>(PlayerDetached);
|
||||
|
||||
_footstepRandom = new Random();
|
||||
_audioSystem = EntitySystemManager.GetEntitySystem<AudioSystem>();
|
||||
}
|
||||
|
||||
@@ -153,7 +154,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
{
|
||||
mover.StepSoundDistance = 0;
|
||||
if (mover.Owner.TryGetComponent<InventoryComponent>(out var inventory)
|
||||
&& inventory.TryGetSlotItem<ItemComponent>(EquipmentSlotDefines.Slots.SHOES, out var item)
|
||||
&& inventory.TryGetSlotItem<ItemComponent>(EquipmentSlotDefines.Slots.SHOES, out var item)
|
||||
&& item.Owner.TryGetComponent<FootstepModifierComponent>(out var modifier))
|
||||
{
|
||||
modifier.PlayFootstep();
|
||||
@@ -186,7 +187,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
where T: Component
|
||||
{
|
||||
component = default;
|
||||
|
||||
|
||||
var ent = session.AttachedEntity;
|
||||
|
||||
if (ent == null || !ent.IsValid())
|
||||
@@ -238,7 +239,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
try
|
||||
{
|
||||
var soundCollection = _prototypeManager.Index<SoundCollectionPrototype>(soundCollectionName);
|
||||
var file = _footstepRandom.Pick(soundCollection.PickFiles);
|
||||
var file = _robustRandom.Pick(soundCollection.PickFiles);
|
||||
_audioSystem.Play(file, coordinates);
|
||||
}
|
||||
catch (UnknownPrototypeException)
|
||||
|
||||
@@ -21,12 +21,14 @@ using Robust.Shared.Interfaces.Configuration;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.Interfaces.Network;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.Interfaces.Timing;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Timers;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -76,8 +78,6 @@ namespace Content.Server.GameTicking
|
||||
[ViewVariables] private bool _roundStartCountdownHasNotStartedYetDueToNoPlayers;
|
||||
private DateTime _roundStartTimeUtc;
|
||||
|
||||
private readonly Random _spawnRandom = new Random();
|
||||
|
||||
[ViewVariables] private readonly List<GameRule> _gameRules = new List<GameRule>();
|
||||
|
||||
[ViewVariables] private Type _presetType;
|
||||
@@ -92,6 +92,7 @@ namespace Content.Server.GameTicking
|
||||
[Dependency] private IChatManager _chatManager;
|
||||
[Dependency] private IServerNetManager _netManager;
|
||||
[Dependency] private IDynamicTypeFactory _dynamicTypeFactory;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom;
|
||||
#pragma warning restore 649
|
||||
|
||||
public void Initialize()
|
||||
@@ -293,7 +294,7 @@ namespace Content.Server.GameTicking
|
||||
|
||||
if (possiblePoints.Count != 0)
|
||||
{
|
||||
location = _spawnRandom.Pick(possiblePoints);
|
||||
location = _robustRandom.Pick(possiblePoints);
|
||||
}
|
||||
|
||||
return location;
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace Content.Shared.GameObjects
|
||||
public enum ClientInventoryUpdate
|
||||
{
|
||||
Equip = 0,
|
||||
Unequip = 1
|
||||
Use = 1
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,6 @@ namespace Content.Shared.Input
|
||||
public static readonly BoundKeyFunction SwapHands = "SwapHands";
|
||||
public static readonly BoundKeyFunction ThrowItemInHand = "ThrowItemInHand";
|
||||
public static readonly BoundKeyFunction ToggleCombatMode = "ToggleCombatMode";
|
||||
public static readonly BoundKeyFunction UseItemInHand = "UseItemInHand"; // use hand item on world entity
|
||||
public static readonly BoundKeyFunction MouseMiddle = "MouseMiddle";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,5 +24,3 @@
|
||||
sprite: Clothing/belt_utility.rsi
|
||||
- type: Storage
|
||||
Capacity: 30
|
||||
|
||||
|
||||
|
||||
@@ -53,19 +53,4 @@
|
||||
state: leather
|
||||
- type: Clothing
|
||||
sprite: Clothing/gloves_leather.rsi
|
||||
HeatResistance: 1500
|
||||
|
||||
- type: entity
|
||||
parent: GlovesBase
|
||||
id: WhiteGloves
|
||||
name: White Gloves
|
||||
description: These look pretty fancy.
|
||||
components:
|
||||
- type: Sprite
|
||||
sprite: Clothing/gloves_white.rsi
|
||||
state: white
|
||||
- type: Icon
|
||||
sprite: Clothing/gloves_white.rsi
|
||||
state: white
|
||||
- type: Clothing
|
||||
sprite: Clothing/gloves_white.rsi
|
||||
HeatResistance: 1500
|
||||
@@ -40,37 +40,3 @@
|
||||
sprite: Clothing/captain_hat.rsi
|
||||
Slots:
|
||||
- helmet
|
||||
|
||||
- type: entity
|
||||
parent: HatBase
|
||||
id: HatHOP
|
||||
name: Head of Personnel's Hat
|
||||
description: Papers, please.
|
||||
components:
|
||||
- type: Sprite
|
||||
sprite: Clothing/hop_hat.rsi
|
||||
state: hop
|
||||
- type: Icon
|
||||
sprite: Clothing/hop_hat.rsi
|
||||
state: hop
|
||||
- type: Clothing
|
||||
sprite: Clothing/hop_hat.rsi
|
||||
Slots:
|
||||
- helmet
|
||||
|
||||
- type: entity
|
||||
parent: HatBase
|
||||
id: HatBeret
|
||||
name: Beret
|
||||
description: A beret, an artists favorite headwear.
|
||||
components:
|
||||
- type: Sprite
|
||||
sprite: Clothing/beret.rsi
|
||||
state: beret
|
||||
- type: Icon
|
||||
sprite: Clothing/beret.rsi
|
||||
state: beret
|
||||
- type: Clothing
|
||||
sprite: Clothing/beret.rsi
|
||||
Slots:
|
||||
- helmet
|
||||
|
||||
@@ -47,19 +47,4 @@
|
||||
sprite: Clothing/mask_clown.rsi
|
||||
state: icon
|
||||
- type: Clothing
|
||||
sprite: Clothing/mask_clown.rsi
|
||||
|
||||
- type: entity
|
||||
parent: MasksBase
|
||||
id: MaskMime
|
||||
name: Mime Mask
|
||||
description: The traditional mime's mask. It has an eerie facial posture.
|
||||
components:
|
||||
- type: Sprite
|
||||
sprite: Clothing/mask_mime.rsi
|
||||
state: mime
|
||||
- type: Icon
|
||||
sprite: Clothing/mask_mime.rsi
|
||||
state: mime
|
||||
- type: Clothing
|
||||
sprite: Clothing/mask_mime.rsi
|
||||
sprite: Clothing/mask_clown.rsi
|
||||
@@ -100,21 +100,4 @@
|
||||
state: brown
|
||||
|
||||
- type: Clothing
|
||||
sprite: Clothing/shoes_brown.rsi
|
||||
|
||||
- type: entity
|
||||
parent: ShoesBase
|
||||
id: ShoesMime
|
||||
name: Mime Shoes
|
||||
description: Comfortable-looking shoes.
|
||||
components:
|
||||
- type: Sprite
|
||||
sprite: Clothing/shoes_mime.rsi
|
||||
state: mime
|
||||
|
||||
- type: Icon
|
||||
sprite: Clothing/shoes_mime.rsi
|
||||
state: mime
|
||||
|
||||
- type: Clothing
|
||||
sprite: Clothing/shoes_mime.rsi
|
||||
sprite: Clothing/shoes_brown.rsi
|
||||
@@ -58,18 +58,3 @@
|
||||
|
||||
- type: Clothing
|
||||
sprite: Clothing/chef_apron.rsi
|
||||
|
||||
- type: entity
|
||||
parent: SuitBase
|
||||
id: BeltSuspenders
|
||||
name: Suspenders
|
||||
description: They suspend the illusion of the mime's play.
|
||||
components:
|
||||
- type: Sprite
|
||||
sprite: Clothing/suspenders.rsi
|
||||
state: suspenders
|
||||
- type: Icon
|
||||
sprite: Clothing/suspenders.rsi
|
||||
state: suspenders
|
||||
- type: Clothing
|
||||
sprite: Clothing/suspenders.rsi
|
||||
@@ -141,38 +141,4 @@
|
||||
state: captain
|
||||
|
||||
- type: Clothing
|
||||
sprite: Clothing/captain_uniform.rsi
|
||||
|
||||
- type: entity
|
||||
parent: UniformBase
|
||||
id: UniformHOP
|
||||
name: Head of Personnel's Jumpsuit
|
||||
description: It's a jumpsuit worn by someone who works in the position of "Head of Personnel".
|
||||
components:
|
||||
- type: Sprite
|
||||
sprite: Clothing/hop_jumpsuit.rsi
|
||||
state: hop
|
||||
|
||||
- type: Icon
|
||||
sprite: Clothing/hop_jumpsuit.rsi
|
||||
state: hop
|
||||
|
||||
- type: Clothing
|
||||
sprite: Clothing/hop_jumpsuit.rsi
|
||||
|
||||
- type: entity
|
||||
parent: UniformBase
|
||||
id: UniformMime
|
||||
name: Mime's Outfit
|
||||
description: It's not very colourful.
|
||||
components:
|
||||
- type: Sprite
|
||||
sprite: Clothing/mime_outfit.rsi
|
||||
state: mime
|
||||
|
||||
- type: Icon
|
||||
sprite: Clothing/mime_outfit.rsi
|
||||
state: mime
|
||||
|
||||
- type: Clothing
|
||||
sprite: Clothing/mime_outfit.rsi
|
||||
sprite: Clothing/captain_uniform.rsi
|
||||
|
||||
|
Before Width: | Height: | Size: 448 B |
|
Before Width: | Height: | Size: 270 B |
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"version": 1,
|
||||
"size": {
|
||||
"x": 32,
|
||||
"y": 32
|
||||
},
|
||||
"license": "CC-BY-SA-3.0",
|
||||
"copyright": "Taken from https://github.com/vgstation-coders/vgstation13/tree/Bleeding-Edge/icons",
|
||||
"states": [
|
||||
{
|
||||
"name": "equipped-HELMET",
|
||||
"directions": 4,
|
||||
"delays": [
|
||||
[ 1.0 ],
|
||||
[ 1.0 ],
|
||||
[ 1.0 ],
|
||||
[ 1.0 ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "beret",
|
||||
"directions": 1,
|
||||
"delays": [ [ 1.0 ] ]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Before Width: | Height: | Size: 216 B |
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"version": 1,
|
||||
"size": {
|
||||
"x": 32,
|
||||
"y": 32
|
||||
},
|
||||
"license": "CC-BY-SA-3.0",
|
||||
"copyright": "Taken from https://github.com/discordia-space/CEV-Eris at commit 9a3a3a180344460263e8df7ea2565128e07b86b5",
|
||||
"states": [
|
||||
{
|
||||
"name": "white",
|
||||
"directions": 1,
|
||||
"delays": [ [ 1.0 ] ]
|
||||
},
|
||||
{
|
||||
"name": "equipped-HAND",
|
||||
"directions": 4,
|
||||
"delays": [
|
||||
[ 1.0 ],
|
||||
[ 1.0 ],
|
||||
[ 1.0 ],
|
||||
[ 1.0 ]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Before Width: | Height: | Size: 462 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 452 B |
|
Before Width: | Height: | Size: 352 B |
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"version": 1,
|
||||
"size": {
|
||||
"x": 32,
|
||||
"y": 32
|
||||
},
|
||||
"license": "CC-BY-SA-3.0",
|
||||
"copyright": "Taken from https://github.com/vgstation-coders/vgstation13/tree/Bleeding-Edge/icons",
|
||||
"states": [
|
||||
{
|
||||
"name": "equipped-HELMET",
|
||||
"directions": 4,
|
||||
"delays": [
|
||||
[ 1.0 ],
|
||||
[ 1.0 ],
|
||||
[ 1.0 ],
|
||||
[ 1.0 ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "hop",
|
||||
"directions": 1,
|
||||
"delays": [ [ 1.0 ] ]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,78 +1,86 @@
|
||||
version: 1 # Not used right now, whatever.
|
||||
binds:
|
||||
- function: Use
|
||||
type: state
|
||||
key: MouseLeft
|
||||
canFocus: true
|
||||
- function: ShowDebugMonitors
|
||||
type: Toggle
|
||||
key: F3
|
||||
type: Toggle
|
||||
- function: HideUI
|
||||
key: F4
|
||||
type: Toggle
|
||||
key: F4
|
||||
- function: MoveUp
|
||||
type: State
|
||||
key: W
|
||||
type: State
|
||||
- function: MoveLeft
|
||||
type: State
|
||||
key: A
|
||||
type: State
|
||||
- function: MoveRight
|
||||
type: State
|
||||
key: D
|
||||
type: State
|
||||
- function: MoveDown
|
||||
type: State
|
||||
key: S
|
||||
type: State
|
||||
- function: Run
|
||||
type: State
|
||||
key: Shift
|
||||
type: State
|
||||
- function: ShowEscapeMenu
|
||||
type: State
|
||||
key: Escape
|
||||
type: State
|
||||
- function: FocusChatWindow
|
||||
type: State
|
||||
key: T
|
||||
type: State
|
||||
- function: EditorLinePlace
|
||||
key: MouseLeft
|
||||
mod1: Shift
|
||||
type: State
|
||||
key: MouseLeft
|
||||
canFocus: true
|
||||
mod1: Shift
|
||||
- function: EditorGridPlace
|
||||
key: MouseLeft
|
||||
mod1: Control
|
||||
type: State
|
||||
key: MouseLeft
|
||||
canFocus: true
|
||||
mod1: Control
|
||||
- function: EditorPlaceObject
|
||||
key: MouseLeft
|
||||
type: State
|
||||
key: MouseLeft
|
||||
canFocus: true
|
||||
- function: EditorCancelPlace
|
||||
key: MouseRight
|
||||
type: State
|
||||
key: MouseRight
|
||||
canFocus: true
|
||||
- function: EditorRotateObject
|
||||
type: State
|
||||
key: MouseMiddle
|
||||
type: State
|
||||
- function: SwapHands
|
||||
type: State
|
||||
key: X
|
||||
type: State
|
||||
- function: Drop
|
||||
type: State
|
||||
key: Q
|
||||
type: State
|
||||
- function: ActivateItemInHand
|
||||
type: State
|
||||
key: Z
|
||||
type: State
|
||||
- function: OpenCharacterMenu
|
||||
type: State
|
||||
key: C
|
||||
type: State
|
||||
- function: ExamineEntity
|
||||
key: MouseLeft
|
||||
mod1: Shift
|
||||
type: State
|
||||
- function: UseItemInHand
|
||||
key: MouseLeft
|
||||
type: state
|
||||
canFocus: true
|
||||
mod1: Shift
|
||||
- function: ActivateItemInWorld
|
||||
type: state
|
||||
key: E
|
||||
type: state
|
||||
- function: ThrowItemInHand
|
||||
type: state
|
||||
key: MouseLeft
|
||||
canFocus: true
|
||||
mod1: Control
|
||||
type: state
|
||||
- function: OpenContextMenu
|
||||
key: MouseRight
|
||||
type: state
|
||||
key: MouseRight
|
||||
canFocus: true
|
||||
- function: ToggleCombatMode
|
||||
type: Toggle
|
||||
key: Tab
|
||||
@@ -85,3 +93,41 @@ binds:
|
||||
- function: OpenInventoryMenu
|
||||
type: state
|
||||
key: I
|
||||
- function: ShowDebugConsole
|
||||
type: state
|
||||
key: Tilde
|
||||
- function: MouseMiddle
|
||||
type: state
|
||||
key: MouseMiddle
|
||||
canFocus: true
|
||||
- function: TextCursorLeft
|
||||
type: state
|
||||
key: Left
|
||||
- function: TextCursorRight
|
||||
type: state
|
||||
key: Right
|
||||
- function: TextBackspace
|
||||
type: state
|
||||
key: BackSpace
|
||||
- function: TextSubmit
|
||||
type: state
|
||||
key: Return
|
||||
- function: TextSubmit
|
||||
type: state
|
||||
key: NumpadEnter
|
||||
- function: TextPaste
|
||||
type: state
|
||||
key: V
|
||||
mod1: Control
|
||||
- function: TextHistoryPrev
|
||||
type: state
|
||||
key: Up
|
||||
- function: TextHistoryNext
|
||||
type: state
|
||||
key: Down
|
||||
- function: TextReleaseFocus
|
||||
type: state
|
||||
key: Escape
|
||||
- function: TextScrollToBottom
|
||||
type: state
|
||||
key: PageDown
|
||||