Пример #1
0
        public static void processCustomObject(GameObject go)
        {
            PrefabsConfig.PrefabList targetList = null;

            if (Input.GetKey(Main.config.customObjects.hotkey))
            {
                targetList = prefabsConfig.dbsCustom;
            }
            else
            if (Input.GetKey(Main.config.customObjects.hotkeyTemp))
            {
                targetList = prefabsConfig.dbsCustomTemp;
            }

            if (targetList == null)
            {
                return;
            }

            var prefabID = go.getComponentInHierarchy <PrefabIdentifier>(false);

            if (prefabID == null || isValidPrefab(prefabID.ClassId))
            {
                return;
            }

            string prefabName = targetList.addPrefab(prefabID.ClassId, Main.config.customObjects.defaultResourceCount);

            prefabsConfig.save();
            refreshValidPrefabs(true);

            L10n.str(L10n.ids_customDebrisAdded).format(prefabName).onScreen();
        }
Пример #2
0
        public bool CanDeconstruct(out string reason)
        {
            reason = L10n.str("ids_tryMoveObject");

            if (Main.config.deconstructValidStaticObjects)
            {
                return(true);
            }

            return(gameObject.getComponentInHierarchy <Rigidbody>(true, false)?.isKinematic == false);
        }
Пример #3
0
        static bool Prefix(BuilderTool __instance, Constructable constructable)
        {
            if (!constructable.gameObject.GetComponent <DebrisDeconstructable>())
            {
                return(true);
            }

            HandReticle hand = HandReticle.main;

            hand.SetInteractText(L10n.str("ids_salvageableDebris"), __instance.deconstructText, false, false, HandReticle.Hand.None);

            if (!constructable.constructed)
            {
                hand.SetProgress(constructable.amount);
                hand.SetIcon(HandReticle.IconType.Progress, 1.5f);
            }

            return(false);
        }
 public override void patch()
 {
     TechType = register(L10n.str(L10n.ids_smallScrapName), "", TechType.ScrapMetal);
     useTextFrom(descriptionFrom: TechType.ScrapMetal);
 }