mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
Merge remote-tracking branch 'upstream/master' into upstream-sync
This commit is contained in:
commit
5e78fb6fff
160 changed files with 4872 additions and 11432 deletions
18
.github/workflows/conflict-labeler.yml
vendored
Normal file
18
.github/workflows/conflict-labeler.yml
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
name: Check Merge Conflicts
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request_target:
|
||||
|
||||
jobs:
|
||||
Label:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check for Merge Conflicts
|
||||
uses: eps1lon/actions-label-merge-conflict@513a24fc7dca40990863be2935e059e650728400
|
||||
with:
|
||||
dirtyLabel: "Merge Conflict"
|
||||
repoToken: "${{ secrets.GITHUB_TOKEN }}"
|
||||
commentOnDirty: "This pull request has conflicts, please resolve those before we can evaluate the pull request."
|
||||
|
|
@ -149,7 +149,7 @@ namespace Content.Client.Actions.UI
|
|||
|
||||
private void UpdateItemIcon()
|
||||
{
|
||||
if (Action?.EntityIcon == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent(Action.EntityIcon.Value, out SpriteComponent sprite))
|
||||
if (Action?.EntityIcon == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent(Action.EntityIcon.Value, out SpriteComponent? sprite))
|
||||
{
|
||||
_bigItemSpriteView.Visible = false;
|
||||
_bigItemSpriteView.Sprite = null;
|
||||
|
|
|
|||
|
|
@ -436,7 +436,7 @@ namespace Content.Client.Actions.UI
|
|||
return;
|
||||
}
|
||||
|
||||
if (Action?.EntityIcon == null || !_entMan.TryGetComponent(Action.EntityIcon.Value, out SpriteComponent sprite))
|
||||
if (Action?.EntityIcon == null || !_entMan.TryGetComponent(Action.EntityIcon.Value, out SpriteComponent? sprite))
|
||||
{
|
||||
_bigItemSpriteView.Visible = false;
|
||||
_bigItemSpriteView.Sprite = null;
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ namespace Content.Client.Body.UI
|
|||
|
||||
public void BodyPartOnItemSelected(ItemListSelectedEventArgs args)
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedBodyComponent>(_currentEntity, out var body))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedBodyComponent>(_currentEntity, out var body))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.CharacterInfo;
|
||||
using Content.Shared.Objectives;
|
||||
using Robust.Client.GameObjects;
|
||||
|
|
@ -32,7 +32,7 @@ public sealed class CharacterInfoSystem : EntitySystem
|
|||
|
||||
private void OnCharacterInfoEvent(CharacterInfoEvent msg, EntitySessionEventArgs args)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(msg.EntityUid, out CharacterInfoComponent characterInfoComponent))
|
||||
if (!EntityManager.TryGetComponent(msg.EntityUid, out CharacterInfoComponent? characterInfoComponent))
|
||||
return;
|
||||
|
||||
UpdateUI(characterInfoComponent, msg.JobTitle, msg.Objectives, msg.Briefing);
|
||||
|
|
@ -41,7 +41,7 @@ public sealed class CharacterInfoSystem : EntitySystem
|
|||
characterInfoComponent.Control.SpriteView.Sprite = spriteComponent;
|
||||
}
|
||||
|
||||
if (!EntityManager.TryGetComponent(msg.EntityUid, out MetaDataComponent metadata))
|
||||
if (!EntityManager.TryGetComponent(msg.EntityUid, out MetaDataComponent? metadata))
|
||||
return;
|
||||
characterInfoComponent.Control.NameLabel.Text = metadata.EntityName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -505,7 +505,7 @@ namespace Content.Client.Damage
|
|||
public override void OnChangeData(AppearanceComponent component)
|
||||
{
|
||||
var entities = _entityManager;
|
||||
if (!entities.TryGetComponent(component.Owner, out DamageVisualizerDataComponent damageData))
|
||||
if (!entities.TryGetComponent(component.Owner, out DamageVisualizerDataComponent? damageData))
|
||||
return;
|
||||
|
||||
if (!damageData.Valid)
|
||||
|
|
@ -527,8 +527,8 @@ namespace Content.Client.Damage
|
|||
private void HandleDamage(AppearanceComponent component, DamageVisualizerDataComponent damageData)
|
||||
{
|
||||
var entities = _entityManager;
|
||||
if (!entities.TryGetComponent(component.Owner, out SpriteComponent spriteComponent)
|
||||
|| !entities.TryGetComponent(component.Owner, out DamageableComponent damageComponent))
|
||||
if (!entities.TryGetComponent(component.Owner, out SpriteComponent? spriteComponent)
|
||||
|| !entities.TryGetComponent(component.Owner, out DamageableComponent? damageComponent))
|
||||
return;
|
||||
|
||||
if (_targetLayers != null && _damageOverlayGroups != null)
|
||||
|
|
|
|||
|
|
@ -178,6 +178,7 @@ namespace Content.Client.EscapeMenu.UI.Tabs
|
|||
AddButton(EngineKeyFunctions.EditorGridPlace);
|
||||
AddButton(EngineKeyFunctions.EditorLinePlace);
|
||||
AddButton(EngineKeyFunctions.EditorRotateObject);
|
||||
AddButton(ContentKeyFunctions.EditorCopyObject);
|
||||
|
||||
AddHeader("ui-options-header-dev");
|
||||
AddButton(EngineKeyFunctions.ShowDebugConsole);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,9 @@ namespace Content.Client.Input
|
|||
common.AddFunction(ContentKeyFunctions.Point);
|
||||
common.AddFunction(ContentKeyFunctions.OpenContextMenu);
|
||||
|
||||
// Not in engine, because engine cannot check for sanbox/admin status before starting placement.
|
||||
common.AddFunction(ContentKeyFunctions.EditorCopyObject);
|
||||
|
||||
var human = contexts.GetContext("human");
|
||||
human.AddFunction(ContentKeyFunctions.SwapHands);
|
||||
human.AddFunction(ContentKeyFunctions.Drop);
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ namespace Content.Client.Items.Managers
|
|||
{
|
||||
ISpriteComponent? sprite;
|
||||
if (_entityManager.TryGetComponent(entity, out HandVirtualItemComponent? virtPull)
|
||||
&& _entityManager.TryGetComponent(virtPull.BlockingEntity, out ISpriteComponent pulledSprite))
|
||||
&& _entityManager.TryGetComponent(virtPull.BlockingEntity, out ISpriteComponent? pulledSprite))
|
||||
{
|
||||
sprite = pulledSprite;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Content.Client.Light.Components;
|
||||
using Content.Client.Light.Components;
|
||||
using Content.Shared.Light.Component;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
|
|
@ -19,7 +19,7 @@ namespace Content.Client.Light.Visualizers
|
|||
var entities = IoCManager.Resolve<IEntityManager>();
|
||||
if (component.TryGetData(ExpendableLightVisuals.Behavior, out string lightBehaviourID))
|
||||
{
|
||||
if (entities.TryGetComponent(component.Owner, out LightBehaviourComponent lightBehaviour))
|
||||
if (entities.TryGetComponent(component.Owner, out LightBehaviourComponent? lightBehaviour))
|
||||
{
|
||||
lightBehaviour.StopLightBehaviour();
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ namespace Content.Client.Light.Visualizers
|
|||
{
|
||||
lightBehaviour.StartLightBehaviour(lightBehaviourID);
|
||||
}
|
||||
else if (entities.TryGetComponent(component.Owner, out PointLightComponent light))
|
||||
else if (entities.TryGetComponent(component.Owner, out PointLightComponent? light))
|
||||
{
|
||||
light.Enabled = false;
|
||||
}
|
||||
|
|
@ -40,7 +40,7 @@ namespace Content.Client.Light.Visualizers
|
|||
}
|
||||
|
||||
if (component.TryGetData(ExpendableLightVisuals.State, out ExpendableLightState state)
|
||||
&& entities.TryGetComponent(component.Owner, out ExpendableLightComponent expendableLight))
|
||||
&& entities.TryGetComponent(component.Owner, out ExpendableLightComponent? expendableLight))
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace Content.Client.Light.Visualizers
|
|||
base.OnChangeData(component);
|
||||
|
||||
var entities = IoCManager.Resolve<IEntityManager>();
|
||||
if (!entities.TryGetComponent(component.Owner, out SpriteComponent sprite))
|
||||
if (!entities.TryGetComponent(component.Owner, out SpriteComponent? sprite))
|
||||
return;
|
||||
|
||||
// update sprite state
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ namespace Content.Client.Nutrition.Visualizers
|
|||
base.OnChangeData(component);
|
||||
|
||||
var entities = IoCManager.Resolve<IEntityManager>();
|
||||
if (!entities.TryGetComponent(component.Owner, out ISpriteComponent sprite))
|
||||
if (!entities.TryGetComponent(component.Owner, out ISpriteComponent? sprite))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Shared.Singularity.Components;
|
||||
using JetBrains.Annotations;
|
||||
|
|
@ -52,7 +52,7 @@ namespace Content.Client.ParticleAccelerator
|
|||
base.OnChangeData(component);
|
||||
|
||||
var entities = IoCManager.Resolve<IEntityManager>();
|
||||
if (!entities.TryGetComponent(component.Owner, out ISpriteComponent sprite)) return;
|
||||
if (!entities.TryGetComponent(component.Owner, out ISpriteComponent? sprite)) return;
|
||||
if (!component.TryGetData(ParticleAcceleratorVisuals.VisualState, out ParticleAcceleratorVisualState state))
|
||||
{
|
||||
state = ParticleAcceleratorVisualState.Unpowered;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace Content.Client.Pinpointer
|
|||
base.OnChangeData(component);
|
||||
|
||||
var entities = IoCManager.Resolve<IEntityManager>();
|
||||
if (!entities.TryGetComponent(component.Owner, out SpriteComponent sprite))
|
||||
if (!entities.TryGetComponent(component.Owner, out SpriteComponent? sprite))
|
||||
return;
|
||||
|
||||
// check if pinpointer screen is active
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Content.Shared.PneumaticCannon;
|
||||
using Content.Shared.PneumaticCannon;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
|
@ -12,7 +12,7 @@ namespace Content.Client.PneumaticCannon
|
|||
base.OnChangeData(component);
|
||||
|
||||
var entities = IoCManager.Resolve<IEntityManager>();
|
||||
if (!entities.TryGetComponent(component.Owner, out SpriteComponent sprite))
|
||||
if (!entities.TryGetComponent(component.Owner, out SpriteComponent? sprite))
|
||||
return;
|
||||
|
||||
if (component.TryGetData(PneumaticCannonVisuals.Tank, out bool tank))
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ namespace Content.Client.Popups
|
|||
|
||||
if (Entity == null)
|
||||
screenCoords = _eyeManager.CoordinatesToScreen(InitialPos);
|
||||
else if (_entityManager.TryGetComponent(Entity.Value, out TransformComponent xform)
|
||||
else if (_entityManager.TryGetComponent(Entity.Value, out TransformComponent? xform)
|
||||
&& xform.MapID == _eyeManager.CurrentMap)
|
||||
screenCoords = _eyeManager.CoordinatesToScreen(xform.Coordinates);
|
||||
else
|
||||
|
|
|
|||
|
|
@ -12,12 +12,14 @@ using Robust.Client.Debugging;
|
|||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Input;
|
||||
using Robust.Client.Placement;
|
||||
using Robust.Client.Placement.Modes;
|
||||
using Robust.Client.ResourceManagement;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.Input.Binding;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Players;
|
||||
using static Robust.Client.UserInterface.Controls.BoxContainer;
|
||||
|
||||
namespace Content.Client.Sandbox
|
||||
|
|
@ -117,6 +119,7 @@ namespace Content.Client.Sandbox
|
|||
{
|
||||
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
|
||||
[Dependency] private readonly IGameHud _gameHud = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly IPlacementManager _placementManager = default!;
|
||||
[Dependency] private readonly IResourceCache _resourceCache = default!;
|
||||
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
|
||||
|
|
@ -148,6 +151,53 @@ namespace Content.Client.Sandbox
|
|||
InputCmdHandler.FromDelegate(session => ToggleTilesWindow()));
|
||||
_inputManager.SetInputCommand(ContentKeyFunctions.OpenDecalSpawnWindow,
|
||||
InputCmdHandler.FromDelegate(session => ToggleDecalsWindow()));
|
||||
|
||||
CommandBinds.Builder
|
||||
.Bind(ContentKeyFunctions.EditorCopyObject, new PointerInputCmdHandler(OnCopy))
|
||||
.Register<SandboxSystem>();
|
||||
}
|
||||
|
||||
private bool OnCopy(ICommonSession? session, EntityCoordinates coords, EntityUid uid)
|
||||
{
|
||||
if (!CanSandbox())
|
||||
return false;
|
||||
|
||||
// Try copy entity.
|
||||
if (uid.IsValid()
|
||||
&& EntityManager.TryGetComponent(uid, out MetaDataComponent? comp)
|
||||
&& !comp.EntityDeleted)
|
||||
{
|
||||
if (comp.EntityPrototype == null || comp.EntityPrototype.NoSpawn || comp.EntityPrototype.Abstract)
|
||||
return false;
|
||||
|
||||
if (_placementManager.Eraser)
|
||||
_placementManager.ToggleEraser();
|
||||
|
||||
_placementManager.BeginPlacing(new()
|
||||
{
|
||||
EntityType = comp.EntityPrototype.ID,
|
||||
IsTile = false,
|
||||
TileType = 0,
|
||||
PlacementOption = comp.EntityPrototype.PlacementMode
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
// Try copy tile.
|
||||
if (!_mapManager.TryFindGridAt(coords.ToMap(EntityManager), out var grid) || !grid.TryGetTileRef(coords, out var tileRef))
|
||||
return false;
|
||||
|
||||
if (_placementManager.Eraser)
|
||||
_placementManager.ToggleEraser();
|
||||
|
||||
_placementManager.BeginPlacing(new()
|
||||
{
|
||||
EntityType = null,
|
||||
IsTile = true,
|
||||
TileType = tileRef.Tile.TypeId,
|
||||
PlacementOption = nameof(AlignTileAny)
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
private void OnAdminStatus()
|
||||
|
|
@ -196,6 +246,7 @@ namespace Content.Client.Sandbox
|
|||
// TODO: Gamehud moment
|
||||
_gameHud.SandboxButtonToggled -= SandboxButtonPressed;
|
||||
_adminManager.AdminStatusUpdated -= OnAdminStatus;
|
||||
CommandBinds.Unregister<SandboxSystem>();
|
||||
}
|
||||
|
||||
private void OnSandboxStatus(MsgSandboxStatus ev)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using Content.Shared.Singularity.Components;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.Animations;
|
||||
|
|
@ -54,8 +54,8 @@ namespace Content.Client.Singularity.Visualizers
|
|||
base.OnChangeData(component);
|
||||
|
||||
var entities = IoCManager.Resolve<IEntityManager>();
|
||||
if (!entities.TryGetComponent(component.Owner, out ISpriteComponent sprite)) return;
|
||||
if (!entities.TryGetComponent(component.Owner, out AnimationPlayerComponent animPlayer)) return;
|
||||
if (!entities.TryGetComponent(component.Owner, out ISpriteComponent? sprite)) return;
|
||||
if (!entities.TryGetComponent(component.Owner, out AnimationPlayerComponent? animPlayer)) return;
|
||||
if (!component.TryGetData(RadiationCollectorVisuals.VisualState, out RadiationCollectorVisualState state))
|
||||
{
|
||||
state = RadiationCollectorVisualState.Deactive;
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ namespace Content.Client.Stack
|
|||
base.OnChangeData(component);
|
||||
|
||||
var entities = IoCManager.Resolve<IEntityManager>();
|
||||
if (entities.TryGetComponent(component.Owner, out ISpriteComponent spriteComponent))
|
||||
if (entities.TryGetComponent(component.Owner, out ISpriteComponent? spriteComponent))
|
||||
{
|
||||
if (_isComposite)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Content.Shared.Storage.Components;
|
||||
using Content.Shared.Storage.Components;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
|
@ -47,7 +47,7 @@ namespace Content.Client.Storage.Visualizers
|
|||
var entities = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
if (_openIcon == null ||
|
||||
!entities.TryGetComponent(component.Owner, out SpriteComponent spriteComponent))
|
||||
!entities.TryGetComponent(component.Owner, out SpriteComponent? spriteComponent))
|
||||
return;
|
||||
|
||||
if (!component.TryGetData<SharedBagState>(SharedBagOpenVisuals.BagState, out var bagState))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Shared.Storage.Components;
|
||||
using JetBrains.Annotations;
|
||||
|
|
@ -32,7 +32,7 @@ namespace Content.Client.Storage.Visualizers
|
|||
base.OnChangeData(component);
|
||||
|
||||
var entities = IoCManager.Resolve<IEntityManager>();
|
||||
if (entities.TryGetComponent(component.Owner, out ISpriteComponent spriteComponent))
|
||||
if (entities.TryGetComponent(component.Owner, out ISpriteComponent? spriteComponent))
|
||||
{
|
||||
if (_spriteLayers.Count == 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ public sealed class SurveillanceCameraMonitorBoundUserInterface : BoundUserInter
|
|||
_currentCamera = cast.ActiveCamera;
|
||||
}
|
||||
|
||||
if (_entityManager.TryGetComponent(cast.ActiveCamera, out EyeComponent eye))
|
||||
if (_entityManager.TryGetComponent(cast.ActiveCamera, out EyeComponent? eye))
|
||||
{
|
||||
_window.UpdateState(eye.Eye, cast.Subnets, cast.ActiveAddress, cast.ActiveSubnet, cast.Cameras);
|
||||
}
|
||||
|
|
|
|||
18
Content.Client/Weapons/Ranged/Commands/ShowSpreadCommand.cs
Normal file
18
Content.Client/Weapons/Ranged/Commands/ShowSpreadCommand.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
using Content.Client.Weapons.Ranged.Systems;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
namespace Content.Client.Weapons.Ranged;
|
||||
|
||||
public sealed class ShowSpreadCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "showspread";
|
||||
public string Description => $"Shows gun spread overlay for debugging";
|
||||
public string Help => $"{Command}";
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var system = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<GunSystem>();
|
||||
system.SpreadOverlay ^= true;
|
||||
|
||||
shell.WriteLine($"Set spread overlay to {system.SpreadOverlay}");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
using Content.Client.Weapons.Ranged.Systems;
|
||||
|
||||
namespace Content.Client.Weapons.Ranged.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Visualizer for gun mag presence; can change states based on ammo count or toggle visibility entirely.
|
||||
/// </summary>
|
||||
[RegisterComponent, Friend(typeof(GunSystem))]
|
||||
public sealed class MagazineVisualsComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// What RsiState we use.
|
||||
/// </summary>
|
||||
[DataField("magState")] public string? MagState;
|
||||
|
||||
/// <summary>
|
||||
/// How many steps there are
|
||||
/// </summary>
|
||||
[DataField("steps")] public int MagSteps;
|
||||
|
||||
/// <summary>
|
||||
/// Should we hide when the count is 0
|
||||
/// </summary>
|
||||
[DataField("zeroVisible")] public bool ZeroVisible;
|
||||
}
|
||||
|
||||
public enum GunVisualLayers : byte
|
||||
{
|
||||
Base,
|
||||
BaseUnshaded,
|
||||
Mag,
|
||||
MagUnshaded,
|
||||
}
|
||||
76
Content.Client/Weapons/Ranged/GunSpreadOverlay.cs
Normal file
76
Content.Client/Weapons/Ranged/GunSpreadOverlay.cs
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
using Content.Client.Weapons.Ranged.Systems;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Input;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Client.Weapons.Ranged;
|
||||
|
||||
public sealed class GunSpreadOverlay : Overlay
|
||||
{
|
||||
public override OverlaySpace Space => OverlaySpace.WorldSpace;
|
||||
|
||||
private IEntityManager _entManager;
|
||||
private IEyeManager _eye;
|
||||
private IGameTiming _timing;
|
||||
private IInputManager _input;
|
||||
private IPlayerManager _player;
|
||||
private GunSystem _guns;
|
||||
|
||||
public GunSpreadOverlay(IEntityManager entManager, IEyeManager eyeManager, IGameTiming timing, IInputManager input, IPlayerManager player, GunSystem system)
|
||||
{
|
||||
_entManager = entManager;
|
||||
_eye = eyeManager;
|
||||
_input = input;
|
||||
_timing = timing;
|
||||
_player = player;
|
||||
_guns = system;
|
||||
}
|
||||
|
||||
protected override void Draw(in OverlayDrawArgs args)
|
||||
{
|
||||
var worldHandle = args.WorldHandle;
|
||||
|
||||
var player = _player.LocalPlayer?.ControlledEntity;
|
||||
|
||||
if (player == null ||
|
||||
!_entManager.TryGetComponent<TransformComponent>(player, out var xform)) return;
|
||||
|
||||
var mapPos = xform.MapPosition;
|
||||
|
||||
if (mapPos.MapId == MapId.Nullspace) return;
|
||||
|
||||
var gun = _guns.GetGun(player.Value);
|
||||
|
||||
if (gun == null) return;
|
||||
|
||||
var mouseScreenPos = _input.MouseScreenPosition;
|
||||
var mousePos = _eye.ScreenToMap(mouseScreenPos);
|
||||
|
||||
if (mapPos.MapId != mousePos.MapId) return;
|
||||
|
||||
// (☞゚ヮ゚)☞
|
||||
var maxSpread = gun.MaxAngle;
|
||||
var minSpread = gun.MinAngle;
|
||||
var timeSinceLastFire = (_timing.CurTime - gun.NextFire).TotalSeconds;
|
||||
var currentAngle = new Angle(MathHelper.Clamp(gun.CurrentAngle.Theta - gun.AngleDecay.Theta * timeSinceLastFire,
|
||||
gun.MinAngle.Theta, gun.MaxAngle.Theta));
|
||||
var direction = (mousePos.Position - mapPos.Position);
|
||||
|
||||
worldHandle.DrawLine(mapPos.Position, mousePos.Position + direction, Color.Orange);
|
||||
|
||||
// Show max spread either side
|
||||
worldHandle.DrawLine(mapPos.Position, mousePos.Position + maxSpread.RotateVec(direction), Color.Red);
|
||||
worldHandle.DrawLine(mapPos.Position, mousePos.Position + (-maxSpread).RotateVec(direction), Color.Red);
|
||||
|
||||
// Show min spread either side
|
||||
worldHandle.DrawLine(mapPos.Position, mousePos.Position + minSpread.RotateVec(direction), Color.Green);
|
||||
worldHandle.DrawLine(mapPos.Position, mousePos.Position + (-minSpread).RotateVec(direction), Color.Green);
|
||||
|
||||
// Show current angle
|
||||
worldHandle.DrawLine(mapPos.Position, mousePos.Position + currentAngle.RotateVec(direction), Color.Yellow);
|
||||
worldHandle.DrawLine(mapPos.Position, mousePos.Position + (-currentAngle).RotateVec(direction), Color.Yellow);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,62 +1,61 @@
|
|||
using Content.Client.Weapons.Ranged.Components;
|
||||
using Content.Shared.Rounding;
|
||||
using Content.Shared.Weapons.Ranged.Systems;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using SharedGunSystem = Content.Shared.Weapons.Ranged.Systems.SharedGunSystem;
|
||||
|
||||
namespace Content.Client.Weapons.Ranged.Components;
|
||||
namespace Content.Client.Weapons.Ranged.Systems;
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class MagVisualizer : AppearanceVisualizer
|
||||
public sealed partial class GunSystem
|
||||
{
|
||||
[DataField("magState")] private string? _magState;
|
||||
[DataField("steps")] private int _magSteps;
|
||||
[DataField("zeroVisible")] private bool _zeroVisible;
|
||||
|
||||
public override void InitializeEntity(EntityUid entity)
|
||||
private void InitializeMagazineVisuals()
|
||||
{
|
||||
base.InitializeEntity(entity);
|
||||
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(entity);
|
||||
SubscribeLocalEvent<MagazineVisualsComponent, ComponentInit>(OnMagazineVisualsInit);
|
||||
SubscribeLocalEvent<MagazineVisualsComponent, AppearanceChangeEvent>(OnMagazineVisualsChange);
|
||||
}
|
||||
|
||||
private void OnMagazineVisualsInit(EntityUid uid, MagazineVisualsComponent component, ComponentInit args)
|
||||
{
|
||||
if (!TryComp<SpriteComponent>(uid, out var sprite)) return;
|
||||
|
||||
if (sprite.LayerMapTryGet(GunVisualLayers.Mag, out _))
|
||||
{
|
||||
sprite.LayerSetState(GunVisualLayers.Mag, $"{_magState}-{_magSteps - 1}");
|
||||
sprite.LayerSetState(GunVisualLayers.Mag, $"{component.MagState}-{component.MagSteps - 1}");
|
||||
sprite.LayerSetVisible(GunVisualLayers.Mag, false);
|
||||
}
|
||||
|
||||
if (sprite.LayerMapTryGet(GunVisualLayers.MagUnshaded, out _))
|
||||
{
|
||||
sprite.LayerSetState(GunVisualLayers.MagUnshaded, $"{_magState}-unshaded-{_magSteps - 1}");
|
||||
sprite.LayerSetState(GunVisualLayers.MagUnshaded, $"{component.MagState}-unshaded-{component.MagSteps - 1}");
|
||||
sprite.LayerSetVisible(GunVisualLayers.MagUnshaded, false);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnChangeData(AppearanceComponent component)
|
||||
private void OnMagazineVisualsChange(EntityUid uid, MagazineVisualsComponent component, ref AppearanceChangeEvent args)
|
||||
{
|
||||
base.OnChangeData(component);
|
||||
|
||||
// tl;dr
|
||||
// 1.If no mag then hide it OR
|
||||
// 2. If step 0 isn't visible then hide it (mag or unshaded)
|
||||
// 3. Otherwise just do mag / unshaded as is
|
||||
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner);
|
||||
var sprite = args.Sprite;
|
||||
|
||||
if (!component.TryGetData(AmmoVisuals.MagLoaded, out bool magloaded) ||
|
||||
magloaded)
|
||||
if (sprite == null) return;
|
||||
|
||||
if (!args.AppearanceData.TryGetValue(AmmoVisuals.MagLoaded, out var magloaded) ||
|
||||
magloaded is true)
|
||||
{
|
||||
if (!component.TryGetData(AmmoVisuals.AmmoMax, out int capacity))
|
||||
if (!args.AppearanceData.TryGetValue(AmmoVisuals.AmmoMax, out var capacity))
|
||||
{
|
||||
capacity = _magSteps;
|
||||
capacity = component.MagSteps;
|
||||
}
|
||||
|
||||
if (!component.TryGetData(AmmoVisuals.AmmoCount, out int current))
|
||||
if (!args.AppearanceData.TryGetValue(AmmoVisuals.AmmoCount, out var current))
|
||||
{
|
||||
current = _magSteps;
|
||||
current = component.MagSteps;
|
||||
}
|
||||
|
||||
var step = ContentHelpers.RoundToLevels(current, capacity, _magSteps);
|
||||
var step = ContentHelpers.RoundToLevels((int) current, (int) capacity, component.MagSteps);
|
||||
|
||||
if (step == 0 && !_zeroVisible)
|
||||
if (step == 0 && !component.ZeroVisible)
|
||||
{
|
||||
if (sprite.LayerMapTryGet(GunVisualLayers.Mag, out _))
|
||||
{
|
||||
|
|
@ -74,13 +73,13 @@ public sealed class MagVisualizer : AppearanceVisualizer
|
|||
if (sprite.LayerMapTryGet(GunVisualLayers.Mag, out _))
|
||||
{
|
||||
sprite.LayerSetVisible(GunVisualLayers.Mag, true);
|
||||
sprite.LayerSetState(GunVisualLayers.Mag, $"{_magState}-{step}");
|
||||
sprite.LayerSetState(GunVisualLayers.Mag, $"{component.MagState}-{step}");
|
||||
}
|
||||
|
||||
if (sprite.LayerMapTryGet(GunVisualLayers.MagUnshaded, out _))
|
||||
{
|
||||
sprite.LayerSetVisible(GunVisualLayers.MagUnshaded, true);
|
||||
sprite.LayerSetState(GunVisualLayers.MagUnshaded, $"{_magState}-unshaded-{step}");
|
||||
sprite.LayerSetState(GunVisualLayers.MagUnshaded, $"{component.MagState}-unshaded-{step}");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -97,11 +96,3 @@ public sealed class MagVisualizer : AppearanceVisualizer
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum GunVisualLayers : byte
|
||||
{
|
||||
Base,
|
||||
BaseUnshaded,
|
||||
Mag,
|
||||
MagUnshaded,
|
||||
}
|
||||
|
|
@ -13,6 +13,7 @@ using Robust.Shared.Audio;
|
|||
using Robust.Shared.Input;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
using SharedGunSystem = Content.Shared.Weapons.Ranged.Systems.SharedGunSystem;
|
||||
|
||||
|
|
@ -27,6 +28,34 @@ public sealed partial class GunSystem : SharedGunSystem
|
|||
[Dependency] private readonly EffectSystem _effects = default!;
|
||||
[Dependency] private readonly InputSystem _inputSystem = default!;
|
||||
|
||||
public bool SpreadOverlay
|
||||
{
|
||||
get => _spreadOverlay;
|
||||
set
|
||||
{
|
||||
if (_spreadOverlay == value) return;
|
||||
_spreadOverlay = value;
|
||||
var overlayManager = IoCManager.Resolve<IOverlayManager>();
|
||||
|
||||
if (_spreadOverlay)
|
||||
{
|
||||
overlayManager.AddOverlay(new GunSpreadOverlay(
|
||||
EntityManager,
|
||||
IoCManager.Resolve<IEyeManager>(),
|
||||
IoCManager.Resolve<IGameTiming>(),
|
||||
IoCManager.Resolve<IInputManager>(),
|
||||
IoCManager.Resolve<IPlayerManager>(),
|
||||
this));
|
||||
}
|
||||
else
|
||||
{
|
||||
overlayManager.RemoveOverlay<GunSpreadOverlay>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool _spreadOverlay;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
|
@ -36,6 +65,7 @@ public sealed partial class GunSystem : SharedGunSystem
|
|||
// Plays animated effects on the client.
|
||||
SubscribeNetworkEvent<HitscanEvent>(OnHitscan);
|
||||
|
||||
InitializeMagazineVisuals();
|
||||
InitializeSpentAmmo();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public sealed class FluidSpill : ContentIntegrationTest
|
|||
{
|
||||
foreach (var uid in mapGrid.GetAnchoredEntities(pos))
|
||||
{
|
||||
if (entityManager.TryGetComponent(uid, out PuddleComponent puddleComponent))
|
||||
if (entityManager.TryGetComponent(uid, out PuddleComponent? puddleComponent))
|
||||
return puddleComponent;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,8 +66,8 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking
|
|||
entityManager.GetComponent<TransformComponent>(human).WorldPosition = entityManager.GetComponent<TransformComponent>(otherHuman).WorldPosition;
|
||||
|
||||
// Test for components existing
|
||||
Assert.True(entityManager.TryGetComponent(human, out cuffed), $"Human has no {nameof(CuffableComponent)}");
|
||||
Assert.True(entityManager.TryGetComponent(human, out hands), $"Human has no {nameof(HandsComponent)}");
|
||||
Assert.True(entityManager.TryGetComponent(human, out cuffed!), $"Human has no {nameof(CuffableComponent)}");
|
||||
Assert.True(entityManager.TryGetComponent(human, out hands!), $"Human has no {nameof(HandsComponent)}");
|
||||
Assert.True(entityManager.TryGetComponent(human, out SharedBodyComponent? _), $"Human has no {nameof(SharedBodyComponent)}");
|
||||
Assert.True(entityManager.TryGetComponent(cuffs, out HandcuffComponent? _), $"Handcuff has no {nameof(HandcuffComponent)}");
|
||||
Assert.True(entityManager.TryGetComponent(secondCuffs, out HandcuffComponent? _), $"Second handcuffs has no {nameof(HandcuffComponent)}");
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement
|
|||
|
||||
// Test for climb components existing
|
||||
// Players and tables should have these in their prototypes.
|
||||
Assert.That(entityManager.TryGetComponent(human, out climbing), "Human has no climbing");
|
||||
Assert.That(entityManager.TryGetComponent(human, out climbing!), "Human has no climbing");
|
||||
Assert.That(entityManager.TryGetComponent(table, out ClimbableComponent? _), "Table has no climbable");
|
||||
|
||||
// TODO ShadowCommander: Implement climbing test
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ namespace Content.MapRenderer.Painters
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!_cEntityManager.TryGetComponent(entity, out SpriteComponent sprite))
|
||||
if (!_cEntityManager.TryGetComponent(entity, out SpriteComponent? sprite))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
$"No sprite component found on an entity for which a server sprite component exists. Prototype id: {prototype.ID}");
|
||||
|
|
|
|||
|
|
@ -660,7 +660,8 @@ namespace Content.Server.AI.Steering
|
|||
// So if 2 entities are moving towards each other and both detect a collision they'll both move in the same direction
|
||||
// i.e. towards the right
|
||||
if (EntityManager.TryGetComponent(physicsEntity, out IPhysBody? otherPhysics) &&
|
||||
Vector2.Dot(otherPhysics.LinearVelocity, direction) > 0)
|
||||
(!otherPhysics.Hard ||
|
||||
Vector2.Dot(otherPhysics.LinearVelocity, direction) > 0))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ namespace Content.Server.Administration.Commands
|
|||
return;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(uid, out SolutionContainerManagerComponent man))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(uid, out SolutionContainerManagerComponent? man))
|
||||
{
|
||||
shell.WriteLine($"Entity does not have any solutions.");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace Content.Server.Administration.Commands
|
|||
return;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(uid, out SolutionContainerManagerComponent man))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(uid, out SolutionContainerManagerComponent? man))
|
||||
{
|
||||
shell.WriteLine($"Entity does not have any solutions.");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace Content.Server.Administration.Commands
|
|||
return;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(uid, out SolutionContainerManagerComponent man))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(uid, out SolutionContainerManagerComponent? man))
|
||||
{
|
||||
shell.WriteLine($"Entity does not have any solutions.");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace Content.Server.Administration.Commands
|
|||
return;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(uid, out SolutionContainerManagerComponent man))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(uid, out SolutionContainerManagerComponent? man))
|
||||
{
|
||||
shell.WriteLine($"Entity does not have any solutions.");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Text.Json;
|
||||
using System.Text.Json;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
namespace Content.Server.Administration.Logs.Converters;
|
||||
|
|
@ -14,7 +14,7 @@ public sealed class EntityUidConverter : AdminLogConverter<EntityUid>
|
|||
|
||||
writer.WriteNumber("id", (int) value);
|
||||
|
||||
if (entities.TryGetComponent(value, out MetaDataComponent metaData))
|
||||
if (entities.TryGetComponent(value, out MetaDataComponent? metaData))
|
||||
{
|
||||
writer.WriteString("name", metaData.EntityName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace Content.Server.Alert.Click
|
|||
{
|
||||
var ps = EntitySystem.Get<SharedPullingSystem>();
|
||||
var playerTarget = ps.GetPulled(player);
|
||||
if (playerTarget != default && IoCManager.Resolve<IEntityManager>().TryGetComponent(playerTarget, out SharedPullableComponent playerPullable))
|
||||
if (playerTarget != default && IoCManager.Resolve<IEntityManager>().TryGetComponent(playerTarget, out SharedPullableComponent? playerPullable))
|
||||
{
|
||||
ps.TryStopPull(playerPullable);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,7 +182,6 @@ public sealed class AlertLevelSystem : EntitySystem
|
|||
|
||||
if (announce)
|
||||
{
|
||||
|
||||
_chatSystem.DispatchStationAnnouncement(station, announcementFull, playDefaultSound: playDefault,
|
||||
colorOverride: detail.Color, sender: stationName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||
{
|
||||
var otherFixture = args.OtherFixture.Body.Owner;
|
||||
|
||||
if (!EntityManager.TryGetComponent(otherFixture, out FlammableComponent flammable))
|
||||
if (!EntityManager.TryGetComponent(otherFixture, out FlammableComponent? flammable))
|
||||
return;
|
||||
|
||||
flammable.FireStacks += component.FireStacks;
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ namespace Content.Server.Atmos.Monitor
|
|||
{
|
||||
public override void Execute(EntityUid uid)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent alarm))
|
||||
if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent? alarm))
|
||||
return;
|
||||
|
||||
foreach (var (addr, device) in alarm.DeviceData)
|
||||
|
|
@ -110,7 +110,7 @@ namespace Content.Server.Atmos.Monitor
|
|||
{
|
||||
public override void Execute(EntityUid uid)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent alarm))
|
||||
if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent? alarm))
|
||||
return;
|
||||
|
||||
foreach (var (addr, device) in alarm.DeviceData)
|
||||
|
|
@ -132,7 +132,7 @@ namespace Content.Server.Atmos.Monitor
|
|||
{
|
||||
public override void Execute(EntityUid uid)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent alarm))
|
||||
if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent? alarm))
|
||||
return;
|
||||
|
||||
foreach (var (addr, device) in alarm.DeviceData)
|
||||
|
|
@ -154,7 +154,7 @@ namespace Content.Server.Atmos.Monitor
|
|||
{
|
||||
public override void Execute(EntityUid uid)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent alarm))
|
||||
if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent? alarm))
|
||||
return;
|
||||
|
||||
foreach (var (addr, device) in alarm.DeviceData)
|
||||
|
|
@ -183,9 +183,9 @@ namespace Content.Server.Atmos.Monitor
|
|||
|
||||
public override void Execute(EntityUid uid)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent alarm)
|
||||
|| !EntityManager.TryGetComponent(uid, out AtmosMonitorComponent monitor)
|
||||
|| !EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent alarmable))
|
||||
if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent? alarm)
|
||||
|| !EntityManager.TryGetComponent(uid, out AtmosMonitorComponent? monitor)
|
||||
|| !EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent? alarmable))
|
||||
return;
|
||||
|
||||
_devices = alarm.DeviceData;
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||
/// <param name="data">The data to send to the device.</param>
|
||||
public void SetData(EntityUid uid, string address, IAtmosDeviceData data)
|
||||
{
|
||||
if (EntityManager.TryGetComponent(uid, out AtmosMonitorComponent monitor)
|
||||
if (EntityManager.TryGetComponent(uid, out AtmosMonitorComponent? monitor)
|
||||
&& !monitor.NetEnabled)
|
||||
return;
|
||||
|
||||
|
|
@ -93,7 +93,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||
/// </summary>
|
||||
public void SyncAllDevices(EntityUid uid)
|
||||
{
|
||||
if (EntityManager.TryGetComponent(uid, out AtmosMonitorComponent monitor)
|
||||
if (EntityManager.TryGetComponent(uid, out AtmosMonitorComponent? monitor)
|
||||
&& !monitor.NetEnabled)
|
||||
return;
|
||||
|
||||
|
|
@ -111,7 +111,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||
/// <param name="address">The address of the device.</param>
|
||||
public void SyncDevice(EntityUid uid, string address)
|
||||
{
|
||||
if (EntityManager.TryGetComponent(uid, out AtmosMonitorComponent monitor)
|
||||
if (EntityManager.TryGetComponent(uid, out AtmosMonitorComponent? monitor)
|
||||
&& !monitor.NetEnabled)
|
||||
return;
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||
/// <param name="mode">The mode to sync with the rest of the network.</param>
|
||||
public void SyncMode(EntityUid uid, AirAlarmMode mode)
|
||||
{
|
||||
if (EntityManager.TryGetComponent(uid, out AtmosMonitorComponent monitor)
|
||||
if (EntityManager.TryGetComponent(uid, out AtmosMonitorComponent? monitor)
|
||||
&& !monitor.NetEnabled)
|
||||
return;
|
||||
|
||||
|
|
@ -196,7 +196,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||
if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
|
||||
return;
|
||||
|
||||
if (EntityManager.TryGetComponent(uid, out WiresComponent wire) && wire.IsPanelOpen)
|
||||
if (EntityManager.TryGetComponent(uid, out WiresComponent? wire) && wire.IsPanelOpen)
|
||||
{
|
||||
args.Handled = false;
|
||||
return;
|
||||
|
|
@ -227,7 +227,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||
private void OnUpdateAlarmMode(EntityUid uid, AirAlarmComponent component, AirAlarmUpdateAlarmModeMessage args)
|
||||
{
|
||||
string addr = string.Empty;
|
||||
if (EntityManager.TryGetComponent(uid, out DeviceNetworkComponent netConn)) addr = netConn.Address;
|
||||
if (EntityManager.TryGetComponent(uid, out DeviceNetworkComponent? netConn)) addr = netConn.Address;
|
||||
if (AccessCheck(uid, args.Session.AttachedEntity, component))
|
||||
SetMode(uid, addr, args.Mode, true, false);
|
||||
else
|
||||
|
|
@ -255,7 +255,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||
if (!Resolve(uid, ref component))
|
||||
return false;
|
||||
|
||||
if (!EntityManager.TryGetComponent(uid, out AccessReaderComponent reader) || user == null)
|
||||
if (!EntityManager.TryGetComponent(uid, out AccessReaderComponent? reader) || user == null)
|
||||
return false;
|
||||
|
||||
if (!_accessSystem.IsAllowed(user.Value, reader))
|
||||
|
|
@ -276,7 +276,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||
}
|
||||
|
||||
string addr = string.Empty;
|
||||
if (EntityManager.TryGetComponent(uid, out DeviceNetworkComponent netConn)) addr = netConn.Address;
|
||||
if (EntityManager.TryGetComponent(uid, out DeviceNetworkComponent? netConn)) addr = netConn.Address;
|
||||
|
||||
|
||||
if (args.HighestNetworkType == AtmosMonitorAlarmType.Danger)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||
{
|
||||
if (component.IgnoreAlarms) return;
|
||||
|
||||
if (!EntityManager.TryGetComponent(uid, out DeviceNetworkComponent netConn))
|
||||
if (!EntityManager.TryGetComponent(uid, out DeviceNetworkComponent? netConn))
|
||||
return;
|
||||
|
||||
if (args.Data.TryGetValue(DeviceNetworkConstants.Command, out string? cmd)
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||
// the highest network alarm state at any time
|
||||
if (!args.Data.TryGetValue(DeviceNetworkConstants.Command, out string? cmd)
|
||||
|| !EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent? alarmable)
|
||||
|| !EntityManager.TryGetComponent(uid, out DeviceNetworkComponent netConn))
|
||||
|| !EntityManager.TryGetComponent(uid, out DeviceNetworkComponent? netConn))
|
||||
return;
|
||||
|
||||
// ignore packets from self, ignore from different frequency
|
||||
|
|
@ -342,7 +342,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||
|
||||
if (state == AtmosMonitorAlarmType.Danger) PlayAlertSound(uid, monitor);
|
||||
|
||||
if (EntityManager.TryGetComponent(monitor.Owner, out AtmosAlarmableComponent alarmable)
|
||||
if (EntityManager.TryGetComponent(monitor.Owner, out AtmosAlarmableComponent? alarmable)
|
||||
&& !alarmable.IgnoreAlarms)
|
||||
RaiseLocalEvent(monitor.Owner, new AtmosMonitorAlarmEvent(monitor.LastAlarmState, monitor.HighestAlarmInNetwork));
|
||||
// TODO: Central system that grabs *all* alarms from wired network
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||
private void OnCanisterChangeReleaseValve(EntityUid uid, GasCanisterComponent canister, GasCanisterChangeReleaseValveMessage args)
|
||||
{
|
||||
var impact = LogImpact.High;
|
||||
if (EntityManager.TryGetComponent(uid, out ContainerManagerComponent containerManager)
|
||||
if (EntityManager.TryGetComponent(uid, out ContainerManagerComponent? containerManager)
|
||||
&& containerManager.TryGetContainer(canister.ContainerName, out var container))
|
||||
impact = container.ContainedEntities.Count != 0 ? LogImpact.Medium : LogImpact.High;
|
||||
|
||||
|
|
|
|||
|
|
@ -159,8 +159,8 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||
|
||||
private void OnPacketRecv(EntityUid uid, GasVentPumpComponent component, DeviceNetworkPacketEvent args)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(uid, out DeviceNetworkComponent netConn)
|
||||
|| !EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent alarmable)
|
||||
if (!EntityManager.TryGetComponent(uid, out DeviceNetworkComponent? netConn)
|
||||
|| !EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent? alarmable)
|
||||
|| !args.Data.TryGetValue(DeviceNetworkConstants.Command, out var cmd))
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -130,8 +130,8 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||
|
||||
private void OnPacketRecv(EntityUid uid, GasVentScrubberComponent component, DeviceNetworkPacketEvent args)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(uid, out DeviceNetworkComponent netConn)
|
||||
|| !EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent alarmable)
|
||||
if (!EntityManager.TryGetComponent(uid, out DeviceNetworkComponent? netConn)
|
||||
|| !EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent? alarmable)
|
||||
|| !args.Data.TryGetValue(DeviceNetworkConstants.Command, out var cmd))
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Content.Server.Body.Components;
|
||||
using Content.Server.Body.Components;
|
||||
using Content.Server.Ghost.Components;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Shared.Body.Components;
|
||||
|
|
@ -24,7 +24,7 @@ namespace Content.Server.Body.Systems
|
|||
private void OnRemovedFromBody(EntityUid uid, BrainComponent component, RemovedFromBodyEvent args)
|
||||
{
|
||||
// This one needs to be special, okay?
|
||||
if (!EntityManager.TryGetComponent(uid, out MechanismComponent mech))
|
||||
if (!EntityManager.TryGetComponent(uid, out MechanismComponent? mech))
|
||||
return;
|
||||
|
||||
HandleMind((mech.Part!).Owner, (args.Old).Owner);
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@ namespace Content.Server.Buckle.Components
|
|||
appearance.SetData(BuckleVisuals.Buckled, false);
|
||||
|
||||
if (_entMan.HasComponent<KnockedDownComponent>(Owner)
|
||||
| _entMan.TryGetComponent<MobStateComponent>(Owner, out var mobState) && mobState.IsIncapacitated())
|
||||
| (_entMan.TryGetComponent<MobStateComponent>(Owner, out var mobState) && mobState.IsIncapacitated()))
|
||||
{
|
||||
EntitySystem.Get<StandingStateSystem>().Down(Owner);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ public sealed class ChatSystem : SharedChatSystem
|
|||
bool playDefaultSound = true, Color? colorOverride = null)
|
||||
{
|
||||
var messageWrap = Loc.GetString("chat-manager-sender-announcement-wrap-message", ("sender", sender));
|
||||
_chatManager.ChatMessageToAll(ChatChannel.Radio, message, messageWrap);
|
||||
_chatManager.ChatMessageToAll(ChatChannel.Radio, message, messageWrap, colorOverride);
|
||||
if (playDefaultSound)
|
||||
{
|
||||
SoundSystem.Play(Filter.Broadcast(), AnnouncementSound, AudioParams.Default.WithVolume(-2f));
|
||||
|
|
@ -180,21 +180,20 @@ public sealed class ChatSystem : SharedChatSystem
|
|||
var station = _stationSystem.GetOwningStation(source);
|
||||
var filter = Filter.Empty();
|
||||
|
||||
if (station != null)
|
||||
if (station == null)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent<StationDataComponent>(station, out var stationDataComp)) return;
|
||||
|
||||
foreach (var gridEnt in stationDataComp.Grids)
|
||||
{
|
||||
filter.AddInGrid(gridEnt);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
filter = Filter.Pvs(source, entityManager: EntityManager);
|
||||
// you can't make a station announcement without a station
|
||||
return;
|
||||
}
|
||||
|
||||
_chatManager.ChatMessageToManyFiltered(filter, ChatChannel.Radio, message, messageWrap, source, true, colorOverride);
|
||||
if (!EntityManager.TryGetComponent<StationDataComponent>(station, out var stationDataComp)) return;
|
||||
|
||||
foreach (var gridEnt in stationDataComp.Grids)
|
||||
{
|
||||
filter.AddInGrid(gridEnt);
|
||||
}
|
||||
|
||||
_chatManager.ChatMessageToManyFiltered(filter, ChatChannel.Radio, message, messageWrap, source, false, colorOverride);
|
||||
|
||||
if (playDefaultSound)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ namespace Content.Server.Chat.Managers
|
|||
_netManager.ServerSendMessage(msg, client);
|
||||
}
|
||||
|
||||
public void ChatMessageToMany(ChatChannel channel, string message, string messageWrap, EntityUid source, bool hideChat, List<INetChannel> clients)
|
||||
public void ChatMessageToMany(ChatChannel channel, string message, string messageWrap, EntityUid source, bool hideChat, List<INetChannel> clients, Color? colorOverride = null)
|
||||
{
|
||||
var msg = new MsgChatMessage();
|
||||
msg.Channel = channel;
|
||||
|
|
@ -226,6 +226,10 @@ namespace Content.Server.Chat.Managers
|
|||
msg.MessageWrap = messageWrap;
|
||||
msg.SenderEntity = source;
|
||||
msg.HideChat = hideChat;
|
||||
if (colorOverride != null)
|
||||
{
|
||||
msg.MessageColorOverride = colorOverride.Value;
|
||||
}
|
||||
_netManager.ServerSendToMany(msg, clients);
|
||||
}
|
||||
|
||||
|
|
@ -240,7 +244,7 @@ namespace Content.Server.Chat.Managers
|
|||
clients.Add(recipient.ConnectedClient);
|
||||
}
|
||||
|
||||
ChatMessageToMany(channel, message, messageWrap, source, hideChat, clients);
|
||||
ChatMessageToMany(channel, message, messageWrap, source, hideChat, clients, colorOverride);
|
||||
}
|
||||
|
||||
public void ChatMessageToAll(ChatChannel channel, string message, string messageWrap, Color? colorOverride = null)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace Content.Server.Chat.Managers
|
|||
void ChatMessageToOne(ChatChannel channel, string message, string messageWrap, EntityUid source, bool hideChat,
|
||||
INetChannel client);
|
||||
void ChatMessageToMany(ChatChannel channel, string message, string messageWrap, EntityUid source, bool hideChat,
|
||||
List<INetChannel> clients);
|
||||
List<INetChannel> clients, Color? colorOverride = null);
|
||||
void ChatMessageToManyFiltered(Filter filter, ChatChannel channel, string message, string messageWrap, EntityUid source, bool hideChat, Color? colorOverride);
|
||||
void ChatMessageToAll(ChatChannel channel, string message, string messageWrap, Color? colorOverride = null);
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ namespace Content.Server.Chat
|
|||
private void EnvironmentSuicideHandler(EntityUid victim, SuicideEvent suicideEvent)
|
||||
{
|
||||
// Suicide by held item
|
||||
if (EntityManager.TryGetComponent(victim, out HandsComponent handsComponent)
|
||||
if (EntityManager.TryGetComponent(victim, out HandsComponent? handsComponent)
|
||||
&& handsComponent.ActiveHandEntity is EntityUid item)
|
||||
{
|
||||
RaiseLocalEvent(item, suicideEvent, false);
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ namespace Content.Server.Chemistry.Components
|
|||
//Special case for reagent tanks, because normally clicking another container will give solution, not take it.
|
||||
if (CanReceive && !_entities.HasComponent<RefillableSolutionComponent>(target) // target must not be refillable (e.g. Reagent Tanks)
|
||||
&& solutionsSys.TryGetDrainableSolution(target, out var targetDrain) // target must be drainable
|
||||
&& _entities.TryGetComponent(Owner, out RefillableSolutionComponent refillComp)
|
||||
&& _entities.TryGetComponent(Owner, out RefillableSolutionComponent? refillComp)
|
||||
&& solutionsSys.TryGetRefillableSolution(Owner, out var ownerRefill, refillable: refillComp))
|
||||
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Content.Server.Temperature.Components;
|
||||
using Content.Server.Temperature.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
|
||||
namespace Content.Server.Chemistry.ReagentEffectConditions
|
||||
|
|
@ -16,7 +16,7 @@ namespace Content.Server.Chemistry.ReagentEffectConditions
|
|||
public float Max = float.MaxValue;
|
||||
public override bool Condition(ReagentEffectArgs args)
|
||||
{
|
||||
if (args.EntityManager.TryGetComponent(args.SolutionEntity, out TemperatureComponent temp))
|
||||
if (args.EntityManager.TryGetComponent(args.SolutionEntity, out TemperatureComponent? temp))
|
||||
{
|
||||
if (temp.CurrentTemperature > Min && temp.CurrentTemperature < Max)
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.FixedPoint;
|
||||
|
||||
|
|
@ -14,7 +14,7 @@ namespace Content.Server.Chemistry.ReagentEffectConditions
|
|||
|
||||
public override bool Condition(ReagentEffectArgs args)
|
||||
{
|
||||
if (args.EntityManager.TryGetComponent(args.SolutionEntity, out DamageableComponent damage))
|
||||
if (args.EntityManager.TryGetComponent(args.SolutionEntity, out DamageableComponent? damage))
|
||||
{
|
||||
var total = damage.TotalDamage;
|
||||
if (total > Min && total < Max)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Content.Server.Temperature.Components;
|
||||
using Content.Server.Temperature.Components;
|
||||
using Content.Server.Temperature.Systems;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
|
||||
|
|
@ -11,7 +11,7 @@ namespace Content.Server.Chemistry.ReagentEffects
|
|||
|
||||
public override void Effect(ReagentEffectArgs args)
|
||||
{
|
||||
if (args.EntityManager.TryGetComponent(args.SolutionEntity, out TemperatureComponent temp))
|
||||
if (args.EntityManager.TryGetComponent(args.SolutionEntity, out TemperatureComponent? temp))
|
||||
{
|
||||
var sys = args.EntityManager.EntitySysManager.GetEntitySystem<TemperatureSystem>();
|
||||
sys.ChangeHeat(args.SolutionEntity, Amount, true, temp);
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace Content.Server.CombatMode
|
|||
|
||||
EntityUid? inTargetHand = null;
|
||||
|
||||
if (EntityManager.TryGetComponent<HandsComponent>(args.Target, out HandsComponent targetHandsComponent)
|
||||
if (EntityManager.TryGetComponent<HandsComponent>(args.Target, out HandsComponent? targetHandsComponent)
|
||||
&& targetHandsComponent.ActiveHand != null
|
||||
&& !targetHandsComponent.ActiveHand.IsEmpty)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,13 +10,12 @@ namespace Content.Server.Communications
|
|||
/// <summary>
|
||||
/// Remaining cooldown between making announcements.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float AnnouncementCooldownRemaining;
|
||||
|
||||
/// <summary>
|
||||
/// Has the UI already been refreshed after the announcement
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public bool AlreadyRefreshed = false;
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ using System.Globalization;
|
|||
using Content.Server.Access.Systems;
|
||||
using Content.Server.AlertLevel;
|
||||
using Content.Server.Chat;
|
||||
using Content.Server.Chat.Managers;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.RoundEnd;
|
||||
using Content.Server.Station.Systems;
|
||||
|
|
@ -199,11 +198,9 @@ namespace Content.Server.Communications
|
|||
if (comp.AnnounceGlobal)
|
||||
{
|
||||
_chatSystem.DispatchGlobalStationAnnouncement(msg, title, colorOverride: comp.AnnouncementColor);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
_chatSystem.DispatchStationAnnouncement(uid, msg, title, colorOverride: comp.AnnouncementColor);
|
||||
}
|
||||
_chatSystem.DispatchStationAnnouncement(uid, msg, title, colorOverride: comp.AnnouncementColor);
|
||||
}
|
||||
|
||||
private void OnCallShuttleMessage(EntityUid uid, CommunicationsConsoleComponent comp, CommunicationsConsoleCallEmergencyShuttleMessage message)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Coordinates.Helpers;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.Pulling;
|
||||
using Content.Server.Tools;
|
||||
using Content.Shared.Construction.Components;
|
||||
|
|
@ -10,22 +11,24 @@ using Content.Shared.Database;
|
|||
using Content.Shared.Examine;
|
||||
using Content.Shared.Pulling.Components;
|
||||
using Content.Shared.Tools.Components;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server.Construction
|
||||
{
|
||||
public sealed class AnchorableSystem : SharedAnchorableSystem
|
||||
{
|
||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||
[Dependency] private readonly PopupSystem _popup = default!;
|
||||
[Dependency] private readonly ToolSystem _toolSystem = default!;
|
||||
[Dependency] private readonly PullingSystem _pullingSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<AnchorableComponent, TryAnchorCompletedEvent>(OnAnchorComplete2);
|
||||
SubscribeLocalEvent<AnchorableComponent, TryAnchorCancelledEvent>(OnAnchorCancelled2);
|
||||
SubscribeLocalEvent<AnchorableComponent, TryUnanchorCompletedEvent>(OnUnanchorComplete2);
|
||||
SubscribeLocalEvent<AnchorableComponent, TryUnanchorCancelledEvent>(OnUnanchorCancelled2);
|
||||
SubscribeLocalEvent<AnchorableComponent, TryAnchorCompletedEvent>(OnAnchorComplete);
|
||||
SubscribeLocalEvent<AnchorableComponent, TryAnchorCancelledEvent>(OnAnchorCancelled);
|
||||
SubscribeLocalEvent<AnchorableComponent, TryUnanchorCompletedEvent>(OnUnanchorComplete);
|
||||
SubscribeLocalEvent<AnchorableComponent, TryUnanchorCancelledEvent>(OnUnanchorCancelled);
|
||||
SubscribeLocalEvent<AnchorableComponent, ExaminedEvent>(OnAnchoredExamine);
|
||||
}
|
||||
|
||||
|
|
@ -36,22 +39,22 @@ namespace Content.Server.Construction
|
|||
args.PushMarkup(Loc.GetString(messageId, ("target", uid)));
|
||||
}
|
||||
|
||||
private void OnUnanchorCancelled2(EntityUid uid, AnchorableComponent component, TryUnanchorCancelledEvent args)
|
||||
private void OnUnanchorCancelled(EntityUid uid, AnchorableComponent component, TryUnanchorCancelledEvent args)
|
||||
{
|
||||
component.CancelToken = null;
|
||||
}
|
||||
|
||||
private void OnUnanchorComplete2(EntityUid uid, AnchorableComponent component, TryUnanchorCompletedEvent args)
|
||||
private void OnUnanchorComplete(EntityUid uid, AnchorableComponent component, TryUnanchorCompletedEvent args)
|
||||
{
|
||||
component.CancelToken = null;
|
||||
var xform = Transform(uid);
|
||||
|
||||
RaiseLocalEvent(uid, new BeforeUnanchoredEvent(args.User, args.Using), false);
|
||||
|
||||
xform.Anchored = false;
|
||||
|
||||
RaiseLocalEvent(uid, new UserUnanchoredEvent(args.User, args.Using), false);
|
||||
|
||||
_popup.PopupEntity(Loc.GetString("anchorable-unanchored"), uid, Filter.Pvs(uid, entityManager: EntityManager));
|
||||
|
||||
_adminLogger.Add(
|
||||
LogType.Action,
|
||||
LogImpact.Low,
|
||||
|
|
@ -59,12 +62,12 @@ namespace Content.Server.Construction
|
|||
);
|
||||
}
|
||||
|
||||
private void OnAnchorCancelled2(EntityUid uid, AnchorableComponent component, TryAnchorCancelledEvent args)
|
||||
private void OnAnchorCancelled(EntityUid uid, AnchorableComponent component, TryAnchorCancelledEvent args)
|
||||
{
|
||||
component.CancelToken = null;
|
||||
}
|
||||
|
||||
private void OnAnchorComplete2(EntityUid uid, AnchorableComponent component, TryAnchorCompletedEvent args)
|
||||
private void OnAnchorComplete(EntityUid uid, AnchorableComponent component, TryAnchorCompletedEvent args)
|
||||
{
|
||||
component.CancelToken = null;
|
||||
var xform = Transform(uid);
|
||||
|
|
@ -82,11 +85,11 @@ namespace Content.Server.Construction
|
|||
xform.Coordinates = xform.Coordinates.SnapToGrid();
|
||||
|
||||
RaiseLocalEvent(uid, new BeforeAnchoredEvent(args.User, args.Using), false);
|
||||
|
||||
xform.Anchored = true;
|
||||
|
||||
RaiseLocalEvent(uid, new UserAnchoredEvent(args.User, args.Using), false);
|
||||
|
||||
_popup.PopupEntity(Loc.GetString("anchorable-anchored"), uid, Filter.Pvs(uid, entityManager: EntityManager));
|
||||
|
||||
_adminLogger.Add(
|
||||
LogType.Action,
|
||||
LogImpact.Low,
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace Content.Server.Disease.Cures
|
|||
public float Max = float.MaxValue;
|
||||
public override bool Cure(DiseaseEffectArgs args)
|
||||
{
|
||||
if (!args.EntityManager.TryGetComponent(args.DiseasedEntity, out TemperatureComponent temp))
|
||||
if (!args.EntityManager.TryGetComponent(args.DiseasedEntity, out TemperatureComponent? temp))
|
||||
return false;
|
||||
|
||||
return temp.CurrentTemperature > Min && temp.CurrentTemperature < float.MaxValue;
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ namespace Content.Server.Doors.Systems
|
|||
// Make firelocks autoclose, but only if the last alarm type it
|
||||
// remembers was a danger. This is to prevent people from
|
||||
// flooding hallways with endless bad air/fire.
|
||||
if (!EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent alarmable))
|
||||
if (!EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent? alarmable))
|
||||
{
|
||||
args.Cancel();
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ using Content.Server.DoAfter;
|
|||
using Content.Server.Engineering.Components;
|
||||
using Content.Server.Stack;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Maps;
|
||||
using Content.Shared.Stacks;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Map;
|
||||
|
|
@ -36,7 +37,7 @@ namespace Content.Server.Engineering.EntitySystems
|
|||
|
||||
bool IsTileClear()
|
||||
{
|
||||
return tileRef.Tile.IsEmpty == false;
|
||||
return tileRef.Tile.IsEmpty == false && !tileRef.IsBlockedTurf(true);
|
||||
}
|
||||
|
||||
if (!IsTileClear())
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ namespace Content.Server.Entry
|
|||
"DiseaseMachineVisuals",
|
||||
"HandheldGPS",
|
||||
"SpentAmmoVisuals",
|
||||
"MagazineVisuals",
|
||||
"ToggleableLightVisuals",
|
||||
"CableVisualizer",
|
||||
"PotencyVisuals",
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||
if (!airtight.AirBlocked)
|
||||
return;
|
||||
|
||||
if (!EntityManager.TryGetComponent(uid, out TransformComponent transform) || !transform.Anchored)
|
||||
if (!EntityManager.TryGetComponent(uid, out TransformComponent? transform) || !transform.Anchored)
|
||||
return;
|
||||
|
||||
if (!_mapManager.TryGetGrid(transform.GridID, out var grid))
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ namespace Content.Server.Fluids.EntitySystems
|
|||
|
||||
bool hasEvaporationComponent = EntityManager.TryGetComponent<EvaporationComponent>(uid, out var evaporationComponent);
|
||||
bool canEvaporate = (hasEvaporationComponent &&
|
||||
(evaporationComponent.LowerLimit == 0 || puddleComponent.CurrentVolume > evaporationComponent.LowerLimit));
|
||||
(evaporationComponent!.LowerLimit == 0 || puddleComponent.CurrentVolume > evaporationComponent.LowerLimit));
|
||||
|
||||
// "Does this puddle's sprite need changing to the wet floor effect sprite?"
|
||||
bool changeToWetFloor = (puddleComponent.CurrentVolume <= puddleComponent.WetFloorEffectThreshold
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ namespace Content.Server.Labels
|
|||
{
|
||||
_itemSlotsSystem.AddItemSlot(uid, component.Name, component.LabelSlot);
|
||||
|
||||
if (!EntityManager.TryGetComponent(uid, out AppearanceComponent appearance))
|
||||
if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance))
|
||||
return;
|
||||
|
||||
appearance.SetData(PaperLabelVisuals.HasLabel, false);
|
||||
|
|
@ -68,7 +68,7 @@ namespace Content.Server.Labels
|
|||
return;
|
||||
}
|
||||
|
||||
if (!EntityManager.TryGetComponent(item, out PaperComponent paper))
|
||||
if (!EntityManager.TryGetComponent(item, out PaperComponent? paper))
|
||||
// Assuming yaml has the correct entity whitelist, this should not happen.
|
||||
return;
|
||||
|
||||
|
|
@ -90,7 +90,7 @@ namespace Content.Server.Labels
|
|||
if (args.Container.ID != label.LabelSlot.ID)
|
||||
return;
|
||||
|
||||
if (!EntityManager.TryGetComponent(uid, out AppearanceComponent appearance))
|
||||
if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance))
|
||||
return;
|
||||
|
||||
appearance.SetData(PaperLabelVisuals.HasLabel, label.LabelSlot.HasItem);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Content.Server.Access.Systems;
|
||||
using Content.Server.Access.Systems;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Administration.Systems;
|
||||
using Content.Server.Cloning;
|
||||
|
|
@ -47,7 +47,7 @@ public sealed class RenameCommand : IConsoleCommand
|
|||
|
||||
var entSysMan = IoCManager.Resolve<IEntitySystemManager>();
|
||||
|
||||
if (entMan.TryGetComponent(entityUid, out MindComponent mind) && mind.Mind != null)
|
||||
if (entMan.TryGetComponent(entityUid, out MindComponent? mind) && mind.Mind != null)
|
||||
{
|
||||
// Mind
|
||||
mind.Mind.CharacterName = name;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ namespace Content.Server.Morgue.Components
|
|||
if (Open)
|
||||
CloseStorage();
|
||||
|
||||
if(_entities.TryGetComponent(Owner, out AppearanceComponent appearanceComponent))
|
||||
if(_entities.TryGetComponent(Owner, out AppearanceComponent? appearanceComponent))
|
||||
appearanceComponent.SetData(CrematoriumVisuals.Burning, true);
|
||||
Cooking = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ namespace Content.Server.Nuke
|
|||
return;
|
||||
|
||||
var anchored = false;
|
||||
if (EntityManager.TryGetComponent(uid, out TransformComponent transform))
|
||||
if (EntityManager.TryGetComponent(uid, out TransformComponent? transform))
|
||||
anchored = transform.Anchored;
|
||||
|
||||
var allowArm = component.DiskSlot.HasItem &&
|
||||
|
|
|
|||
|
|
@ -358,7 +358,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||
if (args.Cancelled)
|
||||
return;
|
||||
|
||||
IngestionBlockerComponent blocker;
|
||||
IngestionBlockerComponent? blocker;
|
||||
|
||||
if (_inventorySystem.TryGetSlotEntity(uid, "mask", out var maskUid) &&
|
||||
EntityManager.TryGetComponent(maskUid, out blocker) &&
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||
|
||||
private bool TryUseUtensil(EntityUid user, EntityUid target, UtensilComponent component)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(target, out FoodComponent food))
|
||||
if (!EntityManager.TryGetComponent(target, out FoodComponent? food))
|
||||
return false;
|
||||
|
||||
//Prevents food usage with a wrong utensil
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Linq;
|
||||
using System.Linq;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Objectives.Interfaces;
|
||||
using Content.Shared.MobState.Components;
|
||||
|
|
@ -21,7 +21,7 @@ namespace Content.Server.Objectives.Conditions
|
|||
if (entity == default)
|
||||
return false;
|
||||
|
||||
return entityMgr.TryGetComponent(entity, out MobStateComponent mobState) &&
|
||||
return entityMgr.TryGetComponent(entity, out MobStateComponent? mobState) &&
|
||||
mobState.IsAlive() &&
|
||||
mc.Mind != mind;
|
||||
}).Select(mc => mc.Mind).ToList();
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ namespace Content.Server.Power.EntitySystems
|
|||
|
||||
private void OnReceiverConnected(EntityUid uid, ApcPowerProviderComponent provider, ExtensionCableSystem.ReceiverConnectedEvent args)
|
||||
{
|
||||
if (EntityManager.TryGetComponent(args.Receiver.Owner, out ApcPowerReceiverComponent receiver))
|
||||
if (EntityManager.TryGetComponent(args.Receiver.Owner, out ApcPowerReceiverComponent? receiver))
|
||||
{
|
||||
provider.AddReceiver(receiver);
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@ namespace Content.Server.Power.EntitySystems
|
|||
|
||||
private void OnReceiverDisconnected(EntityUid uid, ApcPowerProviderComponent provider, ExtensionCableSystem.ReceiverDisconnectedEvent args)
|
||||
{
|
||||
if (EntityManager.TryGetComponent(args.Receiver.Owner, out ApcPowerReceiverComponent receiver))
|
||||
if (EntityManager.TryGetComponent(args.Receiver.Owner, out ApcPowerReceiverComponent? receiver))
|
||||
{
|
||||
provider.RemoveReceiver(receiver);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -261,8 +261,9 @@ namespace Content.Server.Shuttles.EntitySystems
|
|||
|
||||
private void OnPowerChange(EntityUid uid, DockingComponent component, PowerChangedEvent args)
|
||||
{
|
||||
var lifestage = MetaData(uid).EntityLifeStage;
|
||||
// This is because power can change during startup for <Reasons> and undock
|
||||
if (MetaData(uid).EntityLifeStage < EntityLifeStage.MapInitialized) return;
|
||||
if (lifestage is < EntityLifeStage.MapInitialized or >= EntityLifeStage.Terminating) return;
|
||||
|
||||
if (args.Powered)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -305,6 +305,12 @@ public sealed class StationSystem : EntitySystem
|
|||
if (!Resolve(entity, ref xform))
|
||||
throw new ArgumentException("Tried to use an abstract entity!", nameof(entity));
|
||||
|
||||
if (TryComp<StationDataComponent>(entity, out _))
|
||||
{
|
||||
// We are the station, just return ourselves.
|
||||
return entity;
|
||||
}
|
||||
|
||||
if (TryComp<IMapGridComponent>(entity, out _))
|
||||
{
|
||||
// We are the station, just check ourselves.
|
||||
|
|
|
|||
|
|
@ -63,8 +63,9 @@ public sealed class DiseaseOutbreak : StationEvent
|
|||
return;
|
||||
|
||||
var diseaseSystem = EntitySystem.Get<DiseaseSystem>();
|
||||
var stationSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<StationSystem>();
|
||||
var chatSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ChatSystem>();
|
||||
var entSysMgr = IoCManager.Resolve<IEntitySystemManager>();
|
||||
var stationSystem = entSysMgr.GetEntitySystem<StationSystem>();
|
||||
var chatSystem = entSysMgr.GetEntitySystem<ChatSystem>();
|
||||
// Now we give it to people in the list of living disease carriers earlier
|
||||
foreach (var target in aliveList)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -51,8 +51,9 @@ public sealed class RandomSentience : StationEvent
|
|||
var kind2 = groupList.Count > 1 ? groupList[1] : "???";
|
||||
var kind3 = groupList.Count > 2 ? groupList[2] : "???";
|
||||
|
||||
var stationSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<StationSystem>();
|
||||
var chatSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ChatSystem>();
|
||||
var entSysMgr = IoCManager.Resolve<IEntitySystemManager>();
|
||||
var stationSystem = entSysMgr.GetEntitySystem<StationSystem>();
|
||||
var chatSystem = entSysMgr.GetEntitySystem<ChatSystem>();
|
||||
foreach (var target in targetList)
|
||||
{
|
||||
var station = stationSystem.GetOwningStation(target.Owner);
|
||||
|
|
|
|||
|
|
@ -43,8 +43,9 @@ namespace Content.Server.StationEvents.Events
|
|||
var toInfect = _random.Next(1, 3);
|
||||
|
||||
// Now we give it to people in the list of dead entities earlier.
|
||||
var stationSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<StationSystem>();
|
||||
var chatSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ChatSystem>();
|
||||
var entSysMgr = IoCManager.Resolve<IEntitySystemManager>();
|
||||
var stationSystem = entSysMgr.GetEntitySystem<StationSystem>();
|
||||
var chatSystem = entSysMgr.GetEntitySystem<ChatSystem>();
|
||||
foreach (var target in deadList)
|
||||
{
|
||||
if (toInfect-- == 0)
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ using Content.Server.Disposal.Unit.EntitySystems;
|
|||
using Content.Server.DoAfter;
|
||||
using Content.Shared.Placeable;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.Storage.EntitySystems
|
||||
{
|
||||
|
|
@ -15,6 +16,7 @@ namespace Content.Server.Storage.EntitySystems
|
|||
{
|
||||
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
|
||||
[Dependency] private readonly DisposalUnitSystem _disposalUnitSystem = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
|
|
@ -146,14 +148,17 @@ namespace Content.Server.Storage.EntitySystems
|
|||
|
||||
foreach (var entity in dumpQueue)
|
||||
{
|
||||
Transform(entity).AttachParentToContainerOrGrid(EntityManager);
|
||||
var transform = Transform(entity);
|
||||
transform.AttachParentToContainerOrGrid(EntityManager);
|
||||
transform.LocalPosition = transform.LocalPosition + _random.NextVector2Box() / 2;
|
||||
transform.LocalRotation = _random.NextAngle();
|
||||
}
|
||||
|
||||
if (HasComp<PlaceableSurfaceComponent>(args.Target))
|
||||
{
|
||||
foreach (var entity in dumpQueue)
|
||||
{
|
||||
Transform(entity).LocalPosition = Transform(args.Target.Value).LocalPosition;
|
||||
Transform(entity).LocalPosition = Transform(args.Target.Value).LocalPosition + _random.NextVector2Box() / 4;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,16 +56,14 @@ namespace Content.Server.Tiles
|
|||
continue;
|
||||
|
||||
PlaceAt(mapGrid, location, currentTileDefinition.TileId, component.PlaceTileSound);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (HasBaseTurf(currentTileDefinition, "space"))
|
||||
else if (HasBaseTurf(currentTileDefinition, "space"))
|
||||
{
|
||||
mapGrid = _mapManager.CreateGrid(locationMap.MapId);
|
||||
mapGrid.WorldPosition = locationMap.Position;
|
||||
location = new EntityCoordinates(mapGrid.GridEntityId, Vector2.Zero);
|
||||
PlaceAt(mapGrid, location, _tileDefinitionManager[component.OutputTiles[0]].TileId, component.PlaceTileSound, mapGrid.TileSize / 2f);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public sealed class VendingMachineContrabandWireAction : BaseToggleWireAction
|
|||
public override StatusLightData? GetStatusLightData(Wire wire)
|
||||
{
|
||||
var lightState = StatusLightState.Off;
|
||||
if (IsPowered(wire.Owner) && EntityManager.TryGetComponent(wire.Owner, out VendingMachineComponent vending))
|
||||
if (IsPowered(wire.Owner) && EntityManager.TryGetComponent(wire.Owner, out VendingMachineComponent? vending))
|
||||
{
|
||||
lightState = vending.Contraband
|
||||
? StatusLightState.BlinkingSlow
|
||||
|
|
@ -30,7 +30,7 @@ public sealed class VendingMachineContrabandWireAction : BaseToggleWireAction
|
|||
|
||||
public override void ToggleValue(EntityUid owner, bool setting)
|
||||
{
|
||||
if (EntityManager.TryGetComponent(owner, out VendingMachineComponent vending))
|
||||
if (EntityManager.TryGetComponent(owner, out VendingMachineComponent? vending))
|
||||
{
|
||||
vending.Contraband = !setting;
|
||||
}
|
||||
|
|
@ -38,6 +38,6 @@ public sealed class VendingMachineContrabandWireAction : BaseToggleWireAction
|
|||
|
||||
public override bool GetValue(EntityUid owner)
|
||||
{
|
||||
return EntityManager.TryGetComponent(owner, out VendingMachineComponent vending) && !vending.Contraband;
|
||||
return EntityManager.TryGetComponent(owner, out VendingMachineComponent? vending) && !vending.Contraband;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public sealed class VendingMachineEjectItemWireAction : BaseWireAction
|
|||
var lightState = StatusLightState.Off;
|
||||
|
||||
if (IsPowered(wire.Owner)
|
||||
&& EntityManager.TryGetComponent(wire.Owner, out VendingMachineComponent vending))
|
||||
&& EntityManager.TryGetComponent(wire.Owner, out VendingMachineComponent? vending))
|
||||
{
|
||||
lightState = vending.CanShoot
|
||||
? StatusLightState.BlinkingFast
|
||||
|
|
@ -40,7 +40,7 @@ public sealed class VendingMachineEjectItemWireAction : BaseWireAction
|
|||
|
||||
public override bool Cut(EntityUid user, Wire wire)
|
||||
{
|
||||
if (EntityManager.TryGetComponent(wire.Owner, out VendingMachineComponent vending))
|
||||
if (EntityManager.TryGetComponent(wire.Owner, out VendingMachineComponent? vending))
|
||||
{
|
||||
vending.CanShoot = true;
|
||||
}
|
||||
|
|
@ -50,7 +50,7 @@ public sealed class VendingMachineEjectItemWireAction : BaseWireAction
|
|||
|
||||
public override bool Mend(EntityUid user, Wire wire)
|
||||
{
|
||||
if (EntityManager.TryGetComponent(wire.Owner, out VendingMachineComponent vending))
|
||||
if (EntityManager.TryGetComponent(wire.Owner, out VendingMachineComponent? vending))
|
||||
{
|
||||
vending.CanShoot = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -196,8 +196,10 @@ public sealed partial class GunSystem : SharedGunSystem
|
|||
component.LastFire = component.NextFire;
|
||||
|
||||
// Convert it so angle can go either side.
|
||||
var random = Random.NextGaussian(0, 0.5);
|
||||
var random = Random.NextFloat(-0.5f, 0.5f);
|
||||
var spread = component.CurrentAngle.Theta * random;
|
||||
var angle = new Angle(direction.Theta + component.CurrentAngle.Theta * random);
|
||||
DebugTools.Assert(spread <= component.MaxAngle.Theta);
|
||||
return angle;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,14 +15,14 @@ public abstract class AlertsSystem : EntitySystem
|
|||
|
||||
public IReadOnlyDictionary<AlertKey, AlertState>? GetActiveAlerts(EntityUid euid)
|
||||
{
|
||||
return EntityManager.TryGetComponent(euid, out AlertsComponent comp)
|
||||
return EntityManager.TryGetComponent(euid, out AlertsComponent? comp)
|
||||
? comp.Alerts
|
||||
: null;
|
||||
}
|
||||
|
||||
public bool IsShowingAlert(EntityUid euid, AlertType alertType)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(euid, out AlertsComponent alertsComponent))
|
||||
if (!EntityManager.TryGetComponent(euid, out AlertsComponent? alertsComponent))
|
||||
return false;
|
||||
|
||||
if (TryGet(alertType, out var alert))
|
||||
|
|
@ -37,13 +37,13 @@ public abstract class AlertsSystem : EntitySystem
|
|||
/// <returns>true iff an alert of the indicated alert category is currently showing</returns>
|
||||
public bool IsShowingAlertCategory(EntityUid euid, AlertCategory alertCategory)
|
||||
{
|
||||
return EntityManager.TryGetComponent(euid, out AlertsComponent alertsComponent)
|
||||
return EntityManager.TryGetComponent(euid, out AlertsComponent? alertsComponent)
|
||||
&& alertsComponent.Alerts.ContainsKey(AlertKey.ForCategory(alertCategory));
|
||||
}
|
||||
|
||||
public bool TryGetAlertState(EntityUid euid, AlertKey key, out AlertState alertState)
|
||||
{
|
||||
if (EntityManager.TryGetComponent(euid, out AlertsComponent alertsComponent))
|
||||
if (EntityManager.TryGetComponent(euid, out AlertsComponent? alertsComponent))
|
||||
return alertsComponent.Alerts.TryGetValue(key, out alertState);
|
||||
|
||||
alertState = default;
|
||||
|
|
@ -62,7 +62,7 @@ public abstract class AlertsSystem : EntitySystem
|
|||
/// be erased if there is currently a cooldown for the alert)</param>
|
||||
public void ShowAlert(EntityUid euid, AlertType alertType, short? severity = null, (TimeSpan, TimeSpan)? cooldown = null)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(euid, out AlertsComponent alertsComponent))
|
||||
if (!EntityManager.TryGetComponent(euid, out AlertsComponent? alertsComponent))
|
||||
return;
|
||||
|
||||
if (TryGet(alertType, out var alert))
|
||||
|
|
@ -100,7 +100,7 @@ public abstract class AlertsSystem : EntitySystem
|
|||
/// </summary>
|
||||
public void ClearAlertCategory(EntityUid euid, AlertCategory category)
|
||||
{
|
||||
if(!EntityManager.TryGetComponent(euid, out AlertsComponent alertsComponent))
|
||||
if(!EntityManager.TryGetComponent(euid, out AlertsComponent? alertsComponent))
|
||||
return;
|
||||
|
||||
var key = AlertKey.ForCategory(category);
|
||||
|
|
@ -119,7 +119,7 @@ public abstract class AlertsSystem : EntitySystem
|
|||
/// </summary>
|
||||
public void ClearAlert(EntityUid euid, AlertType alertType)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(euid, out AlertsComponent alertsComponent))
|
||||
if (!EntityManager.TryGetComponent(euid, out AlertsComponent? alertsComponent))
|
||||
return;
|
||||
|
||||
if (TryGet(alertType, out var alert))
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ public sealed class CameraRecoilSystem : EntitySystem
|
|||
|
||||
private void HandleCameraKick(CameraKickEvent args)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(args.Euid, out CameraRecoilComponent recoil))
|
||||
if (!EntityManager.TryGetComponent(args.Euid, out CameraRecoilComponent? recoil))
|
||||
{
|
||||
_log.Warning($"Received a kick for euid {args.Euid}, but it is missing required components.");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ namespace Content.Shared.Containers.ItemSlots
|
|||
if (args.Handled)
|
||||
return;
|
||||
|
||||
if (!EntityManager.TryGetComponent(args.User, out SharedHandsComponent hands))
|
||||
if (!EntityManager.TryGetComponent(args.User, out SharedHandsComponent? hands))
|
||||
return;
|
||||
|
||||
foreach (var slot in itemSlots.Slots.Values)
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ namespace Content.Shared.Examine
|
|||
public bool IsInDetailsRange(EntityUid examiner, EntityUid entity)
|
||||
{
|
||||
// check if the mob is in ciritcal or dead
|
||||
if (EntityManager.TryGetComponent(examiner, out MobStateComponent mobState) && mobState.IsIncapacitated())
|
||||
if (EntityManager.TryGetComponent(examiner, out MobStateComponent? mobState) && mobState.IsIncapacitated())
|
||||
return false;
|
||||
|
||||
if (!_interactionSystem.InRangeUnobstructed(examiner, entity, ExamineDetailsRange))
|
||||
|
|
|
|||
|
|
@ -79,5 +79,6 @@ namespace Content.Shared.Input
|
|||
public static readonly BoundKeyFunction Vote7 = "Vote7";
|
||||
public static readonly BoundKeyFunction Vote8 = "Vote8";
|
||||
public static readonly BoundKeyFunction Vote9 = "Vote9";
|
||||
public static readonly BoundKeyFunction EditorCopyObject = "EditorCopyObject";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,13 +90,13 @@ namespace Content.Shared.Item
|
|||
|
||||
public void RemovedFromSlot()
|
||||
{
|
||||
if (_entMan.TryGetComponent(Owner, out SharedSpriteComponent component))
|
||||
if (_entMan.TryGetComponent(Owner, out SharedSpriteComponent? component))
|
||||
component.Visible = true;
|
||||
}
|
||||
|
||||
public virtual void EquippedToSlot()
|
||||
{
|
||||
if (_entMan.TryGetComponent(Owner, out SharedSpriteComponent component))
|
||||
if (_entMan.TryGetComponent(Owner, out SharedSpriteComponent? component))
|
||||
component.Visible = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,8 +38,11 @@ namespace Content.Shared.Movement.Components
|
|||
if (body == null)
|
||||
entityManager.TryGetComponent(entity, out body);
|
||||
|
||||
if (entityManager.TryGetComponent<MovementIgnoreGravityComponent>(entity, out var ignoreGravityComponent) ||
|
||||
(body?.BodyType & (BodyType.Static | BodyType.Kinematic)) != 0) return ignoreGravityComponent.Weightless;
|
||||
if ((body?.BodyType & (BodyType.Static | BodyType.Kinematic)) != 0)
|
||||
return false;
|
||||
|
||||
if (entityManager.TryGetComponent<MovementIgnoreGravityComponent>(entity, out var ignoreGravityComponent))
|
||||
return ignoreGravityComponent.Weightless;
|
||||
|
||||
var transform = entityManager.GetComponent<TransformComponent>(entity);
|
||||
var gridId = transform.GridID;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Movement.EntitySystems;
|
||||
using Content.Shared.Pulling.Components;
|
||||
using Content.Shared.MobState.Components;
|
||||
|
||||
namespace Content.Shared.Pulling.Systems
|
||||
{
|
||||
|
|
@ -19,6 +20,7 @@ namespace Content.Shared.Pulling.Systems
|
|||
{
|
||||
var entity = args.Session.AttachedEntity;
|
||||
if (entity == null || !_blocker.CanMove(entity.Value)) return;
|
||||
if (TryComp<MobStateComponent>(component.Owner, out var mobState) && mobState.IsIncapacitated()) return;
|
||||
_pullSystem.TryStopPull(component);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Linq;
|
||||
using Robust.Shared.Collections;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
|
||||
|
|
@ -34,15 +34,27 @@ public sealed class StepTriggerSystem : EntitySystem
|
|||
component.Colliding.Count == 0)
|
||||
return true;
|
||||
|
||||
foreach (var otherUid in component.Colliding.ToArray())
|
||||
var remQueue = new ValueList<EntityUid>();
|
||||
foreach (var otherUid in component.Colliding)
|
||||
{
|
||||
var shouldRemoveFromColliding = UpdateColliding(component, transform, otherUid, query);
|
||||
if (!shouldRemoveFromColliding) continue;
|
||||
if (!shouldRemoveFromColliding)
|
||||
continue;
|
||||
|
||||
remQueue.Add(otherUid);
|
||||
}
|
||||
|
||||
if (remQueue.Count > 0)
|
||||
{
|
||||
foreach (var uid in remQueue)
|
||||
{
|
||||
component.Colliding.Remove(uid);
|
||||
component.CurrentlySteppedOn.Remove(uid);
|
||||
}
|
||||
|
||||
component.Colliding.Remove(otherUid);
|
||||
component.CurrentlySteppedOn.Remove(otherUid);
|
||||
Dirty(component);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,13 +56,13 @@ public class GunComponent : Component
|
|||
/// <summary>
|
||||
/// The maximum angle allowed for <see cref="CurrentAngle"/>
|
||||
/// </summary>
|
||||
[ViewVariables, DataField("maxAngle")]
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("maxAngle")]
|
||||
public Angle MaxAngle = Angle.FromDegrees(2);
|
||||
|
||||
/// <summary>
|
||||
/// The minimum angle allowed for <see cref="CurrentAngle"/>
|
||||
/// </summary>
|
||||
[ViewVariables, DataField("minAngle")]
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("minAngle")]
|
||||
public Angle MinAngle = Angle.FromDegrees(1);
|
||||
|
||||
#endregion
|
||||
|
|
|
|||
|
|
@ -54,13 +54,8 @@ public partial class SharedGunSystem
|
|||
|
||||
var oldIndex = component.CurrentIndex;
|
||||
component.CurrentIndex = state.CurrentIndex;
|
||||
|
||||
component.AmmoSlots.EnsureCapacity(state.AmmoSlots.Count);
|
||||
component.AmmoSlots.Clear();
|
||||
component.Chambers = new bool?[state.Chambers.Length];
|
||||
|
||||
DebugTools.Assert(component.AmmoSlots.Count == component.Chambers.Length);
|
||||
|
||||
// Need to copy across the state rather than the ref.
|
||||
for (var i = 0; i < component.AmmoSlots.Count; i++)
|
||||
{
|
||||
|
|
@ -322,6 +317,8 @@ public partial class SharedGunSystem
|
|||
component.Chambers[i] = true;
|
||||
}
|
||||
}
|
||||
|
||||
DebugTools.Assert(component.AmmoSlots.Count == component.Capacity);
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
|
|
|
|||
|
|
@ -120,6 +120,10 @@ public abstract partial class SharedGunSystem : EntitySystem
|
|||
{
|
||||
args.State = new GunComponentState
|
||||
{
|
||||
FireRate = component.FireRate,
|
||||
CurrentAngle = component.CurrentAngle,
|
||||
MinAngle = component.MinAngle,
|
||||
MaxAngle = component.MaxAngle,
|
||||
NextFire = component.NextFire,
|
||||
ShotCounter = component.ShotCounter,
|
||||
SelectiveFire = component.SelectedMode,
|
||||
|
|
@ -132,13 +136,17 @@ public abstract partial class SharedGunSystem : EntitySystem
|
|||
if (args.Current is not GunComponentState state) return;
|
||||
|
||||
Sawmill.Debug($"Handle state: setting shot count from {component.ShotCounter} to {state.ShotCounter}");
|
||||
component.FireRate = state.FireRate;
|
||||
component.CurrentAngle = state.CurrentAngle;
|
||||
component.MinAngle = state.MinAngle;
|
||||
component.MaxAngle = state.MaxAngle;
|
||||
component.NextFire = state.NextFire;
|
||||
component.ShotCounter = state.ShotCounter;
|
||||
component.SelectedMode = state.SelectiveFire;
|
||||
component.AvailableModes = state.AvailableSelectiveFire;
|
||||
}
|
||||
|
||||
protected GunComponent? GetGun(EntityUid entity)
|
||||
public GunComponent? GetGun(EntityUid entity)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(entity, out SharedHandsComponent? hands) ||
|
||||
hands.ActiveHandEntity is not { } held)
|
||||
|
|
@ -358,7 +366,11 @@ public abstract partial class SharedGunSystem : EntitySystem
|
|||
[Serializable, NetSerializable]
|
||||
protected sealed class GunComponentState : ComponentState
|
||||
{
|
||||
public Angle CurrentAngle;
|
||||
public Angle MinAngle;
|
||||
public Angle MaxAngle;
|
||||
public TimeSpan NextFire;
|
||||
public float FireRate;
|
||||
public int ShotCounter;
|
||||
public SelectiveFire SelectiveFire;
|
||||
public SelectiveFire AvailableSelectiveFire;
|
||||
|
|
|
|||
|
|
@ -1,77 +1,4 @@
|
|||
Entries:
|
||||
- author: Mith-randalf
|
||||
changes:
|
||||
- {message: Removed fun (by which I mean the centcomm outfit bundle from the traitor
|
||||
uplink)!, type: Remove}
|
||||
id: 1151
|
||||
time: '2022-03-02T01:46:55.0000000+00:00'
|
||||
- author: Emisse
|
||||
changes:
|
||||
- {message: updated Saltern to Saltern Special Edition HD Enhanced Edition, type: Add}
|
||||
id: 1152
|
||||
time: '2022-03-02T13:16:42.0000000+00:00'
|
||||
- author: ElectroJr
|
||||
changes:
|
||||
- {message: Fixed a bug preventing the RCD from constructing entities on some empty
|
||||
tiles., type: Fix}
|
||||
id: 1153
|
||||
time: '2022-03-02T13:38:19.0000000+00:00'
|
||||
- author: wrexbe
|
||||
changes:
|
||||
- {message: Glass tables now have different mass limits., type: Add}
|
||||
id: 1154
|
||||
time: '2022-03-02T14:07:49.0000000+00:00'
|
||||
- author: DogZeroX
|
||||
changes:
|
||||
- {message: Xenos no longer need oxygen and are space-proof., type: Tweak}
|
||||
- {message: The odds of winning against a Xeno in a fist-fight have decreased considerably.,
|
||||
type: Tweak}
|
||||
id: 1155
|
||||
time: '2022-03-02T14:08:19.0000000+00:00'
|
||||
- author: notafet
|
||||
changes:
|
||||
- {message: Items on conveyor belts now round corners correctly., type: Add}
|
||||
id: 1156
|
||||
time: '2022-03-02T22:32:33.0000000+00:00'
|
||||
- author: DogZeroX
|
||||
changes:
|
||||
- {message: 'Ratvar, Rouny, and Space Lizard have joined the plushie gang, find
|
||||
them on your closest plushie crate or toy spawners!', type: Add}
|
||||
id: 1157
|
||||
time: '2022-03-03T00:26:18.0000000+00:00'
|
||||
- author: metalgearsloth
|
||||
changes:
|
||||
- {message: Pushing objects has been disabled. Pulling is still okay., type: Tweak}
|
||||
id: 1158
|
||||
time: '2022-03-03T02:32:03.0000000+00:00'
|
||||
- author: HoofedEar
|
||||
changes:
|
||||
- {message: Cargo door remote now works on Salvage access airlocks., type: Fix}
|
||||
- {message: Security door remote now works on Armory access airlocks., type: Fix}
|
||||
id: 1159
|
||||
time: '2022-03-03T09:18:15.0000000+00:00'
|
||||
- author: router
|
||||
changes:
|
||||
- {message: Added capitalism. The captain spawns with some money now., type: Add}
|
||||
id: 1160
|
||||
time: '2022-03-03T10:11:35.0000000+00:00'
|
||||
- author: Peptide90
|
||||
changes:
|
||||
- {message: Onion and Oat seeds are now in the seed vendor and seed crate., type: Add}
|
||||
- {message: Seed vendor inventory reduced from 10 seeds to 5., type: Tweak}
|
||||
id: 1161
|
||||
time: '2022-03-03T10:42:49.0000000+00:00'
|
||||
- author: router
|
||||
changes:
|
||||
- {message: Added money to the captain's locker. Capitalism is now REAL., type: Add}
|
||||
id: 1162
|
||||
time: '2022-03-04T05:03:12.0000000+00:00'
|
||||
- author: ElectroJr
|
||||
changes:
|
||||
- {message: 'Fixed a bug that was preventing clothing from being hidden inside of
|
||||
secret stashes (e.g., potted plants)', type: Fix}
|
||||
id: 1163
|
||||
time: '2022-03-04T06:54:27.0000000+00:00'
|
||||
- author: Peptide90
|
||||
changes:
|
||||
- {message: Added secure cargo and external windoors. Fixed glass EVA airlock sprite.,
|
||||
|
|
@ -3008,3 +2935,72 @@ Entries:
|
|||
technology unlock., type: Fix}
|
||||
id: 1650
|
||||
time: '2022-06-04T00:04:49.0000000+00:00'
|
||||
- author: themias
|
||||
changes:
|
||||
- {message: Inflatables can no longer be placed on walls or doors, type: Fix}
|
||||
id: 1651
|
||||
time: '2022-06-04T02:15:46.0000000+00:00'
|
||||
- author: themias
|
||||
changes:
|
||||
- {message: Ghosting no longer causes dragged corpses to be dropped, type: Fix}
|
||||
id: 1652
|
||||
time: '2022-06-04T02:59:07.0000000+00:00'
|
||||
- author: Peptide90
|
||||
changes:
|
||||
- {message: Added boxes of nitrile gloves., type: Add}
|
||||
- {message: Fixed name of sterile mask and latex glove boxes., type: Tweak}
|
||||
id: 1653
|
||||
time: '2022-06-04T05:05:18.0000000+00:00'
|
||||
- author: UKNOWH
|
||||
changes:
|
||||
- {message: Added makeshift laser gun!, type: Add}
|
||||
id: 1654
|
||||
time: '2022-06-04T06:30:37.0000000+00:00'
|
||||
- author: metalgearsloth
|
||||
changes:
|
||||
- {message: L6 sustained spread increased and item size increased., type: Tweak}
|
||||
id: 1655
|
||||
time: '2022-06-04T06:52:40.0000000+00:00'
|
||||
- author: Veritius
|
||||
changes:
|
||||
- {message: Fix communications consoles not sending announcements., type: Fix}
|
||||
id: 1656
|
||||
time: '2022-06-04T09:09:04.0000000+00:00'
|
||||
- author: EmoGarbage404
|
||||
changes:
|
||||
- {message: Post lights now have interaction outlines., type: Fix}
|
||||
id: 1657
|
||||
time: '2022-06-04T21:50:30.0000000+00:00'
|
||||
- author: themias
|
||||
changes:
|
||||
- {message: Other players can now hear the Musician's PDA music, type: Fix}
|
||||
id: 1658
|
||||
time: '2022-06-05T04:12:55.0000000+00:00'
|
||||
- author: metalgearsloth
|
||||
changes:
|
||||
- {message: Emitter hitsound has been removed, type: Tweak}
|
||||
id: 1659
|
||||
time: '2022-06-05T07:54:48.0000000+00:00'
|
||||
- author: metalgearsloth
|
||||
changes:
|
||||
- {message: Fix NPCs steering around puddles, type: Fix}
|
||||
id: 1660
|
||||
time: '2022-06-05T09:42:03.0000000+00:00'
|
||||
- author: ElectroJr
|
||||
changes:
|
||||
- {message: Added a mapping/editor keybinding that starts placing the same type
|
||||
of entity or tile that the mouse is currently hovering over. Defaults to `P`,
|
||||
type: Add}
|
||||
id: 1661
|
||||
time: '2022-06-05T22:58:20.0000000+00:00'
|
||||
- author: metalgearsloth
|
||||
changes:
|
||||
- {message: Anchoring now shows popups, type: Add}
|
||||
id: 1662
|
||||
time: '2022-06-05T23:04:40.0000000+00:00'
|
||||
- author: WilliamECrew
|
||||
changes:
|
||||
- {message: 'When dumping contents out of a bag, items will now be spread out randomly
|
||||
instead of all being dumped into the same exact spot.', type: Tweak}
|
||||
id: 1663
|
||||
time: '2022-06-06T00:34:44.0000000+00:00'
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
anchorable-anchored = Anchored
|
||||
anchorable-unanchored = Unanchored
|
||||
|
|
@ -129,6 +129,7 @@ ui-options-function-editor-cancel-place = Cancel placement
|
|||
ui-options-function-editor-grid-place = Place in grid
|
||||
ui-options-function-editor-line-place = Place line
|
||||
ui-options-function-editor-rotate-object = Rotate
|
||||
ui-options-function-editor-copy-object = Copy
|
||||
|
||||
ui-options-function-open-abilities-menu = Open action menu
|
||||
ui-options-function-show-debug-console = Open Console
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue