From d3053c3c8c93b65149e87d67562ac467641e5977 Mon Sep 17 00:00:00 2001 From: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Date: Sat, 27 Jul 2019 00:32:59 -0700 Subject: [PATCH 01/22] Fixed HandsGui children so that HandsGui is clickable --- Content.Client/UserInterface/HandsGui.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Content.Client/UserInterface/HandsGui.cs b/Content.Client/UserInterface/HandsGui.cs index 7d54b88c55..7a3dfbbf56 100644 --- a/Content.Client/UserInterface/HandsGui.cs +++ b/Content.Client/UserInterface/HandsGui.cs @@ -60,6 +60,7 @@ namespace Content.Client.UserInterface AddChild(new TextureRect { + MouseFilter = MouseFilterMode.Ignore, Texture = TextureHandLeft, Size = _handL.Size, Position = _handL.TopLeft, @@ -68,6 +69,7 @@ namespace Content.Client.UserInterface AddChild(new TextureRect { + MouseFilter = MouseFilterMode.Ignore, Texture = TextureHandRight, Size = _handR.Size, Position = _handR.TopLeft, @@ -76,6 +78,7 @@ namespace Content.Client.UserInterface AddChild(ActiveHandRect = new TextureRect { + MouseFilter = MouseFilterMode.Ignore, Texture = TextureHandActive, Size = _handL.Size, Position = _handL.TopLeft, From e5d9634cfe7707301ab5f1a10a9a893d70d5eb4e Mon Sep 17 00:00:00 2001 From: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Date: Sat, 27 Jul 2019 03:32:25 -0700 Subject: [PATCH 02/22] Added TextureButton for opening Storage items --- .../HumanInventoryInterfaceController.cs | 8 +++++--- .../Components/HUD/Inventory/InventoryButton.cs | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Content.Client/GameObjects/Components/HUD/Inventory/HumanInventoryInterfaceController.cs b/Content.Client/GameObjects/Components/HUD/Inventory/HumanInventoryInterfaceController.cs index d03851c073..bf0e268ee5 100644 --- a/Content.Client/GameObjects/Components/HUD/Inventory/HumanInventoryInterfaceController.cs +++ b/Content.Client/GameObjects/Components/HUD/Inventory/HumanInventoryInterfaceController.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using Content.Client.Utility; using JetBrains.Annotations; using Robust.Client.Interfaces.GameObjects.Components; @@ -52,7 +52,8 @@ namespace Content.Client.GameObjects void AddButton(out InventoryButton variable, Slots slot, string textureName) { var texture = _resourceCache.GetTexture($"/Textures/UserInterface/Inventory/{textureName}.png"); - variable = new InventoryButton(slot, texture) + var storageTexture = _resourceCache.GetTexture($"/Textures/UserInterface/Inventory/back.png"); + variable = new InventoryButton(slot, texture, storageTexture) { OnPressed = AddToInventory }; @@ -152,7 +153,8 @@ namespace Content.Client.GameObjects void AddButton(Slots slot, string textureName, Vector2 position) { var texture = resourceCache.GetTexture($"/Textures/UserInterface/Inventory/{textureName}.png"); - var button = new InventoryButton(slot, texture) + var storageTexture = resourceCache.GetTexture($"/Textures/UserInterface/Inventory/back.png"); + var button = new InventoryButton(slot, texture, storageTexture) { Position = position }; diff --git a/Content.Client/GameObjects/Components/HUD/Inventory/InventoryButton.cs b/Content.Client/GameObjects/Components/HUD/Inventory/InventoryButton.cs index ecee121d0b..7a4b8eae10 100644 --- a/Content.Client/GameObjects/Components/HUD/Inventory/InventoryButton.cs +++ b/Content.Client/GameObjects/Components/HUD/Inventory/InventoryButton.cs @@ -1,4 +1,4 @@ -using System; +using System; using Content.Shared.GameObjects.Components.Inventory; using Robust.Client.Graphics; using Robust.Client.UserInterface.Controls; @@ -16,7 +16,7 @@ namespace Content.Client.GameObjects public Action OnPressed { get; set; } - public InventoryButton(EquipmentSlotDefines.Slots slot, Texture texture) + public InventoryButton(EquipmentSlotDefines.Slots slot, Texture texture, Texture storageTexture) { Slot = slot; @@ -25,7 +25,7 @@ namespace Content.Client.GameObjects AddChild(Button = new TextureButton { TextureNormal = texture, - Scale = (2, 2), + Scale = (2, 2) }); Button.OnPressed += e => OnPressed?.Invoke(e); @@ -35,6 +35,15 @@ namespace Content.Client.GameObjects MouseFilter = MouseFilterMode.Ignore, Scale = (2, 2) }); + + AddChild(Button = new TextureButton + { + TextureNormal = storageTexture, + Scale = (0.75f, 0.75f), + SizeFlagsHorizontal = SizeFlags.ShrinkEnd, + SizeFlagsVertical = SizeFlags.ShrinkEnd, + Visible = false + }); } } } From bb20243b05cc6f506fc5bdd1b2cc2b6140f36d43 Mon Sep 17 00:00:00 2001 From: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Date: Sun, 28 Jul 2019 17:24:15 -0700 Subject: [PATCH 03/22] Update ClientInventoryComponent.cs Fixed HandleComponentState so that it only updates the inventory when there are changes. --- .../HUD/Inventory/ClientInventoryComponent.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs b/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs index 0d672b28d2..da5613447f 100644 --- a/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs +++ b/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs @@ -1,7 +1,10 @@ -using System.Collections.Generic; +using System; +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.GameObjects.Components.Storage; using Robust.Client.GameObjects; using Robust.Client.Interfaces.GameObjects.Components; using Robust.Shared.GameObjects; @@ -76,15 +79,12 @@ namespace Content.Client.GameObjects foreach (var (slot, entityUid) in cast.Entities) { - if (_slots.ContainsKey(slot)) - { - _slots.Remove(slot); - _clearSlot(slot); - } - var entity = Owner.EntityManager.GetEntity(entityUid); - _slots[slot] = entity; - _setSlot(slot, entity); + if (!_slots.ContainsKey(slot) || _slots[slot] != entity) + { + _slots[slot] = entity; + _setSlot(slot, entity); + } doneSlots.Add(slot); } From d9628d39eb4efa210534d44dba6cd830c5fd8bc9 Mon Sep 17 00:00:00 2001 From: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Date: Mon, 29 Jul 2019 13:32:04 -0700 Subject: [PATCH 04/22] Implemented storage button on Inventory Adds a small button on the bottom right of Storage items when inside the inventory. When the button is pressed it opens the Storage UI. --- .../HUD/Inventory/ClientInventoryComponent.cs | 5 +++++ .../HumanInventoryInterfaceController.cs | 7 ++++++- .../Components/HUD/Inventory/InventoryButton.cs | 6 +++++- .../Inventory/InventoryInterfaceController.cs | 8 ++++++++ .../Components/GUI/InventoryComponent.cs | 6 ++++++ .../Items/Storage/ServerStorageComponent.cs | 16 +++++++++++----- .../Inventory/SharedInventoryComponent.cs | 15 +++++++++++++++ 7 files changed, 56 insertions(+), 7 deletions(-) diff --git a/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs b/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs index da5613447f..58456557f9 100644 --- a/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs +++ b/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs @@ -138,6 +138,11 @@ namespace Content.Client.GameObjects SendNetworkMessage(equipmessage); } + public void SendOpenStorageUIMessage(Slots slot) + { + SendNetworkMessage(new OpenSlotStorageUIMessage(slot)); + } + public override void HandleMessage(ComponentMessage message, INetChannel netChannel = null, IComponent component = null) { diff --git a/Content.Client/GameObjects/Components/HUD/Inventory/HumanInventoryInterfaceController.cs b/Content.Client/GameObjects/Components/HUD/Inventory/HumanInventoryInterfaceController.cs index bf0e268ee5..9b23c3ef8d 100644 --- a/Content.Client/GameObjects/Components/HUD/Inventory/HumanInventoryInterfaceController.cs +++ b/Content.Client/GameObjects/Components/HUD/Inventory/HumanInventoryInterfaceController.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using Content.Client.GameObjects.Components.Storage; using Content.Client.Utility; using JetBrains.Annotations; using Robust.Client.Interfaces.GameObjects.Components; @@ -55,7 +56,8 @@ namespace Content.Client.GameObjects var storageTexture = _resourceCache.GetTexture($"/Textures/UserInterface/Inventory/back.png"); variable = new InventoryButton(slot, texture, storageTexture) { - OnPressed = AddToInventory + OnPressed = AddToInventory, + OnStoragePressed = OpenStorage }; _inventoryButtons[slot].Add(variable); } @@ -90,11 +92,13 @@ namespace Content.Client.GameObjects } entity.TryGetComponent(out ISpriteComponent sprite); + var hasInventory = entity.HasComponent(); foreach (var button in buttons) { button.SpriteView.Sprite = sprite; button.OnPressed = RemoveFromInventory; + button.StorageButton.Visible = hasInventory; } } @@ -111,6 +115,7 @@ namespace Content.Client.GameObjects { button.SpriteView.Sprite = null; button.OnPressed = AddToInventory; + button.StorageButton.Visible = false; } } diff --git a/Content.Client/GameObjects/Components/HUD/Inventory/InventoryButton.cs b/Content.Client/GameObjects/Components/HUD/Inventory/InventoryButton.cs index 7a4b8eae10..1bc30aae84 100644 --- a/Content.Client/GameObjects/Components/HUD/Inventory/InventoryButton.cs +++ b/Content.Client/GameObjects/Components/HUD/Inventory/InventoryButton.cs @@ -13,8 +13,10 @@ namespace Content.Client.GameObjects public BaseButton Button { get; } public SpriteView SpriteView { get; } + public BaseButton StorageButton { get; } public Action OnPressed { get; set; } + public Action OnStoragePressed { get; set; } public InventoryButton(EquipmentSlotDefines.Slots slot, Texture texture, Texture storageTexture) { @@ -36,7 +38,7 @@ namespace Content.Client.GameObjects Scale = (2, 2) }); - AddChild(Button = new TextureButton + AddChild(StorageButton = new TextureButton { TextureNormal = storageTexture, Scale = (0.75f, 0.75f), @@ -44,6 +46,8 @@ namespace Content.Client.GameObjects SizeFlagsVertical = SizeFlags.ShrinkEnd, Visible = false }); + + StorageButton.OnPressed += e => OnStoragePressed?.Invoke(e); } } } diff --git a/Content.Client/GameObjects/Components/HUD/Inventory/InventoryInterfaceController.cs b/Content.Client/GameObjects/Components/HUD/Inventory/InventoryInterfaceController.cs index 9a6187e01c..d085df42de 100644 --- a/Content.Client/GameObjects/Components/HUD/Inventory/InventoryInterfaceController.cs +++ b/Content.Client/GameObjects/Components/HUD/Inventory/InventoryInterfaceController.cs @@ -75,5 +75,13 @@ namespace Content.Client.GameObjects Owner.SendEquipMessage(control.Slot); } + + protected void OpenStorage(BaseButton.ButtonEventArgs args) + { + args.Button.Pressed = false; + var control = (InventoryButton)args.Button.Parent; + + Owner.SendOpenStorageUIMessage(control.Slot); + } } } diff --git a/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs b/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs index 69c14bcb5d..baf092315f 100644 --- a/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs +++ b/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs @@ -262,6 +262,12 @@ namespace Content.Server.GameObjects if (playerentity == Owner) HandleInventoryMessage(msg); break; + case OpenSlotStorageUIMessage msg: + ItemComponent item = GetSlotItem(msg.Slot); + ServerStorageComponent storage; + if (item.Owner.TryGetComponent(out storage)) + storage.OpenStorageUI(Owner); + break; } } diff --git a/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs index f9a4b57b2c..49b3ec9550 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs @@ -33,6 +33,7 @@ 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; @@ -173,12 +174,18 @@ namespace Content.Server.GameObjects bool IUse.UseEntity(UseEntityEventArgs eventArgs) { _ensureInitialCalculated(); - var user_session = eventArgs.User.GetComponent().playerSession; + OpenStorageUI(eventArgs.User); + return false; + } + + public void OpenStorageUI(IEntity Character) + { + _ensureInitialCalculated(); + var user_session = Character.GetComponent().playerSession; Logger.DebugS("Storage", "Storage (UID {0}) \"used\" by player session (UID {1}).", Owner.Uid, user_session.AttachedEntityUid); SubscribeSession(user_session); SendNetworkMessage(new OpenStorageUIMessage(), user_session.ConnectedClient); UpdateClientInventory(user_session); - return false; } /// @@ -300,16 +307,15 @@ namespace Content.Server.GameObjects entity.GetComponent().WorldPosition = ourtransform.WorldPosition; } } - } break; - + } case CloseStorageUIMessage _: { var session = _playerManager.GetSessionByChannel(netChannel); UnsubscribeSession(session); - } break; + } } } diff --git a/Content.Shared/GameObjects/Components/Inventory/SharedInventoryComponent.cs b/Content.Shared/GameObjects/Components/Inventory/SharedInventoryComponent.cs index ac97f9a54d..6464f2fbe8 100644 --- a/Content.Shared/GameObjects/Components/Inventory/SharedInventoryComponent.cs +++ b/Content.Shared/GameObjects/Components/Inventory/SharedInventoryComponent.cs @@ -78,5 +78,20 @@ namespace Content.Shared.GameObjects Unequip = 1 } } + + /// + /// Component message for opening the Storage UI of item in Slot + /// + [Serializable, NetSerializable] + public class OpenSlotStorageUIMessage : ComponentMessage + { + public Slots Slot; + + public OpenSlotStorageUIMessage(Slots slot) + { + Directed = true; + Slot = slot; + } + } } } From b996466b3dabc5a810888c9784c965043c24cc5c Mon Sep 17 00:00:00 2001 From: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Date: Sat, 3 Aug 2019 19:08:22 -0700 Subject: [PATCH 05/22] Update RobustToolbox --- RobustToolbox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RobustToolbox b/RobustToolbox index be0c520455..3f7cd1f1b2 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit be0c520455e97a6b16a08dbd995d3e55bd0c57fd +Subproject commit 3f7cd1f1b2da2b2e4b0e046632030c8011f85912 From 7422d9148ad110b73b748edcf0b5bf9e8d327c76 Mon Sep 17 00:00:00 2001 From: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Date: Sun, 4 Aug 2019 16:03:51 -0700 Subject: [PATCH 06/22] Refactored input system --- Content.Client/Chat/ChatBox.cs | 9 ++- .../EntitySystems/RangedWeaponSystem.cs | 4 +- Content.Client/Input/ContentContexts.cs | 2 +- Content.Client/UserInterface/HandsGui.cs | 23 ++++--- .../EntitySystems/Click/InteractionSystem.cs | 2 +- Content.Shared/Input/ContentKeyFunctions.cs | 2 +- Resources/keybinds.yml | 69 +++++++++++-------- RobustToolbox | 2 +- 8 files changed, 70 insertions(+), 43 deletions(-) diff --git a/Content.Client/Chat/ChatBox.cs b/Content.Client/Chat/ChatBox.cs index fc86a3c3fb..74717204fe 100644 --- a/Content.Client/Chat/ChatBox.cs +++ b/Content.Client/Chat/ChatBox.cs @@ -121,9 +121,14 @@ 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(); } diff --git a/Content.Client/GameObjects/EntitySystems/RangedWeaponSystem.cs b/Content.Client/GameObjects/EntitySystems/RangedWeaponSystem.cs index 9071ee8e31..11216aa891 100644 --- a/Content.Client/GameObjects/EntitySystems/RangedWeaponSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/RangedWeaponSystem.cs @@ -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; diff --git a/Content.Client/Input/ContentContexts.cs b/Content.Client/Input/ContentContexts.cs index d768e88611..13c5a43518 100644 --- a/Content.Client/Input/ContentContexts.cs +++ b/Content.Client/Input/ContentContexts.cs @@ -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); diff --git a/Content.Client/UserInterface/HandsGui.cs b/Content.Client/UserInterface/HandsGui.cs index 7a3dfbbf56..292da6f617 100644 --- a/Content.Client/UserInterface/HandsGui.cs +++ b/Content.Client/UserInterface/HandsGui.cs @@ -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; @@ -201,12 +203,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) @@ -222,7 +229,7 @@ namespace Content.Client.UserInterface return; } - if (args.Button == Mouse.Button.Left) + if (args.Function == EngineKeyFunctions.Use) { if (!TryGetHands(out var hands)) return; @@ -238,12 +245,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)) { @@ -257,7 +264,7 @@ namespace Content.Client.UserInterface } var esm = IoCManager.Resolve(); - esm.GetEntitySystem().OpenContextMenu(entity, new ScreenCoordinates(args.GlobalPosition)); + esm.GetEntitySystem().OpenContextMenu(entity, new ScreenCoordinates(args.PointerLocation.Position)); } } } diff --git a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs index 3f851589dc..0c98ead8f5 100644 --- a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs @@ -200,7 +200,7 @@ namespace Content.Server.GameObjects.EntitySystems public override void Initialize() { var inputSys = EntitySystemManager.GetEntitySystem(); - inputSys.BindMap.BindFunction(ContentKeyFunctions.UseItemInHand, + inputSys.BindMap.BindFunction(EngineKeyFunctions.Use, new PointerInputCmdHandler(HandleUseItemInHand)); inputSys.BindMap.BindFunction(ContentKeyFunctions.ActivateItemInWorld, new PointerInputCmdHandler(HandleActivateItemInWorld)); diff --git a/Content.Shared/Input/ContentKeyFunctions.cs b/Content.Shared/Input/ContentKeyFunctions.cs index 2b63091d36..501e433c97 100644 --- a/Content.Shared/Input/ContentKeyFunctions.cs +++ b/Content.Shared/Input/ContentKeyFunctions.cs @@ -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"; } } diff --git a/Resources/keybinds.yml b/Resources/keybinds.yml index d21fbb314c..b72e6baf7c 100644 --- a/Resources/keybinds.yml +++ b/Resources/keybinds.yml @@ -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,10 @@ binds: - function: OpenInventoryMenu type: state key: I +- function: ShowDebugConsole + type: state + key: Tilde +- function: MouseMiddle + type: state + key: MouseMiddle + canFocus: true \ No newline at end of file diff --git a/RobustToolbox b/RobustToolbox index 3f7cd1f1b2..a9d8044105 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit 3f7cd1f1b2da2b2e4b0e046632030c8011f85912 +Subproject commit a9d8044105d40b8e85267ed4fb9e98889bc60c92 From 7454c62ff2252a0850c16bb1e1d04cb3fd465ff5 Mon Sep 17 00:00:00 2001 From: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Date: Mon, 5 Aug 2019 22:59:37 -0700 Subject: [PATCH 07/22] Upgraded ChatBox and fixed FocusChat hotkey Upgraded ChatBox to use Keybinds. Put cursor at the end of text of ChatBox history. Fixed FocusChat hotkey getting called when typing in a LineEdit. Added Keybinds. --- Content.Client/Chat/ChatBox.cs | 21 ++++++------ .../GameTicking/ClientGameTicker.cs | 29 ++++++++-------- Resources/keybinds.yml | 33 ++++++++++++++++++- RobustToolbox | 2 +- 4 files changed, 60 insertions(+), 25 deletions(-) diff --git a/Content.Client/Chat/ChatBox.cs b/Content.Client/Chat/ChatBox.cs index 74717204fe..50b095833d 100644 --- a/Content.Client/Chat/ChatBox.cs +++ b/Content.Client/Chat/ChatBox.cs @@ -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 { @@ -84,7 +85,7 @@ namespace Content.Client.Chat vBox.AddChild(contentMargin); Input = new LineEdit(); - Input.OnKeyDown += InputKeyDown; + Input.OnKeyBindDown += InputKeyBindDown; Input.OnTextEntered += Input_OnTextEntered; vBox.AddChild(Input); @@ -133,16 +134,15 @@ namespace Content.Client.Chat 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) { @@ -158,12 +158,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) { @@ -176,8 +176,9 @@ namespace Content.Client.Chat _inputIndex--; Input.Text = _inputHistory[_inputIndex]; } + Input.CursorPos = Input.Text.Length; - e.Handle(); + args.Handle(); } } diff --git a/Content.Client/GameTicking/ClientGameTicker.cs b/Content.Client/GameTicking/ClientGameTicker.cs index 59cce13532..a112b66431 100644 --- a/Content.Client/GameTicking/ClientGameTicker.cs +++ b/Content.Client/GameTicking/ClientGameTicker.cs @@ -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 diff --git a/Resources/keybinds.yml b/Resources/keybinds.yml index b72e6baf7c..a7b5a94466 100644 --- a/Resources/keybinds.yml +++ b/Resources/keybinds.yml @@ -99,4 +99,35 @@ binds: - function: MouseMiddle type: state key: MouseMiddle - canFocus: true \ No newline at end of file + 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 \ No newline at end of file diff --git a/RobustToolbox b/RobustToolbox index 6c6764593b..7374fc5894 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit 6c6764593b6c1df6a3be03f3e8c2c1aea0fe9448 +Subproject commit 7374fc5894fb81ae8581e0bf66c734b455337c8b From 8c59d2e3b9a132ad410414f28cecc88db031bc64 Mon Sep 17 00:00:00 2001 From: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Date: Tue, 6 Aug 2019 01:09:44 -0700 Subject: [PATCH 08/22] Removed extra dependencies --- .../Components/Items/Storage/ServerStorageComponent.cs | 1 - RobustToolbox | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs index b50a8b9ff4..77fe298f07 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs @@ -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; diff --git a/RobustToolbox b/RobustToolbox index 5914125f46..f3f317385a 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit 5914125f461e07b9ff104d6ca9286e2e36c1fef3 +Subproject commit f3f317385a542152cf753b5cfc7582e508ec2f57 From 7753ae7c3afbfb023b363d8c1e54e265dfe27e99 Mon Sep 17 00:00:00 2001 From: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Date: Wed, 7 Aug 2019 15:56:22 -0700 Subject: [PATCH 09/22] Added OpenStorage trigger on ActivateItemInWorld When ActivateItemInWorld is pressed when hovering over a InventoryButton and the InventorySlot contains a storage item, it will open the StorageGUI. --- Content.Client/EscapeMenuOwner.cs | 9 ++-- .../HUD/Inventory/ClientInventoryComponent.cs | 12 ++--- .../HumanInventoryInterfaceController.cs | 2 +- .../HUD/Inventory/InventoryButton.cs | 6 ++- .../Inventory/InventoryInterfaceController.cs | 33 ++++++++++--- Content.Client/UserInterface/GameHud.cs | 2 +- .../Components/GUI/InventoryComponent.cs | 49 +++++++++++++------ .../Components/GUI/ServerHandsComponent.cs | 15 ++++-- .../Inventory/SharedInventoryComponent.cs | 2 +- RobustToolbox | 2 +- 10 files changed, 90 insertions(+), 42 deletions(-) diff --git a/Content.Client/EscapeMenuOwner.cs b/Content.Client/EscapeMenuOwner.cs index 914233839d..54c6f53cb5 100644 --- a/Content.Client/EscapeMenuOwner.cs +++ b/Content.Client/EscapeMenuOwner.cs @@ -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) { diff --git a/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs b/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs index bc3b6c039b..4a7819589e 100644 --- a/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs +++ b/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs @@ -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)); diff --git a/Content.Client/GameObjects/Components/HUD/Inventory/HumanInventoryInterfaceController.cs b/Content.Client/GameObjects/Components/HUD/Inventory/HumanInventoryInterfaceController.cs index 9b23c3ef8d..80fbaf6517 100644 --- a/Content.Client/GameObjects/Components/HUD/Inventory/HumanInventoryInterfaceController.cs +++ b/Content.Client/GameObjects/Components/HUD/Inventory/HumanInventoryInterfaceController.cs @@ -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; } } diff --git a/Content.Client/GameObjects/Components/HUD/Inventory/InventoryButton.cs b/Content.Client/GameObjects/Components/HUD/Inventory/InventoryButton.cs index 1bc30aae84..8f680a23c5 100644 --- a/Content.Client/GameObjects/Components/HUD/Inventory/InventoryButton.cs +++ b/Content.Client/GameObjects/Components/HUD/Inventory/InventoryButton.cs @@ -27,7 +27,8 @@ namespace Content.Client.GameObjects AddChild(Button = new TextureButton { TextureNormal = texture, - Scale = (2, 2) + Scale = (2, 2), + NonFocusKeybinds = 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, + NonFocusKeybinds = true }); StorageButton.OnPressed += e => OnStoragePressed?.Invoke(e); diff --git a/Content.Client/GameObjects/Components/HUD/Inventory/InventoryInterfaceController.cs b/Content.Client/GameObjects/Components/HUD/Inventory/InventoryInterfaceController.cs index d085df42de..091e1c46db 100644 --- a/Content.Client/GameObjects/Components/HUD/Inventory/InventoryInterfaceController.cs +++ b/Content.Client/GameObjects/Components/HUD/Inventory/InventoryInterfaceController.cs @@ -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; diff --git a/Content.Client/UserInterface/GameHud.cs b/Content.Client/UserInterface/GameHud.cs index 4eef7a335f..146449060b 100644 --- a/Content.Client/UserInterface/GameHud.cs +++ b/Content.Client/UserInterface/GameHud.cs @@ -1,4 +1,4 @@ -using System; +using System; using Content.Client.Utility; using Content.Shared.Input; using Robust.Client.Graphics; diff --git a/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs b/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs index 0f71bd3b92..833f06d54f 100644 --- a/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs +++ b/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs @@ -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 SlotContainers = new Dictionary(); @@ -223,27 +228,41 @@ namespace Content.Server.GameObjects /// private void HandleInventoryMessage(ClientInventoryMessage msg) { - if (msg.Updatetype == ClientInventoryUpdate.Equip) + switch (msg.Updatetype) { - var hands = Owner.GetComponent(); - 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(); + 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(); - 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(); + var hands = Owner.GetComponent(); + 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; } } } diff --git a/Content.Server/GameObjects/Components/GUI/ServerHandsComponent.cs b/Content.Server/GameObjects/Components/GUI/ServerHandsComponent.cs index 7b42e79451..d38b0efd48 100644 --- a/Content.Server/GameObjects/Components/GUI/ServerHandsComponent.cs +++ b/Content.Server/GameObjects/Components/GUI/ServerHandsComponent.cs @@ -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.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; diff --git a/Content.Shared/GameObjects/Components/Inventory/SharedInventoryComponent.cs b/Content.Shared/GameObjects/Components/Inventory/SharedInventoryComponent.cs index 6464f2fbe8..7dfb88f4d4 100644 --- a/Content.Shared/GameObjects/Components/Inventory/SharedInventoryComponent.cs +++ b/Content.Shared/GameObjects/Components/Inventory/SharedInventoryComponent.cs @@ -75,7 +75,7 @@ namespace Content.Shared.GameObjects public enum ClientInventoryUpdate { Equip = 0, - Unequip = 1 + Use = 1 } } diff --git a/RobustToolbox b/RobustToolbox index f3f317385a..0adcc3c645 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit f3f317385a542152cf753b5cfc7582e508ec2f57 +Subproject commit 0adcc3c64545e96ca16e7e0e7eeed757dc0262c9 From b38e780f010f5475d2607891bb723e4ec1a5c6a6 Mon Sep 17 00:00:00 2001 From: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Date: Fri, 9 Aug 2019 15:47:59 -0700 Subject: [PATCH 10/22] Updates Submodule and updates Inventory Button variables --- .../GameObjects/Components/HUD/Inventory/InventoryButton.cs | 4 ++-- RobustToolbox | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Content.Client/GameObjects/Components/HUD/Inventory/InventoryButton.cs b/Content.Client/GameObjects/Components/HUD/Inventory/InventoryButton.cs index 8f680a23c5..2fd04a6456 100644 --- a/Content.Client/GameObjects/Components/HUD/Inventory/InventoryButton.cs +++ b/Content.Client/GameObjects/Components/HUD/Inventory/InventoryButton.cs @@ -28,7 +28,7 @@ namespace Content.Client.GameObjects { TextureNormal = texture, Scale = (2, 2), - NonFocusKeybinds = true + EnableAllKeybinds = true }); Button.OnPressed += e => OnPressed?.Invoke(e); @@ -46,7 +46,7 @@ namespace Content.Client.GameObjects SizeFlagsHorizontal = SizeFlags.ShrinkEnd, SizeFlagsVertical = SizeFlags.ShrinkEnd, Visible = false, - NonFocusKeybinds = true + EnableAllKeybinds = true }); StorageButton.OnPressed += e => OnStoragePressed?.Invoke(e); diff --git a/RobustToolbox b/RobustToolbox index 0adcc3c645..8aa87a6803 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit 0adcc3c64545e96ca16e7e0e7eeed757dc0262c9 +Subproject commit 8aa87a68039d57f77d238f4190edc83da3a74138 From e5090cd10d5df82e62608fa25aefea324da80903 Mon Sep 17 00:00:00 2001 From: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Date: Sat, 10 Aug 2019 16:09:31 -0700 Subject: [PATCH 11/22] Update RobustToolbox --- RobustToolbox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RobustToolbox b/RobustToolbox index 023a782048..778290eb85 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit 023a782048188af3a81527d76ce38bcd43c94c5a +Subproject commit 778290eb8594160dd845889ad555d055e23592e5 From 844518d9215d2cf92354127d5650cb399037715a Mon Sep 17 00:00:00 2001 From: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Date: Sat, 10 Aug 2019 16:30:12 -0700 Subject: [PATCH 12/22] Update RobustToolbox --- RobustToolbox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RobustToolbox b/RobustToolbox index 778290eb85..9468238739 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit 778290eb8594160dd845889ad555d055e23592e5 +Subproject commit 946823873914d03af11e127273022c58279a8f76 From b38a014b02ccddc006c7800556d24f5767e9f6c9 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Thu, 15 Aug 2019 15:49:16 +0200 Subject: [PATCH 13/22] Fix build --- Content.Client/Research/LatheMenu.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Content.Client/Research/LatheMenu.cs b/Content.Client/Research/LatheMenu.cs index e4f5964325..4a0ffbae6e 100644 --- a/Content.Client/Research/LatheMenu.cs +++ b/Content.Client/Research/LatheMenu.cs @@ -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 { From 225bc86d738eb0b9076c2f59ab9cfe991b8a7516 Mon Sep 17 00:00:00 2001 From: DamianX Date: Fri, 16 Aug 2019 18:08:43 +0200 Subject: [PATCH 14/22] Revert "full mime outfit, HoP hat and uniform" (#305) This reverts commit 89c485200bcf498565bfda9ee3cd30c87ccdf5f5. --- .../Entities/items/clothing/belts.yml | 2 - .../Entities/items/clothing/gloves.yml | 17 +-------- .../Entities/items/clothing/hats.yml | 34 ----------------- .../Entities/items/clothing/masks.yml | 17 +-------- .../Entities/items/clothing/shoes.yml | 19 +-------- .../Entities/items/clothing/suits.yml | 15 -------- .../Entities/items/clothing/uniforms.yml | 36 +----------------- .../Textures/Clothing/beret.rsi/beret.png | Bin 448 -> 0 bytes .../Clothing/beret.rsi/equipped-HELMET.png | Bin 270 -> 0 bytes .../Textures/Clothing/beret.rsi/meta.json | 26 ------------- .../gloves_white.rsi/equipped-HAND.png | Bin 216 -> 0 bytes .../Clothing/gloves_white.rsi/meta.json | 26 ------------- .../Clothing/gloves_white.rsi/white.png | Bin 462 -> 0 bytes .../Clothing/hop_coat.rsi/equipped-OUTER.png | Bin 1078 -> 0 bytes .../Clothing/hop_hat.rsi/equipped-HELMET.png | Bin 452 -> 0 bytes .../Textures/Clothing/hop_hat.rsi/hop.png | Bin 352 -> 0 bytes .../Textures/Clothing/hop_hat.rsi/meta.json | 26 ------------- 17 files changed, 4 insertions(+), 214 deletions(-) delete mode 100644 Resources/Textures/Clothing/beret.rsi/beret.png delete mode 100644 Resources/Textures/Clothing/beret.rsi/equipped-HELMET.png delete mode 100644 Resources/Textures/Clothing/beret.rsi/meta.json delete mode 100644 Resources/Textures/Clothing/gloves_white.rsi/equipped-HAND.png delete mode 100644 Resources/Textures/Clothing/gloves_white.rsi/meta.json delete mode 100644 Resources/Textures/Clothing/gloves_white.rsi/white.png delete mode 100644 Resources/Textures/Clothing/hop_coat.rsi/equipped-OUTER.png delete mode 100644 Resources/Textures/Clothing/hop_hat.rsi/equipped-HELMET.png delete mode 100644 Resources/Textures/Clothing/hop_hat.rsi/hop.png delete mode 100644 Resources/Textures/Clothing/hop_hat.rsi/meta.json diff --git a/Resources/Prototypes/Entities/items/clothing/belts.yml b/Resources/Prototypes/Entities/items/clothing/belts.yml index 84cb15b8a0..b023279c80 100644 --- a/Resources/Prototypes/Entities/items/clothing/belts.yml +++ b/Resources/Prototypes/Entities/items/clothing/belts.yml @@ -24,5 +24,3 @@ sprite: Clothing/belt_utility.rsi - type: Storage Capacity: 30 - - diff --git a/Resources/Prototypes/Entities/items/clothing/gloves.yml b/Resources/Prototypes/Entities/items/clothing/gloves.yml index af0b3af5a7..a47c382c76 100644 --- a/Resources/Prototypes/Entities/items/clothing/gloves.yml +++ b/Resources/Prototypes/Entities/items/clothing/gloves.yml @@ -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 \ No newline at end of file + HeatResistance: 1500 \ No newline at end of file diff --git a/Resources/Prototypes/Entities/items/clothing/hats.yml b/Resources/Prototypes/Entities/items/clothing/hats.yml index 423ed9fde7..26aaed52c0 100644 --- a/Resources/Prototypes/Entities/items/clothing/hats.yml +++ b/Resources/Prototypes/Entities/items/clothing/hats.yml @@ -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 diff --git a/Resources/Prototypes/Entities/items/clothing/masks.yml b/Resources/Prototypes/Entities/items/clothing/masks.yml index 37ed00bff3..9a0c7d2388 100644 --- a/Resources/Prototypes/Entities/items/clothing/masks.yml +++ b/Resources/Prototypes/Entities/items/clothing/masks.yml @@ -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 \ No newline at end of file + sprite: Clothing/mask_clown.rsi \ No newline at end of file diff --git a/Resources/Prototypes/Entities/items/clothing/shoes.yml b/Resources/Prototypes/Entities/items/clothing/shoes.yml index a046c1d5c8..1d7d2a03be 100644 --- a/Resources/Prototypes/Entities/items/clothing/shoes.yml +++ b/Resources/Prototypes/Entities/items/clothing/shoes.yml @@ -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 \ No newline at end of file + sprite: Clothing/shoes_brown.rsi \ No newline at end of file diff --git a/Resources/Prototypes/Entities/items/clothing/suits.yml b/Resources/Prototypes/Entities/items/clothing/suits.yml index 991628dcfd..fa6132001a 100644 --- a/Resources/Prototypes/Entities/items/clothing/suits.yml +++ b/Resources/Prototypes/Entities/items/clothing/suits.yml @@ -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 \ No newline at end of file diff --git a/Resources/Prototypes/Entities/items/clothing/uniforms.yml b/Resources/Prototypes/Entities/items/clothing/uniforms.yml index d5986f3ef1..fa65553d34 100644 --- a/Resources/Prototypes/Entities/items/clothing/uniforms.yml +++ b/Resources/Prototypes/Entities/items/clothing/uniforms.yml @@ -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 \ No newline at end of file + sprite: Clothing/captain_uniform.rsi diff --git a/Resources/Textures/Clothing/beret.rsi/beret.png b/Resources/Textures/Clothing/beret.rsi/beret.png deleted file mode 100644 index feac165f6d246fd7969c41f5588cb8dd898d5d9a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 448 zcmV;x0YCnUP)y_L3(MPk9V|gMcp}Fz2I zX(tPUGf6xM_6KunrvCr0s&1%MDwY2od1`@q+nNJ*yeFHH%{V$c8(sI&2Ig&RQ}3BL z$1~?pAe*sP*c(cE6jR=mrb~Pfr+THCF z=aTs3`kI&1X`kNA7|uV!KsF;dhiuI|=M2!d`_s)009P^MxZj2DZ;YT*^Q@OZJ1?M>hQ@oP$a*=(4FaNnIG{^8*cHkO5EYL-r)K z8I68VSDxZYSy`YkRm*uoQkUSP|9zd8to-uyFU`MQySss7@+$e=9=q7S31=PfT$OGf zrgD~(ckZoc{c|g&*Cg&psJ`^q)lJxE)wQ4Po~2vb7AC2$TxT7Br{);%ja!Pl3|^mN z23iaOH(WGs8&4Ow&7a&3YjGYH3?Wz;5~22g)DsIk)<6*!J_$s|@xF zwc9_ODzLd{^|yd)=CsT6%zuRaxOHpQXa| zcKlyxsTkQxa8$bFLsEBK6)cd8(?{>-DW6-X7o)2{Wtr9!=9&9BtbI zfC9j)L0%3(MCzQw>2z9104yZyH~=(FgTC*VS=UeOEfA3sk*1V1rKIyb7gtJ2$8juj z^4xV@?va;IfQU4Nu-vPD);i~496z5)uZdDWXqf4b`oCBG>Z9uwU@#aA z27|$1(1UXxP|oM2&p8j|QJB691ZzML72})-Ye3)vxf-GBFDxvCM;iUp6!9v6#WB|x zmHS-4q8dWccN`}(eXScg=fQuMe??Gj;HMWZ4h{|=gs{}><#HL7N(BJmdEUtNv~bP? z>Gb~oey9TgzVAcK|AL^}7&z2vVRmO-TmO`1lUkpTCRNi+JFEsyR$Bh%_Iuq^y8e5LeVD~s?)RP)dcd=*PaMT zYKL!ezC45ZiiO6L4`|&xhrRs({~sKpJu^owj*Qfo%vY>b`s4~|&&&az0lWvE{{G|F z3o~OM$&^rE@;;qDxdIqtBkj)j{jd{KhpW7h`chZ5BZEIb!y&Jbg_u~1 zS_Lu~30;pnO8}(UoVuUdk zrl&4Ff0#M}nuh2?sazSR*h7v0byfDw%}2Se1W!VBUgibItr$-t(V}R**M-$-0T?7J zi>`#I^J)Z8NxUjNyR#0f(+ZQ7MI)WIZ97~jEhGZeT9$hSifjtxex`B7mG4 zyU}g~0R9B z-hK(NWN)kX2}Q8GE5hGG2x|$j+~J5OZPbMv0d8dIl*x)&c+{d2bMe*7fp+A)3s^Pc zT!0h-aoN{Wsf60$+wj=l&M#B5y^TQCDwRrFHcleZM5x_vTk?POp1dbTlQe6!T0or$ zk&RUiP&Y7Uy*u>Fnr&90ZeNqgu<-ClK=n!07*qoM6N<$f{mg7qyPW_ diff --git a/Resources/Textures/Clothing/hop_hat.rsi/equipped-HELMET.png b/Resources/Textures/Clothing/hop_hat.rsi/equipped-HELMET.png deleted file mode 100644 index 866e91981aea4586a8aca7cd572bd5d7bb9ffc41..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 452 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7T#lEVC?pEaSW-L^Y)fu_8|um_7C+7 zoQt`fp08Qgp1iQ6aC@-T55rB?yPhXom`r}B*M1>z(=ID<7T-H@?UPKnGWV|T4ESd+ zkfied?%rxYeL0zx29q9Hc_*DWJ-7DmO}l`c7&hl0bM-zQmg5pw@YTuV=`G9kSDT;D z)_>A&yXUKr!)MnOW%n$n-?=6`LDf*CA^GXN@H_m(!LIVv~`bQro_ z5=rWr_$Y31XQ0@EGvR+3Cd}WpxG#9?mTQ;Ze?R?x_F1;fS=&DSzaDixZ_`>+0YM~C zn_1;narMWw%ZUr>T;{5NydPFQQJ;{Mmf}<)a<5qD2p`WbRx2^CaJ9l{Wj>DfvB5CQtOf(H-(RWwKyMX)NEzHU6jO z>zxw*aLwCh&wfURw9S%Ld($)SzIe&Za7kp-ZONYF$qWaMKYs10{$%pSquD!dC9T%? o$k~4TSl5LxIVB|UE8mXMf_wI>P4kFVdQ&MBb@0GfczMgRZ+ diff --git a/Resources/Textures/Clothing/hop_hat.rsi/hop.png b/Resources/Textures/Clothing/hop_hat.rsi/hop.png deleted file mode 100644 index 55e5a58f117e4e2f823c1df6cf7296eda09373e1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 352 zcmV-m0iXVfP)!P+3na3*PXyGH z7-Ni2tiQmRdJ*_RL Date: Fri, 16 Aug 2019 21:45:34 +0200 Subject: [PATCH 15/22] Update submodule --- RobustToolbox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RobustToolbox b/RobustToolbox index cb5f2ffae1..7f9f593989 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit cb5f2ffae1994e0a3f0f6be5697896ab7eaafe50 +Subproject commit 7f9f5939893af302fa52ef9253448c6c3743fcc9 From 534af65f7c802799b34be7fd3a8f73a3524c2785 Mon Sep 17 00:00:00 2001 From: DamianX Date: Fri, 16 Aug 2019 21:52:00 +0200 Subject: [PATCH 16/22] Fixed inventory button not updating when window was closed (#304) * Fixed inventory button not updating when window was closed * Only add the event handler once * uhhhh * UHHHHHH --- .../HUD/Inventory/HumanInventoryInterfaceController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content.Client/GameObjects/Components/HUD/Inventory/HumanInventoryInterfaceController.cs b/Content.Client/GameObjects/Components/HUD/Inventory/HumanInventoryInterfaceController.cs index fa59cf6ab9..ecc47ef5ef 100644 --- a/Content.Client/GameObjects/Components/HUD/Inventory/HumanInventoryInterfaceController.cs +++ b/Content.Client/GameObjects/Components/HUD/Inventory/HumanInventoryInterfaceController.cs @@ -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; From 7f5654bb069a3650a4b111f25d5432c745c8f4f5 Mon Sep 17 00:00:00 2001 From: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Date: Fri, 16 Aug 2019 15:15:00 -0700 Subject: [PATCH 17/22] Update RobustToolbox --- RobustToolbox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RobustToolbox b/RobustToolbox index 9468238739..f023b66a5d 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit 946823873914d03af11e127273022c58279a8f76 +Subproject commit f023b66a5d28ab1514d1863951e7a7b9f159f7e0 From 4c67856dd6b822975647f501753ebadcb9484c4f Mon Sep 17 00:00:00 2001 From: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Date: Fri, 16 Aug 2019 23:14:43 -0700 Subject: [PATCH 18/22] Update RobustToolbox --- RobustToolbox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RobustToolbox b/RobustToolbox index f023b66a5d..4af449b9e8 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit f023b66a5d28ab1514d1863951e7a7b9f159f7e0 +Subproject commit 4af449b9e829e7b85482730cbb0cdd832e28ea25 From 4dcbf28714f994c749d4e931afb1e3e99058bc31 Mon Sep 17 00:00:00 2001 From: DamianX Date: Sat, 17 Aug 2019 21:09:09 +0200 Subject: [PATCH 19/22] IoC'd random (#302) * Implemented RobustRandom * update submodule * update submodule * Fix benchmark --- Content.Benchmarks/ColorInterpolateBenchmark.cs | 3 +++ .../GameObjects/Components/Sound/SoundComponent.cs | 8 +++++--- Content.Client/Parallax/ParallaxGenerator.cs | 1 + .../Construction/ConstructionComponent.cs | 10 ++++++---- .../Components/Damage/BreakableComponent.cs | 4 +++- .../Components/Damage/DestructibleComponent.cs | 6 ++++-- .../Components/Explosion/ExplosiveComponent.cs | 7 +++++-- .../GameObjects/Components/Items/DiceComponent.cs | 10 +++------- .../Items/Storage/Fill/ToolLockerFillComponent.cs | 4 +++- .../Storage/Fill/ToolboxElectricalFillComponent.cs | 4 +++- .../Components/Items/Storage/ItemComponent.cs | 9 ++++++++- .../Movement/ServerTeleporterComponent.cs | 5 ++--- .../Components/Sound/FootstepModifierComponent.cs | 10 +++------- .../Projectile/BallisticMagazineWeaponComponent.cs | 9 ++++++--- .../Weapon/Ranged/Projectile/ProjectileWeapon.cs | 8 +++++--- .../GameObjects/EntitySystems/MoverSystem.cs | 13 +++++++------ Content.Server/GameTicking/GameTicker.cs | 7 ++++--- 17 files changed, 71 insertions(+), 47 deletions(-) diff --git a/Content.Benchmarks/ColorInterpolateBenchmark.cs b/Content.Benchmarks/ColorInterpolateBenchmark.cs index aaa172f0aa..f45b91363d 100644 --- a/Content.Benchmarks/ColorInterpolateBenchmark.cs +++ b/Content.Benchmarks/ColorInterpolateBenchmark.cs @@ -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 diff --git a/Content.Client/GameObjects/Components/Sound/SoundComponent.cs b/Content.Client/GameObjects/Components/Sound/SoundComponent.cs index cfed2998ee..9b46924eb0 100644 --- a/Content.Client/GameObjects/Components/Sound/SoundComponent.cs +++ b/Content.Client/GameObjects/Components/Sound/SoundComponent.cs @@ -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 _schedules = new List(); 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().GetEntitySystem(); diff --git a/Content.Client/Parallax/ParallaxGenerator.cs b/Content.Client/Parallax/ParallaxGenerator.cs index a42cf44a04..98823fc160 100644 --- a/Content.Client/Parallax/ParallaxGenerator.cs +++ b/Content.Client/Parallax/ParallaxGenerator.cs @@ -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; diff --git a/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs b/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs index 86e64d2b5c..c7783a2c29 100644 --- a/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs +++ b/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs @@ -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(); Transform = Owner.GetComponent(); var systemman = IoCManager.Resolve(); - 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()) { - 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); diff --git a/Content.Server/GameObjects/Components/Damage/BreakableComponent.cs b/Content.Server/GameObjects/Components/Damage/BreakableComponent.cs index 1f1a87d427..56c44178b8 100644 --- a/Content.Server/GameObjects/Components/Damage/BreakableComponent.cs +++ b/Content.Server/GameObjects/Components/Damage/BreakableComponent.cs @@ -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(); switch (eventArgs.Severity) { case ExplosionSeverity.Destruction: diff --git a/Content.Server/GameObjects/Components/Damage/DestructibleComponent.cs b/Content.Server/GameObjects/Components/Damage/DestructibleComponent.cs index d5efd91802..492d4deeb0 100644 --- a/Content.Server/GameObjects/Components/Damage/DestructibleComponent.cs +++ b/Content.Server/GameObjects/Components/Damage/DestructibleComponent.cs @@ -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(); 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; } diff --git a/Content.Server/GameObjects/Components/Explosion/ExplosiveComponent.cs b/Content.Server/GameObjects/Components/Explosion/ExplosiveComponent.cs index 656ccd4c5a..d1f6f0e1f3 100644 --- a/Content.Server/GameObjects/Components/Explosion/ExplosiveComponent.cs +++ b/Content.Server/GameObjects/Components/Explosion/ExplosiveComponent.cs @@ -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)); } diff --git a/Content.Server/GameObjects/Components/Items/DiceComponent.cs b/Content.Server/GameObjects/Components/Items/DiceComponent.cs index ef9b10afb2..1dc5939f00 100644 --- a/Content.Server/GameObjects/Components/Items/DiceComponent.cs +++ b/Content.Server/GameObjects/Components/Items/DiceComponent.cs @@ -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; diff --git a/Content.Server/GameObjects/Components/Items/Storage/Fill/ToolLockerFillComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/Fill/ToolLockerFillComponent.cs index d84e55d2f8..5fa5e0fa9c 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/Fill/ToolLockerFillComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/Fill/ToolLockerFillComponent.cs @@ -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(); - var random = new Random(DateTime.Now.GetHashCode() ^ Owner.Uid.GetHashCode()); + var random = IoCManager.Resolve(); void Spawn(string prototype) { diff --git a/Content.Server/GameObjects/Components/Items/Storage/Fill/ToolboxElectricalFillComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/Fill/ToolboxElectricalFillComponent.cs index 95227b7141..3d42912ea0 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/Fill/ToolboxElectricalFillComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/Fill/ToolboxElectricalFillComponent.cs @@ -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(); - var random = new Random(DateTime.Now.GetHashCode() ^ Owner.Uid.GetHashCode()); + var random = IoCManager.Resolve(); void Spawn(string prototype) { diff --git a/Content.Server/GameObjects/Components/Items/Storage/ItemComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/ItemComponent.cs index 5cf06c5508..695d2fff6c 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/ItemComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/ItemComponent.cs @@ -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; } } } diff --git a/Content.Server/GameObjects/Components/Movement/ServerTeleporterComponent.cs b/Content.Server/GameObjects/Components/Movement/ServerTeleporterComponent.cs index fca5b45b79..7771bdf05c 100644 --- a/Content.Server/GameObjects/Components/Movement/ServerTeleporterComponent.cs +++ b/Content.Server/GameObjects/Components/Movement/ServerTeleporterComponent.cs @@ -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(); - _spreadRandom = new Random(Owner.Uid.GetHashCode() ^ DateTime.Now.GetHashCode()); _state = ItemTeleporterState.Off; base.Initialize(); } diff --git a/Content.Server/GameObjects/Components/Sound/FootstepModifierComponent.cs b/Content.Server/GameObjects/Components/Sound/FootstepModifierComponent.cs index 1cf60c0bc5..eb68beb188 100644 --- a/Content.Server/GameObjects/Components/Sound/FootstepModifierComponent.cs +++ b/Content.Server/GameObjects/Components/Sound/FootstepModifierComponent.cs @@ -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 /// /// - 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)) diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Projectile/BallisticMagazineWeaponComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Projectile/BallisticMagazineWeaponComponent.cs index 7b6dccfe06..4d6053a42b 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Projectile/BallisticMagazineWeaponComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Projectile/BallisticMagazineWeaponComponent.cs @@ -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(); - _bulletDropRandom = new Random(Owner.Uid.GetHashCode() ^ DateTime.Now.GetHashCode()); } public override void Startup() diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Projectile/ProjectileWeapon.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Projectile/ProjectileWeapon.cs index 9d86c27a94..7481342ead 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Projectile/ProjectileWeapon.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Projectile/ProjectileWeapon.cs @@ -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(); rangedWeapon.FireHandler = Fire; - - _spreadRandom = new Random(Owner.Uid.GetHashCode() ^ DateTime.Now.GetHashCode()); } public override void ExposeData(ObjectSerializer serializer) diff --git a/Content.Server/GameObjects/EntitySystems/MoverSystem.cs b/Content.Server/GameObjects/EntitySystems/MoverSystem.cs index ef0faabec0..7febdefc70 100644 --- a/Content.Server/GameObjects/EntitySystems/MoverSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/MoverSystem.cs @@ -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(PlayerAttached); SubscribeEvent(PlayerDetached); - _footstepRandom = new Random(); _audioSystem = EntitySystemManager.GetEntitySystem(); } @@ -153,7 +154,7 @@ namespace Content.Server.GameObjects.EntitySystems { mover.StepSoundDistance = 0; if (mover.Owner.TryGetComponent(out var inventory) - && inventory.TryGetSlotItem(EquipmentSlotDefines.Slots.SHOES, out var item) + && inventory.TryGetSlotItem(EquipmentSlotDefines.Slots.SHOES, out var item) && item.Owner.TryGetComponent(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(soundCollectionName); - var file = _footstepRandom.Pick(soundCollection.PickFiles); + var file = _robustRandom.Pick(soundCollection.PickFiles); _audioSystem.Play(file, coordinates); } catch (UnknownPrototypeException) diff --git a/Content.Server/GameTicking/GameTicker.cs b/Content.Server/GameTicking/GameTicker.cs index d9b019129d..76726b6ceb 100644 --- a/Content.Server/GameTicking/GameTicker.cs +++ b/Content.Server/GameTicking/GameTicker.cs @@ -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 _gameRules = new List(); [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; From be4197351a0fe4f1ea59363c0ecae8e5a75abb83 Mon Sep 17 00:00:00 2001 From: DamianX Date: Mon, 19 Aug 2019 22:27:25 +0200 Subject: [PATCH 20/22] Fixed examine things (#308) --- .../Components/Interactable/Tools/WelderComponent.cs | 1 + Content.Server/GameObjects/Components/Power/PowerDevice.cs | 2 +- .../GameObjects/EntitySystems/Click/ExamineSystem.cs | 7 +++---- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Content.Server/GameObjects/Components/Interactable/Tools/WelderComponent.cs b/Content.Server/GameObjects/Components/Interactable/Tools/WelderComponent.cs index a7de418d8f..0168ad739a 100644 --- a/Content.Server/GameObjects/Components/Interactable/Tools/WelderComponent.cs +++ b/Content.Server/GameObjects/Components/Interactable/Tools/WelderComponent.cs @@ -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(); } } diff --git a/Content.Server/GameObjects/Components/Power/PowerDevice.cs b/Content.Server/GameObjects/Components/Power/PowerDevice.cs index f93930cc6c..33d0c5c054 100644 --- a/Content.Server/GameObjects/Components/Power/PowerDevice.cs +++ b/Content.Server/GameObjects/Components/Power/PowerDevice.cs @@ -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."); } } diff --git a/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs index c3b6dd967a..7b0cfd0696 100644 --- a/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs @@ -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()) { + 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(); From 27d7337abff54516c1dfa13c7fbf96477afde935 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Wed, 21 Aug 2019 17:19:41 +0200 Subject: [PATCH 21/22] Gitignore some stuff in BuildChecker --- BuildChecker/.gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/BuildChecker/.gitignore b/BuildChecker/.gitignore index 97fb21bb98..5eeecc18fc 100644 --- a/BuildChecker/.gitignore +++ b/BuildChecker/.gitignore @@ -1,2 +1,5 @@ INSTALLED_HOOKS_VERSION DISABLE_SUBMODULE_AUTOUPDATE +*.nuget* +project.assets.json +project.packagespec.json \ No newline at end of file From 6e6aef62c617c0a0f1865c2c9def22c761ec5e28 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Wed, 21 Aug 2019 17:22:24 +0200 Subject: [PATCH 22/22] Update submodule --- RobustToolbox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RobustToolbox b/RobustToolbox index 7f9f593989..a8d6c294ab 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit 7f9f5939893af302fa52ef9253448c6c3743fcc9 +Subproject commit a8d6c294abca40b47dcf3da45359130b9151252a