* Station AI overlay * implement * Bunch of ports * Fix a heap of bugs and basic scouting * helldivers * Shuffle interactions a bit * navmap stuff * Revert "navmap stuff" This reverts commit d1f89dd4be83233e22cf5dd062b2581f3c6da062. * AI wires implemented * Fix examines * Optimise the overlay significantly * Back to old static * BUI radial working * lots of work * Saving work * thanks fork * alright * pc * AI upload console * AI upload * stuff * Fix copy-paste shitcode * AI actions * navmap work * Fixes * first impressions * a * reh * Revert "navmap work" This reverts commit 6f63fea6e9245e189f368f97be3e32e9b210580e. # Conflicts: # Content.Client/Silicons/StationAi/StationAiOverlay.cs * OD * radar * weh * Fix examines * scoop mine eyes * fixes * reh * Optimise * Final round of optimisations * Fixes * fixes
60 lines
1.8 KiB
C#
60 lines
1.8 KiB
C#
using System.Threading.Tasks;
|
|
using Content.Server.NPC.Pathfinding;
|
|
using Content.Shared.Maps;
|
|
using Content.Shared.NPC;
|
|
using Content.Shared.Procedural;
|
|
using Content.Shared.Procedural.DungeonGenerators;
|
|
using Robust.Shared.Collections;
|
|
using Robust.Shared.Random;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Content.Server.Procedural.DungeonJob;
|
|
|
|
public sealed partial class DungeonJob
|
|
{
|
|
/// <summary>
|
|
/// <see cref="ExteriorDunGen"/>
|
|
/// </summary>
|
|
private async Task<List<Dungeon>> GenerateExteriorDungen(Vector2i position, ExteriorDunGen dungen, HashSet<Vector2i> reservedTiles, Random random)
|
|
{
|
|
DebugTools.Assert(_grid.ChunkCount > 0);
|
|
|
|
var aabb = new Box2i(_grid.LocalAABB.BottomLeft.Floored(), _grid.LocalAABB.TopRight.Floored());
|
|
var angle = random.NextAngle();
|
|
|
|
var distance = Math.Max(aabb.Width / 2f + 1f, aabb.Height / 2f + 1f);
|
|
|
|
var startTile = new Vector2i(0, (int) distance).Rotate(angle);
|
|
|
|
Vector2i? dungeonSpawn = null;
|
|
var pathfinder = _entManager.System<PathfindingSystem>();
|
|
|
|
// Gridcast
|
|
SharedPathfindingSystem.GridCast(startTile, position, tile =>
|
|
{
|
|
if (!_maps.TryGetTileRef(_gridUid, _grid, tile, out var tileRef) ||
|
|
tileRef.Tile.IsSpace(_tileDefManager))
|
|
{
|
|
return true;
|
|
}
|
|
|
|
dungeonSpawn = tile;
|
|
return false;
|
|
});
|
|
|
|
if (dungeonSpawn == null)
|
|
{
|
|
return new List<Dungeon>()
|
|
{
|
|
Dungeon.Empty
|
|
};
|
|
}
|
|
|
|
var config = _prototype.Index(dungen.Proto);
|
|
var nextSeed = random.Next();
|
|
var dungeons = await GetDungeons(dungeonSpawn.Value, config, config.Data, config.Layers, reservedTiles, nextSeed, new Random(nextSeed));
|
|
|
|
return dungeons;
|
|
}
|
|
}
|