From 28e5a23ea90c44b1880218b8a0e68c42a494c32d Mon Sep 17 00:00:00 2001 From: stilnat Date: Sat, 12 Aug 2023 11:09:05 +0200 Subject: [PATCH] Add and remove individual hands (#1230) * allow old view inventory to avoid crashing * Add type to slots and resize slots * make divisor a prefab * Add basis for new inventory * Add new inventory to human and inventory view to canvas * Add alternative inventory container * Make alternative dynamic UI work * remove handsview and put highlight in hands script * require inventoryalt component * fix completely container UI interactions * fix everything * separate inventory into inventory and containerviewer this alleviates a bit the role of the inventory. Inventory should only handles what's on the player or hold by them. Opened Containers by the player should be displayed using another script, dedicated to that. * add doc, add method to InventoryView * adds doc * rename Inventory to HUmanInventory this prevents the conflit with Inventory namespace * a bit of decoupling and renaming * make hands set up after inventory to avoid timing issues * fix weird hand highlight bug * sync loadout * prefab update with some bugs * fix slots type and count hand slots * kinda fix highlight hands colors * remove old hand prefabs * add bag slot and fix hand distance * fix order of slots * add clothing slots and containers * add trucker hat and sunglasses * add cloth displayers for glasses * fix a bit some patch * add hat display * add some doc * factorise some code * fix value in container type to have non overlapping bits * update human prefab * Add some clothes items * make pair slots individual, fix container type * add display for other type of clothes * small fix * add inventory slot container * remove useless using * fix container on jumpsuit * make slot remove when container removed * add and remove slots and containers in inventory * update hack * fix exception on item display * show item present in slot * update human prefab * sync clothing display * remove warning about parent transform * allows to remove container in UI of clients * slightly reduce the mesh bug * Add bunch of traits for clothing * add backpack item * modify a bit slots * remove separator and improve methods to select slots * adding id slot and inventory * remove shoes * rename stuff, document HumanInventory * rename, document inventoryview * rename, document containerviewer * doc an name change in clothesDisplayer * small rename * fix build clothes displaying weirdly * add support for bag and face mask * add headset item and support * remove inventory slot * fix hand slots * Revert "remove inventory slot" This reverts commit 07d3b0ec5d576116926c17b0b4b5674e3b7fc742. * fix glove left and right * fix slot position in horizontal layout * remove inventoryslot container * only container with display as slot in the UI * clicking on wrong containers no longer drop item * add some doc and tags * PDa is no longer considered clothing * fixing hand containers from push and fixing PDA container * making containerViewer private * change to dynamic list of displayed clothes * partly fix some handling positions * fix pda spawning multiple times * correctly set up viewer only for owner * remove useless PDA and methods * move accessor * remove inventory container on disabled * add spawning with clothes * fixing forgotten change * update assistant loadout * add headset to items, fix loadout * fix sec jumpsuit * fix return too soon * fix jumpsuit * fix pocket jumpsuit * add and remove containers methods * removing and adding slots now works properly When a gameobject container is disabled and was part of the inventory, the container slot linked to it disappear. Similar when adding a container. * onenable add container * fix slot size of items sprite * fixing item missing exceptions * fix grid * put jumpsuit on item layer * clean and doc * first commit * fix some interaction stuff * fix pickup interaction * fix hands * add some fix and properly remove hand * some doc * more doc * add assetdatabase for bodyparts * add hands as items * assetdatabase bodyparts adding follow up * small fix to hands selection * add hand command * condition fix * cleanup and permission check * add doc * fix handcommand * remove useless method in hand command * Update Assets/Scripts/SS3D/Systems/IngameConsoleSystem/Commands/AddHandCommand.cs Co-authored-by: Iamteapot <77565416+iamteapot422@users.noreply.github.com> * Update Assets/Scripts/SS3D/Systems/IngameConsoleSystem/Commands/AddHandCommand.cs Co-authored-by: Iamteapot <77565416+iamteapot422@users.noreply.github.com> * Update Assets/Scripts/SS3D/Systems/IngameConsoleSystem/Commands/AddHandCommand.cs Co-authored-by: Iamteapot <77565416+iamteapot422@users.noreply.github.com> * Update Assets/Scripts/SS3D/Systems/IngameConsoleSystem/Commands/AddHandCommand.cs Co-authored-by: Iamteapot <77565416+iamteapot422@users.noreply.github.com> * Update Assets/Scripts/SS3D/Systems/IngameConsoleSystem/Commands/AddHandCommand.cs Co-authored-by: Iamteapot <77565416+iamteapot422@users.noreply.github.com> * rename delegate and event * Update Assets/Scripts/SS3D/Systems/Inventory/Containers/Hand.cs Co-authored-by: Iamteapot <77565416+iamteapot422@users.noreply.github.com> * Update Assets/Scripts/SS3D/Systems/Inventory/Containers/InventoryView.cs Co-authored-by: Iamteapot <77565416+iamteapot422@users.noreply.github.com> * Update Assets/Scripts/SS3D/Systems/Inventory/Containers/Hand.cs Co-authored-by: Iamteapot <77565416+iamteapot422@users.noreply.github.com> * Update Assets/Scripts/SS3D/Systems/IngameConsoleSystem/Commands/AddHandCommand.cs Co-authored-by: Iamteapot <77565416+iamteapot422@users.noreply.github.com> * update variables name * fix missing ref * fix all interactions * add a comment to hand file --------- Co-authored-by: Iamteapot <77565416+iamteapot422@users.noreply.github.com> --- .../AddressableAssetSettings.asset | 1 + .../Addressables/AssetGroups/BodyParts.asset | 33 ++ .../AssetGroups/BodyParts.asset.meta | 8 + .../AssetGroups/Default Local Group.asset | 10 +- .../BodyParts_BundledAssetGroupSchema.asset | 45 ++ ...dyParts_BundledAssetGroupSchema.asset.meta | 8 + .../BodyParts_ContentUpdateGroupSchema.asset | 16 + ...yParts_ContentUpdateGroupSchema.asset.meta | 8 + .../Windows/addressables_content_state.bin | Bin 2351 -> 2916 bytes Assets/Content/Data/BodyParts.asset | 20 + Assets/Content/Data/BodyParts.asset.meta | 8 + .../Content/Data/DefaultPrefabObjects.asset | 2 + .../Entities/Humanoids/Human/Human.prefab | 79 ++-- .../Human/HumanBodyParts/HumanHandLeft.prefab | 136 +++++-- .../HumanBodyParts/HumanHandRight.prefab | 136 +++++-- .../Content/WorldObjects/Items/BodyParts.meta | 8 + .../Items/BodyParts/HumanHandLeft.prefab | 383 ++++++++++++++++++ .../Items/BodyParts/HumanHandLeft.prefab.meta | 7 + .../Items/BodyParts/HumanHandRight.prefab | 382 +++++++++++++++++ .../BodyParts/HumanHandRight.prefab.meta | 7 + .../Scripts/SS3D/Data/Enums/AssetDatabases.cs | 9 +- .../Scripts/SS3D/Data/Enums/BodyPartsIds.cs | 9 + .../SS3D/Data/Enums/BodyPartsIds.cs.meta | 11 + .../Extensions/InteractionSourceExtension.cs | 10 +- .../{IToolHolder.cs => IHandsController.cs} | 4 +- ...older.cs.meta => IHandsController.cs.meta} | 0 .../Interfaces/IInteractionSource.cs | 3 +- .../Commands/AddHandCommand.cs | 91 +++++ .../Commands/AddHandCommand.cs.meta | 11 + .../ItemCommands/ItemCommandUtilities.cs | 2 +- .../Interactions/InteractionController.cs | 8 +- .../Inventory/Containers/ContainerViewer.cs | 2 +- .../SS3D/Systems/Inventory/Containers/Hand.cs | 142 +++++++ .../Systems/Inventory/Containers/Hand.cs.meta | 11 + .../Systems/Inventory/Containers/Hands.cs | 355 ++++++++-------- .../Inventory/Containers/HumanInventory.cs | 10 +- .../Inventory/Containers/InventoryView.cs | 23 +- .../Inventory/Interactions/DropInteraction.cs | 6 +- .../Inventory/Interactions/OpenInteraction.cs | 4 +- .../Interactions/PickupInteraction.cs | 12 +- .../Interactions/StoreInteraction.cs | 4 +- .../Interactions/TakeFirstInteraction.cs | 8 +- .../Interactions/ViewContainerInteraction.cs | 8 +- .../Inventory/UI/SingleItemContainerSlot.cs | 6 +- Assets/Settings/AssetDatabaseSettings.asset | 1 + 45 files changed, 1695 insertions(+), 352 deletions(-) create mode 100644 Assets/Content/Addressables/AssetGroups/BodyParts.asset create mode 100644 Assets/Content/Addressables/AssetGroups/BodyParts.asset.meta create mode 100644 Assets/Content/Addressables/AssetGroups/Schemas/BodyParts_BundledAssetGroupSchema.asset create mode 100644 Assets/Content/Addressables/AssetGroups/Schemas/BodyParts_BundledAssetGroupSchema.asset.meta create mode 100644 Assets/Content/Addressables/AssetGroups/Schemas/BodyParts_ContentUpdateGroupSchema.asset create mode 100644 Assets/Content/Addressables/AssetGroups/Schemas/BodyParts_ContentUpdateGroupSchema.asset.meta create mode 100644 Assets/Content/Data/BodyParts.asset create mode 100644 Assets/Content/Data/BodyParts.asset.meta create mode 100644 Assets/Content/WorldObjects/Items/BodyParts.meta create mode 100644 Assets/Content/WorldObjects/Items/BodyParts/HumanHandLeft.prefab create mode 100644 Assets/Content/WorldObjects/Items/BodyParts/HumanHandLeft.prefab.meta create mode 100644 Assets/Content/WorldObjects/Items/BodyParts/HumanHandRight.prefab create mode 100644 Assets/Content/WorldObjects/Items/BodyParts/HumanHandRight.prefab.meta create mode 100644 Assets/Scripts/SS3D/Data/Enums/BodyPartsIds.cs create mode 100644 Assets/Scripts/SS3D/Data/Enums/BodyPartsIds.cs.meta rename Assets/Scripts/SS3D/Interactions/Interfaces/{IToolHolder.cs => IHandsController.cs} (74%) rename Assets/Scripts/SS3D/Interactions/Interfaces/{IToolHolder.cs.meta => IHandsController.cs.meta} (100%) create mode 100644 Assets/Scripts/SS3D/Systems/IngameConsoleSystem/Commands/AddHandCommand.cs create mode 100644 Assets/Scripts/SS3D/Systems/IngameConsoleSystem/Commands/AddHandCommand.cs.meta create mode 100644 Assets/Scripts/SS3D/Systems/Inventory/Containers/Hand.cs create mode 100644 Assets/Scripts/SS3D/Systems/Inventory/Containers/Hand.cs.meta diff --git a/Assets/Content/Addressables/AddressableAssetSettings.asset b/Assets/Content/Addressables/AddressableAssetSettings.asset index 11aed601a2..108a3a7b53 100644 --- a/Assets/Content/Addressables/AddressableAssetSettings.asset +++ b/Assets/Content/Addressables/AddressableAssetSettings.asset @@ -47,6 +47,7 @@ MonoBehaviour: - {fileID: 11400000, guid: 8e95016540bf27c4eb11580ec096568a, type: 2} - {fileID: 11400000, guid: 9bfbc9d4c2c1bb944942108648547da2, type: 2} - {fileID: 11400000, guid: bacca0c47905ef441803065410c8978e, type: 2} + - {fileID: 11400000, guid: ee54898534212cd4a97b528a9d620c75, type: 2} m_BuildSettings: m_CompileScriptsInVirtualMode: 0 m_CleanupStreamingAssetsAfterBuilds: 1 diff --git a/Assets/Content/Addressables/AssetGroups/BodyParts.asset b/Assets/Content/Addressables/AssetGroups/BodyParts.asset new file mode 100644 index 0000000000..d9c9fc191a --- /dev/null +++ b/Assets/Content/Addressables/AssetGroups/BodyParts.asset @@ -0,0 +1,33 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bbb281ee3bf0b054c82ac2347e9e782c, type: 3} + m_Name: BodyParts + m_EditorClassIdentifier: + m_GroupName: BodyParts + m_Data: + m_SerializedData: [] + m_GUID: ff965427dd1889046a3e238d5cb96512 + m_SerializeEntries: + - m_GUID: 35dfc7c3f708a5b48a206b4a44e7ab49 + m_Address: Assets/Content/WorldObjects/Entities/Humanoids/Human/HumanBodyParts/HumanHandLeft.prefab + m_ReadOnly: 0 + m_SerializedLabels: [] + - m_GUID: 7f5954f009d06b2439ca637b43920440 + m_Address: Assets/Content/WorldObjects/Entities/Humanoids/Human/HumanBodyParts/HumanHandRight.prefab + m_ReadOnly: 0 + m_SerializedLabels: [] + m_ReadOnly: 0 + m_Settings: {fileID: 11400000, guid: ddc57d0f5f9fb874e8a26db0c5b215e0, type: 2} + m_SchemaSet: + m_Schemas: + - {fileID: 11400000, guid: 4de7234b6744e474581238ba31893e14, type: 2} + - {fileID: 11400000, guid: 007c51ffa6d371a4aacdc075169132b2, type: 2} diff --git a/Assets/Content/Addressables/AssetGroups/BodyParts.asset.meta b/Assets/Content/Addressables/AssetGroups/BodyParts.asset.meta new file mode 100644 index 0000000000..b4176f92fd --- /dev/null +++ b/Assets/Content/Addressables/AssetGroups/BodyParts.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ee54898534212cd4a97b528a9d620c75 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Content/Addressables/AssetGroups/Default Local Group.asset b/Assets/Content/Addressables/AssetGroups/Default Local Group.asset index a644a4de56..1da651889a 100644 --- a/Assets/Content/Addressables/AssetGroups/Default Local Group.asset +++ b/Assets/Content/Addressables/AssetGroups/Default Local Group.asset @@ -16,7 +16,15 @@ MonoBehaviour: m_Data: m_SerializedData: [] m_GUID: a8f988e8c8dd50c4ea7f7f7e5f300082 - m_SerializeEntries: [] + m_SerializeEntries: + - m_GUID: c19eccca279beee4186432a03257a7b9 + m_Address: Assets/Content/WorldObjects/Items/BodyParts/HumanHandRight.prefab + m_ReadOnly: 0 + m_SerializedLabels: [] + - m_GUID: df85b75fd341a244c8364ebb9c4fcfef + m_Address: Assets/Content/WorldObjects/Items/BodyParts/HumanHandLeft.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/AssetGroups/Schemas/BodyParts_BundledAssetGroupSchema.asset b/Assets/Content/Addressables/AssetGroups/Schemas/BodyParts_BundledAssetGroupSchema.asset new file mode 100644 index 0000000000..e2b81d8db2 --- /dev/null +++ b/Assets/Content/Addressables/AssetGroups/Schemas/BodyParts_BundledAssetGroupSchema.asset @@ -0,0 +1,45 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e5d17a21594effb4e9591490b009e7aa, type: 3} + m_Name: BodyParts_BundledAssetGroupSchema + m_EditorClassIdentifier: + m_Group: {fileID: 11400000, guid: ee54898534212cd4a97b528a9d620c75, type: 2} + m_InternalBundleIdMode: 1 + m_Compression: 1 + m_IncludeAddressInCatalog: 1 + m_IncludeGUIDInCatalog: 1 + m_IncludeLabelsInCatalog: 1 + m_InternalIdNamingMode: 0 + m_CacheClearBehavior: 0 + m_IncludeInBuild: 1 + m_BundledAssetProviderType: + m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.BundledAssetProvider + m_ForceUniqueProvider: 0 + m_UseAssetBundleCache: 1 + m_UseAssetBundleCrc: 1 + m_UseAssetBundleCrcForCachedBundles: 1 + m_UseUWRForLocalBundles: 0 + m_Timeout: 0 + m_ChunkedTransfer: 0 + m_RedirectLimit: -1 + m_RetryCount: 0 + m_BuildPath: + m_Id: 56790a984472fbe4a809c1ab1b0e4c79 + m_LoadPath: + m_Id: 8abc09617b79e8b4994b07cc672cbbe5 + m_BundleMode: 0 + m_AssetBundleProviderType: + m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleProvider + m_BundleNaming: 0 + m_AssetLoadMode: 0 diff --git a/Assets/Content/Addressables/AssetGroups/Schemas/BodyParts_BundledAssetGroupSchema.asset.meta b/Assets/Content/Addressables/AssetGroups/Schemas/BodyParts_BundledAssetGroupSchema.asset.meta new file mode 100644 index 0000000000..81152d8055 --- /dev/null +++ b/Assets/Content/Addressables/AssetGroups/Schemas/BodyParts_BundledAssetGroupSchema.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4de7234b6744e474581238ba31893e14 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Content/Addressables/AssetGroups/Schemas/BodyParts_ContentUpdateGroupSchema.asset b/Assets/Content/Addressables/AssetGroups/Schemas/BodyParts_ContentUpdateGroupSchema.asset new file mode 100644 index 0000000000..1849a21cfd --- /dev/null +++ b/Assets/Content/Addressables/AssetGroups/Schemas/BodyParts_ContentUpdateGroupSchema.asset @@ -0,0 +1,16 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5834b5087d578d24c926ce20cd31e6d6, type: 3} + m_Name: BodyParts_ContentUpdateGroupSchema + m_EditorClassIdentifier: + m_Group: {fileID: 11400000, guid: ee54898534212cd4a97b528a9d620c75, type: 2} + m_StaticContent: 0 diff --git a/Assets/Content/Addressables/AssetGroups/Schemas/BodyParts_ContentUpdateGroupSchema.asset.meta b/Assets/Content/Addressables/AssetGroups/Schemas/BodyParts_ContentUpdateGroupSchema.asset.meta new file mode 100644 index 0000000000..75f5d4825f --- /dev/null +++ b/Assets/Content/Addressables/AssetGroups/Schemas/BodyParts_ContentUpdateGroupSchema.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 007c51ffa6d371a4aacdc075169132b2 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Content/Addressables/Windows/addressables_content_state.bin b/Assets/Content/Addressables/Windows/addressables_content_state.bin index b33d1cda4d984f1062668f6d24f24008bdcd758f..98759185f9a6ffcced6051ed9b6eb69f7bed06aa 100644 GIT binary patch delta 1026 zcmah{OKTKC5Z+1lnXHM#nD|21m_<=odb)dhx{V%!LD7JC5j28p_jHeF78CLSJ>{Ur zqe@?cCl4Nk2>t;t9y|yh1VIp@5r2SxK&u8fyPme0sjjB$`>Oh@+8p^g_U3U=l?}og zp=eOi2>tV5rBKY}a(TbmciPYNjaDmFI97InsSf$MzE_1|aG&@vKQn7xs#jYpt%XFl zZZ9pYE;jY@vRheh>Q<{MU6LkLCEPlh8o_PsZ0ZQpGGd%l(lD#{Y|B-416@$@llk>2 zC77YYYT-yoToR^XN|n@B3FnL?vJDwQ$N-o!{KY+B*0CNx+dnfrig$zUyS@HJ|FxKL z#Y_|tBUl`3l5%CVOt_8`${E+ zqK(~$SX3#)?gwYhm;29MFbnpi$Qme*J3~ z`(2JB4$p)S+nTW-2dCC+7&fNYE+ev|^a=mFTwnXr#XgV22@Bb=zZv^UaB97#;?ez$ rn~3bNpF&t1aVxpz+;Szkh~Y`B?Ctk`J9BTPv%>i{$y>TfbxL)M=_ap}RV5=y zQpTz$qufdjr}B9orVdFPuVr?-+u;*Y0b1ZyIsn%BX?luJ$X&W)xhysr^L;O*)MIhz z`%xTtUJ$r8Ji5QO5-vw-Cu-#QL3(GL26kAD3_EfI<~XJu7={tBO2q)BY77_pp%jqP z3LtE|A=wbN_j1u>mB?k0Y5LUgz{O;7QFzTVd(#A6oDn<{ipd|*1mjFbW+Ge zsS-jkDm?%izs_iUPc4uVKT$_yxsfCZzs*kYtCsdTJces&i--tFup3lWdI7X%Gq~Ab zm=siyO)ydV_*kx7dxsLOaO>hZg+W4fY+R`KL!vbs*W=>mEHb4(^#Ldt|4OrY^7_x> pqalt73!ICv7=%P?HqDvi&uPK^vl!w>xpMEzKlKOvQ?Q_c)^7=fnA-pV diff --git a/Assets/Content/Data/BodyParts.asset b/Assets/Content/Data/BodyParts.asset new file mode 100644 index 0000000000..ee01e84849 --- /dev/null +++ b/Assets/Content/Data/BodyParts.asset @@ -0,0 +1,20 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3c9b6c8ad6324c838c1743c2a2e2abc4, type: 3} + m_Name: BodyParts + m_EditorClassIdentifier: + EnumNamespaceName: SS3D.Data.Enums + EnumName: BodyPartsIds + AssetGroup: {fileID: 11400000, guid: ee54898534212cd4a97b528a9d620c75, type: 2} + Assets: + - {fileID: 5774385816057912484, guid: 35dfc7c3f708a5b48a206b4a44e7ab49, type: 3} + - {fileID: 5774385816057912484, guid: 7f5954f009d06b2439ca637b43920440, type: 3} diff --git a/Assets/Content/Data/BodyParts.asset.meta b/Assets/Content/Data/BodyParts.asset.meta new file mode 100644 index 0000000000..5a9dc65e19 --- /dev/null +++ b/Assets/Content/Data/BodyParts.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ca2c2a0941deb144b88d6d8cbf4252ee +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Content/Data/DefaultPrefabObjects.asset b/Assets/Content/Data/DefaultPrefabObjects.asset index 07b1b2e9cb..d4b71d598d 100644 --- a/Assets/Content/Data/DefaultPrefabObjects.asset +++ b/Assets/Content/Data/DefaultPrefabObjects.asset @@ -23,6 +23,8 @@ MonoBehaviour: - {fileID: 6636680625000353110, guid: cc5383d385556f443b2a7d3202f2b2c1, type: 3} - {fileID: 3227132888119106738, guid: 7bbb74a7ffc8cae44baa886de43c586b, type: 3} - {fileID: 1871071288925904272, guid: add4d1bc2d874d94782d6b8c912af5e2, type: 3} + - {fileID: 8532088199163376958, guid: df85b75fd341a244c8364ebb9c4fcfef, type: 3} + - {fileID: 8532088199163376958, guid: c19eccca279beee4186432a03257a7b9, type: 3} - {fileID: 6115335805774105745, guid: bf177f8bab26bc84b87fd9a971004418, type: 3} - {fileID: 6699414010407460003, guid: f1aeab0a35c29314a8a3f823de9815c1, type: 3} - {fileID: 4692070367735979832, guid: 8725b7f8f45d28a4ba6063318904cc8a, type: 3} diff --git a/Assets/Content/WorldObjects/Entities/Humanoids/Human/Human.prefab b/Assets/Content/WorldObjects/Entities/Humanoids/Human/Human.prefab index 6a2f11aaff..9bb7f75ccc 100644 --- a/Assets/Content/WorldObjects/Entities/Humanoids/Human/Human.prefab +++ b/Assets/Content/WorldObjects/Entities/Humanoids/Human/Human.prefab @@ -6995,7 +6995,9 @@ MonoBehaviour: - {fileID: 7951212175384182717} - {fileID: 8320963098858079385} - {fileID: 4140518851396729342} + - {fileID: 4854640730944196939} - {fileID: 7144090709710962679} + - {fileID: 4555203962178419925} k__BackingField: {fileID: 0} k__BackingField: - {fileID: 4138789318277530234} @@ -7275,16 +7277,12 @@ MonoBehaviour: _componentIndexCache: 9 _addedNetworkObject: {fileID: 2930813178971533500} _networkObjectCache: {fileID: 2930813178971533500} - HandContainers: - - {fileID: 4140518851396729342} - - {fileID: 7144090709710962679} - handRange: 5 - SelectedColor: {r: 1, g: 0.9764151, b: 0.9764151, a: 0.8509804} - range: - Horizontal: 1.5 - Vertical: 2 - interactionOrigin: {fileID: 5927494552340417975} - pickupIcon: {fileID: 21300000, guid: d1f34343e08a14e48a856e409c355f32, type: 3} + PlayerHands: + - {fileID: 4854640730944196939} + - {fileID: 4555203962178419925} + _selectedColor: {r: 1, g: 1, b: 1, a: 0.8627451} + _defaultColor: {r: 1, g: 1, b: 1, a: 0.45490196} + _selectedHand: {fileID: 0} --- !u!114 &7934531206375951864 MonoBehaviour: m_ObjectHideFlags: 0 @@ -7404,19 +7402,6 @@ MonoBehaviour: _addedNetworkObject: {fileID: 2930813178971533500} _networkObjectCache: {fileID: 2930813178971533500} _inventory: {fileID: 1089183168752255729} - ClothesRoot: {fileID: 1870850359086752095} - startingClothedBodyPart: - - {fileID: 7590913349156985469} - - {fileID: 8410791339138828931} - - {fileID: 4138789318277530234} - - {fileID: 6233962219268866637} - - {fileID: 8067289659534850981} - - {fileID: 6911900315559804093} - - {fileID: 8626656600768578774} - - {fileID: 4684017524585288931} - - {fileID: 2091115627957921416} - - {fileID: 7534105608452820685} - - {fileID: 1527032890679831709} --- !u!114 &4559920193704007786 MonoBehaviour: m_ObjectHideFlags: 0 @@ -9998,6 +9983,7 @@ GameObject: - component: {fileID: 1342008326084027676} - component: {fileID: 4140518851396729342} - component: {fileID: 8300769832796282301} + - component: {fileID: 4854640730944196939} m_Layer: 0 m_Name: hold.l m_TagString: Untagged @@ -10073,6 +10059,28 @@ MonoBehaviour: m_EditorClassIdentifier: attachedContainer: {fileID: 4140518851396729342} Mirrored: 1 +--- !u!114 &4854640730944196939 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8915899267794646267} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e60c09e136263a44eb7996c9a5dc742a, type: 3} + m_Name: + m_EditorClassIdentifier: + _componentIndexCache: 38 + _addedNetworkObject: {fileID: 2930813178971533500} + _networkObjectCache: {fileID: 2930813178971533500} + Container: {fileID: 4140518851396729342} + _range: + Horizontal: 1.5 + Vertical: 2 + _pickupIcon: {fileID: 21300000, guid: d1f34343e08a14e48a856e409c355f32, type: 3} + _interactionOrigin: {fileID: 1342008326084027676} + HandsController: {fileID: 2150560678942863610} --- !u!1 &8935913803077858714 GameObject: m_ObjectHideFlags: 0 @@ -10294,6 +10302,7 @@ GameObject: - component: {fileID: 6653541696833174003} - component: {fileID: 7144090709710962679} - component: {fileID: 8735509741792839302} + - component: {fileID: 4555203962178419925} m_Layer: 0 m_Name: hold.r m_TagString: Untagged @@ -10328,7 +10337,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 25696236470760b41b375e9b6939444c, type: 3} m_Name: m_EditorClassIdentifier: - _componentIndexCache: 38 + _componentIndexCache: 39 _addedNetworkObject: {fileID: 2930813178971533500} _networkObjectCache: {fileID: 2930813178971533500} _automaticContainerSetUp: 0 @@ -10369,6 +10378,28 @@ MonoBehaviour: m_EditorClassIdentifier: attachedContainer: {fileID: 7144090709710962679} Mirrored: 0 +--- !u!114 &4555203962178419925 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9064888651365615274} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e60c09e136263a44eb7996c9a5dc742a, type: 3} + m_Name: + m_EditorClassIdentifier: + _componentIndexCache: 40 + _addedNetworkObject: {fileID: 2930813178971533500} + _networkObjectCache: {fileID: 2930813178971533500} + Container: {fileID: 7144090709710962679} + _range: + Horizontal: 1.5 + Vertical: 2 + _pickupIcon: {fileID: 21300000, guid: 2db953f2ae8f41d4e9842d9144a9e396, type: 2} + _interactionOrigin: {fileID: 6653541696833174003} + HandsController: {fileID: 2150560678942863610} --- !u!1 &9131769810566877388 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Content/WorldObjects/Entities/Humanoids/Human/HumanBodyParts/HumanHandLeft.prefab b/Assets/Content/WorldObjects/Entities/Humanoids/Human/HumanBodyParts/HumanHandLeft.prefab index 0113e32220..7469d01f2c 100644 --- a/Assets/Content/WorldObjects/Entities/Humanoids/Human/HumanBodyParts/HumanHandLeft.prefab +++ b/Assets/Content/WorldObjects/Entities/Humanoids/Human/HumanBodyParts/HumanHandLeft.prefab @@ -11,7 +11,6 @@ GameObject: - component: {fileID: 5000622523273975387} - component: {fileID: 7588121404962905848} - component: {fileID: 9092168884592295084} - - component: {fileID: 1810788163902625152} m_Layer: 0 m_Name: HandLeft m_TagString: Untagged @@ -85,20 +84,6 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_AdditionalVertexStreams: {fileID: 0} ---- !u!64 &1810788163902625152 -MeshCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2957167503393607793} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 4 - m_Convex: 1 - m_CookingOptions: 30 - m_Mesh: {fileID: 779107774233065848, guid: f553c8289710b5e4dab99c3bcbbb802e, type: 3} --- !u!1 &4030553588348042605 GameObject: m_ObjectHideFlags: 0 @@ -139,10 +124,12 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 7596600830642500397} - - component: {fileID: 3362323121630547519} - component: {fileID: 6576413314991157836} - component: {fileID: 8532088199163376958} - - component: {fileID: 103478066480505861} + - component: {fileID: 949826828486068756} + - component: {fileID: 7854195103374356208} + - component: {fileID: 7244337257717968850} + - component: {fileID: 6047619831351193847} m_Layer: 10 m_Name: HumanHandLeft m_TagString: Untagged @@ -167,22 +154,6 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!54 &3362323121630547519 -Rigidbody: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5774385816057912484} - serializedVersion: 2 - m_Mass: 1 - m_Drag: 0 - m_AngularDrag: 0.05 - m_UseGravity: 1 - m_IsKinematic: 0 - m_Interpolate: 1 - m_Constraints: 0 - m_CollisionDetection: 3 --- !u!114 &6576413314991157836 MonoBehaviour: m_ObjectHideFlags: 0 @@ -241,19 +212,21 @@ MonoBehaviour: k__BackingField: 0 _networkBehaviours: - {fileID: 6576413314991157836} - - {fileID: 103478066480505861} + - {fileID: 949826828486068756} + - {fileID: 7854195103374356208} + - {fileID: 6047619831351193847} k__BackingField: {fileID: 0} k__BackingField: [] _isNetworked: 1 _isGlobal: 0 _defaultDespawnType: 0 NetworkObserver: {fileID: 0} - k__BackingField: 41 + k__BackingField: 0 _scenePathHash: 0 k__BackingField: 0 k__BackingField: 63366572448909465 _sceneNetworkObjects: [] ---- !u!114 &103478066480505861 +--- !u!114 &949826828486068756 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -262,17 +235,92 @@ MonoBehaviour: m_GameObject: {fileID: 5774385816057912484} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: cf76e303c1b57ae4ebbf08dab5bbddc2, type: 3} + m_Script: {fileID: 11500000, guid: e60c09e136263a44eb7996c9a5dc742a, type: 3} m_Name: m_EditorClassIdentifier: _componentIndexCache: 1 _addedNetworkObject: {fileID: 8532088199163376958} _networkObjectCache: {fileID: 8532088199163376958} - _name: - _weight: 1 + Container: {fileID: 7854195103374356208} + range: + Horizontal: 1.5 + Vertical: 2 + pickupIcon: {fileID: 0} + interactionOrigin: {fileID: 8087437400747043343} + handsController: {fileID: 0} +--- !u!114 &7854195103374356208 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774385816057912484} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 25696236470760b41b375e9b6939444c, type: 3} + m_Name: + m_EditorClassIdentifier: + _componentIndexCache: 2 + _addedNetworkObject: {fileID: 8532088199163376958} + _networkObjectCache: {fileID: 8532088199163376958} + _automaticContainerSetUp: 1 + ContainerInteractive: {fileID: 6047619831351193847} + ContainerItemDisplay: {fileID: 0} + ContainerUi: {fileID: 0} + _attachmentOffset: {x: 0, y: 0, z: 0} + _onlyStoreWhenOpen: 0 + _openWhenContainerViewed: 0 + _attachItems: 1 + _initialized: 1 + _maxDistance: 5 + _isOpenable: 0 + _isInteractive: 1 + _hasUi: 0 + _hasCustomInteraction: 0 + _hasCustomDisplay: 0 + _displays: [] + _numberDisplay: 0 + _displayAsSlotInUI: 1 + _containerName: hand left _size: {x: 1, y: 1} - _startingTraits: [] - _rigidbody: {fileID: 3362323121630547519} - Prefab: {fileID: 5774385816057912484} - AttachmentPoint: {fileID: 8087437400747043343} - AttachmentPointAlt: {fileID: 0} + _hideItems: 0 + _type: 2 + _startFilter: {fileID: 0} +--- !u!95 &7244337257717968850 +Animator: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774385816057912484} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 0} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!114 &6047619831351193847 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774385816057912484} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3c75d17834848bb4f83ee6e730a65519, type: 3} + m_Name: + m_EditorClassIdentifier: + _componentIndexCache: 3 + _addedNetworkObject: {fileID: 8532088199163376958} + _networkObjectCache: {fileID: 8532088199163376958} + _openState: 0 + OverrideOpenIcon: {fileID: 0} + attachedContainer: {fileID: 7854195103374356208} diff --git a/Assets/Content/WorldObjects/Entities/Humanoids/Human/HumanBodyParts/HumanHandRight.prefab b/Assets/Content/WorldObjects/Entities/Humanoids/Human/HumanBodyParts/HumanHandRight.prefab index 03ec23a600..f7fd70880b 100644 --- a/Assets/Content/WorldObjects/Entities/Humanoids/Human/HumanBodyParts/HumanHandRight.prefab +++ b/Assets/Content/WorldObjects/Entities/Humanoids/Human/HumanBodyParts/HumanHandRight.prefab @@ -11,7 +11,6 @@ GameObject: - component: {fileID: 5000622523273975387} - component: {fileID: 7588121404962905848} - component: {fileID: 9092168884592295084} - - component: {fileID: 1810788163902625152} m_Layer: 0 m_Name: HandRight m_TagString: Untagged @@ -85,20 +84,6 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_AdditionalVertexStreams: {fileID: 0} ---- !u!64 &1810788163902625152 -MeshCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2957167503393607793} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 4 - m_Convex: 1 - m_CookingOptions: 30 - m_Mesh: {fileID: 7778332084892924709, guid: f553c8289710b5e4dab99c3bcbbb802e, type: 3} --- !u!1 &4030553588348042605 GameObject: m_ObjectHideFlags: 0 @@ -139,10 +124,12 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 7596600830642500397} - - component: {fileID: 3362323121630547519} - component: {fileID: 6576413314991157836} - component: {fileID: 8532088199163376958} - - component: {fileID: 103478066480505861} + - component: {fileID: -5392502220935940654} + - component: {fileID: 7230142737511069205} + - component: {fileID: 3402973173329997909} + - component: {fileID: 17826520120412619} m_Layer: 10 m_Name: HumanHandRight m_TagString: Untagged @@ -167,22 +154,6 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!54 &3362323121630547519 -Rigidbody: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5774385816057912484} - serializedVersion: 2 - m_Mass: 1 - m_Drag: 0 - m_AngularDrag: 0.05 - m_UseGravity: 1 - m_IsKinematic: 0 - m_Interpolate: 1 - m_Constraints: 0 - m_CollisionDetection: 3 --- !u!114 &6576413314991157836 MonoBehaviour: m_ObjectHideFlags: 0 @@ -241,19 +212,21 @@ MonoBehaviour: k__BackingField: 0 _networkBehaviours: - {fileID: 6576413314991157836} - - {fileID: 103478066480505861} + - {fileID: -5392502220935940654} + - {fileID: 7230142737511069205} + - {fileID: 17826520120412619} k__BackingField: {fileID: 0} k__BackingField: [] _isNetworked: 1 _isGlobal: 0 _defaultDespawnType: 0 NetworkObserver: {fileID: 0} - k__BackingField: 41 + k__BackingField: 137 _scenePathHash: 0 k__BackingField: 0 k__BackingField: 18047090012426851201 _sceneNetworkObjects: [] ---- !u!114 &103478066480505861 +--- !u!114 &-5392502220935940654 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -262,17 +235,92 @@ MonoBehaviour: m_GameObject: {fileID: 5774385816057912484} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: cf76e303c1b57ae4ebbf08dab5bbddc2, type: 3} + m_Script: {fileID: 11500000, guid: 25696236470760b41b375e9b6939444c, type: 3} m_Name: m_EditorClassIdentifier: _componentIndexCache: 1 _addedNetworkObject: {fileID: 8532088199163376958} _networkObjectCache: {fileID: 8532088199163376958} - _name: - _weight: 1 + _automaticContainerSetUp: 1 + ContainerInteractive: {fileID: 17826520120412619} + ContainerItemDisplay: {fileID: 0} + ContainerUi: {fileID: 0} + _attachmentOffset: {x: 0, y: 0, z: 0} + _onlyStoreWhenOpen: 0 + _openWhenContainerViewed: 0 + _attachItems: 1 + _initialized: 1 + _maxDistance: 5 + _isOpenable: 0 + _isInteractive: 1 + _hasUi: 0 + _hasCustomInteraction: 0 + _hasCustomDisplay: 0 + _displays: [] + _numberDisplay: 0 + _displayAsSlotInUI: 1 + _containerName: right hand _size: {x: 1, y: 1} - _startingTraits: [] - _rigidbody: {fileID: 3362323121630547519} - Prefab: {fileID: 5774385816057912484} - AttachmentPoint: {fileID: 8087437400747043343} - AttachmentPointAlt: {fileID: 0} + _hideItems: 1 + _type: 2 + _startFilter: {fileID: 0} +--- !u!114 &7230142737511069205 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774385816057912484} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e60c09e136263a44eb7996c9a5dc742a, type: 3} + m_Name: + m_EditorClassIdentifier: + _componentIndexCache: 2 + _addedNetworkObject: {fileID: 8532088199163376958} + _networkObjectCache: {fileID: 8532088199163376958} + Container: {fileID: -5392502220935940654} + range: + Horizontal: 1.5 + Vertical: 2 + pickupIcon: {fileID: 0} + interactionOrigin: {fileID: 7596600830642500397} + handsController: {fileID: 0} +--- !u!95 &3402973173329997909 +Animator: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774385816057912484} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 0} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!114 &17826520120412619 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774385816057912484} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3c75d17834848bb4f83ee6e730a65519, type: 3} + m_Name: + m_EditorClassIdentifier: + _componentIndexCache: 3 + _addedNetworkObject: {fileID: 8532088199163376958} + _networkObjectCache: {fileID: 8532088199163376958} + _openState: 0 + OverrideOpenIcon: {fileID: 0} + attachedContainer: {fileID: -5392502220935940654} diff --git a/Assets/Content/WorldObjects/Items/BodyParts.meta b/Assets/Content/WorldObjects/Items/BodyParts.meta new file mode 100644 index 0000000000..4b37c6f1a7 --- /dev/null +++ b/Assets/Content/WorldObjects/Items/BodyParts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5da7765cfa9ed3e40894c6ea977ec220 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Content/WorldObjects/Items/BodyParts/HumanHandLeft.prefab b/Assets/Content/WorldObjects/Items/BodyParts/HumanHandLeft.prefab new file mode 100644 index 0000000000..cea6d01cba --- /dev/null +++ b/Assets/Content/WorldObjects/Items/BodyParts/HumanHandLeft.prefab @@ -0,0 +1,383 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &2957167503393607793 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5000622523273975387} + - component: {fileID: 7588121404962905848} + - component: {fileID: 9092168884592295084} + - component: {fileID: 1810788163902625152} + m_Layer: 0 + m_Name: HandLeft + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5000622523273975387 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2957167503393607793} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 7596600830642500397} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &7588121404962905848 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2957167503393607793} + m_Mesh: {fileID: 779107774233065848, guid: f553c8289710b5e4dab99c3bcbbb802e, type: 3} +--- !u!23 &9092168884592295084 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2957167503393607793} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: cf191327ca9118c4483ccb0d22b33910, type: 2} + - {fileID: 2100000, guid: 1f8078dee7dfc354ebc752f6c3c8e0db, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!64 &1810788163902625152 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2957167503393607793} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 4 + m_Convex: 1 + m_CookingOptions: 30 + m_Mesh: {fileID: 779107774233065848, guid: f553c8289710b5e4dab99c3bcbbb802e, type: 3} +--- !u!1 &4030553588348042605 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8087437400747043343} + m_Layer: 10 + m_Name: AttachmentPoint + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8087437400747043343 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4030553588348042605} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 7596600830642500397} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &5774385816057912484 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7596600830642500397} + - component: {fileID: 3362323121630547519} + - component: {fileID: 6576413314991157836} + - component: {fileID: 8532088199163376958} + - component: {fileID: 103478066480505861} + - component: {fileID: 949826828486068756} + - component: {fileID: 7854195103374356208} + - component: {fileID: 7244337257717968850} + - component: {fileID: 6047619831351193847} + m_Layer: 10 + m_Name: HumanHandLeft + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7596600830642500397 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774385816057912484} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 5000622523273975387} + - {fileID: 8087437400747043343} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!54 &3362323121630547519 +Rigidbody: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774385816057912484} + serializedVersion: 2 + m_Mass: 1 + m_Drag: 0 + m_AngularDrag: 0.05 + m_UseGravity: 1 + m_IsKinematic: 0 + m_Interpolate: 1 + m_Constraints: 0 + m_CollisionDetection: 3 +--- !u!114 &6576413314991157836 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774385816057912484} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a2836e36774ca1c4bbbee976e17b649c, type: 3} + m_Name: + m_EditorClassIdentifier: + _componentIndexCache: 0 + _addedNetworkObject: {fileID: 8532088199163376958} + _networkObjectCache: {fileID: 8532088199163376958} + _synchronizeParent: 0 + _packing: + Position: 0 + Rotation: 0 + Scale: 0 + _interpolation: 1 + _extrapolation: 2 + _enableTeleport: 0 + _teleportThreshold: 1 + _clientAuthoritative: 1 + _sendToOwner: 1 + _interval: 1 + _synchronizePosition: 1 + _positionSnapping: + X: 0 + Y: 0 + Z: 0 + _synchronizeRotation: 1 + _rotationSnapping: + X: 0 + Y: 0 + Z: 0 + _synchronizeScale: 0 + _scaleSnapping: + X: 0 + Y: 0 + Z: 0 +--- !u!114 &8532088199163376958 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774385816057912484} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 26b716c41e9b56b4baafaf13a523ba2e, type: 3} + m_Name: + m_EditorClassIdentifier: + k__BackingField: 0 + k__BackingField: 0 + _networkBehaviours: + - {fileID: 6576413314991157836} + - {fileID: 103478066480505861} + - {fileID: 949826828486068756} + - {fileID: 7854195103374356208} + - {fileID: 6047619831351193847} + k__BackingField: {fileID: 0} + k__BackingField: [] + _isNetworked: 1 + _isGlobal: 0 + _defaultDespawnType: 0 + NetworkObserver: {fileID: 0} + k__BackingField: 0 + _scenePathHash: 0 + k__BackingField: 0 + k__BackingField: 14272839664766648676 + _sceneNetworkObjects: [] +--- !u!114 &103478066480505861 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774385816057912484} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: cf76e303c1b57ae4ebbf08dab5bbddc2, type: 3} + m_Name: + m_EditorClassIdentifier: + _componentIndexCache: 1 + _addedNetworkObject: {fileID: 8532088199163376958} + _networkObjectCache: {fileID: 8532088199163376958} + _name: hand left + _weight: 1 + _size: {x: 1, y: 1} + _startingTraits: [] + _rigidbody: {fileID: 3362323121630547519} + Prefab: {fileID: 5774385816057912484} + AttachmentPoint: {fileID: 8087437400747043343} + AttachmentPointAlt: {fileID: 8087437400747043343} +--- !u!114 &949826828486068756 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774385816057912484} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e60c09e136263a44eb7996c9a5dc742a, type: 3} + m_Name: + m_EditorClassIdentifier: + _componentIndexCache: 2 + _addedNetworkObject: {fileID: 8532088199163376958} + _networkObjectCache: {fileID: 8532088199163376958} + Container: {fileID: 7854195103374356208} + range: + Horizontal: 1.5 + Vertical: 2 + pickupIcon: {fileID: 0} + interactionOrigin: {fileID: 8087437400747043343} + handsController: {fileID: 0} +--- !u!114 &7854195103374356208 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774385816057912484} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 25696236470760b41b375e9b6939444c, type: 3} + m_Name: + m_EditorClassIdentifier: + _componentIndexCache: 3 + _addedNetworkObject: {fileID: 8532088199163376958} + _networkObjectCache: {fileID: 8532088199163376958} + _automaticContainerSetUp: 1 + ContainerInteractive: {fileID: 6047619831351193847} + ContainerItemDisplay: {fileID: 0} + ContainerUi: {fileID: 0} + _attachmentOffset: {x: 0, y: 0, z: 0} + _onlyStoreWhenOpen: 0 + _openWhenContainerViewed: 0 + _attachItems: 1 + _initialized: 1 + _maxDistance: 5 + _isOpenable: 0 + _isInteractive: 1 + _hasUi: 0 + _hasCustomInteraction: 0 + _hasCustomDisplay: 0 + _displays: [] + _numberDisplay: 0 + _displayAsSlotInUI: 1 + _containerName: hand left + _size: {x: 1, y: 1} + _hideItems: 0 + _type: 2 + _startFilter: {fileID: 0} +--- !u!95 &7244337257717968850 +Animator: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774385816057912484} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 0} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!114 &6047619831351193847 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774385816057912484} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3c75d17834848bb4f83ee6e730a65519, type: 3} + m_Name: + m_EditorClassIdentifier: + _componentIndexCache: 4 + _addedNetworkObject: {fileID: 8532088199163376958} + _networkObjectCache: {fileID: 8532088199163376958} + _openState: 0 + OverrideOpenIcon: {fileID: 0} + attachedContainer: {fileID: 7854195103374356208} diff --git a/Assets/Content/WorldObjects/Items/BodyParts/HumanHandLeft.prefab.meta b/Assets/Content/WorldObjects/Items/BodyParts/HumanHandLeft.prefab.meta new file mode 100644 index 0000000000..f65d8914be --- /dev/null +++ b/Assets/Content/WorldObjects/Items/BodyParts/HumanHandLeft.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: df85b75fd341a244c8364ebb9c4fcfef +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Content/WorldObjects/Items/BodyParts/HumanHandRight.prefab b/Assets/Content/WorldObjects/Items/BodyParts/HumanHandRight.prefab new file mode 100644 index 0000000000..c1a5612411 --- /dev/null +++ b/Assets/Content/WorldObjects/Items/BodyParts/HumanHandRight.prefab @@ -0,0 +1,382 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &2957167503393607793 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5000622523273975387} + - component: {fileID: 7588121404962905848} + - component: {fileID: 9092168884592295084} + - component: {fileID: 1810788163902625152} + m_Layer: 0 + m_Name: HandRight + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5000622523273975387 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2957167503393607793} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 7596600830642500397} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &7588121404962905848 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2957167503393607793} + m_Mesh: {fileID: 7778332084892924709, guid: f553c8289710b5e4dab99c3bcbbb802e, type: 3} +--- !u!23 &9092168884592295084 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2957167503393607793} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: cf191327ca9118c4483ccb0d22b33910, type: 2} + - {fileID: 2100000, guid: 1f8078dee7dfc354ebc752f6c3c8e0db, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!64 &1810788163902625152 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2957167503393607793} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 4 + m_Convex: 1 + m_CookingOptions: 30 + m_Mesh: {fileID: 7778332084892924709, guid: f553c8289710b5e4dab99c3bcbbb802e, type: 3} +--- !u!1 &4030553588348042605 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8087437400747043343} + m_Layer: 10 + m_Name: AttachmentPoint + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8087437400747043343 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4030553588348042605} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 7596600830642500397} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &5774385816057912484 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7596600830642500397} + - component: {fileID: 3362323121630547519} + - component: {fileID: 6576413314991157836} + - component: {fileID: 8532088199163376958} + - component: {fileID: 103478066480505861} + - component: {fileID: -5392502220935940654} + - component: {fileID: 7230142737511069205} + - component: {fileID: 3402973173329997909} + - component: {fileID: 17826520120412619} + m_Layer: 10 + m_Name: HumanHandRight + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7596600830642500397 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774385816057912484} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 5000622523273975387} + - {fileID: 8087437400747043343} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!54 &3362323121630547519 +Rigidbody: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774385816057912484} + serializedVersion: 2 + m_Mass: 1 + m_Drag: 0 + m_AngularDrag: 0.05 + m_UseGravity: 1 + m_IsKinematic: 0 + m_Interpolate: 1 + m_Constraints: 0 + m_CollisionDetection: 3 +--- !u!114 &6576413314991157836 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774385816057912484} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a2836e36774ca1c4bbbee976e17b649c, type: 3} + m_Name: + m_EditorClassIdentifier: + _componentIndexCache: 0 + _addedNetworkObject: {fileID: 8532088199163376958} + _networkObjectCache: {fileID: 8532088199163376958} + _synchronizeParent: 0 + _packing: + Position: 0 + Rotation: 0 + Scale: 0 + _interpolation: 1 + _extrapolation: 2 + _enableTeleport: 0 + _teleportThreshold: 1 + _clientAuthoritative: 1 + _sendToOwner: 1 + _interval: 1 + _synchronizePosition: 1 + _positionSnapping: + X: 0 + Y: 0 + Z: 0 + _synchronizeRotation: 1 + _rotationSnapping: + X: 0 + Y: 0 + Z: 0 + _synchronizeScale: 0 + _scaleSnapping: + X: 0 + Y: 0 + Z: 0 +--- !u!114 &8532088199163376958 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774385816057912484} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 26b716c41e9b56b4baafaf13a523ba2e, type: 3} + m_Name: + m_EditorClassIdentifier: + k__BackingField: 0 + k__BackingField: 0 + _networkBehaviours: + - {fileID: 6576413314991157836} + - {fileID: 103478066480505861} + - {fileID: -5392502220935940654} + - {fileID: 7230142737511069205} + k__BackingField: {fileID: 0} + k__BackingField: [] + _isNetworked: 1 + _isGlobal: 0 + _defaultDespawnType: 0 + NetworkObserver: {fileID: 0} + k__BackingField: 135 + _scenePathHash: 0 + k__BackingField: 0 + k__BackingField: 1925488133346520972 + _sceneNetworkObjects: [] +--- !u!114 &103478066480505861 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774385816057912484} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: cf76e303c1b57ae4ebbf08dab5bbddc2, type: 3} + m_Name: + m_EditorClassIdentifier: + _componentIndexCache: 1 + _addedNetworkObject: {fileID: 8532088199163376958} + _networkObjectCache: {fileID: 8532088199163376958} + _name: right hand + _weight: 1 + _size: {x: 1, y: 1} + _startingTraits: [] + _rigidbody: {fileID: 3362323121630547519} + Prefab: {fileID: 5774385816057912484} + AttachmentPoint: {fileID: 8087437400747043343} + AttachmentPointAlt: {fileID: 0} +--- !u!114 &-5392502220935940654 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774385816057912484} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 25696236470760b41b375e9b6939444c, type: 3} + m_Name: + m_EditorClassIdentifier: + _componentIndexCache: 2 + _addedNetworkObject: {fileID: 8532088199163376958} + _networkObjectCache: {fileID: 8532088199163376958} + _automaticContainerSetUp: 1 + ContainerInteractive: {fileID: 17826520120412619} + ContainerItemDisplay: {fileID: 0} + ContainerUi: {fileID: 0} + _attachmentOffset: {x: 0, y: 0, z: 0} + _onlyStoreWhenOpen: 0 + _openWhenContainerViewed: 0 + _attachItems: 1 + _initialized: 1 + _maxDistance: 5 + _isOpenable: 0 + _isInteractive: 1 + _hasUi: 0 + _hasCustomInteraction: 0 + _hasCustomDisplay: 0 + _displays: [] + _numberDisplay: 0 + _displayAsSlotInUI: 1 + _containerName: right hand + _size: {x: 1, y: 1} + _hideItems: 1 + _type: 2 + _startFilter: {fileID: 0} +--- !u!114 &7230142737511069205 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774385816057912484} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e60c09e136263a44eb7996c9a5dc742a, type: 3} + m_Name: + m_EditorClassIdentifier: + _componentIndexCache: 3 + _addedNetworkObject: {fileID: 8532088199163376958} + _networkObjectCache: {fileID: 8532088199163376958} + Container: {fileID: -5392502220935940654} + range: + Horizontal: 1.5 + Vertical: 2 + pickupIcon: {fileID: 0} + interactionOrigin: {fileID: 7596600830642500397} + handsController: {fileID: 0} +--- !u!95 &3402973173329997909 +Animator: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774385816057912484} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 0} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!114 &17826520120412619 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774385816057912484} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3c75d17834848bb4f83ee6e730a65519, type: 3} + m_Name: + m_EditorClassIdentifier: + _componentIndexCache: 255 + _addedNetworkObject: {fileID: 8532088199163376958} + _networkObjectCache: {fileID: 0} + _openState: 0 + OverrideOpenIcon: {fileID: 0} + attachedContainer: {fileID: -5392502220935940654} diff --git a/Assets/Content/WorldObjects/Items/BodyParts/HumanHandRight.prefab.meta b/Assets/Content/WorldObjects/Items/BodyParts/HumanHandRight.prefab.meta new file mode 100644 index 0000000000..ef96f13817 --- /dev/null +++ b/Assets/Content/WorldObjects/Items/BodyParts/HumanHandRight.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c19eccca279beee4186432a03257a7b9 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SS3D/Data/Enums/AssetDatabases.cs b/Assets/Scripts/SS3D/Data/Enums/AssetDatabases.cs index 535c9a07b7..afffc4d2ac 100644 --- a/Assets/Scripts/SS3D/Data/Enums/AssetDatabases.cs +++ b/Assets/Scripts/SS3D/Data/Enums/AssetDatabases.cs @@ -2,10 +2,11 @@ namespace SS3D.Data.Enums { public enum AssetDatabases { - InteractionIcons = 0, - Items = 1, - Scenes = 2, - Settings = 3, + BodyParts = 0, + InteractionIcons = 1, + Items = 2, + Scenes = 3, + Settings = 4, } } diff --git a/Assets/Scripts/SS3D/Data/Enums/BodyPartsIds.cs b/Assets/Scripts/SS3D/Data/Enums/BodyPartsIds.cs new file mode 100644 index 0000000000..c3eaef60f2 --- /dev/null +++ b/Assets/Scripts/SS3D/Data/Enums/BodyPartsIds.cs @@ -0,0 +1,9 @@ +namespace SS3D.Data.Enums +{ + public enum BodyPartsIds + { + HumanHandLeft = 0, + HumanHandRight = 1, + } +} + diff --git a/Assets/Scripts/SS3D/Data/Enums/BodyPartsIds.cs.meta b/Assets/Scripts/SS3D/Data/Enums/BodyPartsIds.cs.meta new file mode 100644 index 0000000000..003c4bfea4 --- /dev/null +++ b/Assets/Scripts/SS3D/Data/Enums/BodyPartsIds.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 35010b904d72eb84e93a20a6fd4ffa12 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SS3D/Interactions/Extensions/InteractionSourceExtension.cs b/Assets/Scripts/SS3D/Interactions/Extensions/InteractionSourceExtension.cs index 022ba3c94e..a5ec5bca22 100644 --- a/Assets/Scripts/SS3D/Interactions/Extensions/InteractionSourceExtension.cs +++ b/Assets/Scripts/SS3D/Interactions/Extensions/InteractionSourceExtension.cs @@ -21,8 +21,14 @@ public static T GetComponent(this IInteractionSource source) where T : class GameObject gameObject = (source as IGameObjectProvider)?.GameObject; return gameObject != null ? gameObject.GetComponent() : null; } - - public static T GetComponentInTree(this IInteractionSource source) where T: class + + public static T GetComponentInParent(this IInteractionSource source) where T : class + { + GameObject gameObject = (source as IGameObjectProvider)?.GameObject; + return gameObject != null ? gameObject.GetComponentInParent() : null; + } + + public static T GetComponentInTree(this IInteractionSource source) where T: class { return GetComponentInTree(source, out IGameObjectProvider _); } diff --git a/Assets/Scripts/SS3D/Interactions/Interfaces/IToolHolder.cs b/Assets/Scripts/SS3D/Interactions/Interfaces/IHandsController.cs similarity index 74% rename from Assets/Scripts/SS3D/Interactions/Interfaces/IToolHolder.cs rename to Assets/Scripts/SS3D/Interactions/Interfaces/IHandsController.cs index 79a4c3ac87..4d36e3941d 100644 --- a/Assets/Scripts/SS3D/Interactions/Interfaces/IToolHolder.cs +++ b/Assets/Scripts/SS3D/Interactions/Interfaces/IHandsController.cs @@ -3,11 +3,11 @@ /// /// Represents a class that can hold items /// - public interface IToolHolder + public interface IHandsController { /// /// Gets the InteractionSource of the item currently in the active hand /// - IInteractionSource GetActiveTool(); + IInteractionSource GetActiveInteractionSource(); } } \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Interactions/Interfaces/IToolHolder.cs.meta b/Assets/Scripts/SS3D/Interactions/Interfaces/IHandsController.cs.meta similarity index 100% rename from Assets/Scripts/SS3D/Interactions/Interfaces/IToolHolder.cs.meta rename to Assets/Scripts/SS3D/Interactions/Interfaces/IHandsController.cs.meta diff --git a/Assets/Scripts/SS3D/Interactions/Interfaces/IInteractionSource.cs b/Assets/Scripts/SS3D/Interactions/Interfaces/IInteractionSource.cs index 21565c34fa..077c445fab 100644 --- a/Assets/Scripts/SS3D/Interactions/Interfaces/IInteractionSource.cs +++ b/Assets/Scripts/SS3D/Interactions/Interfaces/IInteractionSource.cs @@ -3,7 +3,8 @@ namespace SS3D.Interactions.Interfaces { /// - /// Represents a source of an interaction + /// Represents a source for an interaction. + /// A screw driver can be a source of interaction for the opening maintenance panels, building and stabbing interactions. /// public interface IInteractionSource { diff --git a/Assets/Scripts/SS3D/Systems/IngameConsoleSystem/Commands/AddHandCommand.cs b/Assets/Scripts/SS3D/Systems/IngameConsoleSystem/Commands/AddHandCommand.cs new file mode 100644 index 0000000000..39806fccaa --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/IngameConsoleSystem/Commands/AddHandCommand.cs @@ -0,0 +1,91 @@ +using SS3D.Core; +using SS3D.Systems.Entities; +using SS3D.Systems.Permissions; +using SS3D.Systems.PlayerControl; +using UnityEngine; +using FishNet; +using SS3D.Data; +using SS3D.Data.Enums; +using FishNet.Object; +using SS3D.Systems.Inventory.Containers; +using FishNet.Connection; + +namespace SS3D.Systems.IngameConsoleSystem.Commands +{ + /// + /// Command to add a hand to an entity. + /// This is mostly used for testing purpose, to check if hands can correctly be added to an entity and if they behave + /// as expected. + /// + public class AddHandCommand : Command + { + public override string LongDescription => "add (ckey) [(position) (rotation)]\n Position and rotation are float arrays and written as x y z"; + public override string ShortDescription => "add hand to user"; + public override ServerRoleTypes AccessLevel => ServerRoleTypes.Administrator; + + public override CommandType Type => CommandType.Server; + public override string Perform(string[] args, NetworkConnection conn) + { + CheckArgsResponse checkArgsResponse = CheckArgs(args); + if (checkArgsResponse.IsValid == false) + return checkArgsResponse.InvalidArgs; + + string ckey = args[0]; + + // default transform for hand. + Vector3 position = new Vector3(0.5f, 0.7f, 0); + Vector3 rotation = new Vector3(-50, -270, 90); + + if (args.Length > 1) + { + position = new Vector3(float.Parse(args[1]), float.Parse(args[2]), float.Parse(args[3])); + rotation = new Vector3(float.Parse(args[4]), float.Parse(args[5]), float.Parse(args[6])); + } + + Player Player = Subsystems.Get().GetPlayer(ckey); + Entity entity = Subsystems.Get().GetSpawnedEntity(Player); + + GameObject leftHandPrefab = Assets.Get((int)AssetDatabases.BodyParts, (int)BodyPartsIds.HumanHandLeft); + GameObject leftHandObject = GameObject.Instantiate(leftHandPrefab, entity.transform); + leftHandObject.transform.localPosition = position; + leftHandObject.transform.localEulerAngles = rotation; + + Hand leftHand = leftHandObject.GetComponent(); + InstanceFinder.ServerManager.Spawn(leftHandObject, Player.Owner); + + Hands hands = entity.GetComponent(); + HumanInventory inventory = entity.GetComponent(); + inventory.TryAddContainer(leftHandObject.GetComponent()); + hands.AddHand(leftHand); + + return "hand added"; + } + protected override CheckArgsResponse CheckArgs(string[] args) + { + CheckArgsResponse response = new CheckArgsResponse(); + if (args.Length != 1 && args.Length != 7) + { + response.IsValid = false; + response.InvalidArgs = "Invalid number of arguments"; + return response; + } + string ckey = args[0]; + Player player = Subsystems.Get().GetPlayer(ckey); + if (player == null) + { + response.IsValid = false; + response.InvalidArgs = "This player doesn't exist"; + return response; + } + Entity entityToKill = Subsystems.Get().GetSpawnedEntity(player); + if (entityToKill == null) + { + response.IsValid = false; + response.InvalidArgs = "This entity doesn't exist"; + return response; + } + response.IsValid = true; + return response; + } + } +} diff --git a/Assets/Scripts/SS3D/Systems/IngameConsoleSystem/Commands/AddHandCommand.cs.meta b/Assets/Scripts/SS3D/Systems/IngameConsoleSystem/Commands/AddHandCommand.cs.meta new file mode 100644 index 0000000000..9b97bb9449 --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/IngameConsoleSystem/Commands/AddHandCommand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 89ff148b8018fd049a17f269d7c3f6db +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SS3D/Systems/IngameConsoleSystem/Commands/ItemCommands/ItemCommandUtilities.cs b/Assets/Scripts/SS3D/Systems/IngameConsoleSystem/Commands/ItemCommands/ItemCommandUtilities.cs index 578c74b919..8328747d74 100644 --- a/Assets/Scripts/SS3D/Systems/IngameConsoleSystem/Commands/ItemCommands/ItemCommandUtilities.cs +++ b/Assets/Scripts/SS3D/Systems/IngameConsoleSystem/Commands/ItemCommands/ItemCommandUtilities.cs @@ -21,7 +21,7 @@ public static Item GetItemInHand(NetworkConnection conn = null) } Hands hands = playerEntity.GetComponentInParent().Hands; - return hands.ItemInHand; + return hands.SelectedHand.ItemInHand; } } } diff --git a/Assets/Scripts/SS3D/Systems/Interactions/InteractionController.cs b/Assets/Scripts/SS3D/Systems/Interactions/InteractionController.cs index cd380e25d1..abc265fd79 100644 --- a/Assets/Scripts/SS3D/Systems/Interactions/InteractionController.cs +++ b/Assets/Scripts/SS3D/Systems/Interactions/InteractionController.cs @@ -128,7 +128,7 @@ private void HandleUse(InputAction.CallbackContext callbackContext) return; } - Item item = hands.ItemInHand; + Item item = hands.SelectedHand.ItemInHand; if (item != null) { InteractInHand(item.gameObject, gameObject); @@ -361,10 +361,8 @@ private List GetInteractionsFromTargets(IInteractionSource sou [ServerOrClient] private IInteractionSource GetActiveInteractionSource() { - IToolHolder toolHolder = GetComponent(); - IInteractionSource activeTool = toolHolder?.GetActiveTool(); - - IInteractionSource interactionSource = activeTool ?? GetComponent(); + IHandsController handsController = GetComponent(); + var interactionSource = handsController.GetActiveInteractionSource(); return interactionSource; } diff --git a/Assets/Scripts/SS3D/Systems/Inventory/Containers/ContainerViewer.cs b/Assets/Scripts/SS3D/Systems/Inventory/Containers/ContainerViewer.cs index 9338696f95..818f91b4fd 100644 --- a/Assets/Scripts/SS3D/Systems/Inventory/Containers/ContainerViewer.cs +++ b/Assets/Scripts/SS3D/Systems/Inventory/Containers/ContainerViewer.cs @@ -146,7 +146,7 @@ private void HandleUpdate(ref EventContext context, in UpdateEvent updateEvent) for (int i = 0; i < _displayedContainers.Count; i++) { AttachedContainer attachedContainer = _displayedContainers[i]; - if (hands.CanInteract(attachedContainer.gameObject)) + if (hands.SelectedHand.CanInteract(attachedContainer.gameObject)) { continue; } diff --git a/Assets/Scripts/SS3D/Systems/Inventory/Containers/Hand.cs b/Assets/Scripts/SS3D/Systems/Inventory/Containers/Hand.cs new file mode 100644 index 0000000000..19ac13a066 --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Inventory/Containers/Hand.cs @@ -0,0 +1,142 @@ +using UnityEngine; +using SS3D.Systems.Inventory.Items; +using System.Linq; +using SS3D.Interactions.Interfaces; +using SS3D.Interactions; +using FishNet.Object; + +namespace SS3D.Systems.Inventory.Containers +{ + /// + /// A hand is what an entity uses to grab and hold items, to interact with things in range. + /// + public class Hand : InteractionSource, IInteractionRangeLimit, IInteractionOriginProvider + { + /// + /// Container linked to this hand, necessary to hold stuff. + /// + public AttachedContainer Container; + + /// + /// Horizontal and vertical max distance to interact with stuff. + /// + [SerializeField] private RangeLimit _range = new(1.5f, 2); + + // pickup icon that this hand uses when there's a pickup interaction + // TODO: When AssetData is on, we should update this to not use this + [SerializeField] private Sprite _pickupIcon; + + /// + /// The item held in this hand, if it exists + /// + public Item ItemInHand => Container.Items.FirstOrDefault(); + + /// + /// Point from where distances for interaction is computed. + /// + [SerializeField] private Transform _interactionOrigin; + + /// + /// the hands script controlling this hand. + /// + public Hands HandsController; + + public Vector3 InteractionOrigin => _interactionOrigin.position; + + public delegate void HandEventHandler(Hand hand); + public event HandEventHandler OnHandDisabled; + + protected override void OnDisabled() + { + if (!IsServer) + { + return; + } + + OnHandDisabled?.Invoke(this); + } + + public bool IsEmpty() + { + return Container.Container.Empty; + } + + /// + /// Get the interaction source from stuff in hand if there's any. + /// Also sets the source of the IInteraction source to be this hand. + /// + /// + public IInteractionSource GetActiveTool() + { + Item itemInHand = ItemInHand; + if (itemInHand == null) + { + return null; + } + + IInteractionSource interactionSource = itemInHand.Prefab.GetComponent(); + if (interactionSource != null) + { + interactionSource.Source = this; + } + return interactionSource; + } + + public RangeLimit GetInteractionRange() + { + return _range; + } + + [Server] + public void Pickup(Item item) + { + if (!IsEmpty()) + { + return; + } + + if (item.Container != null && item.Container.AttachedTo != Container) + { + item.Container.RemoveItem(item); + } + + Container.Container.AddItem(item); + } + + [ServerRpc] + public void CmdDropHeldItem() + { + if (IsEmpty()) + { + return; + } + + Container.Container.Dump(); + } + + /// + /// Place item on the floor, or on any other surface, place it out of its container. + /// + [Server] + public void PlaceHeldItemOutOfHand(Vector3 position, Quaternion rotation) + { + if (IsEmpty()) + { + return; + } + + Item item = ItemInHand; + item.SetContainer(null); + ItemUtility.Place(item, position, rotation, transform); + } + + /// + /// Checks if the creature can interact with an object + /// + /// The game object to interact with + public bool CanInteract(GameObject otherObject) + { + return GetInteractionRange().IsInRange(InteractionOrigin, otherObject.transform.position); + } + } +} diff --git a/Assets/Scripts/SS3D/Systems/Inventory/Containers/Hand.cs.meta b/Assets/Scripts/SS3D/Systems/Inventory/Containers/Hand.cs.meta new file mode 100644 index 0000000000..5cc059c36e --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Inventory/Containers/Hand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e60c09e136263a44eb7996c9a5dc742a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SS3D/Systems/Inventory/Containers/Hands.cs b/Assets/Scripts/SS3D/Systems/Inventory/Containers/Hands.cs index e1112b21e2..507c971783 100644 --- a/Assets/Scripts/SS3D/Systems/Inventory/Containers/Hands.cs +++ b/Assets/Scripts/SS3D/Systems/Inventory/Containers/Hands.cs @@ -1,9 +1,13 @@ using System; +using System.Collections.Generic; using System.Linq; using FishNet.Object; +using FishNet.Object.Synchronizing; using SS3D.Core; +using SS3D.Core.Behaviours; using SS3D.Interactions; using SS3D.Interactions.Interfaces; +using SS3D.Logging; using SS3D.Systems.Inputs; using SS3D.Systems.Inventory.Items; using SS3D.Systems.Inventory.UI; @@ -17,163 +21,150 @@ namespace SS3D.Systems.Inventory.Containers { /// - /// Handle selections of the hands, holding stuff, using tools, and interacting.. - /// Should probably have some of this code in independent hand components, to allow hands to not be usable after loosing one. + /// Handle selections of the active hands, changing colors of active hand slot, and using controls such as dropping or swapping hands. + /// Also acts as a controller for all hands present on the player. /// [RequireComponent(typeof(HumanInventory))] - public class Hands : InteractionSource, IToolHolder, IInteractionRangeLimit, IInteractionOriginProvider - { - [SerializeField] public AttachedContainer[] HandContainers; - [SerializeField] private float handRange; + public class Hands : NetworkActor, IHandsController + { + /// + /// List of hands currently on the player, should be modified on server only. + /// + [SerializeField] public List PlayerHands; + + private Controls.HotkeysActions _controls; + /// + /// Reference to the inventory linked to Hands. + /// [NonSerialized] public HumanInventory Inventory; - public Color SelectedColor; - private Color _defaultColor; - - public int SelectedHandIndex { get; private set; } - public RangeLimit range = new(1.5f, 2); - // the origin of an x interaction that is performed is provided by this, we use it for range checks - public Transform interactionOrigin; - // pickup icon that this hand uses when there's a pickup interaction - // TODO: When AssetData is on, we should update this to not use this - public Sprite pickupIcon; - /// - /// Called when the active hand gets changed - /// - public event Action OnHandChanged; - /// - /// The item held in the active hand - /// - public Item ItemInHand => SelectedHandContainer.Items.FirstOrDefault(); - - - /// - /// The currently active hand - /// - public AttachedContainer SelectedHand => SelectedHandIndex < HandContainers.Length ? HandContainers[SelectedHandIndex] : null; - /// - /// The container of the currently active hand - /// - public Container SelectedHandContainer => SelectedHand != null ? SelectedHand.Container : null; - /// - /// If the selected hand is empty - /// - public bool SelectedHandEmpty => SelectedHandContainer.Empty; - - public void SetInventory(HumanInventory inventory) + /// + /// Color of selected hand, or when mouse passes over the slot. + /// + [SerializeField] + private Color _selectedColor; + + /// + /// Color of unselected hand + /// + [SerializeField] + private Color _defaultColor; + + /// + /// The selected hand, should be part of PlayerHands list. + /// + [SyncVar(OnChange = nameof(SyncSelectedHand))] + private Hand _selectedHand; + + /// + /// The currently active hand + /// + public Hand SelectedHand => _selectedHand; + + /// + /// A list of all containers linked to all hands on player. + /// + public List HandContainers => PlayerHands.Select(x => x.Container).ToList(); + + public override void OnStartServer() + { + base.OnStartServer(); + foreach(Hand hand in PlayerHands) + { + hand.HandsController = this; + hand.OnHandDisabled += HandleHandRemoved; + } + // Set the selected hand to be the first available one. + _selectedHand = PlayerHands.FirstOrDefault(); + } + + /// + /// Sync for clients, set highlight on slots properly. + /// + public void SyncSelectedHand(Hand oldHand, Hand newHand, bool asServer) + { + if (asServer || !IsOwner) return; + if(oldHand != null) + { + SetHandHighlight(oldHand, false); + } + if (newHand != null) + { + SetHandHighlight(newHand, true); + } + } + + [Client] + public void SetInventory(HumanInventory inventory) { Inventory = inventory; Inventory.OnInventorySetUp += OnInventorySetUp; } - private void OnInventorySetUp() + [Client] + private void OnInventorySetUp() { - SetHandHighlight(SelectedHandIndex, true); + SetHandHighlight(PlayerHands.First(), true); + // Set up hand related controls. _controls = Subsystems.Get().Inputs.Hotkeys; _controls.SwapHands.performed += HandleSwapHands; _controls.Drop.performed += HandleDropHeldItem; - SupportsMultipleInteractions = true; Inventory.OnInventorySetUp -= OnInventorySetUp; } - protected override void OnDestroyed() + protected override void OnDestroyed() { base.OnDestroyed(); - _controls.SwapHands.performed -= HandleSwapHands; - _controls.Drop.performed -= HandleDropHeldItem; - } - - [Server] - public void Pickup(Item item) - { - if (!SelectedHandEmpty) - { - return; - } - - if (item.Container != SelectedHandContainer && item.Container != null) - { - item.Container.RemoveItem(item); - } - - SelectedHandContainer.AddItem(item); - } - - public bool IsEmpty() - { - return SelectedHandContainer.Empty; + if (IsOwner) + { + _controls.SwapHands.performed -= HandleSwapHands; + _controls.Drop.performed -= HandleDropHeldItem; + } } - /* - * Command wrappers for inventory actions using the currently held item - */ - [Server] - public void DropHeldItem() + [Client] + private void HandleSwapHands(InputAction.CallbackContext context) { - if (SelectedHandEmpty) + // We don't swap hand if there's a single one. + if (!IsOwner || !enabled || PlayerHands.Count <= 1) { return; } - - SelectedHandContainer.Dump(); + CmdNextHand(); } - [Server] - public void PlaceHeldItem(Vector3 position, Quaternion rotation) + /// + /// Set the Active hand of the Player to be the AttachedContainer passed in parameter. + /// Do nothing if the parameter is the already active parameter. + /// + /// This AttachedContainer should only be a hand. + [ServerRpc] + public void CmdSetActiveHand(AttachedContainer selectedContainer) { - if (SelectedHandEmpty) - { - return; - } - Item item = ItemInHand; - item.SetContainer(null); - ItemUtility.Place(item, position, rotation, transform); - } + Hand hand = PlayerHands.FirstOrDefault(x => x.Container == selectedContainer); - private void HandleSwapHands(InputAction.CallbackContext context) - { - if (!IsOwner || !enabled || HandContainers.Length < 1) - { - return; - } - int oldSelectedHandIndex = SelectedHandIndex; - SelectedHandIndex = (SelectedHandIndex + 1) % HandContainers.Length; - OnHandChanged?.Invoke(SelectedHandIndex); - HighLightChanged(oldSelectedHandIndex); - CmdSetActiveHand(SelectedHandIndex); - } - - /// - /// Set the Active hand of the Player to be the AttachedContainer passed in parameter. - /// Do nothing if the parameter is the already active parameter. - /// - /// This AttachedContainer should only be a hand. - public void SetActiveHand(AttachedContainer selectedContainer) - { - if (selectedContainer == SelectedHand) + if (hand == selectedContainer) { + Punpun.Warning(this, "Hand already selected"); return; } if (!HandContainers.Contains(selectedContainer)) { - return; + Punpun.Warning(this, "no hand with the passed container in parameter"); + return; } - int oldSelectedHandIndex = SelectedHandIndex; - SelectedHandIndex = HandContainers.ToList().IndexOf(selectedContainer); - if (SelectedHandIndex != -1) + if (hand != null) { - OnHandChanged?.Invoke(SelectedHandIndex); - HighLightChanged(oldSelectedHandIndex); - CmdSetActiveHand(SelectedHandIndex); + _selectedHand = hand; } else { @@ -181,88 +172,100 @@ public void SetActiveHand(AttachedContainer selectedContainer) } } + [Client] private void HandleDropHeldItem(InputAction.CallbackContext context) { - CmdDropHeldItem(); - } - [ServerRpc] - private void CmdDropHeldItem() - { - DropHeldItem(); + SelectedHand.CmdDropHeldItem(); } [ServerRpc] - private void CmdSetActiveHand(int selectedHand) - { - if (selectedHand >= 0 && selectedHand < HandContainers.Length) - { - SelectedHandIndex = selectedHand; - } - else - { - Debug.Log($"Invalid hand index {selectedHand}"); - } - } - - public IInteractionSource GetActiveTool() - { - Item itemInHand = ItemInHand; - if (itemInHand == null) - { - return null; - } - - IInteractionSource interactionSource = itemInHand.Prefab.GetComponent(); - if (interactionSource != null) - { - interactionSource.Source = this; - } - return interactionSource; - } - public RangeLimit GetInteractionRange() - { - return range; - } - - /// - /// Checks if the creature can interact with an object - /// - /// The game object to interact with - public bool CanInteract(GameObject otherObject) + private void CmdNextHand() { - return GetInteractionRange().IsInRange(InteractionOrigin, otherObject.transform.position); + NextHand(); } - public Vector3 InteractionOrigin => interactionOrigin.position; + [Server] + private void NextHand() + { + int index = PlayerHands.FindIndex(0, x => x == SelectedHand); + _selectedHand = PlayerHands[(index + 1) % PlayerHands.Count]; + } - - private void HighLightChanged(int oldIndex) + [Client] + private void SetHandHighlight(Hand hand, bool highlight) { - if (SelectedHandIndex != -1) - { - SetHandHighlight(oldIndex, false); - } - - SetHandHighlight(SelectedHandIndex, true); - } - - private void SetHandHighlight(int index, bool highlight) - { - Transform handSlot = ViewLocator.Get().First().GetHandSlot(index); + Transform handSlot = ViewLocator.Get().First().GetHandSlot(hand); Button button = handSlot.GetComponent