Fixed fluid manager not transporting fluids. Added in steam boiler, water, and steam.

This commit is contained in:
JoshuaNavarro 2019-09-24 17:31:33 -07:00
parent 43eb60e9b9
commit ecfc595751
9 changed files with 401 additions and 8 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -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)
{

View File

@ -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<ResourceInformation> ProducedResources = null, int EnergyRequiredPer10Minutes = 0, int TimeToProduce = 0, bool UpdatesContainer = false, string CraftingBook = "") : base(PyTKData, info)
{
this.producedResources = ProducedResources ?? new List<ResourceInformation>();
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<ResourceInformation> 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<ResourceInformation>();
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<ResourceInformation> 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<ResourceInformation>();
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<string, string> 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<SteamBoiler>(additionalSaveData["GUID"]);
if (ModCore.IsNullOrDefault<Machine>(self)) return null;
try
{
if (!Revitalize.ModCore.ObjectGroups.ContainsKey(additionalSaveData["ParentGUID"]))
{
MultiTiledObject obj = (MultiTiledObject)Revitalize.ModCore.Serializer.DeserializeGUID<MultiTiledObject>(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<string, string> 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<string, string> getAdditionalSaveData()
{
Dictionary<string, string> 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;
}
}
}

View File

@ -127,7 +127,6 @@ namespace Revitalize.Framework.Objects.Machines
}
}
[JsonIgnore]
public List<ResourceInformation> 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;

View File

@ -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!");
}
}

View File

@ -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<string, List<Animation>>()
{
{"Default",new List<Animation>(){
new Animation(0,0,16,16)
} },
{"Working",new List<Animation>(){
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<string, List<Animation>>()
{
{"Default",new List<Animation>(){
new Animation(16,0,16,16)
} },
{"Working",new List<Animation>(){
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<string, List<Animation>>()
{
{"Default",new List<Animation>(){
new Animation(0,16,16,16)
} },
{"Working",new List<Animation>(){
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<string, List<Animation>>()
{
{"Default",new List<Animation>(){
new Animation(16,16,16,16)
} },
{"Working",new List<Animation>(){
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<string, List<Animation>>()
{
{"Default",new List<Animation>(){
new Animation(0,32,16,16)
} },
{"Working",new List<Animation>(){
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<string, List<Animation>>()
{
{"Default",new List<Animation>(){
new Animation(16,32,16,16)
} },
{"Working",new List<Animation>(){
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()

View File

@ -36,6 +36,11 @@ namespace Revitalize.Framework.Objects
public Dictionary<string, ResourceInformation> miningDrillResources;
public Dictionary<string, Fluid> fluids;
/// <summary>
/// A dictionary containing the names of all objects that can be burned with their burn times for a value.
/// </summary>
public Dictionary<string, int> burnableObjects;
/// <summary>
/// A list of all visited floors on the current visit to the mines.
/// </summary>
@ -54,6 +59,7 @@ namespace Revitalize.Framework.Objects
this.resources = new Dictionary<string, CustomObject>();
this.miningDrillResources = new Dictionary<string, ResourceInformation>();
this.fluids = new Dictionary<string, Fluid>();
this.burnableObjects = new Dictionary<string, int>();
}
@ -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()
{

View File

@ -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")
});
}

View File

@ -166,6 +166,7 @@
<Compile Include="Framework\Objects\Machines\AlloyFurnace.cs" />
<Compile Include="Framework\Objects\Machines\ChargingStation.cs" />
<Compile Include="Framework\Objects\Machines\EnergyGeneration\SolarPanel.cs" />
<Compile Include="Framework\Objects\Machines\EnergyGeneration\SteamBoiler.cs" />
<Compile Include="Framework\Objects\Machines\Grinder.cs" />
<Compile Include="Framework\Objects\Machines\Machine.cs" />
<Compile Include="Framework\Objects\Machines\WaterPump.cs" />
@ -509,6 +510,9 @@
<Content Include="Content\Graphics\Objects\Machines\SolarPanelTier1.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Objects\Machines\SteamBoiler.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Objects\Machines\WaterPump.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>