-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
base: master
Are you sure you want to change the base?
Remove warnings from ExplosionSystem.TileFill.cs #34088
Conversation
var xform = Transform(referenceGrid.Value); | ||
spaceMatrix = _transformSystem.GetWorldMatrix(xform); | ||
spaceAngle = _transformSystem.GetWorldRotation(xform); | ||
} |
There was a problem hiding this comment.
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).
|
||
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; | ||
} | ||
|
There was a problem hiding this comment.
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?
|
||
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) |
There was a problem hiding this comment.
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.
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
Changelog
N/A