Skip to content

Commit

Permalink
Merge branch 'master' into character-info-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
DangerRevolution committed Jun 2, 2024
2 parents 01ee8f9 + 8e27a83 commit 8cc82c1
Show file tree
Hide file tree
Showing 520 changed files with 3,000 additions and 1,853 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-docfx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 8.0.x
dotnet-version: 8.0.100

- name: Install dependencies
run: dotnet restore
Expand Down
8 changes: 7 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"recommendations": [
"ms-dotnettools.csharp",
"editorconfig.editorconfig"
"editorconfig.editorconfig",
"aaron-bond.better-comments",
"tamasfe.even-better-toml",
"slava0135.robust-yaml",
"slevesque.shader",
"macabeus.vscode-fluent",
"redhat.vscode-yaml"
]
}
2 changes: 2 additions & 0 deletions Content.Client/Atmos/Overlays/AtmosDebugOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ private void DrawTooltip(DrawingHandleScreen handle, Vector2 pos, AtmosDebugOver
handle.DrawString(_font, pos, $"Map: {data.MapAtmosphere}");
pos += offset;
handle.DrawString(_font, pos, $"NoGrid: {data.NoGrid}");
pos += offset;
handle.DrawString(_font, pos, $"Immutable: {data.Immutable}");
}

private void GetGrids(MapId mapId, Box2Rotated box)
Expand Down
70 changes: 46 additions & 24 deletions Content.Client/Atmos/Overlays/GasTileOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Shared.Enums;
using Robust.Shared.Graphics;
using Robust.Shared.Graphics.RSI;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
Expand All @@ -23,7 +22,7 @@ public sealed class GasTileOverlay : Overlay
private readonly IEntityManager _entManager;
private readonly IMapManager _mapManager;

public override OverlaySpace Space => OverlaySpace.WorldSpaceEntities;
public override OverlaySpace Space => OverlaySpace.WorldSpaceEntities | OverlaySpace.WorldSpaceBelowWorld;
private readonly ShaderInstance _shader;

// Gas overlays
Expand Down Expand Up @@ -79,7 +78,8 @@ public GasTileOverlay(GasTileOverlaySystem system, IEntityManager entManager, IR
var rsi = resourceCache.GetResource<RSIResource>(animated.RsiPath).RSI;
var stateId = animated.RsiState;

if (!rsi.TryGetState(stateId, out var state)) continue;
if (!rsi.TryGetState(stateId, out var state))
continue;

_frames[i] = state.GetFrames(RsiDirection.South);
_frameDelays[i] = state.GetDelays();
Expand Down Expand Up @@ -111,7 +111,8 @@ protected override void FrameUpdate(FrameEventArgs args)
for (var i = 0; i < _gasCount; i++)
{
var delays = _frameDelays[i];
if (delays.Length == 0) continue;
if (delays.Length == 0)
continue;

var frameCount = _frameCounter[i];
_timer[i] += args.DeltaSeconds;
Expand All @@ -127,7 +128,8 @@ protected override void FrameUpdate(FrameEventArgs args)
for (var i = 0; i < FireStates; i++)
{
var delays = _fireFrameDelays[i];
if (delays.Length == 0) continue;
if (delays.Length == 0)
continue;

var frameCount = _fireFrameCounter[i];
_fireTimer[i] += args.DeltaSeconds;
Expand Down Expand Up @@ -161,26 +163,10 @@ protected override void Draw(in OverlayDrawArgs args)
var mapUid = _mapManager.GetMapEntityId(args.MapId);

if (_entManager.TryGetComponent<MapAtmosphereComponent>(mapUid, out var atmos))
{
var bottomLeft = args.WorldAABB.BottomLeft.Floored();
var topRight = args.WorldAABB.TopRight.Ceiled();

for (var x = bottomLeft.X; x <= topRight.X; x++)
{
for (var y = bottomLeft.Y; y <= topRight.Y; y++)
{
var tilePosition = new Vector2(x, y);

for (var i = 0; i < atmos.OverlayData.Opacity.Length; i++)
{
var opacity = atmos.OverlayData.Opacity[i];
DrawMapOverlay(drawHandle, args, mapUid, atmos);

if (opacity > 0)
args.WorldHandle.DrawTexture(_frames[i][_frameCounter[i]], tilePosition, Color.White.WithAlpha(opacity));
}
}
}
}
if (args.Space != OverlaySpace.WorldSpaceEntities)
return;

// TODO: WorldBounds callback.
_mapManager.FindGridsIntersecting(args.MapId, args.WorldAABB, ref gridState,
Expand Down Expand Up @@ -265,5 +251,41 @@ protected override void Draw(in OverlayDrawArgs args)
drawHandle.UseShader(null);
drawHandle.SetTransform(Matrix3.Identity);
}

private void DrawMapOverlay(
DrawingHandleWorld handle,
OverlayDrawArgs args,
EntityUid map,
MapAtmosphereComponent atmos)
{
var mapGrid = _entManager.HasComponent<MapGridComponent>(map);

// map-grid atmospheres get drawn above grids
if (mapGrid && args.Space != OverlaySpace.WorldSpaceEntities)
return;

// Normal map atmospheres get drawn below grids
if (!mapGrid && args.Space != OverlaySpace.WorldSpaceBelowWorld)
return;

var bottomLeft = args.WorldAABB.BottomLeft.Floored();
var topRight = args.WorldAABB.TopRight.Ceiled();

for (var x = bottomLeft.X; x <= topRight.X; x++)
{
for (var y = bottomLeft.Y; y <= topRight.Y; y++)
{
var tilePosition = new Vector2(x, y);

for (var i = 0; i < atmos.OverlayData.Opacity.Length; i++)
{
var opacity = atmos.OverlayData.Opacity[i];

if (opacity > 0)
handle.DrawTexture(_frames[i][_frameCounter[i]], tilePosition, Color.White.WithAlpha(opacity));
}
}
}
}
}
}
5 changes: 3 additions & 2 deletions Content.Client/CardboardBox/CardboardBoxSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Numerics;
using System.Numerics;
using Content.Shared.CardboardBox;
using Content.Shared.CardboardBox.Components;
using Content.Shared.Examine;
Expand All @@ -11,6 +11,7 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
{
[Dependency] private readonly EntityLookupSystem _entityLookup = default!;
[Dependency] private readonly TransformSystem _transform = default!;
[Dependency] private readonly ExamineSystemShared _examine = default!;

public override void Initialize()
{
Expand Down Expand Up @@ -55,7 +56,7 @@ private void OnBoxEffect(PlayBoxEffectMessage msg)
foreach (var mob in mobMoverEntities)
{
var mapPos = _transform.GetMapCoordinates(mob);
if (!ExamineSystemShared.InRangeUnOccluded(sourcePos, mapPos, box.Distance, null))
if (!_examine.InRangeUnOccluded(sourcePos, mapPos, box.Distance, null))
continue;

var ent = Spawn(box.Effect, mapPos);
Expand Down
4 changes: 2 additions & 2 deletions Content.Client/Cargo/UI/CargoConsoleMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void PopulateProducts()
if (search.Length == 0 && _category == null ||
search.Length != 0 && prototype.Name.ToLowerInvariant().Contains(search) ||
search.Length != 0 && prototype.Description.ToLowerInvariant().Contains(search) ||
search.Length == 0 && _category != null && prototype.Category.Equals(_category))
search.Length == 0 && _category != null && Loc.GetString(prototype.Category).Equals(_category))
{
var button = new CargoProductRow
{
Expand Down Expand Up @@ -122,7 +122,7 @@ public void PopulateCategories()

foreach (var prototype in ProductPrototypes)
{
if (!_categoryStrings.Contains(prototype.Category))
if (!_categoryStrings.Contains(Loc.GetString(prototype.Category)))
{
_categoryStrings.Add(Loc.GetString(prototype.Category));
}
Expand Down
3 changes: 2 additions & 1 deletion Content.Client/Construction/ConstructionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public sealed class ConstructionSystem : SharedConstructionSystem
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;

private readonly Dictionary<int, EntityUid> _ghosts = new();
Expand Down Expand Up @@ -195,7 +196,7 @@ public bool TrySpawnGhost(
return false;

// This InRangeUnobstructed should probably be replaced with "is there something blocking us in that tile?"
var predicate = GetPredicate(prototype.CanBuildInImpassable, loc.ToMap(EntityManager));
var predicate = GetPredicate(prototype.CanBuildInImpassable, loc.ToMap(EntityManager, _transformSystem));
if (!_interactionSystem.InRangeUnobstructed(user, loc, 20f, predicate: predicate))
return false;

Expand Down
2 changes: 1 addition & 1 deletion Content.Client/ContextMenu/UI/EntityMenuUIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ private bool HandleOpenEntityMenu(in PointerInputCmdHandler.PointerInputCmdArgs
if (_combatMode.IsInCombatMode(args.Session?.AttachedEntity))
return false;

var coords = args.Coordinates.ToMap(_entityManager);
var coords = args.Coordinates.ToMap(_entityManager, _xform);

if (_verbSystem.TryGetEntityMenuEntities(coords, out var entities))
OpenRootMenu(entities);
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Gameplay/GameplayStateBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private bool HandleInspect(ICommonSession? session, EntityCoordinates coords, En

public IEnumerable<EntityUid> GetClickableEntities(EntityCoordinates coordinates)
{
return GetClickableEntities(coordinates.ToMap(_entityManager));
return GetClickableEntities(coordinates.ToMap(_entityManager, _entitySystemManager.GetEntitySystem<SharedTransformSystem>()));
}

public IEnumerable<EntityUid> GetClickableEntities(MapCoordinates coordinates)
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Mapping/MappingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private void OnFillActionSlot(FillActionSlotEvent ev)
if (tileDef is not ContentTileDefinition contentTileDef)
return;

var tileIcon = contentTileDef.IsSpace
var tileIcon = contentTileDef.MapAtmosphere
? _spaceIcon
: new Texture(contentTileDef.Sprite!.Value);

Expand Down
10 changes: 7 additions & 3 deletions Content.Client/NPC/PathfindingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public sealed class PathfindingSystem : SharedPathfindingSystem
[Dependency] private readonly IResourceCache _cache = default!;
[Dependency] private readonly NPCSteeringSystem _steering = default!;
[Dependency] private readonly MapSystem _mapSystem = default!;
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;

public PathfindingDebugMode Modes
{
Expand All @@ -39,7 +40,7 @@ public PathfindingDebugMode Modes
}
else if (!overlayManager.HasOverlay<PathfindingOverlay>())
{
overlayManager.AddOverlay(new PathfindingOverlay(EntityManager, _eyeManager, _inputManager, _mapManager, _cache, this, _mapSystem));
overlayManager.AddOverlay(new PathfindingOverlay(EntityManager, _eyeManager, _inputManager, _mapManager, _cache, this, _mapSystem, _transformSystem));
}

if ((value & PathfindingDebugMode.Steering) != 0x0)
Expand Down Expand Up @@ -140,6 +141,7 @@ public sealed class PathfindingOverlay : Overlay
private readonly IMapManager _mapManager;
private readonly PathfindingSystem _system;
private readonly MapSystem _mapSystem;
private readonly SharedTransformSystem _transformSystem;

public override OverlaySpace Space => OverlaySpace.ScreenSpace | OverlaySpace.WorldSpace;

Expand All @@ -153,14 +155,16 @@ public PathfindingOverlay(
IMapManager mapManager,
IResourceCache cache,
PathfindingSystem system,
MapSystem mapSystem)
MapSystem mapSystem,
SharedTransformSystem transformSystem)
{
_entManager = entManager;
_eyeManager = eyeManager;
_inputManager = inputManager;
_mapManager = mapManager;
_system = system;
_mapSystem = mapSystem;
_transformSystem = transformSystem;
_font = new VectorFont(cache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 10);
}

Expand Down Expand Up @@ -480,7 +484,7 @@ private void DrawWorld(OverlayDrawArgs args, DrawingHandleWorld worldHandle)
if (neighborPoly.NetEntity != poly.GraphUid)
{
color = Color.Green;
var neighborMap = _entManager.GetCoordinates(neighborPoly).ToMap(_entManager);
var neighborMap = _entManager.GetCoordinates(neighborPoly).ToMap(_entManager, _transformSystem);

if (neighborMap.MapId != args.MapId)
continue;
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ private void InputManagerOnFirstChanceOnKeyEvent(KeyEventArgs keyEvent, KeyEvent
Mod1 = mods[0],
Mod2 = mods[1],
Mod3 = mods[2],
Priority = 0,
Priority = _currentlyRebinding.Binding?.Priority ?? 0,
Type = bindType,
CanFocus = key == Keyboard.Key.MouseLeft
|| key == Keyboard.Key.MouseRight
Expand Down
11 changes: 8 additions & 3 deletions Content.Client/Popups/PopupOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ public sealed class PopupOverlay : Overlay
private readonly IUserInterfaceManager _uiManager;
private readonly PopupSystem _popup;
private readonly PopupUIController _controller;

private readonly ExamineSystemShared _examine;
private readonly SharedTransformSystem _transform;
private readonly ShaderInstance _shader;

public override OverlaySpace Space => OverlaySpace.ScreenSpace;
Expand All @@ -33,12 +34,16 @@ public PopupOverlay(
IPrototypeManager protoManager,
IUserInterfaceManager uiManager,
PopupUIController controller,
ExamineSystemShared examine,
SharedTransformSystem transform,
PopupSystem popup)
{
_configManager = configManager;
_entManager = entManager;
_playerMgr = playerMgr;
_uiManager = uiManager;
_examine = examine;
_transform = transform;
_popup = popup;
_controller = controller;

Expand Down Expand Up @@ -73,15 +78,15 @@ private void DrawWorld(DrawingHandleScreen worldHandle, OverlayDrawArgs args, fl

foreach (var popup in _popup.WorldLabels)
{
var mapPos = popup.InitialPos.ToMap(_entManager);
var mapPos = popup.InitialPos.ToMap(_entManager, _transform);

if (mapPos.MapId != args.MapId)
continue;

var distance = (mapPos.Position - args.WorldBounds.Center).Length();

// Should handle fade here too wyci.
if (!args.WorldBounds.Contains(mapPos.Position) || !ExamineSystemShared.InRangeUnOccluded(viewPos, mapPos, distance,
if (!args.WorldBounds.Contains(mapPos.Position) || !_examine.InRangeUnOccluded(viewPos, mapPos, distance,
e => e == popup.InitialPos.EntityId || e == ourEntity, entMan: _entManager))
continue;

Expand Down
5 changes: 5 additions & 0 deletions Content.Client/Popups/PopupSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Linq;
using Content.Shared.Examine;
using Content.Shared.GameTicking;
using Content.Shared.Popups;
using Robust.Client.Graphics;
Expand Down Expand Up @@ -26,6 +27,8 @@ public sealed class PopupSystem : SharedPopupSystem
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IUserInterfaceManager _uiManager = default!;
[Dependency] private readonly IReplayRecordingManager _replayRecording = default!;
[Dependency] private readonly ExamineSystemShared _examine = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;

public IReadOnlyList<WorldPopupLabel> WorldLabels => _aliveWorldLabels;
public IReadOnlyList<CursorPopupLabel> CursorLabels => _aliveCursorLabels;
Expand All @@ -51,6 +54,8 @@ public override void Initialize()
_prototype,
_uiManager,
_uiManager.GetUIController<PopupUIController>(),
_examine,
_transform,
this));
}

Expand Down
5 changes: 4 additions & 1 deletion Content.Client/Radiation/Overlays/RadiationPulseOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ private void RadiationQuery(IEye? currentEye)

private bool PulseQualifies(EntityUid pulseEntity, MapCoordinates currentEyeLoc)
{
return _entityManager.GetComponent<TransformComponent>(pulseEntity).MapID == currentEyeLoc.MapId && _entityManager.GetComponent<TransformComponent>(pulseEntity).Coordinates.InRange(_entityManager, EntityCoordinates.FromMap(_entityManager, _entityManager.GetComponent<TransformComponent>(pulseEntity).ParentUid, currentEyeLoc), MaxDist);
var transformComponent = _entityManager.GetComponent<TransformComponent>(pulseEntity);
var transformSystem = _entityManager.System<SharedTransformSystem>();
return transformComponent.MapID == currentEyeLoc.MapId
&& transformComponent.Coordinates.InRange(_entityManager, transformSystem, EntityCoordinates.FromMap(transformComponent.ParentUid, currentEyeLoc, transformSystem, _entityManager), MaxDist);
}

private sealed record RadiationShaderInstance(MapCoordinates CurrentMapCoords, float Range, TimeSpan Start, float Duration)
Expand Down
3 changes: 2 additions & 1 deletion Content.Client/Sandbox/SandboxSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public sealed class SandboxSystem : SharedSandboxSystem
[Dependency] private readonly IMapManager _map = default!;
[Dependency] private readonly IPlacementManager _placement = default!;
[Dependency] private readonly ContentEyeSystem _contentEye = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;

private bool _sandboxEnabled;
public bool SandboxAllowed { get; private set; }
Expand Down Expand Up @@ -108,7 +109,7 @@ public bool Copy(ICommonSession? session, EntityCoordinates coords, EntityUid ui
}

// Try copy tile.
if (!_map.TryFindGridAt(coords.ToMap(EntityManager), out _, out var grid) || !grid.TryGetTileRef(coords, out var tileRef))
if (!_map.TryFindGridAt(coords.ToMap(EntityManager, _transform), out _, out var grid) || !grid.TryGetTileRef(coords, out var tileRef))
return false;

if (_placement.Eraser)
Expand Down
Loading

0 comments on commit 8cc82c1

Please sign in to comment.