private static void MakeItemPlaceable(TechType techType, GameObject item, Collider collider = null) { // We can pick this item PrefabsHelper.SetDefaultPickupable(item); // We can place this item PrefabsHelper.SetDefaultPlaceTool(item, collider); // Add TechType to the hand-equipments SMLHelper.V2.Handlers.CraftDataHandler.SetEquipmentType(techType, EquipmentType.Hand); // Set as selectable item. SMLHelper.V2.Handlers.CraftDataHandler.SetQuickSlotType(techType, QuickSlotType.Selectable); }
//public abstract GameObject GetGameObject(); public virtual void RegisterItem() { if (this.IsRegistered == false && this.GameObject != null) { // Associate new recipe if (this.Recipe != null) { SMLHelper.V2.Handlers.CraftDataHandler.SetTechData(this.TechType, this.Recipe); } // Update PlaceTool parameters PrefabsHelper.SetDefaultPlaceTool(this.GameObject, null, null, false, false, true); PlaceTool placeTool = this.GameObject.GetComponent <GenericPlaceTool>(); if (placeTool == null) { placeTool = this.GameObject.GetComponent <PlaceTool>(); } if (placeTool != null) { if (this.TechType == TechType.Poster || this.TechType == TechType.PosterAurora || this.TechType == TechType.PosterExoSuit1 || this.TechType == TechType.PosterExoSuit2 || this.TechType == TechType.PosterKitty #if BELOWZERO || this.TechType == TechType.PosterSpyPenguin #endif ) { placeTool.allowedOnGround = false; placeTool.allowedOnWalls = true; placeTool.hasAnimations = false; placeTool.hasBashAnimation = false; placeTool.hasFirstUseAnimation = false; } else { placeTool.allowedOnGround = true; placeTool.allowedOnWalls = false; } } // Set the buildable prefab SMLHelper.V2.Handlers.PrefabHandler.RegisterPrefab(this); this.IsRegistered = true; } }