Added in windmills. Also fixed machine summary menu crashing when fluid manager doesn't set fluid tanks on initialization.

This commit is contained in:
JoshuaNavarro 2019-10-08 13:01:58 -07:00
parent 70518a1d38
commit 106b7a9474
10 changed files with 380 additions and 17 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 B

View File

@ -27,6 +27,10 @@ namespace Revitalize.Framework.Configs
public int steamEngineV1_requiredSteamPerOperation;
public int steamEngineV1_powerGeneratedPerOperation;
public double windmill_windyDayPowerMultiplier;
public int windmillV1_basePowerProduction;
public int windmillV2_basePowerProduction;
public GlobalMachineConfig()
{
this.doMachinesConsumeEnergy = true;
@ -43,6 +47,9 @@ namespace Revitalize.Framework.Configs
this.steamEngineV1_requiredSteamPerOperation = 200;
this.steamEngineV1_powerGeneratedPerOperation = 10;
this.windmill_windyDayPowerMultiplier = 1.5d;
this.windmillV1_basePowerProduction = 4;
this.windmillV2_basePowerProduction = 12;
}
public static GlobalMachineConfig InitializeConfig()

View File

@ -337,7 +337,12 @@ namespace Revitalize.Framework.Managers
else
{
this.outputTank = new MachineFluidTank(Capacity);
if (NumberOfInputTanks == 1)
if (NumberOfInputTanks == 0)
{
this.inputTank1 = new MachineFluidTank(0);
this.inputTank2 = new MachineFluidTank(0);
}
else if (NumberOfInputTanks == 1)
{
this.inputTank1 = new MachineFluidTank(Capacity);
this.inputTank2 = new MachineFluidTank(0);

View File

@ -107,11 +107,19 @@ namespace Revitalize.Framework.Menus.Machines
this.storageButton = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Storage Remaining", this.storageRemainingDisplayLocation, new StardustCore.Animations.AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus", "Chest"), new StardustCore.Animations.Animation(0, 0, 16, 32)), Color.White), new Rectangle(0, 0, 16, 32), 1f);
this.inputFluidTank1Button = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Input 1 fluid:", this.fluidDisplayLocation, new StardustCore.Animations.AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus.EnergyMenu",this.objectSource.info.fluidManager.inputTank1.fluid!=null? "DropletColored" : "DropletOutline"), new StardustCore.Animations.Animation(0, 0, 16, 16)), this.objectSource.info.fluidManager.inputTank1.fluid!=null ? this.objectSource.info.fluidManager.inputTank1.fluid.color : Color.White), new Rectangle(0, 0, 16, 16), 2f);
this.inputFluidTank2Button = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Input 2 fluid:", this.fluidDisplayLocation+new Vector2(0,64), new StardustCore.Animations.AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus.EnergyMenu", this.objectSource.info.fluidManager.inputTank2.fluid!=null ? "DropletColored" : "DropletOutline"), new StardustCore.Animations.Animation(0, 0, 16, 16)), this.objectSource.info.fluidManager.inputTank2.fluid!=null ? this.objectSource.info.fluidManager.inputTank2.fluid.color : Color.White), new Rectangle(0, 0, 16, 16), 2f);
ModCore.log(this.objectSource.info.fluidManager.outputTank.fluid != null ? "Color of fluid:" + this.objectSource.info.fluidManager.outputTank.fluid.color.ToString() : "Color is null!");
this.outputFluidTankButton = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Output fluid:", this.fluidDisplayLocation+new Vector2(0,128), new StardustCore.Animations.AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus.EnergyMenu", this.objectSource.info.fluidManager.outputTank.fluid!=null ? "DropletColored" : "DropletOutline"), new StardustCore.Animations.Animation(0, 0, 16, 16)), this.objectSource.info.fluidManager.outputTank.fluid!=null ? this.objectSource.info.fluidManager.outputTank.fluid.color : Color.White), new Rectangle(0, 0, 16, 16), 2f);
if (this.objectSource.GetFluidManager().inputTank1.capacity > 0)
{
this.inputFluidTank1Button = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Input 1 fluid:", this.fluidDisplayLocation, new StardustCore.Animations.AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus.EnergyMenu", this.objectSource.info.fluidManager.inputTank1.fluid != null ? "DropletColored" : "DropletOutline"), new StardustCore.Animations.Animation(0, 0, 16, 16)), this.objectSource.info.fluidManager.inputTank1.fluid != null ? this.objectSource.info.fluidManager.inputTank1.fluid.color : Color.White), new Rectangle(0, 0, 16, 16), 2f);
}
if (this.objectSource.GetFluidManager().inputTank2.capacity > 0)
{
this.inputFluidTank2Button = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Input 2 fluid:", this.fluidDisplayLocation + new Vector2(0, 64), new StardustCore.Animations.AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus.EnergyMenu", this.objectSource.info.fluidManager.inputTank2.fluid != null ? "DropletColored" : "DropletOutline"), new StardustCore.Animations.Animation(0, 0, 16, 16)), this.objectSource.info.fluidManager.inputTank2.fluid != null ? this.objectSource.info.fluidManager.inputTank2.fluid.color : Color.White), new Rectangle(0, 0, 16, 16), 2f);
}
//ModCore.log(this.objectSource.info.fluidManager.outputTank.fluid != null ? "Color of fluid:" + this.objectSource.info.fluidManager.outputTank.fluid.color.ToString() : "Color is null!");
if (this.objectSource.GetFluidManager().outputTank.capacity > 0)
{
this.outputFluidTankButton = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Output fluid:", this.fluidDisplayLocation + new Vector2(0, 128), new StardustCore.Animations.AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus.EnergyMenu", this.objectSource.info.fluidManager.outputTank.fluid != null ? "DropletColored" : "DropletOutline"), new StardustCore.Animations.Animation(0, 0, 16, 16)), this.objectSource.info.fluidManager.outputTank.fluid != null ? this.objectSource.info.fluidManager.outputTank.fluid.color : Color.White), new Rectangle(0, 0, 16, 16), 2f);
}
this.requiredEnergyPer10Min = RequiredEnergyPer10Min;
}
@ -162,13 +170,13 @@ namespace Revitalize.Framework.Menus.Machines
hovered = true;
}
}
}
if (hovered == false)
{
this.hoverText = "";
}
}
}
protected virtual string getProperEnergyDescriptionString(int EnergyAmount)
{
@ -180,7 +188,7 @@ namespace Revitalize.Framework.Menus.Machines
else if (this.energy.producesEnergy)
{
return "Produces " + EnergyAmount + " per 10 minutes.";
return "Produces " + EnergyAmount + " energy per 10 minutes.";
}
else return "";
}

View File

@ -0,0 +1,272 @@
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.Managers;
using Revitalize.Framework.Objects.InformationFiles;
using Revitalize.Framework.Utilities;
using StardewValley;
using StardustCore.Animations;
namespace Revitalize.Framework.Objects.Machines.EnergyGeneration
{
public class Windmill:Machine
{
public Windmill() { }
public Windmill(CustomObjectData PyTKData, BasicItemInformation info, List<ResourceInformation> ProducedResources = null, int EnergyRequiredPer10Minutes = 0, int TimeToProduce = 0, bool UpdatesContainer = false, string CraftingBook = "", Fluid FluidRequiredForOperation = null, int FluidAmountRequiredPerOperation = 0) : 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();
this.requiredFluidForOperation = FluidRequiredForOperation;
this.amountOfFluidRequiredForOperation = FluidAmountRequiredPerOperation;
}
public Windmill(CustomObjectData PyTKData, BasicItemInformation info, Vector2 TileLocation, List<ResourceInformation> ProducedResources = null, int EnergyRequiredPer10Minutes = 0, int TimeToProduce = 0, bool UpdatesContainer = false, string CraftingBook = "", MultiTiledObject obj = null, Fluid FluidRequiredForOperation = null, int FluidAmountRequiredPerOperation = 0) : 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();
this.requiredFluidForOperation = FluidRequiredForOperation;
this.amountOfFluidRequiredForOperation = FluidAmountRequiredPerOperation;
}
public Windmill(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, Fluid FluidRequiredForOperation = null, int FluidAmountRequiredPerOperation = 0) : 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();
this.requiredFluidForOperation = FluidRequiredForOperation;
this.amountOfFluidRequiredForOperation = FluidAmountRequiredPerOperation;
}
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();
//ModCore.log(this.info.animationManager.currentAnimationName);
this.info.animationManager.playAnimation("Working");
if (this.updatesContainerObjectForProduction)
{
int remaining = minutes;
if (this.GetEnergyManager().energyInteractionType == Enums.EnergyInteractionType.Produces)
{
while (remaining > 0)
{
remaining -= 10;
this.produceEnergy();
this.storeEnergyToNetwork();
}
}
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()
{
Windmill component = new Windmill(this.data, this.info.Copy(), this.producedResources, this.energyRequiredPer10Minutes, this.timeToProduce, this.updatesContainerObjectForProduction, this.craftingRecipeBook, this.requiredFluidForOperation, this.amountOfFluidRequiredForOperation);
component.containerObject = this.containerObject;
component.offsetKey = this.offsetKey;
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"];
Windmill self = Revitalize.ModCore.Serializer.DeserializeGUID<Windmill>(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.location != null)
{
if (this.location.IsOutdoors == false) return;
}
if (this.GetEnergyManager().canReceieveEnergy)
{
if (WeatherUtilities.IsWeatherGoodForWindmills())
{
this.GetEnergyManager().produceEnergy((int)(this.energyRequiredPer10Minutes*ModCore.Configs.machinesConfig.windmill_windyDayPowerMultiplier));
}
else
{
this.GetEnergyManager().produceEnergy(this.energyRequiredPer10Minutes);
}
}
}
public override void updateInfo()
{
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;
}
}
}

View File

@ -416,11 +416,71 @@ namespace Revitalize.Framework.Objects
this.AddItem("SteamBoilerV1", steamBoilerV1);
MultiTiledObject steamEngineV1 = new MultiTiledObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.SteamEngineV1", TextureManager.GetTexture(ModCore.Manifest, "Machines", "SteamEngine"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Steam Engine", "Omegasis.Revitalize.Objects.Machines.SteamEngine", "Consumes steam in order to produce power.", "Machine", Color.SteelBlue, -300, 0, false, 500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "SteamEngine"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "SteamEngine"), new Animation(0, 0, 16, 16)), Color.White, false, null, null, new Energy.EnergyManager(500, Enums.EnergyInteractionType.Produces), false, null, null, new Managers.FluidManagerV2(2000, false, Enums.FluidInteractionType.Machine, false,true,1)));
SteamEngine steamEngineV1_0_0 = new SteamEngine(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.SteamEngineV1", TextureManager.GetTexture(ModCore.Manifest, "Machines", "SteamEngine"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Steam Engine", "Omegasis.Revitalize.Objects.Machines.SteamEngine", "Consumes steam in order to produce power.", "Machine", Color.SteelBlue, -300, 0, false, 500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "SteamEngine"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "SteamEngine"), new Animation(0, 0, 16, 16)), Color.White, false, new InventoryManager(9, 3, 3), null, new Energy.EnergyManager(500, Enums.EnergyInteractionType.Produces), false, null, null, new Managers.FluidManagerV2(2000, false, Enums.FluidInteractionType.Machine, false, true, 1)), null, ModCore.Configs.machinesConfig.steamEngineV1_powerGeneratedPerOperation, 0, true, "", ModCore.ObjectManager.resources.getFluid("Steam"), ModCore.Configs.machinesConfig.steamEngineV1_requiredSteamPerOperation);
SteamEngine steamEngineV1_1_0 = new SteamEngine(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.SteamEngineV1", TextureManager.GetTexture(ModCore.Manifest, "Machines", "SteamEngine"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Steam Engine", "Omegasis.Revitalize.Objects.Machines.SteamEngine", "Consumes steam in order to produce power.", "Machine", Color.SteelBlue, -300, 0, false, 500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "SteamEngine"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "SteamEngine"), new Animation(16, 0, 16, 16)), Color.White, false, new InventoryManager(9, 3, 3), null, new Energy.EnergyManager(500, Enums.EnergyInteractionType.Produces), false, null, null, new Managers.FluidManagerV2(2000, false, Enums.FluidInteractionType.Machine, false, true, 1)), null, ModCore.Configs.machinesConfig.steamEngineV1_powerGeneratedPerOperation, 0, true, "", ModCore.ObjectManager.resources.getFluid("Steam"), ModCore.Configs.machinesConfig.steamEngineV1_requiredSteamPerOperation);
SteamEngine steamEngineV1_0_0 = new SteamEngine(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.SteamEngineV1", TextureManager.GetTexture(ModCore.Manifest, "Machines", "SteamEngine"), typeof(SteamEngine), Color.White, true), new BasicItemInformation("Steam Engine", "Omegasis.Revitalize.Objects.Machines.SteamEngine", "Consumes steam in order to produce power.", "Machine", Color.SteelBlue, -300, 0, false, 500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "SteamEngine"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "SteamEngine"), new Animation(0, 0, 16, 16)), Color.White, false, new InventoryManager(9, 3, 3), null, new Energy.EnergyManager(500, Enums.EnergyInteractionType.Produces), false, null, null, new Managers.FluidManagerV2(2000, false, Enums.FluidInteractionType.Machine, false, true, 1)), null, ModCore.Configs.machinesConfig.steamEngineV1_powerGeneratedPerOperation, 0, true, "", ModCore.ObjectManager.resources.getFluid("Steam"), ModCore.Configs.machinesConfig.steamEngineV1_requiredSteamPerOperation);
SteamEngine steamEngineV1_1_0 = new SteamEngine(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.SteamEngineV1", TextureManager.GetTexture(ModCore.Manifest, "Machines", "SteamEngine"), typeof(SteamEngine), Color.White, true), new BasicItemInformation("Steam Engine", "Omegasis.Revitalize.Objects.Machines.SteamEngine", "Consumes steam in order to produce power.", "Machine", Color.SteelBlue, -300, 0, false, 500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "SteamEngine"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "SteamEngine"), new Animation(16, 0, 16, 16)), Color.White, false, new InventoryManager(9, 3, 3), null, new Energy.EnergyManager(500, Enums.EnergyInteractionType.Produces), false, null, null, new Managers.FluidManagerV2(2000, false, Enums.FluidInteractionType.Machine, false, true, 1)), null, ModCore.Configs.machinesConfig.steamEngineV1_powerGeneratedPerOperation, 0, true, "", ModCore.ObjectManager.resources.getFluid("Steam"), ModCore.Configs.machinesConfig.steamEngineV1_requiredSteamPerOperation);
steamEngineV1.addComponent(new Vector2(0, 0), steamEngineV1_0_0);
steamEngineV1.addComponent(new Vector2(1, 0), steamEngineV1_1_0);
this.AddItem("SteamEngineV1", steamEngineV1);
MultiTiledObject windMillV1 = new MultiTiledObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.WindmillV1", TextureManager.GetTexture(ModCore.Manifest, "Machines", "Windmill"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Windmill", "Omegasis.Revitalize.Objects.Machines.WindmillV1", "Generates power from the wind.", "Machine", Color.SteelBlue, -300, 0, false, 500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "Windmill"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "Windmill"), new Animation(0, 0, 16, 16)), Color.White, false, null, null, new Energy.EnergyManager(500, Enums.EnergyInteractionType.Produces), false, null, null, null));
Windmill windMillV1_0_0 = new Windmill(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.WindmillV1", TextureManager.GetTexture(ModCore.Manifest, "Machines", "Windmill"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Windmill", "Omegasis.Revitalize.Objects.Machines.WindmillV1", "Generates power from the wind.", "Machine", Color.SteelBlue, -300, 0, false, 500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "Windmill"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "Windmill"), 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(0,0,16,16,20),
new Animation(16,0,16,16,20)
} }
},"Working"), Color.White, false, null, null, new Energy.EnergyManager(500, Enums.EnergyInteractionType.Produces), false, null, null, null), null, ModCore.Configs.machinesConfig.windmillV1_basePowerProduction, 0, true, "", null, 0);
Windmill windMillV1_0_1 = new Windmill(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.WindmillV1", TextureManager.GetTexture(ModCore.Manifest, "Machines", "Windmill"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Windmill", "Omegasis.Revitalize.Objects.Machines.WindmillV1", "Generates power from the wind.", "Machine", Color.SteelBlue, -300, 0, false, 500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "Windmill"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "Windmill"), new Animation(0, 0, 16, 16), new Dictionary<string, List<Animation>>() {
{"Default",new List<Animation>()
{
new Animation(0,16,16,16)
} },
{"Working",new List<Animation>()
{
new Animation(0,16,16,16,20),
new Animation(16,16,16,16,20)
} }
},"Working"), Color.White, false, null, null, new Energy.EnergyManager(500, Enums.EnergyInteractionType.Produces), false, null, null, null), null, ModCore.Configs.machinesConfig.windmillV1_basePowerProduction, 0, false, "", null, 0);
windMillV1.addComponent(new Vector2(0, 0), windMillV1_0_0);
windMillV1.addComponent(new Vector2(0, 1), windMillV1_0_1);
this.AddItem("WindmillV1", windMillV1);
MultiTiledObject windMillV2 = new MultiTiledObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.WindmillV2", TextureManager.GetTexture(ModCore.Manifest, "Machines", "ClothWindmill"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Improved Windmill", "Omegasis.Revitalize.Objects.Machines.WindmillV2", "Generates power from the wind.", "Machine", Color.SteelBlue, -300, 0, false, 700, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "ClothWindmill"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "ClothWindmill"), new Animation(0, 0, 16, 16)), Color.White, false, null, null, new Energy.EnergyManager(500, Enums.EnergyInteractionType.Produces), false, null, null, null));
Windmill windMillV2_0_0 = new Windmill(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.WindmillV2", TextureManager.GetTexture(ModCore.Manifest, "Machines", "ClothWindmill"), typeof(Windmill), Color.White, true), new BasicItemInformation("Improved Windmill", "Omegasis.Revitalize.Objects.Machines.WindmillV2", "Generates power from the wind.", "Machine", Color.SteelBlue, -300, 0, false, 700, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "ClothWindmill"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "ClothWindmill"), 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(0,0,16,16,20),
new Animation(16,0,16,16,20)
} }
},"Working"), Color.White, false, null, null, new Energy.EnergyManager(500, Enums.EnergyInteractionType.Produces), false, null, null, null), null, ModCore.Configs.machinesConfig.windmillV2_basePowerProduction, 0, true, "", null, 0);
Windmill windMillV2_0_1 = new Windmill(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.WindmillV2", TextureManager.GetTexture(ModCore.Manifest, "Machines", "ClothWindmill"), typeof(Windmill), Color.White, true), new BasicItemInformation("Improved Windmill", "Omegasis.Revitalize.Objects.Machines.WindmillV2", "Generates power from the wind.", "Machine", Color.SteelBlue, -300, 0, false, 700, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "ClothWindmill"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "ClothWindmill"), new Animation(0, 0, 16, 16), new Dictionary<string, List<Animation>>() {
{"Default",new List<Animation>()
{
new Animation(0,16,16,16)
} },
{"Working",new List<Animation>()
{
new Animation(0,16,16,16,20),
new Animation(16,16,16,16,20)
} }
},"Working"), Color.White, false, null, null, new Energy.EnergyManager(500, Enums.EnergyInteractionType.Produces), false, null, null, null), null, ModCore.Configs.machinesConfig.windmillV2_basePowerProduction, 0, false, "", null, 0);
windMillV2.addComponent(new Vector2(0, 0), windMillV2_0_0);
windMillV2.addComponent(new Vector2(0, 1), windMillV2_0_1);
this.AddItem("WindmillV2", windMillV2);
}
private void loadInConnectionComponents()

View File

@ -67,5 +67,10 @@ namespace Revitalize.Framework.Utilities
return IsItRaining() || IsItSnowing() || IsStorm();
}
public static bool IsWeatherGoodForWindmills()
{
return IsWindyDay() || IsStorm();
}
}
}

View File

@ -588,14 +588,11 @@ namespace Revitalize
ModCore.ObjectManager.GetItem("SolarPanelTier1",1),
ModCore.ObjectManager.GetItem("SolarArrayTier1",1),
new StardewValley.Object(Vector2.Zero,(int)Enums.SDVBigCraftable.Furnace,false),
ModCore.ObjectManager.GetItem("Lighthouse",1),
ModCore.ObjectManager.GetItem("CopperWire",10),
batteryBin,
ModCore.ObjectManager.GetItem("Capacitor",1),
ModCore.ObjectManager.GetItem("ChargingStation",1),
ModCore.ObjectManager.GetItem("Grinder",1),
new StardewValley.Object((int)Enums.SDVObject.CopperOre,10),
ModCore.ObjectManager.GetTool("MiningDrillV1"),
ModCore.ObjectManager.GetTool("ChainsawV1"),
ModCore.ObjectManager.GetItem("MiningDrillMachineV1"),
ModCore.ObjectManager.GetItem("AlloyFurnace"),
@ -603,7 +600,9 @@ namespace Revitalize
ModCore.ObjectManager.GetItem("WaterPumpV1"),
ModCore.ObjectManager.GetItem("SteamBoilerV1"),
ModCore.ObjectManager.GetItem("IronPipe",100),
ModCore.ObjectManager.GetItem("SteamEngineV1")
ModCore.ObjectManager.GetItem("SteamEngineV1"),
ModCore.ObjectManager.GetItem("WindmillV1"),
ModCore.ObjectManager.GetItem("WindmillV2")
});
}

View File

@ -168,6 +168,7 @@
<Compile Include="Framework\Objects\Machines\EnergyGeneration\SolarPanel.cs" />
<Compile Include="Framework\Objects\Machines\EnergyGeneration\SteamBoiler.cs" />
<Compile Include="Framework\Objects\Machines\EnergyGeneration\SteamEngine.cs" />
<Compile Include="Framework\Objects\Machines\EnergyGeneration\Windmill.cs" />
<Compile Include="Framework\Objects\Machines\Grinder.cs" />
<Compile Include="Framework\Objects\Machines\Machine.cs" />
<Compile Include="Framework\Objects\Machines\Pipe.cs" />
@ -498,6 +499,9 @@
<Content Include="Content\Graphics\Objects\Machines\ChargingStation.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Objects\Machines\ClothWindmill.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Objects\Machines\Grinder.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@ -525,6 +529,9 @@
<Content Include="Content\Graphics\Objects\Machines\WaterPump.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Objects\Machines\Windmill.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Objects\Machines\Wires\CopperWire.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>