void reattachBeaconAfterLoad()
 {
     if (UniqueIdentifier.TryGetIdentifier(_beaconID, out UniqueIdentifier beacon))
     {
         setBeaconAttached(beacon.GetComponent <Beacon>(), true);
     }
 }
Ejemplo n.º 2
0
 void onSave()
 {
     "StorageAutoname.Serializer: onSave".logDbg();
     managedStorages.RemoveWhere(id => !UniqueIdentifier.TryGetIdentifier(id, out _));
     SaveLoad.save(saveName, new SaveData {
         storages = managedStorages
     });
 }
Ejemplo n.º 3
0
 internal static void Postfix(Vehicle __instance)
 {
     UniqueIdentifier.TryGetIdentifier(__instance.pilotId, out UniqueIdentifier uniqueIdentifier);
     if (__instance.pilotId != null)
     {
         if (uniqueIdentifier)
         {
             __instance.EnterVehicle(uniqueIdentifier.GetComponent <Player>(), true, false);
         }
     }
 }
Ejemplo n.º 4
0
        private void ReattachBeaconAfterLoad()
        {
            //Beacon Attachment code from FloatingCargoControl NexusMod: 303 by zorgesho
            UniqueIdentifier uniqueIdentifier;

            QuickLogger.Debug($"Trying to reattachBeacon after load");
            if (UniqueIdentifier.TryGetIdentifier(_beaconID, out uniqueIdentifier))
            {
                SetBeaconAttached(uniqueIdentifier.GetComponent <Beacon>(), true);
            }
        }
Ejemplo n.º 5
0
        static public GameObject Find(string guid, bool verbose = true)
        {
            if (string.IsNullOrEmpty(guid))
            {
                return(null);
            }

            UniqueIdentifier result;

            if (UniqueIdentifier.TryGetIdentifier(guid, out result) == false)
            {
                if (verbose)
                {
                    Log.Warn("Couldn't find guid: " + guid);
                }
                return(null);
            }

            return(result.gameObject);
        }
Ejemplo n.º 6
0
        // Feature parity of UniqueIdentifierHelper.GetByName() except does not do the verbose logging
        public static Optional <GameObject> GetObjectFrom(string guid)
        {
            if (string.IsNullOrEmpty(guid))
            {
                return(Optional <GameObject> .Empty());
            }

            UniqueIdentifier uniqueIdentifier;

            if (!UniqueIdentifier.TryGetIdentifier(guid, out uniqueIdentifier))
            {
                return(Optional <GameObject> .Empty());
            }

            if (uniqueIdentifier == null)
            {
                return(Optional <GameObject> .Empty());
            }

            return(Optional <GameObject> .Of(uniqueIdentifier.gameObject));
        }