Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove warnings from ExplosionSystem.TileFill.cs #34088

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

BarryNorfolk
Copy link
Contributor

@BarryNorfolk BarryNorfolk commented Dec 27, 2024

About the PR

Removes approx 26 warnings from Content.Server\Explosion\EntitySystems\ExplosionSystem.TileFill.cs.
Looking to help out with #33279

Why / Balance

Warnings are bad. Warnings delenda est.

Technical details

Swapping away from obsolete functions/code to ones.
One instance of breaking up a logic bomb into a separate function that's a tad easier to read.

I've tested in game with a china lake to see if the explosion system still works, which it does. Can provide video if needed.

Media

N/A.

Requirements

Breaking changes

  • None

Changelog
N/A

@github-actions github-actions bot added S: Untriaged Status: Indicates an item has not been triaged and doesn't have appropriate labels. size/S Denotes a PR that changes 10-99 lines. labels Dec 27, 2024
@BarryNorfolk BarryNorfolk changed the title Warnings/sprite component Remove warnings from ExplosionSystem.TileFill.cs Dec 27, 2024
@beck-thompson beck-thompson added P2: Raised Priority: Item has a raised priority, indicating it might get increased maintainer attention. T: Cleanup Type: Code clean-up, without being a full refactor or feature D2: Medium Difficulty: A good amount of codebase knowledge required. S: Needs Review Status: Requires additional reviews before being fully accepted A: Core Tech Area: Underlying core tech for the game and the Github repository. and removed S: Untriaged Status: Indicates an item has not been triaged and doesn't have appropriate labels. labels Dec 27, 2024
Comment on lines +92 to 95
var xform = Transform(referenceGrid.Value);
spaceMatrix = _transformSystem.GetWorldMatrix(xform);
spaceAngle = _transformSystem.GetWorldRotation(xform);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the overload that does both at the same time please, much faster (each one needs to go up the transform hierarchy individually instead of at the same time).

Comment on lines 254 to +281

private bool FindInitialTile(MapCoordinates epicenter, out Vector2i initialTile, out EntityUid? epicentreGrid)
{
initialTile = new Vector2i();
epicentreGrid = null;

if (!_mapManager.TryFindGridAt(epicenter, out var gridUid, out var candidateGrid))
{
return false;
}

var tilePos = _map.WorldToTile(gridUid, candidateGrid, epicenter.Position);
if (!_map.TryGetTileRef(gridUid, candidateGrid, tilePos, out var tileRef))
{
return false;
}

if (tileRef.Tile.IsEmpty)
{
return false;
}

epicentreGrid = gridUid;
initialTile = tileRef.GridIndices;

return true;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it should be an engine method on SharedMapSystem if anything?

Also doesn't TryFindGridAt fail if the tile is empty? is the return at 273 even possible?

Comment on lines 307 to +310

foreach (var grid in _mapManager.FindGridsIntersecting(epicenter.MapId, box))
var mapGrids = new List<Entity<MapGridComponent>>();
_mapManager.FindGridsIntersecting(epicenter.MapId, box, ref mapGrids);
foreach (var grid in mapGrids)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This warning is around the fact you should be storing the list on the system and clearing + re-using it instead of allocating it every time.

@metalgearsloth metalgearsloth added S: Awaiting Changes Status: Changes are required before another review can happen and removed S: Needs Review Status: Requires additional reviews before being fully accepted labels Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: Core Tech Area: Underlying core tech for the game and the Github repository. D2: Medium Difficulty: A good amount of codebase knowledge required. P2: Raised Priority: Item has a raised priority, indicating it might get increased maintainer attention. S: Awaiting Changes Status: Changes are required before another review can happen size/S Denotes a PR that changes 10-99 lines. T: Cleanup Type: Code clean-up, without being a full refactor or feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants