From 1cffcda774662af121b9948419a53497c88d0e40 Mon Sep 17 00:00:00 2001 From: excitedneon Date: Mon, 15 May 2017 00:17:42 +0300 Subject: [PATCH 1/2] Fix Inventory hash function for now --- Assets/Scripts/Entities/SyncBases/Inventory.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/Entities/SyncBases/Inventory.cs b/Assets/Scripts/Entities/SyncBases/Inventory.cs index 6b1830a..38f61bc 100644 --- a/Assets/Scripts/Entities/SyncBases/Inventory.cs +++ b/Assets/Scripts/Entities/SyncBases/Inventory.cs @@ -37,18 +37,19 @@ namespace Cyber.Entities.SyncBases { } /// - /// Generates a checksum for the inventory + /// Generates a checksum for the inventory. /// /// A checksum of the IDs of the items public override int GenerateChecksum() { var Items = Drive.GetItems().ToArray(); int Checksum = 0; for (int i = 0; i < Items.Length; i++) { - Checksum ^= Items[i].ID; + // Times with primes and sprinkle some i to spice up the stew + Checksum += (Items[i].ID + 1) * 509 * (i + 1) * 53; } var EquippedItems = Equipped.GetEquippedList().ToArray(); for (int i = 0; i < EquippedItems.Length; i++) { - Checksum ^= EquippedItems[i].ID; + Checksum += (EquippedItems[i].ID + 1) * 859 * (i + 1) * 97; } return Checksum; } From c2520b3260cadec57868128f04078708630a7926 Mon Sep 17 00:00:00 2001 From: excitedneon Date: Mon, 15 May 2017 00:30:17 +0300 Subject: [PATCH 2/2] Add visual equipment for npcs --- Assets/Prefabs/NPC.prefab | 231 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 231 insertions(+) diff --git a/Assets/Prefabs/NPC.prefab b/Assets/Prefabs/NPC.prefab index 153c57b..4240e1f 100644 --- a/Assets/Prefabs/NPC.prefab +++ b/Assets/Prefabs/NPC.prefab @@ -39,6 +39,7 @@ GameObject: - component: {fileID: 143753897266899886} - component: {fileID: 114052379458543858} - component: {fileID: 114934786006823366} + - component: {fileID: 114629890146295716} m_Layer: 0 m_Name: NPC m_TagString: Untagged @@ -46,6 +47,23 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 +--- !u!1 &1061796689964632 +GameObject: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 4021186793457802} + - component: {fileID: 33347327159040576} + - component: {fileID: 23664335955531464} + m_Layer: 0 + m_Name: Left Hand + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 --- !u!1 &1147981388454896 GameObject: m_ObjectHideFlags: 1 @@ -78,6 +96,40 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 +--- !u!1 &1473522455052964 +GameObject: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 4530387361756610} + - component: {fileID: 33512562496570824} + - component: {fileID: 23983100625939084} + m_Layer: 0 + m_Name: Hat Mesh + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1702112528416172 +GameObject: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 4029151840286420} + - component: {fileID: 33917458294930386} + - component: {fileID: 23177266068827686} + m_Layer: 0 + m_Name: Right Hand + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 --- !u!1 &1755630587503636 GameObject: m_ObjectHideFlags: 0 @@ -95,6 +147,32 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 +--- !u!4 &4021186793457802 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1061796689964632} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -0.6, y: -0.30000007, z: 0.6} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4900355877646882} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!4 &4029151840286420 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1702112528416172} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0.6, y: -0.30000007, z: 0.6} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4900355877646882} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!4 &4100501400945576 Transform: m_ObjectHideFlags: 1 @@ -121,6 +199,19 @@ Transform: m_Father: {fileID: 4900355877646882} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: -50.230003, y: 0, z: 0} +--- !u!4 &4530387361756610 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1473522455052964} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0.125, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4900355877646882} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!4 &4844777526459442 Transform: m_ObjectHideFlags: 1 @@ -161,6 +252,9 @@ Transform: m_Children: - {fileID: 4881667698869324} - {fileID: 4213406191208536} + - {fileID: 4530387361756610} + - {fileID: 4021186793457802} + - {fileID: 4029151840286420} m_Father: {fileID: 4844777526459442} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -196,6 +290,38 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 +--- !u!23 &23177266068827686 +MeshRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1702112528416172} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 2100000, guid: cac55f0f5d2b94909899376ddfca7276, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + 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 --- !u!23 &23446230835089794 MeshRenderer: m_ObjectHideFlags: 1 @@ -260,6 +386,70 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 +--- !u!23 &23664335955531464 +MeshRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1061796689964632} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 2100000, guid: cac55f0f5d2b94909899376ddfca7276, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + 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 +--- !u!23 &23983100625939084 +MeshRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1473522455052964} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 2100000, guid: cac55f0f5d2b94909899376ddfca7276, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + 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 --- !u!33 &33321560475186088 MeshFilter: m_ObjectHideFlags: 1 @@ -267,6 +457,20 @@ MeshFilter: m_PrefabInternal: {fileID: 100100000} m_GameObject: {fileID: 1042355583027620} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &33347327159040576 +MeshFilter: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1061796689964632} + m_Mesh: {fileID: 0} +--- !u!33 &33512562496570824 +MeshFilter: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1473522455052964} + m_Mesh: {fileID: 0} --- !u!33 &33780506824302906 MeshFilter: m_ObjectHideFlags: 1 @@ -281,6 +485,13 @@ MeshFilter: m_PrefabInternal: {fileID: 100100000} m_GameObject: {fileID: 1147981388454896} m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &33917458294930386 +MeshFilter: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1702112528416172} + m_Mesh: {fileID: 0} --- !u!114 &114052379458543858 MonoBehaviour: m_ObjectHideFlags: 1 @@ -297,6 +508,26 @@ MonoBehaviour: InteractionDistance: 2 CharacterController: {fileID: 143753897266899886} Head: {fileID: 4900355877646882} +--- !u!114 &114629890146295716 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1045762529817142} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bd9edbba64bb2450dab508e94163b0f8, type: 3} + m_Name: + m_EditorClassIdentifier: + Inventory: {fileID: 114934786006823366} + UpdateFrequency: 5 + Slots: + - Slot: 0 + Mesh: {fileID: 33512562496570824} + - Slot: 1 + Mesh: {fileID: 33917458294930386} + - Slot: 2 + Mesh: {fileID: 33347327159040576} --- !u!114 &114934786006823366 MonoBehaviour: m_ObjectHideFlags: 1