diff --git a/GeneralMods/Revitalize/Content/Graphics/Objects/Machines/SteamBoiler.png b/GeneralMods/Revitalize/Content/Graphics/Objects/Machines/SteamBoiler.png new file mode 100644 index 00000000..57fb38af Binary files /dev/null and b/GeneralMods/Revitalize/Content/Graphics/Objects/Machines/SteamBoiler.png differ diff --git a/GeneralMods/Revitalize/Framework/Managers/FluidManagerV2.cs b/GeneralMods/Revitalize/Framework/Managers/FluidManagerV2.cs index ffec6dc4..fd5de4e7 100644 --- a/GeneralMods/Revitalize/Framework/Managers/FluidManagerV2.cs +++ b/GeneralMods/Revitalize/Framework/Managers/FluidManagerV2.cs @@ -478,7 +478,7 @@ namespace Revitalize.Framework.Managers { if (this.inputTank1.CanRecieveThisFluid(L) && this.inputTank2.DoesTankContainThisFluid(L) == false) { - return false; + return true; } if (this.inputTank2.CanRecieveThisFluid(L) && this.inputTank1.DoesTankContainThisFluid(L) == false) { diff --git a/GeneralMods/Revitalize/Framework/Objects/Machines/EnergyGeneration/SteamBoiler.cs b/GeneralMods/Revitalize/Framework/Objects/Machines/EnergyGeneration/SteamBoiler.cs new file mode 100644 index 00000000..93906137 --- /dev/null +++ b/GeneralMods/Revitalize/Framework/Objects/Machines/EnergyGeneration/SteamBoiler.cs @@ -0,0 +1,295 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Newtonsoft.Json; +using PyTK.CustomElementHandler; +using Revitalize.Framework.Objects.InformationFiles; +using Revitalize.Framework.Utilities; +using StardewValley; + +namespace Revitalize.Framework.Objects.Machines.EnergyGeneration +{ + public class SteamBoiler : Machine + { + + public SteamBoiler() { } + + public SteamBoiler(CustomObjectData PyTKData, BasicItemInformation info, List ProducedResources = null, int EnergyRequiredPer10Minutes = 0, int TimeToProduce = 0, bool UpdatesContainer = false, string CraftingBook = "") : base(PyTKData, info) + { + this.producedResources = ProducedResources ?? new List(); + this.energyRequiredPer10Minutes = EnergyRequiredPer10Minutes; + this.timeToProduce = TimeToProduce; + this.updatesContainerObjectForProduction = UpdatesContainer; + this.MinutesUntilReady = TimeToProduce; + this.craftingRecipeBook = CraftingBook; + this.createStatusBubble(); + + } + + public SteamBoiler(CustomObjectData PyTKData, BasicItemInformation info, Vector2 TileLocation, List ProducedResources = null, int EnergyRequiredPer10Minutes = 0, int TimeToProduce = 0, bool UpdatesContainer = false, string CraftingBook = "", MultiTiledObject obj = null) : base(PyTKData, info, TileLocation) + { + this.containerObject = obj; + this.producedResources = ProducedResources ?? new List(); + this.energyRequiredPer10Minutes = EnergyRequiredPer10Minutes; + this.timeToProduce = TimeToProduce; + this.updatesContainerObjectForProduction = UpdatesContainer; + this.MinutesUntilReady = TimeToProduce; + this.craftingRecipeBook = CraftingBook; + this.createStatusBubble(); + } + + public SteamBoiler(CustomObjectData PyTKData, BasicItemInformation info, Vector2 TileLocation, Vector2 offsetKey, List ProducedResources = null, int EnergyRequiredPer10Minutes = 0, int TimeToProduce = 0, bool UpdatesContainer = false, string CraftingBook = "", MultiTiledObject obj = null) : base(PyTKData, info, TileLocation) + { + this.offsetKey = offsetKey; + this.containerObject = obj; + this.producedResources = ProducedResources ?? new List(); + this.energyRequiredPer10Minutes = EnergyRequiredPer10Minutes; + this.timeToProduce = TimeToProduce; + this.updatesContainerObjectForProduction = UpdatesContainer; + this.MinutesUntilReady = TimeToProduce; + this.craftingRecipeBook = CraftingBook; + this.createStatusBubble(); + } + + public override void updateWhenCurrentLocation(GameTime time, GameLocation environment) + { + base.updateWhenCurrentLocation(time, environment); + + this.animationManager.prepareForNextUpdateTick(); + } + + + public override bool minutesElapsed(int minutes, GameLocation environment) + { + this.updateInfo(); + + if (this.containerObject.MinutesUntilReady > 0) + { + this.animationManager.playAnimation("Working"); + } + else + { + this.animationManager.playDefaultAnimation(); + } + this.pullFluidFromNetworkOutputs(ModCore.ObjectManager.resources.getFluid("Water")); + + if (this.updatesContainerObjectForProduction) + { + int remaining = minutes; + if (this.containerObject.MinutesUntilReady <= 0) + { + this.searchInventoryForBurnableObjects(); + } + while (remaining > 0 && this.containerObject.MinutesUntilReady > 0) + { + remaining -= 10; + this.processFluidLogic(); + if (this.containerObject.MinutesUntilReady <= 0) + { + this.searchInventoryForBurnableObjects(); + } + } + return false; + } + else + { + + if (this.GetEnergyManager().energyInteractionType == Enums.EnergyInteractionType.Produces) + { + this.storeEnergyToNetwork(); + } + + return false; + } + + //return base.minutesElapsed(minutes, environment); + } + + public override bool rightClicked(Farmer who) + { + if (this.location == null) + this.location = Game1.player.currentLocation; + if (Game1.menuUp || Game1.currentMinigame != null) return false; + + //ModCore.playerInfo.sittingInfo.sit(this, Vector2.Zero); + this.createMachineMenu(); + return true; + } + + + public override Item getOne() + { + SteamBoiler component = new SteamBoiler(this.data, this.info.Copy(), this.producedResources, this.energyRequiredPer10Minutes, this.timeToProduce, this.updatesContainerObjectForProduction, this.craftingRecipeBook); + component.containerObject = this.containerObject; + component.offsetKey = this.offsetKey; + return component; + return component; + } + + public override ICustomObject recreate(Dictionary additionalSaveData, object replacement) + { + Vector2 offsetKey = new Vector2(Convert.ToInt32(additionalSaveData["offsetKeyX"]), Convert.ToInt32(additionalSaveData["offsetKeyY"])); + string GUID = additionalSaveData["GUID"]; + SteamBoiler self = Revitalize.ModCore.Serializer.DeserializeGUID(additionalSaveData["GUID"]); + if (ModCore.IsNullOrDefault(self)) return null; + try + { + if (!Revitalize.ModCore.ObjectGroups.ContainsKey(additionalSaveData["ParentGUID"])) + { + MultiTiledObject obj = (MultiTiledObject)Revitalize.ModCore.Serializer.DeserializeGUID(additionalSaveData["ParentGUID"]); + self.containerObject = obj; + self.containerObject.removeComponent(offsetKey); + self.containerObject.addComponent(offsetKey, self); + Revitalize.ModCore.ObjectGroups.Add(additionalSaveData["ParentGUID"], obj); + } + else + { + self.containerObject = Revitalize.ModCore.ObjectGroups[additionalSaveData["ParentGUID"]]; + self.containerObject.removeComponent(offsetKey); + self.containerObject.addComponent(offsetKey, self); + } + } + catch (Exception err) + { + ModCore.log(err); + } + + return self; + } + + public override void rebuild(Dictionary additionalSaveData, object replacement) + { + base.rebuild(additionalSaveData, replacement); + } + + public override void draw(SpriteBatch spriteBatch, int x, int y, float alpha = 1f) + { + this.updateInfo(); + + if (this.info == null) + { + Revitalize.ModCore.log("info is null"); + if (this.syncObject == null) Revitalize.ModCore.log("DEAD SYNC"); + } + if (this.animationManager == null) Revitalize.ModCore.log("Animation Manager Null"); + if (this.displayTexture == null) Revitalize.ModCore.log("Display texture is null"); + + //The actual planter box being drawn. + if (this.animationManager == null) + { + if (this.animationManager.getExtendedTexture() == null) + ModCore.ModMonitor.Log("Tex Extended is null???"); + + spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(y * Game1.tileSize) / 10000f)); + // Log.AsyncG("ANIMATION IS NULL?!?!?!?!"); + } + + else + { + //Log.AsyncC("Animation Manager is working!"); + float addedDepth = 0; + + + if (Revitalize.ModCore.playerInfo.sittingInfo.SittingObject == this.containerObject && this.info.facingDirection == Enums.Direction.Up) + { + addedDepth += (this.containerObject.Height - 1) - ((int)(this.offsetKey.Y)); + if (this.info.ignoreBoundingBox) addedDepth += 1.5f; + } + else if (this.info.ignoreBoundingBox) + { + addedDepth += 1.0f; + } + this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((y + addedDepth) * Game1.tileSize) / 10000f) + .00001f); + this.drawStatusBubble(spriteBatch, x, y, alpha); + + try + { + if (this.animationManager.canTickAnimation()) + { + this.animationManager.tickAnimation(); + } + // Log.AsyncC("Tick animation"); + } + catch (Exception err) + { + ModCore.ModMonitor.Log(err.ToString()); + } + } + + // spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)((double)tileLocation.X * (double)Game1.tileSize + (((double)tileLocation.X * 11.0 + (double)tileLocation.Y * 7.0) % 10.0 - 5.0)) + (float)(Game1.tileSize / 2), (float)((double)tileLocation.Y * (double)Game1.tileSize + (((double)tileLocation.Y * 11.0 + (double)tileLocation.X * 7.0) % 10.0 - 5.0)) + (float)(Game1.tileSize / 2))), new Rectangle?(new Rectangle((int)((double)tileLocation.X * 51.0 + (double)tileLocation.Y * 77.0) % 3 * 16, 128 + this.whichForageCrop * 16, 16, 16)), Color.White, 0.0f, new Vector2(8f, 8f), (float)Game1.pixelZoom, SpriteEffects.None, (float)(((double)tileLocation.Y * (double)Game1.tileSize + (double)(Game1.tileSize / 2) + (((double)tileLocation.Y * 11.0 + (double)tileLocation.X * 7.0) % 10.0 - 5.0)) / 10000.0)); + + } + + public override void produceEnergy() + { + /* + if (this.GetEnergyManager().canReceieveEnergy) + { + this.GetEnergyManager().produceEnergy(this.energyRequiredPer10Minutes); + this.containerObject.MinutesUntilReady -= 10; + } + */ + } + + public virtual void processFluidLogic() + { + if (this.GetFluidManager().doTheInputTanksHaveEnoughFluid(ModCore.ObjectManager.resources.getFluid("Water"), 200)) + { + this.GetFluidManager().consumeFluid(ModCore.ObjectManager.resources.getFluid("Water"), 200); + this.GetFluidManager().produceFluid(ModCore.ObjectManager.resources.getFluid("Steam"), 100); + this.MinutesUntilReady -= 10; + } + } + + public override void updateInfo() + { + return; + if (this.info == null || this.containerObject == null) + { + this.ItemInfo = this.text; + //ModCore.log("Updated item info!"); + return; + } + + if (this.requiresUpdate()) + { + //this.ItemInfo = this.text; + this.text = this.ItemInfo; + this.info.cleanAfterUpdate(); + //this.containerObject.updateInfo(); + //ModCore.log("Force an update for machine: " + this.info.name); + MultiplayerUtilities.RequestUpdateSync(this.guid); + } + } + + public override Dictionary getAdditionalSaveData() + { + Dictionary saveData = base.getAdditionalSaveData(); + Revitalize.ModCore.Serializer.SerializeGUID(this.containerObject.childrenGuids[this.offsetKey].ToString(), this); + this.containerObject.getAdditionalSaveData(); + return saveData; + + } + + protected virtual void searchInventoryForBurnableObjects() + { + Item removed = null; + foreach (Item I in this.GetInventoryManager().items) + { + if (ModCore.ObjectManager.resources.burnableObjects.ContainsKey(I.Name)) + { + this.containerObject.MinutesUntilReady = ModCore.ObjectManager.resources.burnableObjects[I.Name]; + removed = I; + break; + } + } + if (removed == null) return; + if (removed.Stack == 1) this.GetInventoryManager().items.Remove(removed); + else removed.Stack -= 1; + } + } +} diff --git a/GeneralMods/Revitalize/Framework/Objects/Machines/Machine.cs b/GeneralMods/Revitalize/Framework/Objects/Machines/Machine.cs index 001e3163..0c381a04 100644 --- a/GeneralMods/Revitalize/Framework/Objects/Machines/Machine.cs +++ b/GeneralMods/Revitalize/Framework/Objects/Machines/Machine.cs @@ -127,7 +127,6 @@ namespace Revitalize.Framework.Objects.Machines } } - [JsonIgnore] public List producedResources { get @@ -139,9 +138,6 @@ namespace Revitalize.Framework.Objects.Machines if (MachineUtilities.ResourcesForMachines == null) MachineUtilities.InitializeResourceList(); if (MachineUtilities.ResourcesForMachines.ContainsKey(this.info.id)) return; MachineUtilities.ResourcesForMachines.Add(this.info.id, value); - - - Chest c = new Chest(); } } public int energyRequiredPer10Minutes; diff --git a/GeneralMods/Revitalize/Framework/Objects/MultiTiledComponent.cs b/GeneralMods/Revitalize/Framework/Objects/MultiTiledComponent.cs index cc210ffd..bba52826 100644 --- a/GeneralMods/Revitalize/Framework/Objects/MultiTiledComponent.cs +++ b/GeneralMods/Revitalize/Framework/Objects/MultiTiledComponent.cs @@ -711,9 +711,15 @@ namespace Revitalize.Framework.Objects StardewValley.Object obj = this.location.getObjectAtTile((int)neighborTile.X, (int)neighborTile.Y); if (obj is MultiTiledComponent) { + if ((obj as MultiTiledComponent).GetFluidManager().InteractsWithFluids) { customObjects.Add((MultiTiledComponent)obj); + //ModCore.log("Found a neighboring fluid manager"); + } + else + { + ModCore.log("Found a neighboring object but it isn't a valid fluid manager."); } } else continue; @@ -752,6 +758,7 @@ namespace Revitalize.Framework.Objects if (searchComponent.containerObject.info.fluidManager.doesThisOutputTankContainThisFluid(L)) { fluidSources.Add(searchComponent.containerObject); + //ModCore.log("Found a tank that contains this fluid!"); } } diff --git a/GeneralMods/Revitalize/Framework/Objects/ObjectManager.cs b/GeneralMods/Revitalize/Framework/Objects/ObjectManager.cs index c8fe7ba3..38d4d164 100644 --- a/GeneralMods/Revitalize/Framework/Objects/ObjectManager.cs +++ b/GeneralMods/Revitalize/Framework/Objects/ObjectManager.cs @@ -333,11 +333,87 @@ namespace Revitalize.Framework.Objects MultiTiledObject waterPumpV1 = new MultiTiledObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.WaterPump", TextureManager.GetTexture(ModCore.Manifest, "Machines", "WaterPump"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Water Pump", "Omegasis.Revitalize.Objects.Machines.WaterPump", "Pumps up water from a water source.", "Machine", Color.SteelBlue, -300, 0, false, 350, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "WaterPump"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "WaterPump"), new Animation(0, 0, 16, 16)), Color.White, false, null, null, null, false, null, null, new Managers.FluidManagerV2(5000, true, Enums.FluidInteractionType.Machine, false))); - WaterPump waterPumpV1_0_0 = new WaterPump(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.WaterPump", TextureManager.GetTexture(ModCore.Manifest, "Machines", "WaterPump"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Water Pump", "Omegasis.Revitalize.Objects.Machines.WaterPump", "Pumps up water from a water source.", "Machine", Color.SteelBlue, -300, 0, false, 350, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "WaterPump"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "WaterPump"), new Animation(0, 0, 16, 16)), Color.White, true, null, null, null, false, null, null, new Managers.FluidManagerV2(5000, true, Enums.FluidInteractionType.Machine, false)), null, 0, 0, false, ""); - WaterPump waterPumpV1_0_1= new WaterPump(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.WaterPump", TextureManager.GetTexture(ModCore.Manifest, "Machines", "WaterPump"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Water Pump", "Omegasis.Revitalize.Objects.Machines.WaterPump", "Pumps up water from a water source.", "Machine", Color.SteelBlue, -300, 0, false, 350, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "WaterPump"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "WaterPump"), new Animation(0, 16, 16, 16)), Color.White, false, null, null, null, false, null, null, new Managers.FluidManagerV2(5000, true, Enums.FluidInteractionType.Machine, false)), null, 0, 0, true, ""); + WaterPump waterPumpV1_0_0 = new WaterPump(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.WaterPump", TextureManager.GetTexture(ModCore.Manifest, "Machines", "WaterPump"), typeof(WaterPump), Color.White, true), new BasicItemInformation("Water Pump", "Omegasis.Revitalize.Objects.Machines.WaterPump", "Pumps up water from a water source.", "Machine", Color.SteelBlue, -300, 0, false, 350, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "WaterPump"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "WaterPump"), new Animation(0, 0, 16, 16)), Color.White, true, null, null, null, false, null, null, new Managers.FluidManagerV2(5000, true, Enums.FluidInteractionType.Machine, false)), null, 0, 0, false, ""); + WaterPump waterPumpV1_0_1= new WaterPump(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.WaterPump", TextureManager.GetTexture(ModCore.Manifest, "Machines", "WaterPump"), typeof(WaterPump), Color.White, true), new BasicItemInformation("Water Pump", "Omegasis.Revitalize.Objects.Machines.WaterPump", "Pumps up water from a water source.", "Machine", Color.SteelBlue, -300, 0, false, 350, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "WaterPump"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "WaterPump"), new Animation(0, 16, 16, 16)), Color.White, false, null, null, null, false, null, null, new Managers.FluidManagerV2(5000, true, Enums.FluidInteractionType.Machine, false)), null, 0, 0, true, ""); waterPumpV1.addComponent(new Vector2(0, 0), waterPumpV1_0_0); waterPumpV1.addComponent(new Vector2(0, 1), waterPumpV1_0_1); this.AddItem("WaterPumpV1", waterPumpV1); + + MultiTiledObject steamBoilerV1= new MultiTiledObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.SteamBoiler", TextureManager.GetTexture(ModCore.Manifest, "Machines", "SteamBoiler"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Steam Boiler", "Omegasis.Revitalize.Objects.Machines.SteamBoiler", "Burns coal and wood. Consumes water to produce steam which can be used in a steam generator.", "Machine", Color.SteelBlue, -300, 0, false, 1000, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "SteamBoiler"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "SteamBoiler"), new Animation(0, 0, 16, 16)), Color.White, false, new InventoryManager(9,3,3), null, null, false, null, null, new Managers.FluidManagerV2(4000, false, Enums.FluidInteractionType.Machine, false))); + SteamBoiler steamBoilerV1_0_0 = new SteamBoiler(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.SteamBoiler", TextureManager.GetTexture(ModCore.Manifest, "Machines", "SteamBoiler"), typeof(SteamBoiler), Color.White, true), new BasicItemInformation("Steam Boiler", "Omegasis.Revitalize.Objects.Machines.SteamBoiler", "Burns coal and wood. Consumes water to produce steam which can be used in a steam generator.", "Machine", Color.SteelBlue, -300, 0, false, 1000, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "SteamBoiler"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "SteamBoiler"), new Animation(0, 0, 16, 16),new Dictionary>() + { + {"Default",new List(){ + new Animation(0,0,16,16) + } }, + {"Working",new List(){ + new Animation(32,0,16,16) + } }, + + },"Default"), Color.White, true, new InventoryManager(9, 3, 3), null, null, false, null, null, new Managers.FluidManagerV2(4000, false, Enums.FluidInteractionType.Machine, false)), null, 0, 0, true, ""); + + SteamBoiler steamBoilerV1_1_0 = new SteamBoiler(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.SteamBoiler", TextureManager.GetTexture(ModCore.Manifest, "Machines", "SteamBoiler"), typeof(SteamBoiler), Color.White, true), new BasicItemInformation("Steam Boiler", "Omegasis.Revitalize.Objects.Machines.SteamBoiler", "Burns coal and wood. Consumes water to produce steam which can be used in a steam generator.", "Machine", Color.SteelBlue, -300, 0, false, 1000, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "SteamBoiler"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "SteamBoiler"), new Animation(16, 0, 16, 16), new Dictionary>() + { + {"Default",new List(){ + new Animation(16,0,16,16) + } }, + {"Working",new List(){ + new Animation(48,0,16,16) + } }, + + }, "Default"), Color.White, true, new InventoryManager(9, 3, 3), null, null, false, null, null, new Managers.FluidManagerV2(4000, false, Enums.FluidInteractionType.Machine, false)), null, 0, 0, false, ""); + + SteamBoiler steamBoilerV1_0_1 = new SteamBoiler(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.SteamBoiler", TextureManager.GetTexture(ModCore.Manifest, "Machines", "SteamBoiler"), typeof(SteamBoiler), Color.White, true), new BasicItemInformation("Steam Boiler", "Omegasis.Revitalize.Objects.Machines.SteamBoiler", "Burns coal and wood. Consumes water to produce steam which can be used in a steam generator.", "Machine", Color.SteelBlue, -300, 0, false, 1000, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "SteamBoiler"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "SteamBoiler"), new Animation(0, 16, 16, 16), new Dictionary>() + { + {"Default",new List(){ + new Animation(0,16,16,16) + } }, + {"Working",new List(){ + new Animation(32,16,16,16) + } }, + + }, "Default"), Color.White, false, new InventoryManager(9, 3, 3), null, null, false, null, null, new Managers.FluidManagerV2(4000, false, Enums.FluidInteractionType.Machine, false)), null, 0, 0, false, ""); + + SteamBoiler steamBoilerV1_1_1 = new SteamBoiler(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.SteamBoiler", TextureManager.GetTexture(ModCore.Manifest, "Machines", "SteamBoiler"), typeof(SteamBoiler), Color.White, true), new BasicItemInformation("Steam Boiler", "Omegasis.Revitalize.Objects.Machines.SteamBoiler", "Burns coal and wood. Consumes water to produce steam which can be used in a steam generator.", "Machine", Color.SteelBlue, -300, 0, false, 1000, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "SteamBoiler"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "SteamBoiler"), new Animation(16, 16, 16, 16), new Dictionary>() + { + {"Default",new List(){ + new Animation(16,16,16,16) + } }, + {"Working",new List(){ + new Animation(48,16,16,16) + } }, + + }, "Default"), Color.White, false, new InventoryManager(9, 3, 3), null, null, false, null, null, new Managers.FluidManagerV2(4000, false, Enums.FluidInteractionType.Machine, false)), null, 0, 0, false, ""); + + SteamBoiler steamBoilerV1_0_2 = new SteamBoiler(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.SteamBoiler", TextureManager.GetTexture(ModCore.Manifest, "Machines", "SteamBoiler"), typeof(SteamBoiler), Color.White, true), new BasicItemInformation("Steam Boiler", "Omegasis.Revitalize.Objects.Machines.SteamBoiler", "Burns coal and wood. Consumes water to produce steam which can be used in a steam generator.", "Machine", Color.SteelBlue, -300, 0, false, 1000, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "SteamBoiler"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "SteamBoiler"), new Animation(0, 32, 16, 16), new Dictionary>() + { + {"Default",new List(){ + new Animation(0,32,16,16) + } }, + {"Working",new List(){ + new Animation(32,32,16,16) + } }, + + }, "Default"), Color.White, false, new InventoryManager(9, 3, 3), null, null, false, null, null, new Managers.FluidManagerV2(4000, false, Enums.FluidInteractionType.Machine, false)), null, 0, 0, false, ""); + + SteamBoiler steamBoilerV1_1_2 = new SteamBoiler(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.SteamBoiler", TextureManager.GetTexture(ModCore.Manifest, "Machines", "SteamBoiler"), typeof(SteamBoiler), Color.White, true), new BasicItemInformation("Steam Boiler", "Omegasis.Revitalize.Objects.Machines.SteamBoiler", "Burns coal and wood. Consumes water to produce steam which can be used in a steam generator.", "Machine", Color.SteelBlue, -300, 0, false, 1000, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "SteamBoiler"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "SteamBoiler"), new Animation(16, 32, 16, 16), new Dictionary>() + { + {"Default",new List(){ + new Animation(16,32,16,16) + } }, + {"Working",new List(){ + new Animation(48,32,16,16) + } }, + + }, "Default"), Color.White, false, new InventoryManager(9, 3, 3), null, null, false, null, null, new Managers.FluidManagerV2(4000, false, Enums.FluidInteractionType.Machine, false)), null, 0, 0, false, ""); + + steamBoilerV1.addComponent(new Vector2(0, 0), steamBoilerV1_0_0); + steamBoilerV1.addComponent(new Vector2(1, 0), steamBoilerV1_1_0); + steamBoilerV1.addComponent(new Vector2(0, 1), steamBoilerV1_0_1); + steamBoilerV1.addComponent(new Vector2(1, 1), steamBoilerV1_1_1); + steamBoilerV1.addComponent(new Vector2(0, 2), steamBoilerV1_0_2); + steamBoilerV1.addComponent(new Vector2(1, 2), steamBoilerV1_1_2); + + this.AddItem("SteamBoilerV1", steamBoilerV1); } private void loadInWires() diff --git a/GeneralMods/Revitalize/Framework/Objects/ResourceManager.cs b/GeneralMods/Revitalize/Framework/Objects/ResourceManager.cs index 3547061a..7a6f511a 100644 --- a/GeneralMods/Revitalize/Framework/Objects/ResourceManager.cs +++ b/GeneralMods/Revitalize/Framework/Objects/ResourceManager.cs @@ -36,6 +36,11 @@ namespace Revitalize.Framework.Objects public Dictionary miningDrillResources; public Dictionary fluids; + /// + /// A dictionary containing the names of all objects that can be burned with their burn times for a value. + /// + public Dictionary burnableObjects; + /// /// A list of all visited floors on the current visit to the mines. /// @@ -54,6 +59,7 @@ namespace Revitalize.Framework.Objects this.resources = new Dictionary(); this.miningDrillResources = new Dictionary(); this.fluids = new Dictionary(); + this.burnableObjects = new Dictionary(); } @@ -66,11 +72,19 @@ namespace Revitalize.Framework.Objects this.loadOreVeins(); this.loadInMiningDrillLootTable(); this.loadInFluidDictionary(); + this.loadInBurnableObjects(); } private void loadInFluidDictionary() { this.fluids.Add("Water", new Fluid("Water", Color.Blue)); + this.fluids.Add("Steam", new Fluid("Steam", Color.White)); + } + + private void loadInBurnableObjects() + { + this.burnableObjects.Add("Coal", TimeUtilities.GetMinutesFromTime(0, 1, 0)); + this.burnableObjects.Add("Wood", TimeUtilities.GetMinutesFromTime(0, 0, 10)); } private void loadInMiningDrillLootTable() { diff --git a/GeneralMods/Revitalize/ModCore.cs b/GeneralMods/Revitalize/ModCore.cs index a2e494a8..1ce659d4 100644 --- a/GeneralMods/Revitalize/ModCore.cs +++ b/GeneralMods/Revitalize/ModCore.cs @@ -600,7 +600,8 @@ namespace Revitalize ModCore.ObjectManager.GetItem("MiningDrillMachineV1"), ModCore.ObjectManager.GetItem("AlloyFurnace"), new StardewValley.Object((int)Enums.SDVObject.IronBar,100), - ModCore.ObjectManager.GetItem("WaterPumpV1") + ModCore.ObjectManager.GetItem("WaterPumpV1"), + ModCore.ObjectManager.GetItem("SteamBoilerV1") }); } diff --git a/GeneralMods/Revitalize/Revitalize.csproj b/GeneralMods/Revitalize/Revitalize.csproj index dc1561e3..d2846b29 100644 --- a/GeneralMods/Revitalize/Revitalize.csproj +++ b/GeneralMods/Revitalize/Revitalize.csproj @@ -166,6 +166,7 @@ + @@ -509,6 +510,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest