private void InitializeRodsContainer() { if (_rodsRoot == null) { QuickLogger.Debug("Initializing StorageRoot"); var storageRoot = new GameObject("StorageRoot"); storageRoot.transform.SetParent(this.transform, false); _rodsRoot = storageRoot.AddComponent <ChildObjectIdentifier>(); } if (RodsContainer == null) { QuickLogger.Debug("Initializing RodsContainer"); RodsContainer = new ItemsContainer(ContainerWidth, ContainerHeight, _rodsRoot.transform, CyNukReactorBuildable.StorageLabel(), null); RodsContainer.SetAllowedTechTypes(new[] { TechType.ReactorRod, TechType.DepletedReactorRod }); RodsContainer.isAllowedToAdd += IsAllowedToAdd; RodsContainer.isAllowedToRemove += IsAllowedToRemove; RodsContainer.onAddItem += OnAddItem; RodsContainer.onRemoveItem += OnRemoveItem; RodsContainer.onChangeItemPosition += RodsContainer_onChangeItemPosition; } }
internal void Setup(FCSDeepDrillerController mono) { _mono = mono; _isConstructed = () => mono.IsConstructed; if (_containerRoot == null) { QuickLogger.Debug("Initializing Deep Driller StorageRoot"); var storageRoot = new GameObject("DeepDrillerStorageRoot"); storageRoot.transform.SetParent(mono.transform, false); _containerRoot = storageRoot.AddComponent <ChildObjectIdentifier>(); } if (_container == null) { QuickLogger.Debug("Initializing Deep Driller Container"); _container = new ItemsContainer(_containerWidth, _containerHeight, _containerRoot.transform, FCSDeepDrillerBuildable.StorageContainerLabel(), null); _container.Resize(_containerWidth, _containerHeight); _container.isAllowedToAdd += IsAllowedToAdd; _container.onRemoveItem += OnRemoveItemEvent; } DayNightCycle main = DayNightCycle.main; //if (_timeSpawnMedKit < 0.0 && main) //{ // this._timeSpawnMedKit = (float)(main.timePassed + (!this.startWithMedKit ? (double)MedKitSpawnInterval : 0.0)); //} }
private void InitializeStorageRoot() { if (storageRoot is null) { var storeRoot = new GameObject("StorageRoot"); storeRoot.transform.SetParent(this.transform, false); storageRoot = storeRoot.AddComponent <ChildObjectIdentifier>(); } }
internal AlterraShippingContainer(AlterraShippingTarget target) { _isContstructed = () => target.IsConstructed; _target = target; if (_containerRoot == null) { QuickLogger.Debug("Initializing StorageRoot"); var storageRoot = new GameObject("StorageRoot"); storageRoot.transform.SetParent(target.transform, false); _containerRoot = storageRoot.AddComponent <ChildObjectIdentifier>(); } CreateNewContainer(); }
private void Init() { if (ArmourRoot == null) { var root = new GameObject("EquipmentRoot"); root.transform.SetParent(transform, false); ArmourRoot = root.AddComponent <ChildObjectIdentifier>(); } Armour = new Equipment(base.gameObject, ArmourRoot.transform); Armour.SetLabel("OpenStorage"); Armour.onEquip += OnEquip; Armour.onUnequip += OnUnequip; SetSlots(); }
internal void Initialize(AIPowerCellSocketController mono) { _mono = mono; StartCoroutine(UpdatePowerRelay()); InvokeRepeating("UpdateSlots", 1f, 0.5f); if (_containerRoot == null) { QuickLogger.Debug("Initializing Filter StorageRoot"); var storageRoot = new GameObject("FilterStorageRoot"); storageRoot.transform.SetParent(transform, false); _containerRoot = storageRoot.AddComponent <ChildObjectIdentifier>(); } _batteryContainer = new ItemsContainer(ContainerWidth, ContainerHeight, _containerRoot.transform, AIPowerCellSocketBuildable.PowercellContainterLabel(), null); _batteryContainer.isAllowedToAdd += IsAllowedToAdd; _batteryContainer.onAddItem += BatteryContainerOnOnAddItem; _batteryContainer.onRemoveItem += BatteryContainerOnOnRemoveItem; }
internal void Initialize(ExStorageDepotController mono) { _mono = mono; _containerHeight = _maxItems = QPatch.Config.MaxStorage; if (_containerRoot == null) { QuickLogger.Debug("Ex-Storage Root"); var storageRoot = new GameObject("ExStorageRoot"); storageRoot.transform.SetParent(mono.transform, false); _containerRoot = storageRoot.AddComponent <ChildObjectIdentifier>(); _mono = mono; } if (_container == null) { QuickLogger.Debug("Initializing Storage Container"); _container = _mono.gameObject.GetComponentInChildren <StorageContainer>(); _container.width = _containerWidth; _container.height = _containerHeight; _container.container.onRemoveItem += ContainerOnRemoveItem; _container.container.onAddItem += ContainerOnAddItem; _container.container.Resize(_containerWidth, _containerHeight); _container.storageLabel = ExStorageDepotBuildable.StorageContainerLabel(); } if (_dumpContainer == null) { QuickLogger.Debug("Initializing Dump Container"); _dumpContainer = new ItemsContainer(DumpContainerWidth, DumpContainerHeight, _containerRoot.transform, ExStorageDepotBuildable.DumpContainerLabel(), null); _dumpContainer.Resize(DumpContainerWidth, DumpContainerHeight); _dumpContainer.isAllowedToAdd += IsAllowedToAdd; } InvokeRepeating("UpdateStorageDisplayCount", 1, 0.5f); }
public void Initialize(SeaCookerController mono) { _mono = mono; _isConstructed = () => mono.IsConstructed; if (_containerRoot == null) { QuickLogger.Debug("Initializing StorageRoot"); var storageRoot = new GameObject("StorageRoot"); var exportStorageRoot = new GameObject("ExportStorageRoot"); storageRoot.transform.SetParent(mono.transform, false); _containerRoot = storageRoot.AddComponent <ChildObjectIdentifier>(); _exportContainerRoot = exportStorageRoot.AddComponent <ChildObjectIdentifier>(); } if (_container == null) { QuickLogger.Debug("Initializing Container"); _container = new ItemsContainer(_containerWidth, _containerHeight, _containerRoot.transform, SeaCookerBuildable.StorageLabel(), null); _container.isAllowedToAdd += IsAllowedToAddContainer; } if (_exportContainer == null) { QuickLogger.Debug("Initializing Export Container"); _exportContainer = new ItemsContainer(_containerWidth, _containerHeight, _exportContainerRoot.transform, SeaCookerBuildable.ExportStorageLabel(), null); _exportContainer.isAllowedToAdd += IsAllowedToAddExport; } _mono.FoodManager.OnFoodCookedAll += OnFoodCookedAll; _mono.FoodManager.OnCookingStart += OnCookingStart; }
public void Initialize(Transform trans, string label, string itemNotAllowedMessage, string storageIsFullMessage, IFCSStorage storage, int width = 6, int height = 8, string name = "StorageRoot") { _itemNotAllowedMessage = itemNotAllowedMessage; _storageIsFullMessage = storageIsFullMessage; _storage = storage; if (_containerRoot == null) { var storageRoot = new GameObject(name); storageRoot.transform.SetParent(trans, false); _containerRoot = storageRoot.AddComponent <ChildObjectIdentifier>(); } if (_dumpContainer == null) { QuickLogger.Debug("Initializing Container"); _dumpContainer = new ItemsContainer(width, height, _containerRoot.transform, label, null); _dumpContainer.isAllowedToAdd += IsAllowedToAdd; _dumpContainer.onAddItem += DumpContainerOnOnAddItem; } }
public override GameObject GetGameObject() { if (processedPrefab is null) { GameObject prefab = Main.assetBundle.LoadAsset <GameObject>("TechPistol.prefab"); GameObject gameObject = GameObject.Instantiate(prefab, Vector3.zero, Quaternion.identity, false); MeshRenderer[] componentsInChildren = gameObject.GetComponentsInChildren <MeshRenderer>(); foreach (MeshRenderer meshRenderer in componentsInChildren) { if (meshRenderer.name.StartsWith("Gun") || meshRenderer.name.StartsWith("Target")) { Texture emissionMap = meshRenderer.material.GetTexture("_EmissionMap"); Texture specMap = meshRenderer.material.GetTexture("_MetallicGlossMap"); meshRenderer.material.shader = Shader.Find("MarmosetUBER"); meshRenderer.material.EnableKeyword("MARMO_EMISSION"); meshRenderer.material.EnableKeyword("MARMO_SPECMAP"); meshRenderer.material.SetTexture(ShaderPropertyID._Illum, emissionMap); meshRenderer.material.SetTexture(ShaderPropertyID._SpecTex, specMap); meshRenderer.material.SetColor("_GlowColor", new Color(1f, 1f, 1f)); meshRenderer.material.SetFloat(ShaderPropertyID._GlowStrength, 1f); meshRenderer.material.SetFloat(ShaderPropertyID._GlowStrengthNight, 1f); } } EnergyMixin energyMixin = gameObject.GetComponent <EnergyMixin>(); List <EnergyMixin.BatteryModels> batteryModels = new List <EnergyMixin.BatteryModels>(); foreach (TechType techType in modelsToMake) { GameObject batteryprefab = CraftData.GetPrefabForTechType(techType, false); GameObject model = GameObject.Instantiate(batteryprefab); batteryprefab.SetActive(false); model.SetActive(false); GameObject.DestroyImmediate(model.GetComponentInChildren <WorldForces>()); GameObject.DestroyImmediate(model.GetComponentInChildren <Rigidbody>()); GameObject.DestroyImmediate(model.GetComponentInChildren <Battery>()); GameObject.DestroyImmediate(model.GetComponentInChildren <LargeWorldEntity>()); GameObject.DestroyImmediate(model.GetComponentInChildren <TechTag>()); GameObject.DestroyImmediate(model.GetComponentInChildren <EntityTag>()); GameObject.DestroyImmediate(model.GetComponentInChildren <Pickupable>()); GameObject.DestroyImmediate(model.GetComponentInChildren <Collider>()); GameObject.DestroyImmediate(model.GetComponentInChildren <SkyApplier>()); if (model.TryGetComponent <PrefabIdentifier>(out PrefabIdentifier prefabIdentifier)) { string classId = prefabIdentifier.ClassId; GameObject.DestroyImmediate(prefabIdentifier); ChildObjectIdentifier childObjectIdentifier = model.EnsureComponent <ChildObjectIdentifier>(); childObjectIdentifier.ClassId = classId; } model.SetActive(false); bool cellCheck = techType.AsString().ToLower().Contains("cell"); Vector3 position = cellCheck ? new Vector3(0f, 1.45f, 0.95f) : new Vector3(0f, 1.46f, 0.95f); Vector3 scale = cellCheck ? new Vector3(0.15f, 0.15f, 0.15f) : new Vector3(0.3f, 0.3f, 0.3f); model.transform.SetParent(energyMixin.storageRoot.transform); model.transform.SetPositionAndRotation(gameObject.transform.position, gameObject.transform.rotation); model.transform.localPosition = position; model.transform.localEulerAngles = new Vector3(270f, 0f, 0f); model.transform.localScale = scale; batteryModels.Add(new EnergyMixin.BatteryModels { techType = techType, model = model }); } energyMixin.compatibleBatteries = compatibleTech; energyMixin.batteryModels = batteryModels.ToArray(); gameObject.GetComponent <Rigidbody>().detectCollisions = false; gameObject.GetComponent <PrefabIdentifier>().ClassId = base.ClassID; gameObject.GetComponent <TechTag>().type = base.TechType; gameObject.GetComponent <SkyApplier>().renderers = gameObject.GetComponentsInChildren <Renderer>(true); processedPrefab = gameObject; GameObject.DontDestroyOnLoad(processedPrefab); } return(GameObject.Instantiate(processedPrefab)); }