Esempio n. 1
0
        public static void Prefix(BaseGhost __instance)
        {
            // Null out fields that will be used for storing state
            TransientLocalObjectManager.Remove(TransientObjectType.LATEST_BASE_WITH_NEW_CONSTRUCTION);
            TransientLocalObjectManager.Remove(TransientObjectType.LATEST_BASE_CELL_WITH_NEW_CONSTRUCTION);

            // In this case, our piece is part of an existing, larger base.  We'll record the base and offset.
            // We don't directly record the piece as it will be re-built when the base rebuilds geometry (this
            // happens each time a piece is built, subnautica destroys all others and replaces them).
            if (__instance.TargetBase != null)
            {
                Log.Debug("Placed BaseGhost is a new piece of an existing base");
                TransientLocalObjectManager.Add(TransientObjectType.LATEST_BASE_WITH_NEW_CONSTRUCTION, __instance.TargetBase);
                TransientLocalObjectManager.Add(TransientObjectType.LATEST_BASE_CELL_WITH_NEW_CONSTRUCTION, __instance.TargetOffset);
            }
            else
            {
                Log.Debug("Placed BaseGhost is the first piece of a new base.");
            }
        }