More miscellaneous compiler warning fixes (#18228)
This commit is contained in:
@@ -40,6 +40,7 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
|
||||
private void Reset()
|
||||
{
|
||||
var entManager = IoCManager.Resolve<IEntityManager>();
|
||||
var xformSystem = entManager.System<SharedTransformSystem>();
|
||||
var playerManager = IoCManager.Resolve<IPlayerManager>();
|
||||
var player = playerManager.LocalPlayer?.ControlledEntity;
|
||||
|
||||
@@ -50,16 +51,16 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
|
||||
if (entManager.TryGetComponent<TransformComponent>(player, out var xform))
|
||||
{
|
||||
currentMap = xform.MapID;
|
||||
position = xform.WorldPosition;
|
||||
position = xformSystem.GetWorldPosition(xform);
|
||||
|
||||
if (entManager.TryGetComponent<TransformComponent>(xform.GridUid, out var gridXform))
|
||||
{
|
||||
rotation = gridXform.WorldRotation;
|
||||
rotation = xformSystem.GetWorldRotation(gridXform);
|
||||
}
|
||||
else
|
||||
{
|
||||
// MapId moment
|
||||
rotation = xform.WorldRotation - xform.LocalRotation;
|
||||
rotation = xformSystem.GetWorldRotation(xform) - xform.LocalRotation;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Client.Atmos.EntitySystems;
|
||||
using Content.Shared.Atmos.Prototypes;
|
||||
@@ -8,9 +7,6 @@ using Robust.Client.Console;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
@@ -19,24 +15,31 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
[UsedImplicitly]
|
||||
public sealed partial class AddGasWindow : DefaultWindow
|
||||
{
|
||||
private IEnumerable<MapGridComponent>? _gridData;
|
||||
private List<EntityUid>? _gridData;
|
||||
private IEnumerable<GasPrototype>? _gasData;
|
||||
|
||||
protected override void EnteredTree()
|
||||
{
|
||||
// Fill out grids
|
||||
_gridData = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Owner != 0);
|
||||
foreach (var grid in _gridData)
|
||||
var entManager = IoCManager.Resolve<IEntityManager>();
|
||||
var playerManager = IoCManager.Resolve<IPlayerManager>();
|
||||
|
||||
var gridQuery = entManager.AllEntityQueryEnumerator<MapGridComponent>();
|
||||
_gridData ??= new List<EntityUid>();
|
||||
_gridData.Clear();
|
||||
|
||||
while (gridQuery.MoveNext(out var uid, out _))
|
||||
{
|
||||
var player = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity;
|
||||
var playerGrid = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<TransformComponent>(player)?.GridUid;
|
||||
GridOptions.AddItem($"{grid.Owner} {(playerGrid == grid.Owner ? " (Current)" : "")}");
|
||||
var player = playerManager.LocalPlayer?.ControlledEntity;
|
||||
var playerGrid = entManager.GetComponentOrNull<TransformComponent>(player)?.GridUid;
|
||||
GridOptions.AddItem($"{uid} {(playerGrid == uid ? " (Current)" : "")}");
|
||||
}
|
||||
|
||||
GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
|
||||
|
||||
// Fill out gases
|
||||
_gasData = EntitySystem.Get<AtmosphereSystem>().Gases;
|
||||
_gasData = entManager.System<AtmosphereSystem>().Gases;
|
||||
|
||||
foreach (var gas in _gasData)
|
||||
{
|
||||
var gasName = Loc.GetString(gas.Name);
|
||||
@@ -53,8 +56,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
if (_gridData == null || _gasData == null)
|
||||
return;
|
||||
|
||||
var gridList = _gridData.ToList();
|
||||
var gridIndex = gridList[GridOptions.SelectedId].Owner;
|
||||
var gridIndex = _gridData[GridOptions.SelectedId];
|
||||
|
||||
var gasList = _gasData.ToList();
|
||||
var gasId = gasList[GasOptions.SelectedId].ID;
|
||||
|
||||
@@ -19,24 +19,32 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
[UsedImplicitly]
|
||||
public sealed partial class FillGasWindow : DefaultWindow
|
||||
{
|
||||
private IEnumerable<MapGridComponent>? _gridData;
|
||||
private List<EntityUid>? _gridData;
|
||||
private IEnumerable<GasPrototype>? _gasData;
|
||||
|
||||
protected override void EnteredTree()
|
||||
{
|
||||
// Fill out grids
|
||||
_gridData = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Owner != 0);
|
||||
foreach (var grid in _gridData)
|
||||
var entManager = IoCManager.Resolve<IEntityManager>();
|
||||
var playerManager = IoCManager.Resolve<IPlayerManager>();
|
||||
|
||||
var gridQuery = entManager.AllEntityQueryEnumerator<MapGridComponent>();
|
||||
_gridData ??= new List<EntityUid>();
|
||||
_gridData.Clear();
|
||||
|
||||
while (gridQuery.MoveNext(out var uid, out _))
|
||||
{
|
||||
var player = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity;
|
||||
var playerGrid = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<TransformComponent>(player)?.GridUid;
|
||||
GridOptions.AddItem($"{grid.Owner} {(playerGrid == grid.Owner ? " (Current)" : "")}");
|
||||
var player = playerManager.LocalPlayer?.ControlledEntity;
|
||||
var playerGrid = entManager.GetComponentOrNull<TransformComponent>(player)?.GridUid;
|
||||
GridOptions.AddItem($"{uid} {(playerGrid == uid ? " (Current)" : "")}");
|
||||
_gridData.Add(uid);
|
||||
}
|
||||
|
||||
GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
|
||||
|
||||
// Fill out gases
|
||||
_gasData = EntitySystem.Get<AtmosphereSystem>().Gases;
|
||||
_gasData = entManager.System<AtmosphereSystem>().Gases;
|
||||
|
||||
foreach (var gas in _gasData)
|
||||
{
|
||||
var gasName = Loc.GetString(gas.Name);
|
||||
@@ -53,8 +61,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
if (_gridData == null || _gasData == null)
|
||||
return;
|
||||
|
||||
var gridList = _gridData.ToList();
|
||||
var gridIndex = gridList[GridOptions.SelectedId].Owner;
|
||||
var gridIndex = _gridData[GridOptions.SelectedId];
|
||||
|
||||
var gasList = _gasData.ToList();
|
||||
var gasId = gasList[GasOptions.SelectedId].ID;
|
||||
|
||||
@@ -17,16 +17,23 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
[UsedImplicitly]
|
||||
public sealed partial class SetTemperatureWindow : DefaultWindow
|
||||
{
|
||||
private IEnumerable<MapGridComponent>? _data;
|
||||
private List<EntityUid>? _data;
|
||||
|
||||
protected override void EnteredTree()
|
||||
{
|
||||
_data = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Owner != 0);
|
||||
foreach (var grid in _data)
|
||||
var entManager = IoCManager.Resolve<IEntityManager>();
|
||||
var playerManager = IoCManager.Resolve<IPlayerManager>();
|
||||
|
||||
var gridQuery = entManager.AllEntityQueryEnumerator<MapGridComponent>();
|
||||
_data ??= new List<EntityUid>();
|
||||
_data.Clear();
|
||||
|
||||
while (gridQuery.MoveNext(out var uid, out _))
|
||||
{
|
||||
var player = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity;
|
||||
var playerGrid = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<TransformComponent>(player)?.GridUid;
|
||||
GridOptions.AddItem($"{grid.Owner} {(playerGrid == grid.Owner ? " (Current)" : "")}");
|
||||
var player = playerManager.LocalPlayer?.ControlledEntity;
|
||||
var playerGrid = entManager.GetComponentOrNull<TransformComponent>(player)?.GridUid;
|
||||
GridOptions.AddItem($"{uid} {(playerGrid == uid ? " (Current)" : "")}");
|
||||
_data.Add(uid);
|
||||
}
|
||||
|
||||
GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
|
||||
@@ -37,8 +44,8 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
{
|
||||
if (_data == null)
|
||||
return;
|
||||
var dataList = _data.ToList();
|
||||
var selectedGrid = dataList[GridOptions.SelectedId].Owner;
|
||||
|
||||
var selectedGrid = _data[GridOptions.SelectedId];
|
||||
IoCManager.Resolve<IClientConsoleHost>()
|
||||
.ExecuteCommand($"settemp {TileXSpin.Value} {TileYSpin.Value} {selectedGrid} {TemperatureSpin.Value}");
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@ namespace Content.Client.Audio;
|
||||
/// </summary>
|
||||
public sealed class AmbientSoundOverlay : Overlay
|
||||
{
|
||||
private IEntityManager _entManager;
|
||||
private AmbientSoundSystem _ambient;
|
||||
private EntityLookupSystem _lookup;
|
||||
private readonly IEntityManager _entManager;
|
||||
private readonly AmbientSoundSystem _ambient;
|
||||
private readonly EntityLookupSystem _lookup;
|
||||
|
||||
public override OverlaySpace Space => OverlaySpace.WorldSpace;
|
||||
|
||||
@@ -27,6 +27,7 @@ public sealed class AmbientSoundOverlay : Overlay
|
||||
var worldHandle = args.WorldHandle;
|
||||
var ambientQuery = _entManager.GetEntityQuery<AmbientSoundComponent>();
|
||||
var xformQuery = _entManager.GetEntityQuery<TransformComponent>();
|
||||
var xformSystem = _entManager.System<SharedTransformSystem>();
|
||||
|
||||
const float Size = 0.25f;
|
||||
const float Alpha = 0.25f;
|
||||
@@ -40,16 +41,16 @@ public sealed class AmbientSoundOverlay : Overlay
|
||||
{
|
||||
if (_ambient.IsActive(ambientSound))
|
||||
{
|
||||
worldHandle.DrawCircle(xform.WorldPosition, Size, Color.LightGreen.WithAlpha(Alpha * 2f));
|
||||
worldHandle.DrawCircle(xformSystem.GetWorldPosition(xform), Size, Color.LightGreen.WithAlpha(Alpha * 2f));
|
||||
}
|
||||
else
|
||||
{
|
||||
worldHandle.DrawCircle(xform.WorldPosition, Size, Color.Orange.WithAlpha(Alpha));
|
||||
worldHandle.DrawCircle(xformSystem.GetWorldPosition(xform), Size, Color.Orange.WithAlpha(Alpha));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
worldHandle.DrawCircle(xform.WorldPosition, Size, Color.Red.WithAlpha(Alpha));
|
||||
worldHandle.DrawCircle(xformSystem.GetWorldPosition(xform), Size, Color.Red.WithAlpha(Alpha));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Content.Client.Inventory
|
||||
public Action<SlotData>? EntitySlotUpdate = null;
|
||||
public Action<SlotData>? OnSlotAdded = null;
|
||||
public Action<SlotData>? OnSlotRemoved = null;
|
||||
public Action<InventorySlotsComponent>? OnLinkInventorySlots = null;
|
||||
public Action<EntityUid, InventorySlotsComponent>? OnLinkInventorySlots = null;
|
||||
public Action? OnUnlinkInventory = null;
|
||||
public Action<SlotSpriteUpdate>? OnSpriteUpdate = null;
|
||||
|
||||
@@ -138,7 +138,7 @@ namespace Content.Client.Inventory
|
||||
}
|
||||
}
|
||||
|
||||
OnLinkInventorySlots?.Invoke(component);
|
||||
OnLinkInventorySlots?.Invoke(uid, component);
|
||||
}
|
||||
|
||||
public override void Shutdown()
|
||||
@@ -173,7 +173,7 @@ namespace Content.Client.Inventory
|
||||
}
|
||||
|
||||
OnUnlinkInventory?.Invoke();
|
||||
OnLinkInventorySlots?.Invoke(component);
|
||||
OnLinkInventorySlots?.Invoke(player.Value, component);
|
||||
}
|
||||
|
||||
public void SetSlotHighlight(EntityUid owner, InventorySlotsComponent component, string slotName, bool state)
|
||||
|
||||
@@ -28,6 +28,7 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
|
||||
[UISystemDependency] private readonly ClientInventorySystem _inventorySystem = default!;
|
||||
[UISystemDependency] private readonly HandsSystem _handsSystem = default!;
|
||||
|
||||
private EntityUid? _playerUid;
|
||||
private InventorySlotsComponent? _playerInventory;
|
||||
private readonly Dictionary<string, ItemSlotButtonContainer> _slotGroups = new();
|
||||
|
||||
@@ -222,26 +223,26 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
|
||||
return;
|
||||
}
|
||||
|
||||
if (_playerInventory == null)
|
||||
if (_playerInventory == null || _playerUid == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Function == ContentKeyFunctions.ExamineEntity)
|
||||
{
|
||||
_inventorySystem.UIInventoryExamine(slot, _playerInventory.Owner);
|
||||
_inventorySystem.UIInventoryExamine(slot, _playerUid.Value);
|
||||
}
|
||||
else if (args.Function == EngineKeyFunctions.UseSecondary)
|
||||
{
|
||||
_inventorySystem.UIInventoryOpenContextMenu(slot, _playerInventory.Owner);
|
||||
_inventorySystem.UIInventoryOpenContextMenu(slot, _playerUid.Value);
|
||||
}
|
||||
else if (args.Function == ContentKeyFunctions.ActivateItemInWorld)
|
||||
{
|
||||
_inventorySystem.UIInventoryActivateItem(slot, _playerInventory.Owner);
|
||||
_inventorySystem.UIInventoryActivateItem(slot, _playerUid.Value);
|
||||
}
|
||||
else if (args.Function == ContentKeyFunctions.AltActivateItemInWorld)
|
||||
{
|
||||
_inventorySystem.UIInventoryAltActivateItem(slot, _playerInventory.Owner);
|
||||
_inventorySystem.UIInventoryAltActivateItem(slot, _playerUid.Value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,7 +259,7 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
|
||||
|
||||
public void UpdateHover(SlotControl control)
|
||||
{
|
||||
var player = _playerInventory?.Owner;
|
||||
var player = _playerUid;
|
||||
|
||||
if (!control.MouseIsHovering ||
|
||||
_playerInventory == null ||
|
||||
@@ -305,9 +306,10 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
|
||||
_inventorySystem.ReloadInventory();
|
||||
}
|
||||
|
||||
private void LoadSlots(InventorySlotsComponent clientInv)
|
||||
private void LoadSlots(EntityUid clientUid, InventorySlotsComponent clientInv)
|
||||
{
|
||||
UnloadSlots();
|
||||
_playerUid = clientUid;
|
||||
_playerInventory = clientInv;
|
||||
foreach (var slotData in clientInv.SlotData.Values)
|
||||
{
|
||||
@@ -319,6 +321,7 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
|
||||
|
||||
private void UnloadSlots()
|
||||
{
|
||||
_playerUid = null;
|
||||
_playerInventory = null;
|
||||
foreach (var slotGroup in _slotGroups.Values)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using Content.Shared.StepTrigger.Components;
|
||||
using Content.Shared.Tag;
|
||||
using Robust.Shared.Collections;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Physics;
|
||||
@@ -74,26 +72,26 @@ public sealed class StepTriggerSystem : EntitySystem
|
||||
|
||||
foreach (var otherUid in component.Colliding)
|
||||
{
|
||||
UpdateColliding(component, transform, otherUid, query);
|
||||
UpdateColliding(uid, component, transform, otherUid, query);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void UpdateColliding(StepTriggerComponent component, TransformComponent ownerTransform, EntityUid otherUid, EntityQuery<PhysicsComponent> query)
|
||||
private void UpdateColliding(EntityUid uid, StepTriggerComponent component, TransformComponent ownerTransform, EntityUid otherUid, EntityQuery<PhysicsComponent> query)
|
||||
{
|
||||
if (!query.TryGetComponent(otherUid, out var otherPhysics))
|
||||
return;
|
||||
|
||||
// TODO: This shouldn't be calculating based on world AABBs.
|
||||
var ourAabb = _entityLookup.GetWorldAABB(component.Owner, ownerTransform);
|
||||
var ourAabb = _entityLookup.GetWorldAABB(uid, ownerTransform);
|
||||
var otherAabb = _entityLookup.GetWorldAABB(otherUid);
|
||||
|
||||
if (!ourAabb.Intersects(otherAabb))
|
||||
{
|
||||
if (component.CurrentlySteppedOn.Remove(otherUid))
|
||||
{
|
||||
Dirty(component);
|
||||
Dirty(uid, component);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -101,17 +99,16 @@ public sealed class StepTriggerSystem : EntitySystem
|
||||
if (otherPhysics.LinearVelocity.Length() < component.RequiredTriggerSpeed
|
||||
|| component.CurrentlySteppedOn.Contains(otherUid)
|
||||
|| otherAabb.IntersectPercentage(ourAabb) < component.IntersectRatio
|
||||
|| !CanTrigger(component.Owner, otherUid, component))
|
||||
|| !CanTrigger(uid, otherUid, component))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var ev = new StepTriggeredEvent { Source = component.Owner, Tripper = otherUid };
|
||||
RaiseLocalEvent(component.Owner, ref ev, true);
|
||||
var ev = new StepTriggeredEvent { Source = uid, Tripper = otherUid };
|
||||
RaiseLocalEvent(uid, ref ev, true);
|
||||
|
||||
component.CurrentlySteppedOn.Add(otherUid);
|
||||
Dirty(component);
|
||||
return;
|
||||
Dirty(uid, component);
|
||||
}
|
||||
|
||||
private bool CanTrigger(EntityUid uid, EntityUid otherUid, StepTriggerComponent component)
|
||||
@@ -140,7 +137,7 @@ public sealed class StepTriggerSystem : EntitySystem
|
||||
|
||||
if (component.Colliding.Add(otherUid))
|
||||
{
|
||||
Dirty(component);
|
||||
Dirty(uid, component);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +149,7 @@ public sealed class StepTriggerSystem : EntitySystem
|
||||
return;
|
||||
|
||||
component.CurrentlySteppedOn.Remove(otherUid);
|
||||
Dirty(component);
|
||||
Dirty(uid, component);
|
||||
|
||||
if (component.Colliding.Count == 0)
|
||||
{
|
||||
@@ -211,7 +208,7 @@ public sealed class StepTriggerSystem : EntitySystem
|
||||
return;
|
||||
|
||||
component.IntersectRatio = ratio;
|
||||
Dirty(component);
|
||||
Dirty(uid, component);
|
||||
}
|
||||
|
||||
public void SetRequiredTriggerSpeed(EntityUid uid, float speed, StepTriggerComponent? component = null)
|
||||
@@ -223,7 +220,7 @@ public sealed class StepTriggerSystem : EntitySystem
|
||||
return;
|
||||
|
||||
component.RequiredTriggerSpeed = speed;
|
||||
Dirty(component);
|
||||
Dirty(uid, component);
|
||||
}
|
||||
|
||||
public void SetActive(EntityUid uid, bool active, StepTriggerComponent? component = null)
|
||||
@@ -235,7 +232,7 @@ public sealed class StepTriggerSystem : EntitySystem
|
||||
return;
|
||||
|
||||
component.Active = active;
|
||||
Dirty(component);
|
||||
Dirty(uid, component);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,32 +21,32 @@ namespace Content.Shared.Storage.EntitySystems
|
||||
private void CounterEntityInserted(EntityUid uid, ItemCounterComponent itemCounter,
|
||||
EntInsertedIntoContainerMessage args)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(itemCounter.Owner, out AppearanceComponent? appearanceComponent))
|
||||
if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearanceComponent))
|
||||
return;
|
||||
|
||||
var count = GetCount(args, itemCounter);
|
||||
if (count == null)
|
||||
return;
|
||||
|
||||
_appearance.SetData(itemCounter.Owner, StackVisuals.Actual, count, appearanceComponent);
|
||||
_appearance.SetData(uid, StackVisuals.Actual, count, appearanceComponent);
|
||||
|
||||
if (itemCounter.MaxAmount != null)
|
||||
_appearance.SetData(itemCounter.Owner, StackVisuals.MaxCount, itemCounter.MaxAmount, appearanceComponent);
|
||||
_appearance.SetData(uid, StackVisuals.MaxCount, itemCounter.MaxAmount, appearanceComponent);
|
||||
}
|
||||
|
||||
private void CounterEntityRemoved(EntityUid uid, ItemCounterComponent itemCounter,
|
||||
EntRemovedFromContainerMessage args)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(itemCounter.Owner, out AppearanceComponent? appearanceComponent))
|
||||
if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearanceComponent))
|
||||
return;
|
||||
|
||||
var count = GetCount(args, itemCounter);
|
||||
if (count == null)
|
||||
return;
|
||||
|
||||
_appearance.SetData(itemCounter.Owner, StackVisuals.Actual, count, appearanceComponent);
|
||||
_appearance.SetData(uid, StackVisuals.Actual, count, appearanceComponent);
|
||||
if (itemCounter.MaxAmount != null)
|
||||
_appearance.SetData(itemCounter.Owner, StackVisuals.MaxCount, itemCounter.MaxAmount, appearanceComponent);
|
||||
_appearance.SetData(uid, StackVisuals.MaxCount, itemCounter.MaxAmount, appearanceComponent);
|
||||
}
|
||||
|
||||
protected abstract int? GetCount(ContainerModifiedMessage msg, ItemCounterComponent itemCounter);
|
||||
|
||||
@@ -78,7 +78,7 @@ public abstract partial class SharedGunSystem
|
||||
|
||||
Audio.PlayPredicted(component.SoundModeToggle, uid, user);
|
||||
Popup(Loc.GetString("gun-selected-mode", ("mode", GetLocSelector(fire))), uid, user);
|
||||
Dirty(component);
|
||||
Dirty(uid, component);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -8,6 +8,7 @@ using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Shared.Weapons.Ranged.Systems;
|
||||
|
||||
@@ -164,7 +165,7 @@ public partial class SharedGunSystem
|
||||
Popup(Loc.GetString("gun-revolver-insert"), revolverUid, user);
|
||||
UpdateRevolverAppearance(revolverUid, component);
|
||||
UpdateAmmoCount(uid);
|
||||
Dirty(component);
|
||||
Dirty(uid, component);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -223,6 +224,7 @@ public partial class SharedGunSystem
|
||||
return count;
|
||||
}
|
||||
|
||||
[PublicAPI]
|
||||
private int GetRevolverUnspentCount(RevolverAmmoProviderComponent component)
|
||||
{
|
||||
var count = 0;
|
||||
@@ -261,7 +263,8 @@ public partial class SharedGunSystem
|
||||
|
||||
if (slot == null)
|
||||
{
|
||||
if (chamber == null) continue;
|
||||
if (chamber == null)
|
||||
continue;
|
||||
|
||||
// Too lazy to make a new method don't sue me.
|
||||
if (!_netManager.IsClient)
|
||||
@@ -294,7 +297,7 @@ public partial class SharedGunSystem
|
||||
Audio.PlayPredicted(component.SoundEject, revolverUid, user);
|
||||
UpdateAmmoCount(revolverUid);
|
||||
UpdateRevolverAppearance(revolverUid, component);
|
||||
Dirty(component);
|
||||
Dirty(revolverUid, component);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,12 +369,12 @@ public partial class SharedGunSystem
|
||||
component.AmmoContainer.Remove(ent.Value);
|
||||
component.AmmoSlots[index] = null;
|
||||
args.Ammo.Add((ent.Value, EnsureComp<AmmoComponent>(ent.Value)));
|
||||
Transform(ent.Value).Coordinates = args.Coordinates;
|
||||
TransformSystem.SetCoordinates(ent.Value, args.Coordinates);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateRevolverAppearance(uid, component);
|
||||
Dirty(component);
|
||||
Dirty(uid, component);
|
||||
}
|
||||
|
||||
private void Cycle(RevolverAmmoProviderComponent component, int count = 1)
|
||||
|
||||
@@ -329,7 +329,7 @@ public abstract partial class SharedGunSystem : EntitySystem
|
||||
CauseImpulse(fromCoordinates, toCoordinates.Value, user, userPhysics);
|
||||
}
|
||||
|
||||
Dirty(gun);
|
||||
Dirty(gunUid, gun);
|
||||
}
|
||||
|
||||
public void Shoot(
|
||||
@@ -366,7 +366,7 @@ public abstract partial class SharedGunSystem : EntitySystem
|
||||
protected void SetCartridgeSpent(EntityUid uid, CartridgeAmmoComponent cartridge, bool spent)
|
||||
{
|
||||
if (cartridge.Spent != spent)
|
||||
Dirty(cartridge);
|
||||
Dirty(uid, cartridge);
|
||||
|
||||
cartridge.Spent = spent;
|
||||
Appearance.SetData(uid, AmmoVisuals.Spent, spent);
|
||||
@@ -380,14 +380,14 @@ public abstract partial class SharedGunSystem : EntitySystem
|
||||
bool playSound = true)
|
||||
{
|
||||
// TODO: Sound limit version.
|
||||
var offsetPos = (Random.NextVector2(EjectOffset));
|
||||
var offsetPos = Random.NextVector2(EjectOffset);
|
||||
var xform = Transform(entity);
|
||||
|
||||
var coordinates = xform.Coordinates;
|
||||
coordinates = coordinates.Offset(offsetPos);
|
||||
|
||||
xform.LocalRotation = Random.NextAngle();
|
||||
xform.Coordinates = coordinates;
|
||||
TransformSystem.SetLocalRotation(xform, Random.NextAngle());
|
||||
TransformSystem.SetCoordinates(entity, xform, coordinates);
|
||||
|
||||
if (playSound && TryComp<CartridgeAmmoComponent>(entity, out var cartridge))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user