diff --git a/Assets/Content/WorldObjects/Entities/Humanoids/Human/Human.prefab b/Assets/Content/WorldObjects/Entities/Humanoids/Human/Human.prefab index 908f711ade..4c731a0a71 100644 --- a/Assets/Content/WorldObjects/Entities/Humanoids/Human/Human.prefab +++ b/Assets/Content/WorldObjects/Entities/Humanoids/Human/Human.prefab @@ -1745,6 +1745,7 @@ MonoBehaviour: _networkObjectCache: {fileID: 2930813178971533500} _parentBodyPart: {fileID: 0} _skinnedMeshRenderer: {fileID: 4652682359255614497} + _bodyPartItem: {fileID: 0} Name: --- !u!65 &3758014577139489731 BoxCollider: @@ -3719,8 +3720,9 @@ MonoBehaviour: _networkObjectCache: {fileID: 2930813178971533500} _parentBodyPart: {fileID: 6940805956538079602} _skinnedMeshRenderer: {fileID: 6217532572249875957} + _bodyPartItem: {fileID: 5774385816057912484, guid: 35dfc7c3f708a5b48a206b4a44e7ab49, type: 3} Name: left hand - hand: {fileID: 4854640730944196939} + _hand: {fileID: 4854640730944196939} --- !u!65 &2660167717358018512 BoxCollider: m_ObjectHideFlags: 0 @@ -3786,6 +3788,7 @@ MonoBehaviour: _networkObjectCache: {fileID: 2930813178971533500} _parentBodyPart: {fileID: 2109177032093860794} _skinnedMeshRenderer: {fileID: 6840993320086561213} + _bodyPartItem: {fileID: 0} Name: right arm --- !u!136 &7865012682319576541 CapsuleCollider: @@ -5298,8 +5301,9 @@ MonoBehaviour: _networkObjectCache: {fileID: 2930813178971533500} _parentBodyPart: {fileID: 5513208408184026152} _skinnedMeshRenderer: {fileID: 2879367628846680322} + _bodyPartItem: {fileID: 5774385816057912484, guid: 7f5954f009d06b2439ca637b43920440, type: 3} Name: right hand - hand: {fileID: 4555203962178419925} + _hand: {fileID: 4555203962178419925} --- !u!1 &4491579062591798593 GameObject: m_ObjectHideFlags: 0 @@ -6908,6 +6912,7 @@ MonoBehaviour: _networkObjectCache: {fileID: 2930813178971533500} _parentBodyPart: {fileID: 2109177032093860794} _skinnedMeshRenderer: {fileID: 949421968142360378} + _bodyPartItem: {fileID: 0} Name: left arm --- !u!1 &6238267535831980016 GameObject: @@ -8426,6 +8431,7 @@ MonoBehaviour: _networkObjectCache: {fileID: 2930813178971533500} _parentBodyPart: {fileID: 2109177032093860794} _skinnedMeshRenderer: {fileID: 270151793522417329} + _bodyPartItem: {fileID: 0} Name: head --- !u!1 &7346838480958185366 GameObject: diff --git a/Assets/Content/WorldObjects/Entities/Humanoids/Human/HumanBodyParts/HumanHandLeft.prefab b/Assets/Content/WorldObjects/Entities/Humanoids/Human/HumanBodyParts/HumanHandLeft.prefab index 7469d01f2c..f24b9b8880 100644 --- a/Assets/Content/WorldObjects/Entities/Humanoids/Human/HumanBodyParts/HumanHandLeft.prefab +++ b/Assets/Content/WorldObjects/Entities/Humanoids/Human/HumanBodyParts/HumanHandLeft.prefab @@ -130,6 +130,9 @@ GameObject: - component: {fileID: 7854195103374356208} - component: {fileID: 7244337257717968850} - component: {fileID: 6047619831351193847} + - component: {fileID: 787567626965563974} + - component: {fileID: 9217642514011775196} + - component: {fileID: 2681293810503783247} m_Layer: 10 m_Name: HumanHandLeft m_TagString: Untagged @@ -169,6 +172,7 @@ MonoBehaviour: _componentIndexCache: 0 _addedNetworkObject: {fileID: 8532088199163376958} _networkObjectCache: {fileID: 8532088199163376958} + _componentConfiguration: 0 _synchronizeParent: 0 _packing: Position: 0 @@ -178,8 +182,10 @@ MonoBehaviour: _extrapolation: 2 _enableTeleport: 0 _teleportThreshold: 1 + _scaleThreshold: 1 _clientAuthoritative: 1 _sendToOwner: 1 + _enableNetworkLod: 1 _interval: 1 _synchronizePosition: 1 _positionSnapping: @@ -210,22 +216,29 @@ MonoBehaviour: m_EditorClassIdentifier: k__BackingField: 0 k__BackingField: 0 + k__BackingField: {fileID: 0} _networkBehaviours: - {fileID: 6576413314991157836} - {fileID: 949826828486068756} - {fileID: 7854195103374356208} - {fileID: 6047619831351193847} + - {fileID: 9217642514011775196} k__BackingField: {fileID: 0} k__BackingField: [] + SerializedTransformProperties: + Position: {x: 0, y: 0, z: 0} + Rotation: {x: 0, y: 0, z: 0, w: 1} + LocalScale: {x: 1, y: 1, z: 1} _isNetworked: 1 _isGlobal: 0 + _initializeOrder: 0 _defaultDespawnType: 0 NetworkObserver: {fileID: 0} k__BackingField: 0 + k__BackingField: 0 _scenePathHash: 0 k__BackingField: 0 k__BackingField: 63366572448909465 - _sceneNetworkObjects: [] --- !u!114 &949826828486068756 MonoBehaviour: m_ObjectHideFlags: 0 @@ -242,12 +255,12 @@ MonoBehaviour: _addedNetworkObject: {fileID: 8532088199163376958} _networkObjectCache: {fileID: 8532088199163376958} Container: {fileID: 7854195103374356208} - range: + _range: Horizontal: 1.5 Vertical: 2 - pickupIcon: {fileID: 0} - interactionOrigin: {fileID: 8087437400747043343} - handsController: {fileID: 0} + _pickupIcon: {fileID: 0} + _interactionOrigin: {fileID: 0} + HandsController: {fileID: 0} --- !u!114 &7854195103374356208 MonoBehaviour: m_ObjectHideFlags: 0 @@ -266,6 +279,7 @@ MonoBehaviour: _automaticContainerSetUp: 1 ContainerInteractive: {fileID: 6047619831351193847} ContainerItemDisplay: {fileID: 0} + inventory: {fileID: 0} ContainerUi: {fileID: 0} _attachmentOffset: {x: 0, y: 0, z: 0} _onlyStoreWhenOpen: 0 @@ -324,3 +338,56 @@ MonoBehaviour: _openState: 0 OverrideOpenIcon: {fileID: 0} attachedContainer: {fileID: 7854195103374356208} +--- !u!54 &787567626965563974 +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: 0 + m_Constraints: 0 + m_CollisionDetection: 0 +--- !u!114 &9217642514011775196 +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: 4 + _addedNetworkObject: {fileID: 8532088199163376958} + _networkObjectCache: {fileID: 8532088199163376958} + _name: hand left + _weight: 1 + _size: {x: 1, y: 1} + _startingTraits: [] + _rigidbody: {fileID: 787567626965563974} + Prefab: {fileID: 5774385816057912484} + AttachmentPoint: {fileID: 8087437400747043343, guid: df85b75fd341a244c8364ebb9c4fcfef, type: 3} + AttachmentPointAlt: {fileID: 8087437400747043343, guid: df85b75fd341a244c8364ebb9c4fcfef, type: 3} +--- !u!64 &2681293810503783247 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774385816057912484} + 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} diff --git a/Assets/Content/WorldObjects/Entities/Humanoids/Human/HumanBodyParts/HumanHandRight.prefab b/Assets/Content/WorldObjects/Entities/Humanoids/Human/HumanBodyParts/HumanHandRight.prefab index f7fd70880b..64abd3e29b 100644 --- a/Assets/Content/WorldObjects/Entities/Humanoids/Human/HumanBodyParts/HumanHandRight.prefab +++ b/Assets/Content/WorldObjects/Entities/Humanoids/Human/HumanBodyParts/HumanHandRight.prefab @@ -130,6 +130,9 @@ GameObject: - component: {fileID: 7230142737511069205} - component: {fileID: 3402973173329997909} - component: {fileID: 17826520120412619} + - component: {fileID: 1500947923134038856} + - component: {fileID: 2597824146249477698} + - component: {fileID: 6623222218013486614} m_Layer: 10 m_Name: HumanHandRight m_TagString: Untagged @@ -169,6 +172,7 @@ MonoBehaviour: _componentIndexCache: 0 _addedNetworkObject: {fileID: 8532088199163376958} _networkObjectCache: {fileID: 8532088199163376958} + _componentConfiguration: 0 _synchronizeParent: 0 _packing: Position: 0 @@ -178,8 +182,10 @@ MonoBehaviour: _extrapolation: 2 _enableTeleport: 0 _teleportThreshold: 1 + _scaleThreshold: 1 _clientAuthoritative: 1 _sendToOwner: 1 + _enableNetworkLod: 1 _interval: 1 _synchronizePosition: 1 _positionSnapping: @@ -210,22 +216,29 @@ MonoBehaviour: m_EditorClassIdentifier: k__BackingField: 0 k__BackingField: 0 + k__BackingField: {fileID: 0} _networkBehaviours: - {fileID: 6576413314991157836} - {fileID: -5392502220935940654} - {fileID: 7230142737511069205} - {fileID: 17826520120412619} + - {fileID: 2597824146249477698} k__BackingField: {fileID: 0} k__BackingField: [] + SerializedTransformProperties: + Position: {x: 0, y: 0, z: 0} + Rotation: {x: 0, y: 0, z: 0, w: 1} + LocalScale: {x: 1, y: 1, z: 1} _isNetworked: 1 _isGlobal: 0 + _initializeOrder: 0 _defaultDespawnType: 0 NetworkObserver: {fileID: 0} - k__BackingField: 137 + k__BackingField: 138 + k__BackingField: 0 _scenePathHash: 0 k__BackingField: 0 k__BackingField: 18047090012426851201 - _sceneNetworkObjects: [] --- !u!114 &-5392502220935940654 MonoBehaviour: m_ObjectHideFlags: 0 @@ -244,6 +257,7 @@ MonoBehaviour: _automaticContainerSetUp: 1 ContainerInteractive: {fileID: 17826520120412619} ContainerItemDisplay: {fileID: 0} + inventory: {fileID: 0} ContainerUi: {fileID: 0} _attachmentOffset: {x: 0, y: 0, z: 0} _onlyStoreWhenOpen: 0 @@ -280,12 +294,12 @@ MonoBehaviour: _addedNetworkObject: {fileID: 8532088199163376958} _networkObjectCache: {fileID: 8532088199163376958} Container: {fileID: -5392502220935940654} - range: + _range: Horizontal: 1.5 Vertical: 2 - pickupIcon: {fileID: 0} - interactionOrigin: {fileID: 7596600830642500397} - handsController: {fileID: 0} + _pickupIcon: {fileID: 0} + _interactionOrigin: {fileID: 0} + HandsController: {fileID: 0} --- !u!95 &3402973173329997909 Animator: serializedVersion: 4 @@ -324,3 +338,56 @@ MonoBehaviour: _openState: 0 OverrideOpenIcon: {fileID: 0} attachedContainer: {fileID: -5392502220935940654} +--- !u!54 &1500947923134038856 +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: 0 + m_Constraints: 0 + m_CollisionDetection: 0 +--- !u!114 &2597824146249477698 +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: 4 + _addedNetworkObject: {fileID: 8532088199163376958, guid: c19eccca279beee4186432a03257a7b9, type: 3} + _networkObjectCache: {fileID: 8532088199163376958} + _name: right hand + _weight: 1 + _size: {x: 1, y: 1} + _startingTraits: [] + _rigidbody: {fileID: 1500947923134038856} + Prefab: {fileID: 5774385816057912484} + AttachmentPoint: {fileID: 8087437400747043343, guid: c19eccca279beee4186432a03257a7b9, type: 3} + AttachmentPointAlt: {fileID: 0} +--- !u!64 &6623222218013486614 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5774385816057912484} + 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} diff --git a/Assets/Content/WorldObjects/Items/BodyParts/HumanHandLeft.prefab b/Assets/Content/WorldObjects/Items/BodyParts/HumanHandLeft.prefab index cea6d01cba..e7107efeb0 100644 --- a/Assets/Content/WorldObjects/Items/BodyParts/HumanHandLeft.prefab +++ b/Assets/Content/WorldObjects/Items/BodyParts/HumanHandLeft.prefab @@ -183,7 +183,7 @@ Rigidbody: m_Drag: 0 m_AngularDrag: 0.05 m_UseGravity: 1 - m_IsKinematic: 0 + m_IsKinematic: 1 m_Interpolate: 1 m_Constraints: 0 m_CollisionDetection: 3 @@ -202,6 +202,7 @@ MonoBehaviour: _componentIndexCache: 0 _addedNetworkObject: {fileID: 8532088199163376958} _networkObjectCache: {fileID: 8532088199163376958} + _componentConfiguration: 0 _synchronizeParent: 0 _packing: Position: 0 @@ -211,8 +212,10 @@ MonoBehaviour: _extrapolation: 2 _enableTeleport: 0 _teleportThreshold: 1 + _scaleThreshold: 1 _clientAuthoritative: 1 _sendToOwner: 1 + _enableNetworkLod: 1 _interval: 1 _synchronizePosition: 1 _positionSnapping: @@ -243,6 +246,7 @@ MonoBehaviour: m_EditorClassIdentifier: k__BackingField: 0 k__BackingField: 0 + k__BackingField: {fileID: 0} _networkBehaviours: - {fileID: 6576413314991157836} - {fileID: 103478066480505861} @@ -251,15 +255,20 @@ MonoBehaviour: - {fileID: 6047619831351193847} k__BackingField: {fileID: 0} k__BackingField: [] + SerializedTransformProperties: + Position: {x: 0, y: 0, z: 0} + Rotation: {x: 0, y: 0, z: 0, w: 0} + LocalScale: {x: 0, y: 0, z: 0} _isNetworked: 1 _isGlobal: 0 + _initializeOrder: 0 _defaultDespawnType: 0 NetworkObserver: {fileID: 0} - k__BackingField: 0 + k__BackingField: 113 + k__BackingField: 0 _scenePathHash: 0 k__BackingField: 0 k__BackingField: 14272839664766648676 - _sceneNetworkObjects: [] --- !u!114 &103478066480505861 MonoBehaviour: m_ObjectHideFlags: 0 @@ -299,12 +308,12 @@ MonoBehaviour: _addedNetworkObject: {fileID: 8532088199163376958} _networkObjectCache: {fileID: 8532088199163376958} Container: {fileID: 7854195103374356208} - range: + _range: Horizontal: 1.5 Vertical: 2 - pickupIcon: {fileID: 0} - interactionOrigin: {fileID: 8087437400747043343} - handsController: {fileID: 0} + _pickupIcon: {fileID: 0} + _interactionOrigin: {fileID: 0} + HandsController: {fileID: 0} --- !u!114 &7854195103374356208 MonoBehaviour: m_ObjectHideFlags: 0 @@ -323,6 +332,7 @@ MonoBehaviour: _automaticContainerSetUp: 1 ContainerInteractive: {fileID: 6047619831351193847} ContainerItemDisplay: {fileID: 0} + inventory: {fileID: 0} ContainerUi: {fileID: 0} _attachmentOffset: {x: 0, y: 0, z: 0} _onlyStoreWhenOpen: 0 diff --git a/Assets/Content/WorldObjects/Items/BodyParts/HumanHandRight.prefab b/Assets/Content/WorldObjects/Items/BodyParts/HumanHandRight.prefab index c1a5612411..3713c3f30d 100644 --- a/Assets/Content/WorldObjects/Items/BodyParts/HumanHandRight.prefab +++ b/Assets/Content/WorldObjects/Items/BodyParts/HumanHandRight.prefab @@ -202,6 +202,7 @@ MonoBehaviour: _componentIndexCache: 0 _addedNetworkObject: {fileID: 8532088199163376958} _networkObjectCache: {fileID: 8532088199163376958} + _componentConfiguration: 0 _synchronizeParent: 0 _packing: Position: 0 @@ -211,8 +212,10 @@ MonoBehaviour: _extrapolation: 2 _enableTeleport: 0 _teleportThreshold: 1 + _scaleThreshold: 1 _clientAuthoritative: 1 _sendToOwner: 1 + _enableNetworkLod: 1 _interval: 1 _synchronizePosition: 1 _positionSnapping: @@ -243,22 +246,29 @@ MonoBehaviour: m_EditorClassIdentifier: k__BackingField: 0 k__BackingField: 0 + k__BackingField: {fileID: 0} _networkBehaviours: - {fileID: 6576413314991157836} - {fileID: 103478066480505861} - {fileID: -5392502220935940654} - {fileID: 7230142737511069205} + - {fileID: 17826520120412619} k__BackingField: {fileID: 0} k__BackingField: [] + SerializedTransformProperties: + Position: {x: 0, y: 0, z: 0} + Rotation: {x: 0, y: 0, z: 0, w: 0} + LocalScale: {x: 0, y: 0, z: 0} _isNetworked: 1 _isGlobal: 0 + _initializeOrder: 0 _defaultDespawnType: 0 NetworkObserver: {fileID: 0} - k__BackingField: 135 + k__BackingField: 15 + k__BackingField: 0 _scenePathHash: 0 k__BackingField: 0 k__BackingField: 1925488133346520972 - _sceneNetworkObjects: [] --- !u!114 &103478066480505861 MonoBehaviour: m_ObjectHideFlags: 0 @@ -300,6 +310,7 @@ MonoBehaviour: _automaticContainerSetUp: 1 ContainerInteractive: {fileID: 17826520120412619} ContainerItemDisplay: {fileID: 0} + inventory: {fileID: 0} ContainerUi: {fileID: 0} _attachmentOffset: {x: 0, y: 0, z: 0} _onlyStoreWhenOpen: 0 @@ -336,12 +347,12 @@ MonoBehaviour: _addedNetworkObject: {fileID: 8532088199163376958} _networkObjectCache: {fileID: 8532088199163376958} Container: {fileID: -5392502220935940654} - range: + _range: Horizontal: 1.5 Vertical: 2 - pickupIcon: {fileID: 0} - interactionOrigin: {fileID: 7596600830642500397} - handsController: {fileID: 0} + _pickupIcon: {fileID: 0} + _interactionOrigin: {fileID: 0} + HandsController: {fileID: 0} --- !u!95 &3402973173329997909 Animator: serializedVersion: 4 @@ -374,9 +385,9 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 3c75d17834848bb4f83ee6e730a65519, type: 3} m_Name: m_EditorClassIdentifier: - _componentIndexCache: 255 + _componentIndexCache: 4 _addedNetworkObject: {fileID: 8532088199163376958} - _networkObjectCache: {fileID: 0} + _networkObjectCache: {fileID: 8532088199163376958} _openState: 0 OverrideOpenIcon: {fileID: 0} attachedContainer: {fileID: -5392502220935940654} diff --git a/Assets/Scripts/SS3D/Systems/Health/HandBodyPart.cs b/Assets/Scripts/SS3D/Systems/Health/HandBodyPart.cs index aec206b190..4cd7558e14 100644 --- a/Assets/Scripts/SS3D/Systems/Health/HandBodyPart.cs +++ b/Assets/Scripts/SS3D/Systems/Health/HandBodyPart.cs @@ -1,4 +1,5 @@ using Coimbra; +using FishNet; using SS3D.Systems.Inventory.Containers; using System.Collections; using System.Collections.Generic; @@ -7,7 +8,7 @@ public class HandBodyPart : HumanBodypart { - [SerializeField] private Hand hand; + [SerializeField] private Hand _hand; public override void Init(string name = "") { base.Init(name); @@ -21,6 +22,14 @@ public override void Init(BodyPart parent, string name = "") protected override void RemoveSingleBodyPart() { base.RemoveSingleBodyPart(); - hand.DisableHand(); + _hand.DisableHand(); + } + + protected override void DetachBodyPart() + { + GameObject go = Instantiate(_bodyPartItem); + Hand hand = go.GetComponent(); + Destroy(hand); + InstanceFinder.ServerManager.Spawn(go, null); } }