Merge branch 'master' into replace-sounds-with-sound-specifier

This commit is contained in:
ShadowCommander
2021-08-10 15:05:49 -07:00
183 changed files with 5472 additions and 2022 deletions

View File

@@ -5,7 +5,7 @@ using System.Threading.Tasks;
using Content.Server.Atmos;
using Content.Server.Body.Behavior;
using Content.Server.Body.Circulatory;
using Content.Server.Metabolism;
using Content.Server.Body.Respiratory;
using Content.Shared.Atmos;
using Content.Shared.Body.Components;
using NUnit.Framework;
@@ -32,7 +32,7 @@ namespace Content.IntegrationTests.Tests.Body
template: HumanoidTemplate
preset: HumanPreset
centerSlot: torso
- type: Metabolism
- type: Respirator
metabolismHeat: 5000
radiatedHeat: 400
implicitHeatRegulation: 5000
@@ -148,7 +148,7 @@ namespace Content.IntegrationTests.Tests.Body
MapId mapId;
IMapGrid grid = null;
MetabolismComponent metabolism = null;
RespiratorComponent respirator = null;
IEntity human = null;
var testMapName = "Maps/Test/Breathing/3by3-20oxy-80nit.yml";
@@ -169,8 +169,8 @@ namespace Content.IntegrationTests.Tests.Body
Assert.True(human.TryGetComponent(out SharedBodyComponent body));
Assert.True(body.HasMechanismBehavior<LungBehavior>());
Assert.True(human.TryGetComponent(out metabolism));
Assert.False(metabolism.Suffocating);
Assert.True(human.TryGetComponent(out respirator));
Assert.False(respirator.Suffocating);
});
var increment = 10;
@@ -178,7 +178,7 @@ namespace Content.IntegrationTests.Tests.Body
for (var tick = 0; tick < 600; tick += increment)
{
await server.WaitRunTicks(increment);
Assert.False(metabolism.Suffocating, $"Entity {human.Name} is suffocating on tick {tick}");
Assert.False(respirator.Suffocating, $"Entity {human.Name} is suffocating on tick {tick}");
}
await server.WaitIdleAsync();

View File

@@ -1,11 +1,14 @@
using System;
using System.Threading.Tasks;
using Content.Client.Clickable;
using Content.Server.GameTicking;
using NUnit.Framework;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Timing;
namespace Content.IntegrationTests.Tests
{
@@ -57,12 +60,19 @@ namespace Content.IntegrationTests.Tests
[TestCase("ClickTestRotatingCornerInvisibleNoRot", 0.25f, 0.25f, DirSouthEastJustShy, 1, ExpectedResult = true)]
public async Task<bool> Test(string prototype, float clickPosX, float clickPosY, double angle, float scale)
{
Vector2? worldPos = null;
EntityUid entity = default;
var clientEntManager = _client.ResolveDependency<IEntityManager>();
var serverEntManager = _server.ResolveDependency<IEntityManager>();
var mapManager = _server.ResolveDependency<IMapManager>();
var gameTicker = _server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<GameTicker>();
await _server.WaitPost(() =>
{
var entMgr = IoCManager.Resolve<IEntityManager>();
var ent = entMgr.SpawnEntity(prototype, new MapCoordinates(0, 0, new MapId(1)));
var gridEnt = mapManager.GetGrid(gameTicker.DefaultGridId).GridEntityId;
worldPos = serverEntManager.GetEntity(gridEnt).Transform.WorldPosition;
var ent = serverEntManager.SpawnEntity(prototype, new EntityCoordinates(gridEnt, 0f, 0f));
ent.Transform.LocalRotation = angle;
ent.GetComponent<SpriteComponent>().Scale = (scale, scale);
entity = ent.Uid;
@@ -75,17 +85,15 @@ namespace Content.IntegrationTests.Tests
await _client.WaitPost(() =>
{
var entMgr = IoCManager.Resolve<IEntityManager>();
var ent = entMgr.GetEntity(entity);
var ent = clientEntManager.GetEntity(entity);
var clickable = ent.GetComponent<ClickableComponent>();
hit = clickable.CheckClick((clickPosX, clickPosY), out _, out _);
hit = clickable.CheckClick((clickPosX, clickPosY) + worldPos!.Value, out _, out _);
});
await _server.WaitPost(() =>
{
var entMgr = IoCManager.Resolve<IEntityManager>();
entMgr.DeleteEntity(entity);
serverEntManager.DeleteEntity(entity);
});
return hit;

View File

@@ -5,6 +5,7 @@ using Content.Shared.Spawning;
using NUnit.Framework;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Broadphase;
@@ -44,7 +45,11 @@ namespace Content.IntegrationTests.Tests.Utility
await server.WaitAssertion(() =>
{
var mapId = new MapId(1);
var grid = sMapManager.GetGrid(new GridId(1));
grid.SetTile(new Vector2i(0, 0), new Tile(1));
var gridEnt = sEntityManager.GetEntity(grid.GridEntityId);
var gridPos = gridEnt.Transform.WorldPosition;
var entityCoordinates = new EntityCoordinates(grid.GridEntityId, 0, 0);
// Nothing blocking it, only entity is the grid
@@ -52,8 +57,7 @@ namespace Content.IntegrationTests.Tests.Utility
Assert.True(sEntityManager.TrySpawnIfUnobstructed(null, entityCoordinates, CollisionGroup.Impassable, out var entity));
Assert.NotNull(entity);
var mapId = new MapId(1);
var mapCoordinates = new MapCoordinates(0, 0, mapId);
var mapCoordinates = new MapCoordinates(gridPos.X, gridPos.Y, mapId);
// Nothing blocking it, only entity is the grid
Assert.NotNull(sEntityManager.SpawnIfUnobstructed(null, mapCoordinates, CollisionGroup.Impassable));