From 7c29e546f66e832762e88ccf1896fd1084d27b69 Mon Sep 17 00:00:00 2001 From: stilnat Date: Sat, 22 Jul 2023 16:26:46 +0200 Subject: [PATCH] add headset to items, fix loadout --- .../Addressables/AssetGroups/Items.asset | 8 ++ Assets/Content/Addressables/link.xml | 81 ------------------- Assets/Content/Addressables/link.xml.meta | 7 -- Assets/Content/Data/Items.asset | 2 + .../Roles/Loadouts/AssistantLoadout.asset | 28 +++---- .../Data/Roles/Loadouts/SecurityLoadout.asset | 34 ++++++-- .../Items/Clothes/HeadsetRight.prefab | 2 +- Assets/Scripts/SS3D/Data/Enums/ItemId.cs | 2 + .../Systems/Roles/Editor/RoleLoadoutEditor.cs | 43 ++++++---- .../Scripts/SS3D/Systems/Roles/RoleSystem.cs | 8 +- 10 files changed, 89 insertions(+), 126 deletions(-) delete mode 100644 Assets/Content/Addressables/link.xml delete mode 100644 Assets/Content/Addressables/link.xml.meta diff --git a/Assets/Content/Addressables/AssetGroups/Items.asset b/Assets/Content/Addressables/AssetGroups/Items.asset index d89b6ec21b..d4c592cd36 100644 --- a/Assets/Content/Addressables/AssetGroups/Items.asset +++ b/Assets/Content/Addressables/AssetGroups/Items.asset @@ -185,6 +185,14 @@ MonoBehaviour: m_Address: Assets/Content/WorldObjects/Items/Clothes/JumpsuitSecurity.prefab m_ReadOnly: 0 m_SerializedLabels: [] + - m_GUID: f549f4153ef612c4586c46ea280e0e94 + m_Address: Assets/Content/WorldObjects/Items/Clothes/HeadsetLeft.prefab + m_ReadOnly: 0 + m_SerializedLabels: [] + - m_GUID: 1a2f912be4bc1b948a2b22ffde517cdc + m_Address: Assets/Content/WorldObjects/Items/Clothes/HeadsetRight.prefab + m_ReadOnly: 0 + m_SerializedLabels: [] m_ReadOnly: 0 m_Settings: {fileID: 11400000, guid: ddc57d0f5f9fb874e8a26db0c5b215e0, type: 2} m_SchemaSet: diff --git a/Assets/Content/Addressables/link.xml b/Assets/Content/Addressables/link.xml deleted file mode 100644 index 10a9a456be..0000000000 --- a/Assets/Content/Addressables/link.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Assets/Content/Addressables/link.xml.meta b/Assets/Content/Addressables/link.xml.meta deleted file mode 100644 index b066b4750b..0000000000 --- a/Assets/Content/Addressables/link.xml.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: c5d8b17a7c5466f46aa2484ea516f621 -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Content/Data/Items.asset b/Assets/Content/Data/Items.asset index db5873ced2..08a37c89fc 100644 --- a/Assets/Content/Data/Items.asset +++ b/Assets/Content/Data/Items.asset @@ -58,3 +58,5 @@ MonoBehaviour: - {fileID: 60374868058361228, guid: 4b790b4ffedbe564dab49f896d71eaa6, type: 3} - {fileID: 2653363475000095017, guid: d7d68992cbd3cda45bb11a35a1490dc3, type: 3} - {fileID: 726792282085660869, guid: 4635651592391df41b6b2413afdb76c3, type: 3} + - {fileID: 7723921361698481624, guid: f549f4153ef612c4586c46ea280e0e94, type: 3} + - {fileID: 8712940276313799639, guid: 1a2f912be4bc1b948a2b22ffde517cdc, type: 3} diff --git a/Assets/Content/Data/Roles/Loadouts/AssistantLoadout.asset b/Assets/Content/Data/Roles/Loadouts/AssistantLoadout.asset index ff15e824c1..05fe287b65 100644 --- a/Assets/Content/Data/Roles/Loadouts/AssistantLoadout.asset +++ b/Assets/Content/Data/Roles/Loadouts/AssistantLoadout.asset @@ -16,25 +16,25 @@ MonoBehaviour: RightHand: 0 LeftPocket: 0 RightPocket: 0 - LeftGlove: 0 - RightGlove: 0 - LeftShoe: 0 - RightShoe: 0 - Hat: 0 + LeftGlove: 1 + RightGlove: 1 + LeftShoe: 1 + RightShoe: 1 + Hat: 1 Glasses: 0 LeftEar: 0 - RightEar: 0 - Jumpsuit: 0 + RightEar: 1 + Jumpsuit: 1 LeftHandItem: 0 RightHandItem: 0 LeftPocketItem: 0 RightPocketItem: 0 - LeftGloveItem: 0 - RightGloveItem: 0 - LeftShoeItem: 0 - RightShoeItem: 0 - HatItem: 0 + LeftGloveItem: 32 + RightGloveItem: 33 + LeftShoeItem: 37 + RightShoeItem: 38 + HatItem: 29 GlassesItem: 0 LeftEarItem: 0 - RightEarItem: 0 - JumpsuitItem: 0 + RightEarItem: 43 + JumpsuitItem: 36 diff --git a/Assets/Content/Data/Roles/Loadouts/SecurityLoadout.asset b/Assets/Content/Data/Roles/Loadouts/SecurityLoadout.asset index 6a7da29b0d..4201582a6c 100644 --- a/Assets/Content/Data/Roles/Loadouts/SecurityLoadout.asset +++ b/Assets/Content/Data/Roles/Loadouts/SecurityLoadout.asset @@ -12,11 +12,29 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 9fbd6da0c74d76746b141068081e0dc3, type: 3} m_Name: SecurityLoadout m_EditorClassIdentifier: - leftHand: 1 - rightHand: 1 - leftPocket: 0 - rightPocket: 0 - leftHandItem: 0 - rightHandItem: 1 - leftPocketItem: 0 - rightPocketItem: 0 + LeftHand: 0 + RightHand: 0 + LeftPocket: 0 + RightPocket: 0 + LeftGlove: 1 + RightGlove: 1 + LeftShoe: 1 + RightShoe: 1 + Hat: 1 + Glasses: 0 + LeftEar: 0 + RightEar: 1 + Jumpsuit: 1 + LeftHandItem: 30 + RightHandItem: 0 + LeftPocketItem: 0 + RightPocketItem: 0 + LeftGloveItem: 32 + RightGloveItem: 33 + LeftShoeItem: 37 + RightShoeItem: 38 + HatItem: 29 + GlassesItem: 0 + LeftEarItem: 0 + RightEarItem: 43 + JumpsuitItem: 41 diff --git a/Assets/Content/WorldObjects/Items/Clothes/HeadsetRight.prefab b/Assets/Content/WorldObjects/Items/Clothes/HeadsetRight.prefab index 106520ccf2..4aff80fe9a 100644 --- a/Assets/Content/WorldObjects/Items/Clothes/HeadsetRight.prefab +++ b/Assets/Content/WorldObjects/Items/Clothes/HeadsetRight.prefab @@ -99,7 +99,7 @@ MeshRenderer: m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 1640526673506620826, guid: fca31db1818708c40a396f6faa3ee993, type: 3} + - {fileID: 2100000, guid: 695c4de41b9578049a93f19b1eef7213, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 diff --git a/Assets/Scripts/SS3D/Data/Enums/ItemId.cs b/Assets/Scripts/SS3D/Data/Enums/ItemId.cs index 5dfe5121f5..b0da1910a2 100644 --- a/Assets/Scripts/SS3D/Data/Enums/ItemId.cs +++ b/Assets/Scripts/SS3D/Data/Enums/ItemId.cs @@ -44,6 +44,8 @@ public enum ItemId ShoesJackbootsLeft = 39, ShoesJackbootsRight = 40, JumpsuitSecurity = 41, + HeadsetLeft = 42, + HeadsetRight = 43, } } diff --git a/Assets/Scripts/SS3D/Systems/Roles/Editor/RoleLoadoutEditor.cs b/Assets/Scripts/SS3D/Systems/Roles/Editor/RoleLoadoutEditor.cs index 4db5f2ca7b..261a3ec279 100644 --- a/Assets/Scripts/SS3D/Systems/Roles/Editor/RoleLoadoutEditor.cs +++ b/Assets/Scripts/SS3D/Systems/Roles/Editor/RoleLoadoutEditor.cs @@ -11,26 +11,32 @@ public class RoleLoadoutEditor : Editor { private RoleLoadout roleLoadout; - public void OnEnable() + private SerializedProperty sp; + + public void OnEnable() { roleLoadout = (RoleLoadout)target; } public override void OnInspectorGUI() { - roleLoadout.LeftHand = EditorGUILayout.Toggle("Left Hand", roleLoadout.LeftHand); - roleLoadout.RightHand = EditorGUILayout.Toggle("Right Hand", roleLoadout.RightHand); - roleLoadout.LeftPocket = EditorGUILayout.Toggle("Left Pocket", roleLoadout.LeftPocket); - roleLoadout.RightPocket = EditorGUILayout.Toggle("Right Pocket", roleLoadout.RightPocket); - roleLoadout.LeftGlove = EditorGUILayout.Toggle("Left Glove", roleLoadout.LeftGlove); - roleLoadout.RightGlove = EditorGUILayout.Toggle("Right Glove", roleLoadout.RightGlove); - roleLoadout.LeftShoe = EditorGUILayout.Toggle("Left Shoe", roleLoadout.LeftShoe); - roleLoadout.RightShoe = EditorGUILayout.Toggle("Right Shoe", roleLoadout.RightShoe); - roleLoadout.Jumpsuit = EditorGUILayout.Toggle("Jumpsuit", roleLoadout.Jumpsuit); - roleLoadout.Glasses = EditorGUILayout.Toggle("Glasses", roleLoadout.Glasses); - roleLoadout.LeftEar = EditorGUILayout.Toggle("LeftEar", roleLoadout.LeftEar); - roleLoadout.RightEar = EditorGUILayout.Toggle("RightEar", roleLoadout.RightEar); - roleLoadout.Hat = EditorGUILayout.Toggle("Hat", roleLoadout.Hat); + + + serializedObject.Update(); + + HandleBools("LeftHand", roleLoadout.LeftHand); + HandleBools("RightHand", roleLoadout.RightHand); + HandleBools("LeftPocket", roleLoadout.LeftPocket); + HandleBools("RightPocket", roleLoadout.RightPocket); + HandleBools("LeftGlove", roleLoadout.LeftGlove); + HandleBools("RightGlove", roleLoadout.RightGlove); + HandleBools("LeftShoe", roleLoadout.LeftShoe); + HandleBools("RightShoe", roleLoadout.RightShoe); + HandleBools("Jumpsuit", roleLoadout.Jumpsuit); + HandleBools("Glasses", roleLoadout.Glasses); + HandleBools("LeftEar", roleLoadout.LeftEar); + HandleBools("RightEar", roleLoadout.RightEar); + HandleBools("Hat", roleLoadout.Hat); if (roleLoadout.LeftHand) { @@ -111,4 +117,13 @@ public override void OnInspectorGUI() EnumPopup("Glasses Item:", roleLoadout.GlassesItem); } } + + public void HandleBools(string name, bool loadContainer) + { + sp = serializedObject.FindProperty(name); + sp.boolValue = EditorGUILayout.Toggle(name, loadContainer); + serializedObject.ApplyModifiedProperties(); + } + + } \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Roles/RoleSystem.cs b/Assets/Scripts/SS3D/Systems/Roles/RoleSystem.cs index cdf12cb6cf..d9ae086b9f 100644 --- a/Assets/Scripts/SS3D/Systems/Roles/RoleSystem.cs +++ b/Assets/Scripts/SS3D/Systems/Roles/RoleSystem.cs @@ -227,7 +227,13 @@ private void SpawnLoadoutItems(Entity entity, RoleLoadout loadout) if (!inventory.TryGetTypeContainer(ContainerType.Pocket, 1, out AttachedContainer rightPocketContainer)) return; SpawnItemInSlot(loadout.RightPocketItem, loadout.RightPocket, rightPocketContainer); - } + if (!inventory.TryGetTypeContainer(ContainerType.EarRight, 0, out AttachedContainer EarRightContainer)) return; + SpawnItemInSlot(loadout.RightEarItem, loadout.RightEar, EarRightContainer); + + if (!inventory.TryGetTypeContainer(ContainerType.EarLeft, 0, out AttachedContainer EarLeftContainer)) return; + SpawnItemInSlot(loadout.LeftEarItem, loadout.LeftEar, EarLeftContainer); + + } /// /// Spawns an item inside a container slot after checking for boolean