[Fix] Test (#365)

* fix test

* Fix

* fix Prosecutor

* mmm?

* fix SuicideCommandTests.cs

* EnvironmentalSuicide

* pls :(

* fix reaction

* oops
This commit is contained in:
Spatison
2025-03-30 21:48:18 +03:00
committed by GitHub
parent f37778e9cc
commit 9180bf2497
26 changed files with 95 additions and 124 deletions

View File

@@ -4,7 +4,7 @@
public sealed class PoolManagerTestEventHandler
{
// This value is completely arbitrary.
private static TimeSpan MaximumTotalTestingTimeLimit => TimeSpan.FromMinutes(120);
private static TimeSpan MaximumTotalTestingTimeLimit => TimeSpan.FromMinutes(20);
private static TimeSpan HardStopTimeLimit => MaximumTotalTestingTimeLimit.Add(TimeSpan.FromMinutes(1));
[OneTimeSetUp]

View File

@@ -45,14 +45,14 @@ public sealed class SlippingTest : MovementTest
Assert.That(sys.Slipped, Does.Not.Contain(SEntMan.GetEntity(Player)));
// Walking over the banana slowly does not trigger a slip.
await SetKey(EngineKeyFunctions.Walk, sprintWalks ? BoundKeyState.Up : BoundKeyState.Down);
await SetKey(EngineKeyFunctions.Walk, sprintWalks ? BoundKeyState.Down : BoundKeyState.Up); // WD EDIT
await Move(DirectionFlag.East, 1f);
Assert.That(Delta(), Is.LessThan(0.5f));
Assert.That(sys.Slipped, Does.Not.Contain(SEntMan.GetEntity(Player)));
AssertComp<KnockedDownComponent>(false, Player);
// Moving at normal speeds does trigger a slip.
await SetKey(EngineKeyFunctions.Walk, sprintWalks ? BoundKeyState.Down : BoundKeyState.Up);
await SetKey(EngineKeyFunctions.Walk, sprintWalks ? BoundKeyState.Up : BoundKeyState.Down); // WD EDIT
await Move(DirectionFlag.West, 1f);
Assert.That(sys.Slipped, Does.Contain(SEntMan.GetEntity(Player)));
AssertComp<KnockedDownComponent>(true, Player);

View File

@@ -78,6 +78,7 @@ namespace Content.IntegrationTests.Tests
"DryDock", //WWDP
"Moose", //WWDP
"WhiteBox", //WWDP
"Molecule", //WWDP
};
/// <summary>

View File

@@ -1,9 +1,7 @@
using Content.Server.GameTicking;
using Content.Shared.Damage;
using Content.Shared.Database;
using Content.Shared.Hands.Components;
using Content.Shared.Interaction.Events;
using Content.Shared.Item;
using Content.Shared.Mind;
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
@@ -18,7 +16,6 @@ namespace Content.Server.Chat;
public sealed class SuicideSystem : EntitySystem
{
[Dependency] private readonly EntityLookupSystem _entityLookupSystem = default!;
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly TagSystem _tagSystem = default!;
[Dependency] private readonly MobStateSystem _mobState = default!;
@@ -31,7 +28,6 @@ public sealed class SuicideSystem : EntitySystem
base.Initialize();
SubscribeLocalEvent<DamageableComponent, SuicideEvent>(OnDamageableSuicide);
SubscribeLocalEvent<MobStateComponent, SuicideEvent>(OnEnvironmentalSuicide);
SubscribeLocalEvent<MindContainerComponent, SuicideGhostEvent>(OnSuicideGhost);
}
@@ -86,46 +82,6 @@ public sealed class SuicideSystem : EntitySystem
args.Handled = true;
}
/// <summary>
/// Raise event to attempt to use held item, or surrounding entities to attempt to commit suicide
/// </summary>
private void OnEnvironmentalSuicide(Entity<MobStateComponent> victim, ref SuicideEvent args)
{
if (args.Handled || _mobState.IsCritical(victim))
return;
var suicideByEnvironmentEvent = new SuicideByEnvironmentEvent(victim);
// Try to suicide by raising an event on the held item
if (EntityManager.TryGetComponent(victim, out HandsComponent? handsComponent)
&& handsComponent.ActiveHandEntity is { } item)
{
RaiseLocalEvent(item, suicideByEnvironmentEvent);
if (suicideByEnvironmentEvent.Handled)
{
args.Handled = suicideByEnvironmentEvent.Handled;
return;
}
}
// Try to suicide by nearby entities, like Microwaves or Crematoriums, by raising an event on it
// Returns upon being handled by any entity
var itemQuery = GetEntityQuery<ItemComponent>();
foreach (var entity in _entityLookupSystem.GetEntitiesInRange(victim, 1, LookupFlags.Approximate | LookupFlags.Static))
{
// Skip any nearby items that can be picked up, we already checked the active held item above
if (itemQuery.HasComponent(entity))
continue;
RaiseLocalEvent(entity, suicideByEnvironmentEvent);
if (!suicideByEnvironmentEvent.Handled)
continue;
args.Handled = suicideByEnvironmentEvent.Handled;
return;
}
}
/// <summary>
/// Default suicide behavior for any kind of entity that can take damage
/// </summary>

View File

@@ -20,7 +20,7 @@ namespace Content.Server.CombatMode.Disarm // WWDP moved to shared
public float WieldedBonus = 0f;
// WWDP
[DataField, ViewVariables(VVAccess.ReadOnly)]
[ViewVariables(VVAccess.ReadOnly)]
public float CurrentMalus;
}
}

View File

@@ -0,0 +1,57 @@
using Content.Server.Chat;
using Content.Shared.Hands.Components;
using Content.Shared.Interaction.Events;
using Content.Shared.Item;
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
namespace Content.Server._White.Chat;
public sealed class EnvironmentalSuicideSystem : EntitySystem
{
[Dependency] private readonly EntityLookupSystem _entityLookupSystem = default!;
[Dependency] private readonly MobStateSystem _mobState = default!;
public override void Initialize() =>
SubscribeLocalEvent<MobStateComponent, SuicideEvent>(OnEnvironmentalSuicide, before: new[] { typeof(SuicideSystem) });
/// <summary>
/// Raise event to attempt to use held item, or surrounding entities to attempt to commit suicide
/// </summary>
private void OnEnvironmentalSuicide(Entity<MobStateComponent> victim, ref SuicideEvent args)
{
if (args.Handled || _mobState.IsCritical(victim))
return;
var suicideByEnvironmentEvent = new SuicideByEnvironmentEvent(victim);
// Try to suicide by raising an event on the held item
if (EntityManager.TryGetComponent(victim, out HandsComponent? handsComponent)
&& handsComponent.ActiveHandEntity is { } item)
{
RaiseLocalEvent(item, suicideByEnvironmentEvent);
if (suicideByEnvironmentEvent.Handled)
{
args.Handled = suicideByEnvironmentEvent.Handled;
return;
}
}
// Try to suicide by nearby entities, like Microwaves or Crematoriums, by raising an event on it
// Returns upon being handled by any entity
var itemQuery = GetEntityQuery<ItemComponent>();
foreach (var entity in _entityLookupSystem.GetEntitiesInRange(victim, 1, LookupFlags.Approximate | LookupFlags.Static))
{
// Skip any nearby items that can be picked up, we already checked the active held item above
if (itemQuery.HasComponent(entity))
continue;
RaiseLocalEvent(entity, suicideByEnvironmentEvent);
if (!suicideByEnvironmentEvent.Handled)
continue;
args.Handled = suicideByEnvironmentEvent.Handled;
return;
}
}
}

View File

@@ -2,6 +2,7 @@ using Content.Shared.Hands.EntitySystems;
using Content.Shared.Interaction;
using Content.Shared.Verbs;
using Content.Shared.Examine;
using Content.Shared.Inventory;
using Content.Shared.Item.ItemToggle.Components;
using Content.Shared.Storage;
using Content.Shared.Storage.EntitySystems;
@@ -17,6 +18,7 @@ public abstract class SharedItemSystem : EntitySystem
{
[Dependency] private readonly SharedTransformSystem _transform = default!; // Goobstation
[Dependency] private readonly SharedStorageSystem _storage = default!; // Goobstation
[Dependency] private readonly InventorySystem _inventory = default!; // Goobstation
[Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
[Dependency] protected readonly SharedContainerSystem Container = default!;
@@ -248,14 +250,6 @@ public abstract class SharedItemSystem : EntitySystem
}
}
if (Container.TryGetContainingContainer((uid, null, null), out var container) &&
TryComp(container.Owner,
out StorageComponent? storage)) // Goobstation - reinsert item in storage because size changed
{
_transform.AttachToGridOrMap(uid);
_storage.Insert(container.Owner, uid, out _, null, storage, false);
}
Dirty(uid, item);
}
}

View File

@@ -4,3 +4,6 @@ enabled = false
[shuttle]
auto_call_time = 0
[lavaland]
enabled = false

View File

@@ -15698,8 +15698,6 @@ entities:
pos: -199.5,8.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 76
- uid: 445
@@ -15708,8 +15706,6 @@ entities:
pos: -194.5,12.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 76
- uid: 446
@@ -15718,8 +15714,6 @@ entities:
pos: -194.5,4.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 76
- proto: AltarSpawner
@@ -59205,8 +59199,6 @@ entities:
pos: -193.5,14.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 76
- uid: 8281
@@ -59215,8 +59207,6 @@ entities:
pos: -200.5,4.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 76
- uid: 8282
@@ -59225,8 +59215,6 @@ entities:
pos: -197.5,14.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 76
- uid: 8283
@@ -59235,8 +59223,6 @@ entities:
pos: -191.5,8.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 76
- uid: 8284
@@ -59424,8 +59410,6 @@ entities:
pos: -200.5,12.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 76
- uid: 8310
@@ -59467,8 +59451,6 @@ entities:
pos: -194.5,8.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 76
- uid: 8316
@@ -59477,8 +59459,6 @@ entities:
pos: -196.5,5.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 76
- uid: 8317
@@ -74273,8 +74253,6 @@ entities:
pos: -198.5,7.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 76
- type: AtmosPipeColor
@@ -74886,8 +74864,6 @@ entities:
pos: -198.5,2.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 76
- type: AtmosPipeColor
@@ -74899,8 +74875,6 @@ entities:
pos: -193.5,12.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 76
- type: AtmosPipeColor
@@ -74968,8 +74942,6 @@ entities:
pos: -199.5,8.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 76
- type: AtmosPipeColor
@@ -74981,8 +74953,6 @@ entities:
pos: -193.5,8.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 76
- type: AtmosPipeColor
@@ -74994,8 +74964,6 @@ entities:
pos: -197.5,3.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 76
- type: AtmosPipeColor
@@ -75006,8 +74974,6 @@ entities:
pos: -196.5,12.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 76
- type: AtmosPipeColor

View File

@@ -123389,8 +123389,6 @@ entities:
pos: 13.5,20.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 72
- type: AtmosPipeColor
@@ -124714,8 +124712,6 @@ entities:
pos: 17.5,25.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 72
- type: AtmosPipeColor
@@ -124828,8 +124824,6 @@ entities:
pos: 13.5,25.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 72
- type: AtmosPipeColor
@@ -126250,8 +126244,6 @@ entities:
pos: 14.5,20.5
parent: 2
- type: DeviceNetwork
configurators:
- invalid
deviceLists:
- 72
- type: AtmosPipeColor

View File

@@ -327,6 +327,10 @@
interfaces:
enum.StorageUiKey.Key:
type: StorageBoundUserInterface
enum.ItemSlotPickerKey.Key: # WD EDIT
type: ItemSlotPickerBoundUserInterface
requireInputValidation: True
interactionRange: 1.5
- type: Drink
solution: bucket
- type: ContainerContainer

View File

@@ -44,13 +44,13 @@
Paramedic: [ 1, 1 ]
MedicalDoctor: [ 2, 3 ]
MedicalIntern: [ 2, 2 ]
Psychologist: [ 0, 0 ]
# Psychologist: [ 0, 0 ]
#Cargo
SalvageSpecialist: [ 3, 3 ]
CargoTechnician: [ 2, 3 ]
MailCarrier: [ 1, 1 ]
#Engineering
SeniorEngineer: [ 1, 1 ]
# SeniorEngineer: [ 1, 1 ]
AtmosphericTechnician: [ 2, 2 ]
StationEngineer: [ 2, 3 ]
TechnicalAssistant: [ 2, 2 ]
@@ -70,7 +70,7 @@
Clown: [ 1, 1 ]
Musician: [ 1, 1 ]
Reporter: [ 1, 1 ]
Boxer: [ 0, 0 ]
Hobo: [ 1, 2 ]
# Boxer: [ 0, 0 ]
# Hobo: [ 1, 2 ]
Passenger: [ -1, -1 ]

View File

@@ -24,10 +24,7 @@
Librarian: [ 1, 1 ]
#command
Captain: [ 1, 1 ]
BlueshieldOfficer: [ 1, 1]
NanotrasenRepresentative: [ 1, 1 ]
Magistrate: [ 1, 1 ]
AdministrativeAssistant: [ 1, 1 ]
Maid: [ 1, 1 ]
#engineering
AtmosphericTechnician: [ 1, 2 ]
ChiefEngineer: [ 1, 1 ]
@@ -43,7 +40,7 @@
#security
Brigmedic: [ 1, 1 ]
Detective: [ 1, 1 ]
Gladiator: [ 0, 2 ]
# Gladiator: [ 0, 2 ] - WD EDIT
HeadOfSecurity: [ 1, 1 ]
Prisoner: [ 1, 2 ]
PrisonGuard: [ 1, 1 ]

View File

@@ -63,7 +63,7 @@
Clown: [ 1, 2 ]
Mime: [ 1, 2 ]
Musician: [ 1, 3 ]
Boxer: [ 2, 4 ]
# Boxer: [ 2, 4 ] - WD EDIT
Reporter: [ 2, 4 ]
Passenger: [ -1, -1 ]
# Silicon

View File

@@ -70,5 +70,5 @@
Musician: [ 1, 1 ]
Reporter: [ 1, 1 ]
Passenger: [ -1, -1 ]
Hobo: [ 1, 1 ]
# Hobo: [ 1, 1 ]

View File

@@ -28,7 +28,7 @@
HeadOfPersonnel: [ 1, 1 ]
Bartender: [ 2, 2 ]
Botanist: [ 2, 3 ]
Boxer: [ 1, 2 ]
# Boxer: [ 1, 2 ] - WD EDIT
Chef: [ 2, 3 ]
Clown: [ 1, 2 ]
Reporter: [ 2, 2 ]

View File

@@ -25,7 +25,7 @@
HeadOfPersonnel: [ 1, 1 ]
Bartender: [ 1, 2 ]
Botanist: [ 2, 2 ]
Boxer: [ 2, 2 ]
# Boxer: [ 2, 2 ] - WD EDIT
Chef: [ 1, 2 ]
Clown: [ 1, 1 ]
Lawyer: [ 2, 2 ]

View File

@@ -45,7 +45,6 @@
Paramedic: [ 3, 3 ]
MedicalDoctor: [ 3, 4 ]
MedicalIntern: [ 2, 2 ]
Psychologist: [ 1, 1 ]
#Cargo
SalvageSpecialist: [ 3, 3 ]
CargoTechnician: [ 2, 2 ]
@@ -69,7 +68,5 @@
Clown: [ 1, 1 ]
Musician: [ 1, 1 ]
Reporter: [ 1, 1 ]
Boxer: [ 1, 1 ]
Passenger: [ -1, -1 ]
Hobo: [ 1, 1 ]

View File

@@ -69,7 +69,7 @@
Clown: [ 1, 1 ]
Musician: [ 1, 1 ]
Reporter: [ 1, 1 ]
Boxer: [ 1, 1 ]
# Boxer: [ 1, 1 ]
Passenger: [ -1, -1 ]
Hobo: [ 1, 1 ]

View File

@@ -28,7 +28,7 @@
HeadOfPersonnel: [ 1, 1 ]
Bartender: [ 1, 2 ]
Botanist: [ 2, 2 ]
Boxer: [ 2, 2 ]
# Boxer: [ 2, 2 ] - WD EDIT
Chef: [ 2 , 2 ]
Clown: [ 1, 1 ]
Lawyer: [ 1, 1 ]

View File

@@ -69,10 +69,10 @@
Reporter: [ 2, 2 ]
Psychologist: [ 1, 1 ]
#justice
ChiefJustice: [ 1, 1 ]
Clerk: [ 1, 1 ]
# ChiefJustice: [ 1, 1 ] - WD EDIT
# Clerk: [ 1, 1 ] - WD EDIT
Lawyer: [ 1, 1 ]
Prosecutor: [ 1, 1]
# Prosecutor: [ 1, 1] - WD EDIT
#silicon
StationAi: [ 1, 1 ]
Borg: [ 3, 3 ]

View File

@@ -26,7 +26,7 @@
Lawyer: [ 1, 1 ]
Bartender: [ 1, 2 ]
Botanist: [ 1, 2 ]
MartialArtist: [ 2, 3 ]
# MartialArtist: [ 2, 3 ] - WD EDIT
Chef: [ 1, 2 ]
Clown: [ 1, 1 ]
Janitor: [ 1, 2 ]

View File

@@ -31,7 +31,8 @@
components:
- type: RevolverAmmoProvider
capacity: 8
chambers: [ False, False, False, False, False, False, False, False ]
proto: null # WD EDIT - no empty WeaponRevolverArgentiEmpty?
chambers: [ null, null, null, null, null, null, null, null ]
ammoSlots: [ null, null, null, null, null, null, null, null ]
- type: ExtendDescription
descriptionList:

View File

@@ -9,6 +9,9 @@
symmetry: Right
toolName: "a right arm" # Shitmed Change
canSever: false
- type: Sprite # WD EDIT
sprite: Mobs/Customization/cyberlimbs/bishop/bishop_main.rsi
state: "r_arm-combined"
- type: entity
id: RightHandSiliconIndestructible
@@ -21,3 +24,6 @@
symmetry: Right
toolName: "a right hand" # Shitmed Change
canSever: false
- type: Sprite # WD EDIT
sprite: Mobs/Customization/cyberlimbs/bishop/bishop_main.rsi
state: "r_hand"

View File

@@ -18,8 +18,6 @@
reactants:
Cellulose:
amount: 5
Water:
amount: 5
Vodka:
amount: 5
effects:

View File

@@ -52,4 +52,3 @@
Carbon: 2
Sugar: 2
Nutriment: 1