Esempio n. 1
0
 static void Prefix(BuilderTool __instance)
 {
     if (__instance.isDrawn && !Builder.isPlacing && AvatarInputHandler.main.IsEnabled() && GameUtils.getTarget(10f) is GameObject go)
     {
         DebrisPatcher.processObject(go);
     }
 }
 static void Postfix(UniqueIdentifier __instance)
 {
     if (__instance is PrefabIdentifier && DebrisPatcher.isValidPrefab(__instance.ClassId))
     {
         track(__instance.gameObject);
     }
 }
        public static void untrackInvalid()
        {
            if (!ResourceTracker.resources.TryGetValue(SalvageableDebrisDR.TechType, out var trackedResources))
            {
                return;
            }

            var toRemove = new List <ResourceTracker.ResourceInfo>();

            foreach (var info in trackedResources)
            {
                if (trackedDebris.TryGetValue(info.Key, out string prefabID) && !DebrisPatcher.isValidPrefab(prefabID))
                {
                    toRemove.Add(info.Value);
                }
            }

            var onResourceRemoved = typeof(ResourceTracker).evnt("onResourceRemoved").wrap();             // don't make it static

            foreach (var info in toRemove)
            {
                trackedResources.Remove(info.uniqueId);
                onResourceRemoved.raise(info);
            }
        }
Esempio n. 4
0
        public static void patch()
        {
            HarmonyHelper.patchAll(true);
            CraftHelper.patchAll();

            LanguageHelper.init();             // after CraftHelper

            DebrisPatcher.init(Mod.loadConfig <PrefabsConfig>(prefabsConfigName, Config.LoadOptions.ProcessAttributes));
        }
Esempio n. 5
0
 static bool checkIfTooBig(GameObject go, float sizeTooBig)
 {
     if (go.transform.localScale.x <= sizeTooBig)
     {
         return(false);
     }
     $"{go.name} is too big, removing Constructable".logDbg();
     DebrisPatcher.unpatchObject(go, false);
     return(true);
 }
Esempio n. 6
0
        static void Prefix(BuilderTool __instance)
        {
            if (__instance.isDrawn && !Builder.isPlacing && AvatarInputHandler.main.IsEnabled())
            {
                Targeting.GetTarget(Player.main.gameObject, 10f, out GameObject go, out float num, null);

                if (go)
                {
                    DebrisPatcher.processObject(go);
                }
            }
        }