* Implements a Dynamic Lighting System on maps. * Edit: the night should be a little bit brighter and blue now. * Major edit: everything must be done on the client side now, with certain datafield replicated. Changes were outlined in the salvage to accommodate the new lighting system. * Edit: The offset is now serverside, this makes the time accurate in all situations. * Removing ununsed import * Minor tweaks * Tweak in time precision * Minor tweak + Unused import removed * Edit: apparently RealTime is better for what I'm looking for * Fix: Now the time is calculated correctly. * Minor tweaks * Adds condition for when the light should be updated * Add planet lighting * she * close-ish * c * bittersweat * Fixes * Revert "Merge branch '22719' into 2024-09-29-planet-lighting" This reverts commit 9f2785bb16aee47d794aa3eed8ae15004f97fc35, reversing changes made to 19649c07a5fb625423e08fc18d91c9cb101daa86. * Europa and day-night * weh * rooves working * Clean * Remove Europa * Fixes * fix * Update * Fix caves * Update for engine * Add sun shadows (planet lighting v2) For now mostly targeting walls and having the shadows change over time. Got the basic proof-of-concept working just needs a hell of a lot of polish. * Documentation * a * Fixes * Move blur to an overlay * Slughands * Fixes * Remove v2 work * Finalise --------- Co-authored-by: DoutorWhite <thedoctorwhite@gmail.com>
99 lines
3.9 KiB
C#
99 lines
3.9 KiB
C#
using System.Numerics;
|
|
using Content.Shared.CCVar;
|
|
using Robust.Server.GameObjects;
|
|
using Robust.Shared.Configuration;
|
|
using Robust.Shared.ContentPack;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Map;
|
|
using Robust.Shared.Maths;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Content.IntegrationTests.Tests
|
|
{
|
|
[TestFixture]
|
|
public sealed class SaveLoadMapTest
|
|
{
|
|
[Test]
|
|
public async Task SaveLoadMultiGridMap()
|
|
{
|
|
const string mapPath = @"/Maps/Test/TestMap.yml";
|
|
|
|
await using var pair = await PoolManager.GetServerClient();
|
|
var server = pair.Server;
|
|
var mapManager = server.ResolveDependency<IMapManager>();
|
|
var sEntities = server.ResolveDependency<IEntityManager>();
|
|
var mapLoader = sEntities.System<MapLoaderSystem>();
|
|
var mapSystem = sEntities.System<SharedMapSystem>();
|
|
var xformSystem = sEntities.EntitySysManager.GetEntitySystem<SharedTransformSystem>();
|
|
var resManager = server.ResolveDependency<IResourceManager>();
|
|
var cfg = server.ResolveDependency<IConfigurationManager>();
|
|
Assert.That(cfg.GetCVar(CCVars.GridFill), Is.False);
|
|
|
|
await server.WaitAssertion(() =>
|
|
{
|
|
var dir = new ResPath(mapPath).Directory;
|
|
resManager.UserData.CreateDir(dir);
|
|
|
|
mapSystem.CreateMap(out var mapId);
|
|
|
|
{
|
|
var mapGrid = mapManager.CreateGridEntity(mapId);
|
|
xformSystem.SetWorldPosition(mapGrid, new Vector2(10, 10));
|
|
mapSystem.SetTile(mapGrid, new Vector2i(0, 0), new Tile(typeId: 1, flags: 1, variant: 255));
|
|
}
|
|
{
|
|
var mapGrid = mapManager.CreateGridEntity(mapId);
|
|
xformSystem.SetWorldPosition(mapGrid, new Vector2(-8, -8));
|
|
mapSystem.SetTile(mapGrid, new Vector2i(0, 0), new Tile(typeId: 2, flags: 1, variant: 254));
|
|
}
|
|
|
|
Assert.Multiple(() => mapLoader.SaveMap(mapId, mapPath));
|
|
Assert.Multiple(() => mapManager.DeleteMap(mapId));
|
|
});
|
|
|
|
await server.WaitIdleAsync();
|
|
|
|
await server.WaitAssertion(() =>
|
|
{
|
|
Assert.That(mapLoader.TryLoad(new MapId(10), mapPath, out _));
|
|
});
|
|
|
|
await server.WaitIdleAsync();
|
|
|
|
await server.WaitAssertion(() =>
|
|
{
|
|
{
|
|
if (!mapManager.TryFindGridAt(new MapId(10), new Vector2(10, 10), out var gridUid, out var mapGrid) ||
|
|
!sEntities.TryGetComponent<TransformComponent>(gridUid, out var gridXform))
|
|
{
|
|
Assert.Fail();
|
|
return;
|
|
}
|
|
|
|
Assert.Multiple(() =>
|
|
{
|
|
Assert.That(xformSystem.GetWorldPosition(gridXform), Is.EqualTo(new Vector2(10, 10)));
|
|
Assert.That(mapSystem.GetTileRef(gridUid, mapGrid, new Vector2i(0, 0)).Tile, Is.EqualTo(new Tile(typeId: 1, flags: 1, variant: 255)));
|
|
});
|
|
}
|
|
{
|
|
if (!mapManager.TryFindGridAt(new MapId(10), new Vector2(-8, -8), out var gridUid, out var mapGrid) ||
|
|
!sEntities.TryGetComponent<TransformComponent>(gridUid, out var gridXform))
|
|
{
|
|
Assert.Fail();
|
|
return;
|
|
}
|
|
|
|
Assert.Multiple(() =>
|
|
{
|
|
Assert.That(xformSystem.GetWorldPosition(gridXform), Is.EqualTo(new Vector2(-8, -8)));
|
|
Assert.That(mapSystem.GetTileRef(gridUid, mapGrid, new Vector2i(0, 0)).Tile, Is.EqualTo(new Tile(typeId: 2, flags: 1, variant: 254)));
|
|
});
|
|
}
|
|
});
|
|
|
|
await pair.CleanReturnAsync();
|
|
}
|
|
}
|
|
}
|