Rejigging Item slots (#4933)
* itemslot overhaul * remove "shared" prefix * handle component shutdown * comments, cleanup, tests * comments and minor tweak * rename ItemSlotManagerState * fix swapping * fix merge * Add ItemSlot verb text override * fix merge (IEntity -> entityUid) * Fix merge (LabelSystem) * Fix merge (nuke disk) * fix test
This commit is contained in:
@@ -42,7 +42,6 @@ namespace Content.IntegrationTests.Tests
|
||||
Slots:
|
||||
- idcard
|
||||
- type: PDA
|
||||
idCard: AssistantIDCard
|
||||
";
|
||||
[Test]
|
||||
public async Task SpawnItemInSlotTest()
|
||||
|
||||
@@ -29,13 +29,12 @@ namespace Content.IntegrationTests.Tests.PDA
|
||||
id: {PdaDummy}
|
||||
name: {PdaDummy}
|
||||
components:
|
||||
- type: ItemSlots
|
||||
slots:
|
||||
pdaIdSlot:
|
||||
whitelist:
|
||||
components:
|
||||
- IdCard
|
||||
- type: PDA
|
||||
idSlot:
|
||||
name: ID Card
|
||||
whitelist:
|
||||
components:
|
||||
- IdCard
|
||||
- type: Item";
|
||||
|
||||
[Test]
|
||||
@@ -77,9 +76,9 @@ namespace Content.IntegrationTests.Tests.PDA
|
||||
var pdaComponent = dummyPda.GetComponent<PDAComponent>();
|
||||
var pdaIdCard = sEntityManager.SpawnEntity(IdCardDummy, player.Transform.MapPosition);
|
||||
|
||||
var itemSlots = dummyPda.GetComponent<SharedItemSlotsComponent>();
|
||||
sEntityManager.EntitySysManager.GetEntitySystem<SharedItemSlotsSystem>()
|
||||
.TryInsertContent(itemSlots, pdaIdCard, pdaComponent.IdSlot);
|
||||
var itemSlots = dummyPda.GetComponent<ItemSlotsComponent>();
|
||||
sEntityManager.EntitySysManager.GetEntitySystem<ItemSlotsSystem>()
|
||||
.TryInsert(dummyPda.Uid, pdaComponent.IdSlot, pdaIdCard);
|
||||
var pdaContainedId = pdaComponent.ContainedID;
|
||||
|
||||
// The PDA in the hand should be found first
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace Content.IntegrationTests.Tests.Utility
|
||||
|
||||
// Test from serialized
|
||||
var dummy = entityManager.SpawnEntity("WhitelistDummy", mapCoordinates);
|
||||
var whitelistSer = dummy.GetComponent<SharedItemSlotsComponent>().Slots.Values.First().Whitelist;
|
||||
var whitelistSer = dummy.GetComponent<ItemSlotsComponent>().Slots.Values.First().Whitelist;
|
||||
Assert.That(whitelistSer, Is.Not.Null);
|
||||
|
||||
Assert.That(whitelistSer.Components, Is.Not.Null);
|
||||
|
||||
Reference in New Issue
Block a user