mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
* Fix warnings in SharedJointSystem * Fix reference to EC TransformComponent method Replaces call to TransformComponent.GetMapUid with SharedTransformSystem.GetMap * Fix obsolete calls in SharedPhysicsSystem.Contacts.cs Fixes a couple calls to obsolete varients of SetAwake and an obsolete call to RegenerateContacts by converting them to their Entity<T> varients * Fix obsolete call in SharedPhysicsSystem.Components.cs Adds one set of parenthesis to convert a 'uid, comp, comp, comp' call to an 'Entity<T, T, T> call. * Removes unused local var Removes an unused list of broadphases that was being allocated in TryCollideRect * One-line fixes in SharedPhysicsSystem.Islands.cs Fixes all of the easy warnings regarding physics island processing, the rest require more complicated changes than a simple argument rearrangement * Fix obsolete method call in SharedMapSystem * Fix a few obsolete ToMap calls in EntityLookup.Queries * Fix calls to obsolete EntityCoordinate methods in SharedMapSystem.Grids * Fix calls to obsolete EntityCoordinate methods in SharedLookupSystem.ComponentQueries * Fix a few obsolete method calls in entity spawning * Fix obsolete method calls in MapLoaderSystem * Fix obsolete method call in GridFixtureSystem * Fix obsolete IsMapInitialized call in SaveMap command * Fix obsolete MapPosition reference in Client.EyeSystem * Fix obsolete EntitySystem.Get<TSystem> references in DebugLightTreeSystem * Fix obsolete EntitySystem.Get<TSystem> reference in DebugEntityLookup command * Fix obsolete method calls in SpriteBoundsOverlay Slightly more complicated than the rest, but it's really just changing an unused dependency over to use SharedTransformSystem * Remove unused IClyde references from controls LineEdit and TextEdit never use their IClyde dependencies and it generates a warning so yeet * Remove use of EntitySystem.Get from lightbb command * Fix DebugDrawingSystem Removes a bunch of unused private IEntityManager vars Also removes an obsolete use of TransformComponent.GetWorldPositionRotation * Removes duplicate position set when splitting grids There's nothing saying why this is this way and the blame looks like it was an oversight when replacing a bit where they set position and then rotation Please, oh Chesterton's Fence, spare me your wrath * Fix obsolete method use in PlacementMode * Fix obsolete method use in Placement Modes * Removes unused local var in gamestate management * Fix unreachable code warnings in gamestate management Use #else sections to make sure they don't complain about being on the wrong side of a throw * Fix obsolete ToMap use in EyeManager * Make InputManager use a sawmill to log * Fix obsolete ContainerManagerComponent method calls in ContainerSystem * Make ClientPrototypeManager use a sawmill for logging * poke tests * Use LocalizedEntityCommands for SpriteBoundsOverlay toggle * Use LocalizedEntityCommands for system toggles --------- Co-authored-by: ElectroJr <leonsfriedrich@gmail.com>
84 lines
2.6 KiB
C#
84 lines
2.6 KiB
C#
#if DEBUG
|
|
using Robust.Client.ComponentTrees;
|
|
using Robust.Client.Graphics;
|
|
using Robust.Shared.Enums;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Map;
|
|
using Robust.Shared.Maths;
|
|
|
|
namespace Robust.Client.GameObjects
|
|
{
|
|
internal sealed class DebugLightTreeSystem : EntitySystem
|
|
{
|
|
private DebugLightOverlay? _lightOverlay;
|
|
|
|
public bool Enabled
|
|
{
|
|
get => _enabled;
|
|
set
|
|
{
|
|
if (_enabled == value) return;
|
|
|
|
_enabled = value;
|
|
var overlayManager = IoCManager.Resolve<IOverlayManager>();
|
|
|
|
if (_enabled)
|
|
{
|
|
_lightOverlay = new DebugLightOverlay(
|
|
EntityManager.System<EntityLookupSystem>(),
|
|
IoCManager.Resolve<IEyeManager>(),
|
|
IoCManager.Resolve<IMapManager>(),
|
|
EntityManager.System<LightTreeSystem>());
|
|
|
|
overlayManager.AddOverlay(_lightOverlay);
|
|
}
|
|
else
|
|
{
|
|
overlayManager.RemoveOverlay(_lightOverlay!);
|
|
_lightOverlay = null;
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool _enabled;
|
|
|
|
private sealed class DebugLightOverlay : Overlay
|
|
{
|
|
private EntityLookupSystem _lookup;
|
|
private IEyeManager _eyeManager;
|
|
private IMapManager _mapManager;
|
|
|
|
private LightTreeSystem _trees;
|
|
|
|
public override OverlaySpace Space => OverlaySpace.WorldSpace;
|
|
|
|
public DebugLightOverlay(EntityLookupSystem lookup, IEyeManager eyeManager, IMapManager mapManager, LightTreeSystem trees)
|
|
{
|
|
_lookup = lookup;
|
|
_eyeManager = eyeManager;
|
|
_mapManager = mapManager;
|
|
_trees = trees;
|
|
}
|
|
|
|
protected internal override void Draw(in OverlayDrawArgs args)
|
|
{
|
|
var map = args.MapId;
|
|
if (map == MapId.Nullspace) return;
|
|
|
|
foreach (var (_, treeComp) in _trees.GetIntersectingTrees(map, args.WorldBounds))
|
|
{
|
|
foreach (var entry in treeComp.Tree)
|
|
{
|
|
var aabb = _lookup.GetWorldAABB(entry.Uid, entry.Transform);
|
|
if (!aabb.Intersects(args.WorldAABB)) continue;
|
|
|
|
args.WorldHandle.DrawRect(aabb, Color.Green.WithAlpha(0.1f));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endif
|