Skip to content

Commit

Permalink
Фикс половины тестов
Browse files Browse the repository at this point in the history
  • Loading branch information
VigersRay committed Jan 5, 2025
1 parent 3bb4d6e commit 668b4fd
Show file tree
Hide file tree
Showing 37 changed files with 189 additions and 77,863 deletions.
1 change: 1 addition & 0 deletions Content.IntegrationTests/Tests/Buckle/BuckleTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public sealed partial class BuckleTest
- type: Body
prototype: Human
- type: StandingState
- type: Appearance
- type: entity
name: {StrapDummyId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ await server.WaitPost(() =>
damageableComp = entManager.GetComponent<DamageableComponent>(player);

if (protoMan.TryIndex<DamageTypePrototype>("Slash", out var slashProto))
damageableSystem.TryChangeDamage(player, new DamageSpecifier(slashProto, FixedPoint2.New(46.5)));
damageableSystem.TryChangeDamage(player, new DamageSpecifier(slashProto, FixedPoint2.New(46.5)), useModifier: false, useVariance: false); // Sunrise-Edit
});

// Check that running the suicide command kills the player
Expand Down
20 changes: 10 additions & 10 deletions Content.IntegrationTests/Tests/Damageable/DamageableTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ await server.WaitAssertion(() =>
var damageToDeal = FixedPoint2.New(types.Count * 5);
DamageSpecifier damage = new(group3, damageToDeal);

sDamageableSystem.TryChangeDamage(uid, damage, true);
sDamageableSystem.TryChangeDamage(uid, damage, true, useModifier: false, useVariance: false); // Sunrise-Edit

Assert.Multiple(() =>
{
Expand All @@ -170,7 +170,7 @@ await server.WaitAssertion(() =>
});

// Heal
sDamageableSystem.TryChangeDamage(uid, -damage);
sDamageableSystem.TryChangeDamage(uid, -damage, useModifier: false, useVariance: false); // Sunrise-Edit

Assert.Multiple(() =>
{
Expand All @@ -189,7 +189,7 @@ await server.WaitAssertion(() =>
Assert.That(types, Has.Count.EqualTo(3));

damage = new DamageSpecifier(group3, 14);
sDamageableSystem.TryChangeDamage(uid, damage, true);
sDamageableSystem.TryChangeDamage(uid, damage, true, useModifier: false, useVariance: false); // Sunrise-Edit

Assert.Multiple(() =>
{
Expand All @@ -201,7 +201,7 @@ await server.WaitAssertion(() =>
});

// Heal
sDamageableSystem.TryChangeDamage(uid, -damage);
sDamageableSystem.TryChangeDamage(uid, -damage, useModifier: false, useVariance: false); // Sunrise-Edit

Assert.Multiple(() =>
{
Expand All @@ -217,7 +217,7 @@ await server.WaitAssertion(() =>
Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(FixedPoint2.Zero));
});
damage = new DamageSpecifier(group1, FixedPoint2.New(10)) + new DamageSpecifier(type2b, FixedPoint2.New(10));
sDamageableSystem.TryChangeDamage(uid, damage, true);
sDamageableSystem.TryChangeDamage(uid, damage, true, useModifier: false, useVariance: false); // Sunrise-Edit

Assert.Multiple(() =>
{
Expand All @@ -233,9 +233,9 @@ await server.WaitAssertion(() =>
Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(FixedPoint2.Zero));

// Test 'wasted' healing
sDamageableSystem.TryChangeDamage(uid, new DamageSpecifier(type3a, 5));
sDamageableSystem.TryChangeDamage(uid, new DamageSpecifier(type3b, 7));
sDamageableSystem.TryChangeDamage(uid, new DamageSpecifier(group3, -11));
sDamageableSystem.TryChangeDamage(uid, new DamageSpecifier(type3a, 5), useModifier: false, useVariance: false); // Sunrise-Edit
sDamageableSystem.TryChangeDamage(uid, new DamageSpecifier(type3b, 7), useModifier: false, useVariance: false); // Sunrise-Edit
sDamageableSystem.TryChangeDamage(uid, new DamageSpecifier(group3, -11), useModifier: false, useVariance: false); // Sunrise-Edit

Assert.Multiple(() =>
{
Expand All @@ -245,11 +245,11 @@ await server.WaitAssertion(() =>
});

// Test Over-Healing
sDamageableSystem.TryChangeDamage(uid, new DamageSpecifier(group3, FixedPoint2.New(-100)));
sDamageableSystem.TryChangeDamage(uid, new DamageSpecifier(group3, FixedPoint2.New(-100)), useModifier: false, useVariance: false); // Sunrise-Edit
Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(FixedPoint2.Zero));

// Test that if no health change occurred, returns false
sDamageableSystem.TryChangeDamage(uid, new DamageSpecifier(group3, -100));
sDamageableSystem.TryChangeDamage(uid, new DamageSpecifier(group3, -100), useModifier: false, useVariance: false); // Sunrise-Edit
Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(FixedPoint2.Zero));
});
await pair.CleanReturnAsync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ await server.WaitAssertion(() =>
#pragma warning disable NUnit2045 // Interdependent assertions.
Assert.DoesNotThrow(() =>
{
sEntityManager.System<DamageableSystem>().TryChangeDamage(sDestructibleEntity, bruteDamage, true);
sEntityManager.System<DamageableSystem>().TryChangeDamage(sDestructibleEntity, bruteDamage, true, useModifier: false, useVariance: false); // Sunrise-Edit
});

Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Has.Count.EqualTo(1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ await server.WaitAssertion(() =>
{
var bluntDamage = new DamageSpecifier(sPrototypeManager.Index<DamageTypePrototype>("TestBlunt"), 10);

sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage, true, useModifier: false, useVariance: false); // Sunrise-Edit

// No thresholds reached yet, the earliest one is at 20 damage
Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);

sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage, true, useModifier: false, useVariance: false); // Sunrise-Edit

// Only one threshold reached, 20
Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Has.Count.EqualTo(1));
Expand All @@ -87,7 +87,7 @@ await server.WaitAssertion(() =>

sTestThresholdListenerSystem.ThresholdsReached.Clear();

sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * 3, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * 3, true, useModifier: false, useVariance: false); // Sunrise-Edit

// One threshold reached, 50, since 20 already triggered before and it has not been healed below that amount
Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Has.Count.EqualTo(1));
Expand Down Expand Up @@ -118,7 +118,7 @@ await server.WaitAssertion(() =>
sTestThresholdListenerSystem.ThresholdsReached.Clear();

// Damage for 50 again, up to 100 now
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * 5, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * 5, true, useModifier: false, useVariance: false); // Sunrise-Edit

// No thresholds reached as they weren't healed below the trigger amount
Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
Expand All @@ -127,33 +127,33 @@ await server.WaitAssertion(() =>
sDamageableSystem.SetAllDamage(sDestructibleEntity, sDamageableComponent, 0);

// Damage for 100, up to 100
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * 10, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * 10, true, useModifier: false, useVariance: false); // Sunrise-Edit

// Two thresholds reached as damage increased past the previous, 20 and 50
Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Has.Count.EqualTo(2));

sTestThresholdListenerSystem.ThresholdsReached.Clear();

// Heal the entity for 40 damage, down to 60
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * -4, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * -4, true, useModifier: false, useVariance: false); // Sunrise-Edit

// ThresholdsLookup don't work backwards
Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);

// Damage for 10, up to 70
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage, true, useModifier: false, useVariance: false); // Sunrise-Edit

// Not enough healing to de-trigger a threshold
Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);

// Heal by 30, down to 40
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * -3, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * -3, true, useModifier: false, useVariance: false); // Sunrise-Edit

// ThresholdsLookup don't work backwards
Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);

// Damage up to 50 again
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage, true, useModifier: false, useVariance: false); // Sunrise-Edit

// The 50 threshold should have triggered again, after being healed
Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Has.Count.EqualTo(1));
Expand Down Expand Up @@ -188,7 +188,7 @@ await server.WaitAssertion(() =>
sDamageableSystem.SetAllDamage(sDestructibleEntity, sDamageableComponent, 0);

// Damage up to 50
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * 5, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * 5, true, useModifier: false, useVariance: false); // Sunrise-Edit

Assert.Multiple(() =>
{
Expand Down Expand Up @@ -260,7 +260,7 @@ await server.WaitAssertion(() =>
}

// Damage the entity up to 50 damage again
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * 5, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * 5, true, useModifier: false, useVariance: false); // Sunrise-Edit

Assert.Multiple(() =>
{
Expand Down
5 changes: 5 additions & 0 deletions Content.IntegrationTests/Tests/EntityTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ await server.WaitPost(() =>
.ToList();
foreach (var protoId in protoIds)
{
// Sunrise-Start
if (protoId == "Envelope")
continue;
// Sunrise-End

entityMan.SpawnEntity(protoId, map.GridCoords);
}
});
Expand Down
1 change: 1 addition & 0 deletions Content.IntegrationTests/Tests/PostMapInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public sealed class PostMapInitTest
// Sunrise-Start
private static readonly string[] SunriseGameMaps =
{
"SunriseDev",
"SunriseBox",
"SunriseDelta",
"SunriseFland",
Expand Down
1 change: 0 additions & 1 deletion Content.Server/Shuttles/DroneConsoleComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public sealed partial class DroneConsoleComponent : Component
public EntityUid? Entity;

// Sunrise-Start
[ViewVariables]
[DataField("portable")]
public bool Portable;
// Sunrise-End
Expand Down
28 changes: 16 additions & 12 deletions Content.Server/_Sunrise/AssaultOps/Icarus/IcarusTerminalSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ public sealed class IcarusTerminalSystem : EntitySystem
[Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!;
[Dependency] private readonly RoundEndSystem _roundEndSystem = default!;
[Dependency] private readonly AudioSystem _audio = default!;
[Dependency] private readonly ItemSlotsSystem _itemSlotsSystem = default!;

public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<IcarusTerminalComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<IcarusTerminalComponent, EntInsertedIntoContainerMessage>(OnItemSlotInserted);
SubscribeLocalEvent<IcarusTerminalComponent, EntRemovedFromContainerMessage>(OnItemSlotRemoved);

// UI events
SubscribeLocalEvent<IcarusTerminalComponent, IcarusTerminalFireMessage>(OnFireButtonPressed);
}

public override void Update(float frameTime)
{
Expand Down Expand Up @@ -67,19 +79,11 @@ private void TickTimerEndRound(IcarusTerminalComponent component, float frameTim
_roundEndSystem.EndRound();
}

public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<IcarusTerminalComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<IcarusTerminalComponent, EntInsertedIntoContainerMessage>(OnItemSlotInserted);
SubscribeLocalEvent<IcarusTerminalComponent, EntRemovedFromContainerMessage>(OnItemSlotRemoved);

// UI events
SubscribeLocalEvent<IcarusTerminalComponent, IcarusTerminalFireMessage>(OnFireButtonPressed);
}

private void OnInit(EntityUid uid, IcarusTerminalComponent component, ComponentInit args)
private void OnMapInit(EntityUid uid, IcarusTerminalComponent component, MapInitEvent args)
{
_itemSlotsSystem.AddItemSlot(uid, IcarusTerminalComponent.FirstKeySlotId, component.FirstKeySlot);
_itemSlotsSystem.AddItemSlot(uid, IcarusTerminalComponent.SecondKeySlotId, component.SecondKeySlot);
_itemSlotsSystem.AddItemSlot(uid, IcarusTerminalComponent.ThirdKeySlotId, component.ThirdKeySlot);
component.RemainingTime = component.Timer;
UpdateStatus(component);
UpdateUserInterface(component);
Expand Down
10 changes: 2 additions & 8 deletions Content.Server/_Sunrise/Disease/DiseaseRoleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<DiseaseRoleComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<DiseaseRoleComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<DiseaseRoleComponent, DiseaseShopActionEvent>(OnShop);
SubscribeLocalEvent<DiseaseRoleComponent, DiseaseAddSymptomEvent>(OnAddSymptom);
Expand Down Expand Up @@ -113,9 +112,9 @@ private void OnInfects(InfectEvent args)
}
}

private void OnInit(EntityUid uid, DiseaseRoleComponent component, ComponentInit args)
private void OnMapInit(EntityUid uid, DiseaseRoleComponent component, MapInitEvent args)
{

_actionsSystem.AddAction(uid, DiseaseShopId, uid);
foreach (var (id, charges) in component.Actions)
{
EntityUid? actionId = null;
Expand All @@ -126,11 +125,6 @@ private void OnInit(EntityUid uid, DiseaseRoleComponent component, ComponentInit
component.Symptoms.Add("Headache", (1, 4));
}

private void OnMapInit(EntityUid uid, DiseaseRoleComponent component, MapInitEvent args)
{
_actionsSystem.AddAction(uid, DiseaseShopId, uid);
}

private void OnShop(EntityUid uid, DiseaseRoleComponent component, DiseaseShopActionEvent args)
{
if (!TryComp<StoreComponent>(uid, out var store))
Expand Down
32 changes: 10 additions & 22 deletions Content.Server/_Sunrise/FleshCult/FleshAbilitiesComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ public sealed partial class FleshAbilitiesComponent : Component
[DataField("startingActions", customTypeSerializer: typeof(PrototypeIdListSerializer<EntityPrototype>))]
public List<string> StartingActions = new();

[DataField]
public List<EntityUid> Actions = new();

[DataField(customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string ActionFleshCultistDevourId = "FleshCultistDevour";
public EntProtoId ActionFleshCultistDevourId = "FleshCultistDevour";

[ViewVariables(VVAccess.ReadWrite), DataField("bloodWhitelist")]
public List<string> BloodWhitelist = new()
Expand All @@ -29,53 +27,43 @@ public sealed partial class FleshAbilitiesComponent : Component
"ZombieBlood"
};

[DataField("devourTime")] public float DevourTime = 10f;
public float DevourTime = 10f;

[DataField("devourSound")]
public SoundSpecifier DevourSound = new SoundPathSpecifier("/Audio/_Sunrise/FleshCult/devour_flesh_cultist.ogg");

[DataField("adrenalinReagents")] public Solution AdrenalinReagents = new()
public Solution AdrenalinReagents = new()
{
Contents = { new ReagentQuantity(new ReagentId("Ephedrine", null), 10) }
};

[DataField("healDevourReagents")] public Solution HealDevourReagents = new()
public Solution HealDevourReagents = new()
{
Contents =
{
new ReagentQuantity(new ReagentId("Carol", null), 20),
}
};

[DataField("healBloodAbsorbReagents")] public Solution HealBloodAbsorbReagents = new()
public Solution HealBloodAbsorbReagents = new()
{
Contents =
{
new ReagentQuantity(new ReagentId("Carol", null), 1),
}
};

[DataField]
public SoundSpecifier BloodAbsorbSound = new SoundPathSpecifier("/Audio/Effects/Fluids/splat.ogg");

[DataField(customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string BulletAcidSpawnId = "BulletSplashAcid";
public EntProtoId BulletAcidSpawnId = "BulletSplashAcid";

public EntProtoId FleshHeartId = "FleshHeart";

public EntProtoId HuggerMobSpawnId = "MobFleshHugger";

[DataField]
public SoundSpecifier SoundBulletAcid = new SoundPathSpecifier("/Audio/_Sunrise/FleshCult/flesh_cultist_mutation.ogg");

[DataField]
public SoundSpecifier SoundMutation = new SoundPathSpecifier("/Audio/_Sunrise/FleshCult/flesh_cultist_mutation.ogg");

[DataField("fleshHeartId", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>)),
ViewVariables(VVAccess.ReadWrite)]
public string FleshHeartId = "FleshHeart";

[ViewVariables(VVAccess.ReadWrite), DataField("soundThrowWorm")]
public SoundSpecifier? SoundThrowHugger = new SoundPathSpecifier("/Audio/_Sunrise/FleshCult/throw_worm.ogg");

[ViewVariables(VVAccess.ReadWrite),
DataField("huggerMobSpawnId", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string HuggerMobSpawnId = "MobFleshHugger";
}
}
9 changes: 0 additions & 9 deletions Content.Server/_Sunrise/FleshCult/FleshCultSystem.Cultist.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,6 @@ private void OnStartup(EntityUid uid, FleshCultistComponent component, Component

EnsureComp<IgnoreFleshSpiderWebComponent>(uid);

if (HasComp<HungerComponent>(uid))
RemComp<HungerComponent>(uid);

if (HasComp<ThirstComponent>(uid))
RemComp<ThirstComponent>(uid);

_tagSystem.AddTag(uid, FleshTagProto);

if (TryComp<HumanoidAppearanceComponent>(uid, out var appearance))
Expand Down Expand Up @@ -210,9 +204,6 @@ private void OnShutdown(EntityUid uid, FleshCultistComponent component, Componen
collectiveMind.Minds.Remove(FleshCollectiveMindProto);
}

EnsureComp<HungerComponent>(uid);
EnsureComp<ThirstComponent>(uid);

_alerts.ClearAlert(uid, component.MutationPointAlert);

_tagSystem.RemoveTag(uid, FleshTagProto);
Expand Down
Loading

0 comments on commit 668b4fd

Please sign in to comment.