Cuff enhancements (#3087)

* Cuff enhancements

* Cuffs now have an OnClick for the alert to remove them
* nullables
* Use default interaction range so highlights are accurate
* Cuffing fails more gracely
* Make shared abstract and add component references to client / server
* Don't cache AudioSystem and HandsComponent given cuffs are rarely used

* Fix test

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
metalgearsloth
2021-02-06 03:11:21 +11:00
committed by GitHub
parent 9884b14e8d
commit 7ed07c0cac
7 changed files with 121 additions and 74 deletions

View File

@@ -18,7 +18,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking
[TestFixture]
[TestOf(typeof(CuffableComponent))]
[TestOf(typeof(HandcuffComponent))]
public class CuffUnitTest : ContentIntegrationTest
public class HandCuffTest : ContentIntegrationTest
{
private const string PROTOTYPES = @"
- type: entity
@@ -77,7 +77,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking
Assert.True(secondCuffs.TryGetComponent(out secondHandcuff!), $"Second handcuffs has no {nameof(HandcuffComponent)}");
// Test to ensure cuffed players register the handcuffs
cuffed.AddNewCuffs(cuffs);
cuffed.TryAddNewCuffs(human, cuffs);
Assert.True(cuffed.CuffedHandCount > 0, "Handcuffing a player did not result in their hands being cuffed");
// Test to ensure a player with 4 hands will still only have 2 hands cuffed
@@ -86,7 +86,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking
Assert.True(cuffed.CuffedHandCount == 2 && hands.Hands.Count() == 4, "Player doesn't have correct amount of hands cuffed");
// Test to give a player with 4 hands 2 sets of cuffs
cuffed.AddNewCuffs(secondCuffs);
cuffed.TryAddNewCuffs(human, secondCuffs);
Assert.True(cuffed.CuffedHandCount == 4, "Player doesn't have correct amount of hands cuffed");
});