Add interaction tests for mousetraps (#35502)
* Add interaction tests for mousetraps * Silly yaml linter * review * fix debugging thing --------- Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
@@ -169,6 +169,12 @@ public abstract partial class InteractionTest
|
||||
/// <param name="enableToggleable">Whether or not to automatically enable any toggleable items</param>
|
||||
protected async Task<NetEntity> PlaceInHands(EntitySpecifier entity, bool enableToggleable = true)
|
||||
{
|
||||
if (Hands == null)
|
||||
{
|
||||
Assert.Fail("No HandsComponent");
|
||||
return default;
|
||||
}
|
||||
|
||||
if (Hands.ActiveHandId == null)
|
||||
{
|
||||
Assert.Fail("No active hand");
|
||||
@@ -210,6 +216,12 @@ public abstract partial class InteractionTest
|
||||
{
|
||||
entity ??= Target;
|
||||
|
||||
if (Hands == null)
|
||||
{
|
||||
Assert.Fail("No HandsComponent");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Hands.ActiveHandId == null)
|
||||
{
|
||||
Assert.Fail("No active hand");
|
||||
@@ -860,7 +872,7 @@ public abstract partial class InteractionTest
|
||||
/// List of currently active DoAfters on the player.
|
||||
/// </summary>
|
||||
protected IEnumerable<Shared.DoAfter.DoAfter> ActiveDoAfters
|
||||
=> DoAfters.DoAfters.Values.Where(x => !x.Cancelled && !x.Completed);
|
||||
=> DoAfters?.DoAfters.Values.Where(x => !x.Cancelled && !x.Completed) ?? [];
|
||||
|
||||
#region Component
|
||||
|
||||
|
||||
@@ -125,8 +125,8 @@ public abstract partial class InteractionTest
|
||||
protected SharedUserInterfaceSystem CUiSys = default!;
|
||||
|
||||
// player components
|
||||
protected HandsComponent Hands = default!;
|
||||
protected DoAfterComponent DoAfters = default!;
|
||||
protected HandsComponent? Hands;
|
||||
protected DoAfterComponent? DoAfters;
|
||||
|
||||
public float TickPeriod => (float)STiming.TickPeriod.TotalSeconds;
|
||||
|
||||
@@ -222,8 +222,8 @@ public abstract partial class InteractionTest
|
||||
SPlayer = SEntMan.SpawnEntity(PlayerPrototype, SEntMan.GetCoordinates(PlayerCoords));
|
||||
Player = SEntMan.GetNetEntity(SPlayer);
|
||||
Server.PlayerMan.SetAttachedEntity(ServerSession, SPlayer);
|
||||
Hands = SEntMan.GetComponent<HandsComponent>(SPlayer);
|
||||
DoAfters = SEntMan.GetComponent<DoAfterComponent>(SPlayer);
|
||||
Hands = SEntMan.GetComponentOrNull<HandsComponent>(SPlayer);
|
||||
DoAfters = SEntMan.GetComponentOrNull<DoAfterComponent>(SPlayer);
|
||||
});
|
||||
|
||||
// Check player got attached.
|
||||
|
||||
Reference in New Issue
Block a user