Fix test ops real (#1626)

* update engine

* update tests

* Missing meteor presets (#29044)

* add meteors into missing game presets

* changes for real

* implement code

* this too

* love 4 copy paste tests making sure /suicide kills you

* remote rotation from mapped artifact analyzers

* fix syndie survival boxes

* dedup portafib yml and fix

* untroll arena

* fix edge

---------

Co-authored-by: deltanedas <@deltanedas:kde.org>
Co-authored-by: Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
This commit is contained in:
deltanedas 2024-08-14 15:09:20 +00:00 committed by GitHub
parent f8931ad049
commit a03413b5b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 55 additions and 71 deletions

View File

@ -95,7 +95,7 @@ public sealed class SuicideCommandTests
consoleHost.GetSessionShell(playerMan.Sessions.First()).ExecuteCommand("suicide");
Assert.Multiple(() =>
{
Assert.That(mobStateSystem.IsDead(player, mobStateComp));
//Assert.That(mobStateSystem.IsDead(player, mobStateComp)); // DeltaV - /suicide is the same as /ghost
Assert.That(entManager.TryGetComponent<GhostComponent>(mindComponent.CurrentEntity, out var ghostComp) &&
!ghostComp.CanReturnToBody);
});
@ -158,10 +158,10 @@ public sealed class SuicideCommandTests
Assert.Multiple(() =>
{
Assert.That(mobStateSystem.IsDead(player, mobStateComp));
//Assert.That(mobStateSystem.IsDead(player, mobStateComp)); // DeltaV - /suicide is the same as /ghost
Assert.That(entManager.TryGetComponent<GhostComponent>(mindComponent.CurrentEntity, out var ghostComp) &&
!ghostComp.CanReturnToBody);
Assert.That(damageableComp.Damage.GetTotal(), Is.EqualTo(lethalDamageThreshold));
//Assert.That(damageableComp.Damage.GetTotal(), Is.EqualTo(lethalDamageThreshold)); // DeltaV - /suicide is the same as /ghost
});
});
@ -210,7 +210,7 @@ public sealed class SuicideCommandTests
consoleHost.GetSessionShell(playerMan.Sessions.First()).ExecuteCommand("suicide");
Assert.Multiple(() =>
{
Assert.That(mobStateSystem.IsAlive(player, mobStateComp));
//Assert.That(mobStateSystem.IsAlive(player, mobStateComp)); // DeltaV:
Assert.That(entManager.TryGetComponent<GhostComponent>(mindComponent.CurrentEntity, out var ghostComp) &&
!ghostComp.CanReturnToBody);
});
@ -281,10 +281,10 @@ public sealed class SuicideCommandTests
Assert.Multiple(() =>
{
Assert.That(mobStateSystem.IsDead(player, mobStateComp));
//Assert.That(mobStateSystem.IsDead(player, mobStateComp)); // DeltaV
Assert.That(entManager.TryGetComponent<GhostComponent>(mindComponent.CurrentEntity, out var ghostComp) &&
!ghostComp.CanReturnToBody);
Assert.That(damageableComp.Damage.DamageDict["Slash"], Is.EqualTo(lethalDamageThreshold));
//Assert.That(damageableComp.Damage.DamageDict["Slash"], Is.EqualTo(lethalDamageThreshold)); // DeltaV
});
});
@ -353,10 +353,10 @@ public sealed class SuicideCommandTests
Assert.Multiple(() =>
{
Assert.That(mobStateSystem.IsDead(player, mobStateComp));
//Assert.That(mobStateSystem.IsDead(player, mobStateComp)); // DeltaV
Assert.That(entManager.TryGetComponent<GhostComponent>(mindComponent.CurrentEntity, out var ghostComp) &&
!ghostComp.CanReturnToBody);
Assert.That(damageableComp.Damage.DamageDict["Slash"], Is.EqualTo(lethalDamageThreshold / 2));
//Assert.That(damageableComp.Damage.DamageDict["Slash"], Is.EqualTo(lethalDamageThreshold / 2)); // DeltaV
});
});

View File

@ -140,6 +140,8 @@ public sealed class TestRuleSystem : EntitySystem
while (query.MoveNext(out _, out _, out var gameRule))
{
var minPlayers = gameRule.MinPlayers;
if (!gameRule.CancelPresetOnTooFewPlayers)
continue;
if (args.Players.Length >= minPlayers)
continue;

View File

@ -1,10 +1,7 @@
using Content.Server.GameTicking;
using Content.Server.GameTicking.Commands;
using Content.Server.GameTicking;
using Content.Server.GameTicking.Rules;
using Content.Server.GameTicking.Rules.Components;
using Content.Shared.CCVar;
using Content.Shared.GameTicking.Components;
using Robust.Shared.Configuration;
using Robust.Shared.GameObjects;
using Robust.Shared.Timing;
@ -27,8 +24,12 @@ namespace Content.IntegrationTests.Tests.GameRules
var sGameTicker = server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<GameTicker>();
var sGameTiming = server.ResolveDependency<IGameTiming>();
sGameTicker.StartGameRule("MaxTimeRestart", out var ruleEntity);
Assert.That(entityManager.TryGetComponent<MaxTimeRestartRuleComponent>(ruleEntity, out var maxTime));
MaxTimeRestartRuleComponent maxTime = null;
await server.WaitPost(() =>
{
sGameTicker.StartGameRule("MaxTimeRestart", out var ruleEntity);
Assert.That(entityManager.TryGetComponent<MaxTimeRestartRuleComponent>(ruleEntity, out maxTime));
});
Assert.That(server.EntMan.Count<GameRuleComponent>(), Is.EqualTo(1));
Assert.That(server.EntMan.Count<ActiveGameRuleComponent>(), Is.EqualTo(1));

View File

@ -77,16 +77,17 @@ public sealed class TraitorRuleTest
await pair.SetAntagPreference(TraitorAntagRoleName, true);
// Add the game rule
var gameRuleEnt = ticker.AddGameRule(TraitorGameRuleProtoId);
Assert.That(entMan.TryGetComponent<TraitorRuleComponent>(gameRuleEnt, out var traitorRule));
// Ready up
ticker.ToggleReadyAll(true);
Assert.That(ticker.PlayerGameStatuses.Values.All(x => x == PlayerGameStatus.ReadyToPlay));
// Start the round
TraitorRuleComponent traitorRule = null;
await server.WaitPost(() =>
{
var gameRuleEnt = ticker.AddGameRule(TraitorGameRuleProtoId);
Assert.That(entMan.TryGetComponent<TraitorRuleComponent>(gameRuleEnt, out traitorRule));
// Ready up
ticker.ToggleReadyAll(true);
Assert.That(ticker.PlayerGameStatuses.Values.All(x => x == PlayerGameStatus.ReadyToPlay));
// Start the round
ticker.StartRound();
// Force traitor mode to start (skip the delay)
ticker.StartGameRule(gameRuleEnt);

View File

@ -114,7 +114,7 @@ public abstract partial class InteractionTest
return await SpawnEntity((stack.StackTypeId, spec.Quantity), coords);
Assert.That(spec.Quantity, Is.EqualTo(1), "SpawnEntity only supports returning a singular entity");
await Server.WaitPost(() => uid = SEntMan.SpawnEntity(spec.Prototype, coords));
await Server.WaitPost(() => uid = SEntMan.SpawnAtPosition(spec.Prototype, coords));
return uid;
}

View File

@ -91,7 +91,7 @@ public abstract partial class InteractionTest
Target = NetEntity.Invalid;
await Server.WaitPost(() =>
{
Target = SEntMan.GetNetEntity(SEntMan.SpawnEntity(prototype, SEntMan.GetCoordinates(TargetCoords)));
Target = SEntMan.GetNetEntity(SEntMan.SpawnAtPosition(prototype, SEntMan.GetCoordinates(TargetCoords)));
});
await RunTicks(5);

View File

@ -41,11 +41,18 @@ public abstract partial class GameRuleSystem<T> : EntitySystem where T : ICompon
if (args.Players.Length >= minPlayers)
continue;
ChatManager.SendAdminAnnouncement(Loc.GetString("preset-not-enough-ready-players",
("readyPlayersCount", args.Players.Length),
("minimumPlayers", minPlayers),
("presetName", ToPrettyString(uid))));
args.Cancel();
if (gameRule.CancelPresetOnTooFewPlayers)
{
ChatManager.SendAdminAnnouncement(Loc.GetString("preset-not-enough-ready-players",
("readyPlayersCount", args.Players.Length),
("minimumPlayers", minPlayers),
("presetName", ToPrettyString(uid))));
args.Cancel();
}
else
{
ForceEndSelf(uid, gameRule);
}
}
}

View File

@ -163,7 +163,7 @@ public sealed class SecretRuleSystem : GameRuleSystem<SecretRuleComponent>
return false;
}
if (ruleComp.MinPlayers > players)
if (ruleComp.MinPlayers > players && ruleComp.CancelPresetOnTooFewPlayers)
return false;
}

View File

@ -23,6 +23,13 @@ public sealed partial class GameRuleComponent : Component
[DataField]
public int MinPlayers;
/// <summary>
/// If true, this rule not having enough players will cancel the preset selection.
/// If false, it will simply not run silently.
/// </summary>
[DataField]
public bool CancelPresetOnTooFewPlayers = true;
/// <summary>
/// A delay for when the rule the is started and when the starting logic actually runs.
/// </summary>

View File

@ -122253,13 +122253,11 @@ entities:
- uid: 4884
components:
- type: Transform
rot: 3.141592653589793 rad
pos: -5.5,-87.5
parent: 6747
- uid: 4914
components:
- type: Transform
rot: 3.141592653589793 rad
pos: -9.5,-87.5
parent: 6747
- proto: MachineCentrifuge

View File

@ -86834,7 +86834,6 @@ entities:
- uid: 7691
components:
- type: Transform
rot: 1.5707963267948966 rad
pos: -61.5,36.5
parent: 2
- type: DeviceLinkSink
@ -86843,7 +86842,6 @@ entities:
- uid: 7983
components:
- type: Transform
rot: 1.5707963267948966 rad
pos: -61.5,32.5
parent: 2
- type: DeviceLinkSink

View File

@ -209,8 +209,7 @@
- id: ClothingMaskGasSyndicate
- id: ExtendedEmergencyOxygenTankFilled
- id: EmergencyMedipen
- id: SpaceMedipen # DeltaV - keep spacepen
- id: Flare
- id: SpaceMedipen # DeltaV - keep spacepen, replaces flare for space
- id: FoodPSB # DeltaV - replace nutribrick with PSB
- id: DrinkWaterBottleFull # DeltaV - why didnt they get water???
- type: Sprite
@ -228,8 +227,7 @@
- id: ClothingMaskGasSyndicate
- id: ExtendedEmergencyNitrogenTankFilled
- id: EmergencyMedipen
- id: SpaceMedipen # DeltaV - keep spacepen
- id: Flare
- id: SpaceMedipen # DeltaV - keep spacepen, replaces flare for space
- id: FoodPSB # DeltaV - replace nutribrick with PSB
- id: DrinkWaterBottleFull # DeltaV - why didnt they get water???
# Intentionally wrong picture on the box to mimic the NT one

View File

@ -1,48 +1,17 @@
- type: entity
parent: Defibrillator
id: Portafib
parent: [ BaseItem, PowerCellSlotSmallItem ]
name: portafib
description: Less weight, same great ZZZAP!
components:
- type: Sprite
sprite: DeltaV/Objects/Medical/portafib.rsi
layers:
- state: icon
- state: screen
map: [ "enum.ToggleVisuals.Layer" ]
visible: false
shader: unshaded
- state: ready
map: ["enum.PowerDeviceVisualLayers.Powered"]
shader: unshaded
- type: GenericVisualizer
visuals:
enum.ToggleVisuals.Toggled:
enum.ToggleVisuals.Layer:
True: { visible: true }
False: { visible: false }
enum.DefibrillatorVisuals.Ready:
enum.PowerDeviceVisualLayers.Powered:
True: { visible: true }
False: { visible: false }
- type: Item
size: Normal
- type: MultiHandedItem
- type: Speech
- type: Defibrillator
zapHeal:
types:
Asphyxiation: -40
- type: PowerCellDraw
useRate: 140
- type: Appearance
- type: DoAfter
- type: UseDelay
- type: StaticPrice
price: 100
- type: GuideHelp
guides:
- Medical Doctor
- type: entity
id: PortafibEmpty

View File

@ -7,6 +7,7 @@
description: survival-description
rules:
- RampingStationEventScheduler
#- GameRuleMeteorScheduler # DeltaV: old meteor event
- BasicRoundstartVariation
- type: gamePreset
@ -20,6 +21,7 @@
- Revolutionary
- Zombie
- RampingStationEventScheduler
#- GameRuleMeteorScheduler # DeltaV: old meteor event
- type: gamePreset
id: Extended
@ -43,6 +45,7 @@
description: greenshift-description
rules:
- BasicRoundstartVariation
#- GameRuleMeteorScheduler # DeltaV: old meteor event
- type: gamePreset
id: Secret

@ -1 +1 @@
Subproject commit 49c831b48d1449e90a65acdb0c276d2deea4ce2c
Subproject commit 217870793771c008327fe0a7d3be965b2f4880c3