/**
         * This function is called directly after the game clears all base pieces (to update
         * the view model - this is done in Base.ClearGeometry, see that patch).  The game will
         * respawn each object and we need to copy over their ids.  We reference the dictionary
         * in the ClearGemometry patch so know what ids to update.
         */
        public static void Postfix(Base __instance, Transform __result)
        {
            if (__instance == null || __result == null)
            {
                return;
            }

            NitroxId id;

            string key = Base_ClearGeometry_Patch.getObjectKey(__result.name, __result.position);

            if (Base_ClearGeometry_Patch.NitroxIdByObjectKey.TryGetValue(key, out id))
            {
                NitroxIdentifier.SetNewId(__result.gameObject, id);
            }
        }
示例#2
0
        /**
         * This function is called directly after the game clears all base pieces (to update
         * the view model - this is done in Base.ClearGeometry, see that patch).  The game will
         * respawn each object and we need to copy over their ids.  We reference the dictionary
         * in the ClearGemometry patch so know what ids to update.
         */
        public static void Postfix(Base __instance, Transform __result)
        {
            if (__instance == null || __result == null)
            {
                return;
            }

            string guid;

            string key = Base_ClearGeometry_Patch.getObjectKey(__result.name, __result.position);

            if (Base_ClearGeometry_Patch.GuidByObjectKey.TryGetValue(key, out guid))
            {
                GuidHelper.SetNewGuid(__result.gameObject, guid);
            }
        }