From 58ab7631c22e0219ea8ac5dd8b980f8418f72e14 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Mon, 24 Feb 2020 16:58:25 +0100 Subject: [PATCH] Give every job their fancy ID types. --- .../Tests/HumanInventoryUniformSlotsTest.cs | 2 +- Content.Server/GameTicking/GameTicker.cs | 12 ++++++++---- Resources/Prototypes/Jobs/Cargo/CargoTechnician.yml | 1 + Resources/Prototypes/Jobs/Civilian/Assistant.yml | 1 + Resources/Prototypes/Jobs/Civilian/Clown.yml | 1 + Resources/Prototypes/Jobs/Civilian/Janitor.yml | 1 + Resources/Prototypes/Jobs/Command/Captain.yml | 1 + .../Prototypes/Jobs/Command/HeadOfPersonnel.yml | 1 + .../Prototypes/Jobs/Engineering/ChiefEngineer.yml | 1 + .../Prototypes/Jobs/Engineering/StationEngineer.yml | 1 + .../Prototypes/Jobs/Medical/ChiefMedicalOfficer.yml | 1 + Resources/Prototypes/Jobs/Medical/MedicalDoctor.yml | 1 + .../Prototypes/Jobs/Science/ResearchDirector.yml | 1 + Resources/Prototypes/Jobs/Science/Scientist.yml | 1 + .../Prototypes/Jobs/Security/HeadOfSecurity.yml | 1 + .../Prototypes/Jobs/Security/SecurityOfficer.yml | 1 + 16 files changed, 23 insertions(+), 5 deletions(-) diff --git a/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs b/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs index 8238c93da2..0268b6759b 100644 --- a/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs +++ b/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs @@ -38,7 +38,7 @@ namespace Content.IntegrationTests.Tests human = entityMan.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace); uniform = entityMan.SpawnEntity("JanitorUniform", MapCoordinates.Nullspace); - idCard = entityMan.SpawnEntity("IDCardStandard", MapCoordinates.Nullspace); + idCard = entityMan.SpawnEntity("AssistantIDCard", MapCoordinates.Nullspace); pocketItem = entityMan.SpawnEntity("FlashlightLantern", MapCoordinates.Nullspace); var tooBigItem = entityMan.SpawnEntity("RedToolboxItem", MapCoordinates.Nullspace); diff --git a/Content.Server/GameTicking/GameTicker.cs b/Content.Server/GameTicking/GameTicker.cs index 1d41f0a132..e8c654b2c3 100644 --- a/Content.Server/GameTicking/GameTicker.cs +++ b/Content.Server/GameTicking/GameTicker.cs @@ -13,7 +13,6 @@ using Content.Server.Mobs; using Content.Server.Mobs.Roles; using Content.Server.Players; using Content.Shared; -using Content.Shared.GameObjects.Components.Inventory; using Content.Shared.Jobs; using Content.Shared.Preferences; using Robust.Server.Interfaces.Maps; @@ -39,6 +38,7 @@ using Robust.Shared.Timers; using Robust.Shared.Timing; using Robust.Shared.Utility; using Robust.Shared.ViewVariables; +using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines; namespace Content.Server.GameTicking { @@ -481,10 +481,14 @@ namespace Content.Server.GameTicking private void EquipIdCard(IEntity mob, string characterName, JobPrototype jobPrototype) { - var card = _entityManager.SpawnEntity("IDCardStandard", mob.Transform.GridPosition); - var inventory = mob.GetComponent(); - inventory.Equip(EquipmentSlotDefines.Slots.IDCARD, card.GetComponent()); + + if (!inventory.TryGetSlotItem(Slots.IDCARD, out ItemComponent cardItem)) + { + return; + } + + var card = cardItem.Owner; var cardComponent = card.GetComponent(); cardComponent.FullName = characterName; diff --git a/Resources/Prototypes/Jobs/Cargo/CargoTechnician.yml b/Resources/Prototypes/Jobs/Cargo/CargoTechnician.yml index d1467d9ecb..5e75a410e4 100644 --- a/Resources/Prototypes/Jobs/Cargo/CargoTechnician.yml +++ b/Resources/Prototypes/Jobs/Cargo/CargoTechnician.yml @@ -15,3 +15,4 @@ innerclothing: UniformCargoTech backpack: BackpackClothing shoes: ShoesBlack + idcard: CargoIDCard diff --git a/Resources/Prototypes/Jobs/Civilian/Assistant.yml b/Resources/Prototypes/Jobs/Civilian/Assistant.yml index 35ad2d489f..bb73b28c6a 100644 --- a/Resources/Prototypes/Jobs/Civilian/Assistant.yml +++ b/Resources/Prototypes/Jobs/Civilian/Assistant.yml @@ -17,4 +17,5 @@ innerclothing: UniformAssistant backpack: BackpackClothing shoes: ShoesBlack + idcard: AssistantIDCard diff --git a/Resources/Prototypes/Jobs/Civilian/Clown.yml b/Resources/Prototypes/Jobs/Civilian/Clown.yml index 64846913d4..ad069cbf15 100644 --- a/Resources/Prototypes/Jobs/Civilian/Clown.yml +++ b/Resources/Prototypes/Jobs/Civilian/Clown.yml @@ -16,3 +16,4 @@ shoes: ShoesClown mask: MaskClown pocket1: BikeHorn + idcard: ClownIDCard diff --git a/Resources/Prototypes/Jobs/Civilian/Janitor.yml b/Resources/Prototypes/Jobs/Civilian/Janitor.yml index d3fa163f59..0ead8e6ee8 100644 --- a/Resources/Prototypes/Jobs/Civilian/Janitor.yml +++ b/Resources/Prototypes/Jobs/Civilian/Janitor.yml @@ -19,3 +19,4 @@ backpack: BackpackClothing shoes: ShoesGaloshes head: HatPurplesoft + idcard: JanitorIDCard diff --git a/Resources/Prototypes/Jobs/Command/Captain.yml b/Resources/Prototypes/Jobs/Command/Captain.yml index c7194f97ea..74932a1492 100644 --- a/Resources/Prototypes/Jobs/Command/Captain.yml +++ b/Resources/Prototypes/Jobs/Command/Captain.yml @@ -33,3 +33,4 @@ eyes: SunGlasses gloves: GlovesCaptain outerclothing: OuterclothingCaparmor + idcard: CaptainIDCard diff --git a/Resources/Prototypes/Jobs/Command/HeadOfPersonnel.yml b/Resources/Prototypes/Jobs/Command/HeadOfPersonnel.yml index 09144e3b89..48523a6601 100644 --- a/Resources/Prototypes/Jobs/Command/HeadOfPersonnel.yml +++ b/Resources/Prototypes/Jobs/Command/HeadOfPersonnel.yml @@ -26,3 +26,4 @@ backpack: BackpackClothing shoes: ShoesBrown head: HatHopcap + idcard: HoPIDCard diff --git a/Resources/Prototypes/Jobs/Engineering/ChiefEngineer.yml b/Resources/Prototypes/Jobs/Engineering/ChiefEngineer.yml index c9c8ac9682..9ab08aee60 100644 --- a/Resources/Prototypes/Jobs/Engineering/ChiefEngineer.yml +++ b/Resources/Prototypes/Jobs/Engineering/ChiefEngineer.yml @@ -22,3 +22,4 @@ innerclothing: UniformChiefEngineer backpack: BackpackEngineering shoes: ShoesBrown + idcard: CEIDCard diff --git a/Resources/Prototypes/Jobs/Engineering/StationEngineer.yml b/Resources/Prototypes/Jobs/Engineering/StationEngineer.yml index 6c8cfa54d4..685d0dd393 100644 --- a/Resources/Prototypes/Jobs/Engineering/StationEngineer.yml +++ b/Resources/Prototypes/Jobs/Engineering/StationEngineer.yml @@ -20,3 +20,4 @@ backpack: BackpackEngineering shoes: ShoesWorkboots outerclothing: OuterclothingHazard + idcard: EngineeringIDCard diff --git a/Resources/Prototypes/Jobs/Medical/ChiefMedicalOfficer.yml b/Resources/Prototypes/Jobs/Medical/ChiefMedicalOfficer.yml index 195cf6c1c3..f4725e2a76 100644 --- a/Resources/Prototypes/Jobs/Medical/ChiefMedicalOfficer.yml +++ b/Resources/Prototypes/Jobs/Medical/ChiefMedicalOfficer.yml @@ -23,3 +23,4 @@ backpack: BackpackMedical shoes: ShoesBrown outerclothing: OuterclothingLabcoatcmo + idcard: CMOIDCard diff --git a/Resources/Prototypes/Jobs/Medical/MedicalDoctor.yml b/Resources/Prototypes/Jobs/Medical/MedicalDoctor.yml index b73abe7531..f1166a9cf6 100644 --- a/Resources/Prototypes/Jobs/Medical/MedicalDoctor.yml +++ b/Resources/Prototypes/Jobs/Medical/MedicalDoctor.yml @@ -19,3 +19,4 @@ backpack: BackpackMedical shoes: ShoesWhite outerclothing: OuterclothingLabcoatmedspecopen + idcard: MedicalIDCard diff --git a/Resources/Prototypes/Jobs/Science/ResearchDirector.yml b/Resources/Prototypes/Jobs/Science/ResearchDirector.yml index 845d431301..3a577a2025 100644 --- a/Resources/Prototypes/Jobs/Science/ResearchDirector.yml +++ b/Resources/Prototypes/Jobs/Science/ResearchDirector.yml @@ -21,3 +21,4 @@ backpack: BackpackClothing shoes: ShoesBrown outerclothing: OuterclothingLabcoatgenopen + idcard: RDIDCard diff --git a/Resources/Prototypes/Jobs/Science/Scientist.yml b/Resources/Prototypes/Jobs/Science/Scientist.yml index 3852534ddf..86b965ce18 100644 --- a/Resources/Prototypes/Jobs/Science/Scientist.yml +++ b/Resources/Prototypes/Jobs/Science/Scientist.yml @@ -19,3 +19,4 @@ backpack: BackpackClothing shoes: ShoesWhite outerclothing: OuterclothingLabcoattoxopen + idcard: ResearchIDCard diff --git a/Resources/Prototypes/Jobs/Security/HeadOfSecurity.yml b/Resources/Prototypes/Jobs/Security/HeadOfSecurity.yml index 18ef7951ff..ef603517ec 100644 --- a/Resources/Prototypes/Jobs/Security/HeadOfSecurity.yml +++ b/Resources/Prototypes/Jobs/Security/HeadOfSecurity.yml @@ -24,3 +24,4 @@ outerclothing: OuterclothingHoSTrenchcoat eyes: SecGlasses head: HatBeretHoS + idcard: HoSIDCard diff --git a/Resources/Prototypes/Jobs/Security/SecurityOfficer.yml b/Resources/Prototypes/Jobs/Security/SecurityOfficer.yml index 7e4aef1b39..3354512ba3 100644 --- a/Resources/Prototypes/Jobs/Security/SecurityOfficer.yml +++ b/Resources/Prototypes/Jobs/Security/SecurityOfficer.yml @@ -21,3 +21,4 @@ shoes: ShoesJackboots eyes: SecGlasses outerclothing: OuterclothingArmorsec + idcard: SecurityIDCard