diff --git a/GeneralMods/Revitalize/Content/Graphics/Objects/Machines/Grinder.png b/GeneralMods/Revitalize/Content/Graphics/Objects/Machines/Grinder.png new file mode 100644 index 00000000..095ab8c2 Binary files /dev/null and b/GeneralMods/Revitalize/Content/Graphics/Objects/Machines/Grinder.png differ diff --git a/GeneralMods/Revitalize/Framework/Configs/GlobalMachineConfig.cs b/GeneralMods/Revitalize/Framework/Configs/GlobalMachineConfig.cs index 3c674f7b..ffeedb80 100644 --- a/GeneralMods/Revitalize/Framework/Configs/GlobalMachineConfig.cs +++ b/GeneralMods/Revitalize/Framework/Configs/GlobalMachineConfig.cs @@ -16,6 +16,9 @@ namespace Revitalize.Framework.Configs public bool showMachineNotificationBubble_InventoryFull; public float machineNotificationBubbleAlpha; + public int grinderEnergyConsumption; + public int grinderTimeToGrind; + public GlobalMachineConfig() { this.doMachinesConsumeEnergy = true; @@ -23,6 +26,8 @@ namespace Revitalize.Framework.Configs this.solarPanelNightEnergyGenerationMultiplier = .125d; this.showMachineNotificationBubble_InventoryFull = true; this.machineNotificationBubbleAlpha = 0.75f; + this.grinderEnergyConsumption = 20; + this.grinderTimeToGrind = 30; } public static GlobalMachineConfig InitializeConfig() diff --git a/GeneralMods/Revitalize/Framework/Objects/CustomObject.cs b/GeneralMods/Revitalize/Framework/Objects/CustomObject.cs index 255941f3..945d7d6f 100644 --- a/GeneralMods/Revitalize/Framework/Objects/CustomObject.cs +++ b/GeneralMods/Revitalize/Framework/Objects/CustomObject.cs @@ -722,6 +722,7 @@ namespace Revitalize.Framework.Objects public override bool canStackWith(Item other) { + if (other is CustomObject == false) return false; CustomObject o = (CustomObject)other; if (this.info.DyedColor != o.info.DyedColor) return false; diff --git a/GeneralMods/Revitalize/Framework/Objects/Machines/Grinder.cs b/GeneralMods/Revitalize/Framework/Objects/Machines/Grinder.cs new file mode 100644 index 00000000..d875a78f --- /dev/null +++ b/GeneralMods/Revitalize/Framework/Objects/Machines/Grinder.cs @@ -0,0 +1,323 @@ +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 StardewValley; +using StardustCore.Animations; +using StardustCore.UIUtilities; + +namespace Revitalize.Framework.Objects.Machines +{ + public class Grinder : Machine + { + + public Grinder() { } + + public Grinder(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 = ModCore.Configs.machinesConfig.grinderEnergyConsumption; + this.timeToProduce = TimeToProduce; + this.updatesContainerObjectForProduction = UpdatesContainer; + this.MinutesUntilReady = TimeToProduce; + this.craftingRecipeBook = CraftingBook; + this.createStatusBubble(); + + } + + public Grinder(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 = ModCore.Configs.machinesConfig.grinderEnergyConsumption; + this.timeToProduce = TimeToProduce; + this.updatesContainerObjectForProduction = UpdatesContainer; + this.MinutesUntilReady = TimeToProduce; + this.craftingRecipeBook = CraftingBook; + this.createStatusBubble(); + } + + public Grinder(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 = ModCore.Configs.machinesConfig.grinderEnergyConsumption; + 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); + } + + + public override bool minutesElapsed(int minutes, GameLocation environment) + { + if (this.updatesContainerObjectForProduction) + { + if (this.energyRequiredPer10Minutes != ModCore.Configs.machinesConfig.grinderEnergyConsumption) this.energyRequiredPer10Minutes = ModCore.Configs.machinesConfig.grinderEnergyConsumption; + ModCore.log("Update container object for production!"); + + //this.MinutesUntilReady -= minutes; + int remaining = minutes; + //ModCore.log("Minutes elapsed: " + remaining); + List energySources = new List(); + if (this.ConsumesEnergy) + { + //ModCore.log("This machine drains energy: " + this.info.name); + energySources = this.EnergyGraphSearchSources(); //Only grab the network once. + } + + while (remaining > 0) + { + + if (this.ConsumesEnergy) + { + this.drainEnergyFromNetwork(energySources); //Continually drain from the network. + if (this.EnergyManager.remainingEnergy < ModCore.Configs.machinesConfig.grinderEnergyConsumption) return false; + else + { + this.EnergyManager.consumeEnergy(ModCore.Configs.machinesConfig.grinderEnergyConsumption); //Consume the required amount of energy necessary. + } + } + else + { + //ModCore.log("Does not produce energy or consume energy so do whatever!"); + } + remaining -= 10; + this.containerObject.MinutesUntilReady -= 10; + + if (this.containerObject.MinutesUntilReady <= 0 && this.InventoryManager.IsFull == false) + { + this.produceItem(); + this.consumeItemForGrinding(); + } + } + + + return false; + } + else + { + + 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() + { + Grinder component = new Grinder(this.data, this.info.Copy(), this.TileLocation, this.offsetKey, this.producedResources, ModCore.Configs.machinesConfig.grinderEnergyConsumption, this.timeToProduce, this.updatesContainerObjectForProduction, this.craftingRecipeBook, this.containerObject); + return component; + } + + public override ICustomObject recreate(Dictionary additionalSaveData, object replacement) + { + //instead of using this.offsetkey.x use get additional save data function and store offset key there + + Vector2 offsetKey = new Vector2(Convert.ToInt32(additionalSaveData["offsetKeyX"]), Convert.ToInt32(additionalSaveData["offsetKeyY"])); + Grinder self = Revitalize.ModCore.Serializer.DeserializeGUID(additionalSaveData["GUID"]); + if (self == null) + { + return null; + } + + if (!Revitalize.ModCore.ObjectGroups.ContainsKey(additionalSaveData["ParentGUID"])) + { + //Get new container + MultiTiledObject obj = (MultiTiledObject)Revitalize.ModCore.Serializer.DeserializeGUID(additionalSaveData["ParentGUID"]); + self.containerObject = obj; + obj.addComponent(offsetKey, self); + //Revitalize.ModCore.log("ADD IN AN OBJECT!!!!"); + Revitalize.ModCore.ObjectGroups.Add(additionalSaveData["ParentGUID"], (MultiTiledObject)obj); + } + else + { + self.containerObject = Revitalize.ModCore.ObjectGroups[additionalSaveData["ParentGUID"]]; + Revitalize.ModCore.ObjectGroups[additionalSaveData["GUID"]].addComponent(offsetKey, self); + //Revitalize.ModCore.log("READD AN OBJECT!!!!"); + } + + return (ICustomObject)self; + } + + 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 + { + 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 produceItem() + { + if (this.InventoryManager.hasItemsInBuffer) + { + this.InventoryManager.dumpBufferToItems(); + } + } + + protected bool consumeItemForGrinding() + { + + Item itemToRemove = null; + foreach(Item I in this.InventoryManager.items) + { + if(I.canStackWith(new StardewValley.Object((int)Enums.SDVObject.CopperOre, 1))){ + this.InventoryManager.bufferItems.Add(ModCore.ObjectManager.resources.getResource("CopperSand", 2)); + itemToRemove = I; + this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind; + break; + } + if (I.canStackWith(new StardewValley.Object((int)Enums.SDVObject.IronOre, 1))) + { + this.InventoryManager.bufferItems.Add(ModCore.ObjectManager.resources.getResource("IronSand", 2)); + itemToRemove = I; + this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind; + break; + } + if (I.canStackWith(new StardewValley.Object((int)Enums.SDVObject.GoldOre, 1))) + { + this.InventoryManager.bufferItems.Add(ModCore.ObjectManager.resources.getResource("GoldSand", 2)); + itemToRemove = I; + this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind; + break; + } + if (I.canStackWith(new StardewValley.Object((int)Enums.SDVObject.IridiumOre, 1))) + { + this.InventoryManager.bufferItems.Add(ModCore.ObjectManager.resources.getResource("IridiumSand", 2)); + itemToRemove = I; + this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind; + break; + } + + if (I.canStackWith(ModCore.ObjectManager.resources.getOre("BauxiteOre"))) + { + this.InventoryManager.bufferItems.Add(ModCore.ObjectManager.resources.getResource("BauxiteSand", 2)); + itemToRemove = I; + this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind; + break; + } + if (I.canStackWith(ModCore.ObjectManager.resources.getOre("LeadOre"))) + { + this.InventoryManager.bufferItems.Add(ModCore.ObjectManager.resources.getResource("LeadSand", 2)); + itemToRemove = I; + this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind; + break; + } + if (I.canStackWith(ModCore.ObjectManager.resources.getOre("SilverOre"))) + { + this.InventoryManager.bufferItems.Add(ModCore.ObjectManager.resources.getResource("SilverSand", 2)); + itemToRemove = I; + this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind; + break; + } + if (I.canStackWith(ModCore.ObjectManager.resources.getOre("TinOre"))) + { + this.InventoryManager.bufferItems.Add(ModCore.ObjectManager.resources.getResource("TinSand", 2)); + itemToRemove = I; + this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind; + break; + } + if (I.canStackWith(ModCore.ObjectManager.resources.getOre("TitaniumOre"))) + { + this.InventoryManager.bufferItems.Add(ModCore.ObjectManager.resources.getResource("TitaniumSand", 2)); + itemToRemove = I; + this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind; + break; + } + + if (I.canStackWith(new StardewValley.Object((int)Enums.SDVObject.Stone, 1))) + { + this.InventoryManager.bufferItems.Add(ModCore.ObjectManager.resources.getResource("Sand", 1)); + itemToRemove = I; + this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind; + break; + } + } + + if (itemToRemove == null) return false; + + if (itemToRemove.Stack > 1) + { + itemToRemove.Stack--; + } + else if (itemToRemove.Stack == 1) + { + this.InventoryManager.items.Remove(itemToRemove); + } + return true; + + } + + } +} diff --git a/GeneralMods/Revitalize/Framework/Objects/ObjectManager.cs b/GeneralMods/Revitalize/Framework/Objects/ObjectManager.cs index eef1f22e..c36de75e 100644 --- a/GeneralMods/Revitalize/Framework/Objects/ObjectManager.cs +++ b/GeneralMods/Revitalize/Framework/Objects/ObjectManager.cs @@ -180,8 +180,6 @@ namespace Revitalize.Framework.Objects this.AddItem("TrashCan", trashCan); - - MultiTiledObject sandBox = new MultiTiledObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.Sandbox", TextureManager.GetTexture(ModCore.Manifest, "Machines", "Sandbox"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Sandbox", "Omegasis.Revitalize.Objects.Machines.Sandbox", "A sandbox which slowly produces sand. Unfortunately you can't sit in this one.", "Machine", Color.SteelBlue, -300, 0, false, 750, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "Sandbox"), new AnimationManager(), Color.White, true, new InventoryManager(36), null, null)); Machine sandBox_0_0 = new Machine(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.Sandbox", TextureManager.GetTexture(ModCore.Manifest, "Machines", "Sandbox"), typeof(Machine), Color.White, true), new BasicItemInformation("Sandbox", "Omegasis.Revitalize.Objects.Machines.Sandbox", "A sandbox which slowly produces sand. Unfortunately you can't sit in this one.", "Machine", Color.SteelBlue, -300, 0, false, 750, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "Sandbox"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "Sandbox"),new Animation(0,0,16,16)), Color.White, false, new InventoryManager(36), null, null), new List() { @@ -233,7 +231,7 @@ namespace Revitalize.Framework.Objects ///Consumes energy. Produces batteries. MultiTiledObject batteryBin = new MultiTiledObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.BatteryBin", TextureManager.GetTexture(ModCore.Manifest, "Machines", "BatteryBin"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Battery Bin", "Omegasis.Revitalize.Objects.Machines.BatteryBin", "Consumes energy over time to produce battery packs.", "Machine", Color.SteelBlue, -300, 0, false, 500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "BatteryBin"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "BatteryBin"), new Animation(0, 0, 16, 16)), Color.White, false, new InventoryManager(9,3,3), null, new Energy.EnergyManager(500, Enums.EnergyInteractionType.Consumes))); - Machine batteryBin_0_0 = new Machine(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.BatteryBin", TextureManager.GetTexture(ModCore.Manifest, "Machines", "BatteryBin"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Battery Bin", "Omegasis.Revitalize.Objects.Machines.BatteryBin", "Consumes energy over time to produce battery packs.", "Machine", Color.SteelBlue, -300, 0, false, 500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "BatteryBin"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "BatteryBin"), new Animation(0, 0, 16, 16)), Color.White, false, new InventoryManager(9,3,3), null, new Energy.EnergyManager(500, Enums.EnergyInteractionType.Consumes)), new List() + Machine batteryBin_0_0 = new Machine(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.BatteryBin", TextureManager.GetTexture(ModCore.Manifest, "Machines", "BatteryBin"), typeof(Machine), Color.White, true), new BasicItemInformation("Battery Bin", "Omegasis.Revitalize.Objects.Machines.BatteryBin", "Consumes energy over time to produce battery packs.", "Machine", Color.SteelBlue, -300, 0, false, 500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "BatteryBin"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "BatteryBin"), new Animation(0, 0, 16, 16)), Color.White, false, new InventoryManager(9,3,3), null, new Energy.EnergyManager(500, Enums.EnergyInteractionType.Consumes)), new List() { new InformationFiles.ResourceInformation(new StardewValley.Object((int)Enums.SDVObject.BatteryPack,1),1,1,1,1,1,1,0,0,0,0) @@ -242,22 +240,34 @@ namespace Revitalize.Framework.Objects this.AddItem("BatteryBin", batteryBin); MultiTiledObject capacitor= new MultiTiledObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.Capacitor", TextureManager.GetTexture(ModCore.Manifest, "Machines", "Capacitor"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Capacitor", "Omegasis.Revitalize.Objects.Machines.Capacitor", "A box which stores energy for use over time.", "Machine", Color.SteelBlue, -300, 0, false, 500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "Capacitor"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "Capacitor"), new Animation(0, 0, 16, 16)), Color.White, false,null, null, new Energy.EnergyManager(2000, Enums.EnergyInteractionType.Storage))); - Machine capacitor_0_0 = new Machine(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.Capacitor", TextureManager.GetTexture(ModCore.Manifest, "Machines", "Capacitor"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Capacitor", "Omegasis.Revitalize.Objects.Machines.Capacitor", "A box which stores energy for use over time.", "Machine", Color.SteelBlue, -300, 0, false, 500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "Capacitor"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "Capacitor"), new Animation(0, 0, 16, 16)), Color.White, false, null, null, new Energy.EnergyManager(2000, Enums.EnergyInteractionType.Storage)),null,0,0,true,""); + Machine capacitor_0_0 = new Machine(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.Capacitor", TextureManager.GetTexture(ModCore.Manifest, "Machines", "Capacitor"), typeof(Machine), Color.White, true), new BasicItemInformation("Capacitor", "Omegasis.Revitalize.Objects.Machines.Capacitor", "A box which stores energy for use over time.", "Machine", Color.SteelBlue, -300, 0, false, 500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "Capacitor"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "Capacitor"), new Animation(0, 0, 16, 16)), Color.White, false, null, null, new Energy.EnergyManager(2000, Enums.EnergyInteractionType.Storage)),null,0,0,true,""); capacitor.addComponent(new Vector2(0, 0), capacitor_0_0); this.AddItem("Capacitor", capacitor); MultiTiledObject chargingStation = new MultiTiledObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.ChargingStation", TextureManager.GetTexture(ModCore.Manifest, "Machines", "ChargingStation"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Charging Station", "Omegasis.Revitalize.Objects.Machines.ChargingStation", "A place to charge your tools and other electrical components.", "Machine", Color.SteelBlue, -300, 0, false, 500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "ChargingStation"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "ChargingStation"), new Animation(0, 0, 16, 16)), Color.White, false,new InventoryManager(4,4,1), null, new Energy.EnergyManager(2000, Enums.EnergyInteractionType.Storage))); - ChargingStation chargingStation_0_0 = new ChargingStation(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.ChargingStation", TextureManager.GetTexture(ModCore.Manifest, "Machines", "ChargingStation"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Charging Station", "Omegasis.Revitalize.Objects.Machines.ChargingStation", "A place to charge your tools and other electrical components.", "Machine", Color.SteelBlue, -300, 0, false, 500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "ChargingStation"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "ChargingStation"), new Animation(0, 0, 16, 16)), Color.White, true, null, null, new Energy.EnergyManager(2000, Enums.EnergyInteractionType.Storage)), null, 0, 0, true, ""); - ChargingStation chargingStation_1_0 = new ChargingStation(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.ChargingStation", TextureManager.GetTexture(ModCore.Manifest, "Machines", "ChargingStation"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Charging Station", "Omegasis.Revitalize.Objects.Machines.ChargingStation", "A place to charge your tools and other electrical components.", "Machine", Color.SteelBlue, -300, 0, false, 500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "ChargingStation"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "ChargingStation"), new Animation(16, 0, 16, 16)), Color.White, true, null, null, new Energy.EnergyManager(2000, Enums.EnergyInteractionType.Storage)), null, 0, 0, false, ""); - ChargingStation chargingStation_0_1 = new ChargingStation(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.ChargingStation", TextureManager.GetTexture(ModCore.Manifest, "Machines", "ChargingStation"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Charging Station", "Omegasis.Revitalize.Objects.Machines.ChargingStation", "A place to charge your tools and other electrical components.", "Machine", Color.SteelBlue, -300, 0, false, 500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "ChargingStation"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "ChargingStation"), new Animation(0, 16, 16, 16)), Color.White, false, null, null, new Energy.EnergyManager(2000, Enums.EnergyInteractionType.Storage)), null, 0, 0, false, ""); - ChargingStation chargingStation_1_1 = new ChargingStation(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.ChargingStation", TextureManager.GetTexture(ModCore.Manifest, "Machines", "ChargingStation"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Charging Station", "Omegasis.Revitalize.Objects.Machines.ChargingStation", "A place to charge your tools and other electrical components.", "Machine", Color.SteelBlue, -300, 0, false, 500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "ChargingStation"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "ChargingStation"), new Animation(16, 16, 16, 16)), Color.White, false, null, null, new Energy.EnergyManager(2000, Enums.EnergyInteractionType.Storage)), null, 0, 0, false, ""); + ChargingStation chargingStation_0_0 = new ChargingStation(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.ChargingStation", TextureManager.GetTexture(ModCore.Manifest, "Machines", "ChargingStation"), typeof(ChargingStation), Color.White, true), new BasicItemInformation("Charging Station", "Omegasis.Revitalize.Objects.Machines.ChargingStation", "A place to charge your tools and other electrical components.", "Machine", Color.SteelBlue, -300, 0, false, 500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "ChargingStation"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "ChargingStation"), new Animation(0, 0, 16, 16)), Color.White, true, null, null, new Energy.EnergyManager(2000, Enums.EnergyInteractionType.Storage)), null, 0, 0, true, ""); + ChargingStation chargingStation_1_0 = new ChargingStation(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.ChargingStation", TextureManager.GetTexture(ModCore.Manifest, "Machines", "ChargingStation"), typeof(ChargingStation), Color.White, true), new BasicItemInformation("Charging Station", "Omegasis.Revitalize.Objects.Machines.ChargingStation", "A place to charge your tools and other electrical components.", "Machine", Color.SteelBlue, -300, 0, false, 500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "ChargingStation"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "ChargingStation"), new Animation(16, 0, 16, 16)), Color.White, true, null, null, new Energy.EnergyManager(2000, Enums.EnergyInteractionType.Storage)), null, 0, 0, false, ""); + ChargingStation chargingStation_0_1 = new ChargingStation(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.ChargingStation", TextureManager.GetTexture(ModCore.Manifest, "Machines", "ChargingStation"), typeof(ChargingStation), Color.White, true), new BasicItemInformation("Charging Station", "Omegasis.Revitalize.Objects.Machines.ChargingStation", "A place to charge your tools and other electrical components.", "Machine", Color.SteelBlue, -300, 0, false, 500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "ChargingStation"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "ChargingStation"), new Animation(0, 16, 16, 16)), Color.White, false, null, null, new Energy.EnergyManager(2000, Enums.EnergyInteractionType.Storage)), null, 0, 0, false, ""); + ChargingStation chargingStation_1_1 = new ChargingStation(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.ChargingStation", TextureManager.GetTexture(ModCore.Manifest, "Machines", "ChargingStation"), typeof(ChargingStation), Color.White, true), new BasicItemInformation("Charging Station", "Omegasis.Revitalize.Objects.Machines.ChargingStation", "A place to charge your tools and other electrical components.", "Machine", Color.SteelBlue, -300, 0, false, 500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "ChargingStation"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "ChargingStation"), new Animation(16, 16, 16, 16)), Color.White, false, null, null, new Energy.EnergyManager(2000, Enums.EnergyInteractionType.Storage)), null, 0, 0, false, ""); chargingStation.addComponent(new Vector2(0, 0), chargingStation_0_0); chargingStation.addComponent(new Vector2(1, 0), chargingStation_1_0); chargingStation.addComponent(new Vector2(0, 1), chargingStation_0_1); chargingStation.addComponent(new Vector2(1, 1), chargingStation_1_1); this.AddItem("ChargingStation", chargingStation); + + MultiTiledObject grinder= new MultiTiledObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.Grinder", TextureManager.GetTexture(ModCore.Manifest, "Machines", "Grinder"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Grinder", "Omegasis.Revitalize.Objects.Machines.Grinder", "Grinds up ores and rocks.", "Machine", Color.SteelBlue, -300, 0, false, 4000, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "Grinder"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "Grinder"), new Animation(0, 0, 16, 16)), Color.White, false, new InventoryManager(18, 3, 6), null, new Energy.EnergyManager(1000, Enums.EnergyInteractionType.Consumes))); + Grinder grinder_0_0 = new Grinder(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.Grinder", TextureManager.GetTexture(ModCore.Manifest, "Machines", "Grinder"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Grinder", "Omegasis.Revitalize.Objects.Machines.Grinder", "Grinds up ores and rocks.", "Machine", Color.SteelBlue, -300, 0, false, 4000, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "Grinder"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "Grinder"), new Animation(0, 0, 16, 16)), Color.White, false, new InventoryManager(18, 3, 6), null, new Energy.EnergyManager(1000, Enums.EnergyInteractionType.Consumes)),null,ModCore.Configs.machinesConfig.grinderEnergyConsumption,ModCore.Configs.machinesConfig.grinderTimeToGrind,true,""); + Grinder grinder_1_0 = new Grinder(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.Grinder", TextureManager.GetTexture(ModCore.Manifest, "Machines", "Grinder"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Grinder", "Omegasis.Revitalize.Objects.Machines.Grinder", "Grinds up ores and rocks.", "Machine", Color.SteelBlue, -300, 0, false, 4000, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "Grinder"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "Grinder"), new Animation(16, 0, 16, 16)), Color.White, false, new InventoryManager(18, 3, 6), null, new Energy.EnergyManager(1000, Enums.EnergyInteractionType.Consumes)), null, ModCore.Configs.machinesConfig.grinderEnergyConsumption, ModCore.Configs.machinesConfig.grinderTimeToGrind, false, ""); + Grinder grinder_0_1 = new Grinder(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.Grinder", TextureManager.GetTexture(ModCore.Manifest, "Machines", "Grinder"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Grinder", "Omegasis.Revitalize.Objects.Machines.Grinder", "Grinds up ores and rocks.", "Machine", Color.SteelBlue, -300, 0, false, 4000, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "Grinder"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "Grinder"), new Animation(0, 16, 16, 16)), Color.White, false, new InventoryManager(18, 3, 6), null, new Energy.EnergyManager(1000, Enums.EnergyInteractionType.Consumes)), null, ModCore.Configs.machinesConfig.grinderEnergyConsumption, ModCore.Configs.machinesConfig.grinderTimeToGrind, false, ""); + Grinder grinder_1_1 = new Grinder(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.Grinder", TextureManager.GetTexture(ModCore.Manifest, "Machines", "Grinder"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Grinder", "Omegasis.Revitalize.Objects.Machines.Grinder", "Grinds up ores and rocks.", "Machine", Color.SteelBlue, -300, 0, false, 4000, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "Grinder"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "Grinder"), new Animation(16, 16, 16, 16)), Color.White, false, new InventoryManager(18, 3, 6), null, new Energy.EnergyManager(1000, Enums.EnergyInteractionType.Consumes)), null, ModCore.Configs.machinesConfig.grinderEnergyConsumption, ModCore.Configs.machinesConfig.grinderTimeToGrind, false, ""); + grinder.addComponent(new Vector2(0, 0), grinder_0_0); + grinder.addComponent(new Vector2(1, 0), grinder_1_0); + grinder.addComponent(new Vector2(0, 1), grinder_0_1); + grinder.addComponent(new Vector2(1, 1), grinder_1_1); + this.AddItem("Grinder", grinder); + } private void loadInWires() diff --git a/GeneralMods/Revitalize/Framework/Objects/ResourceManager.cs b/GeneralMods/Revitalize/Framework/Objects/ResourceManager.cs index 33d24cfa..cf67ba45 100644 --- a/GeneralMods/Revitalize/Framework/Objects/ResourceManager.cs +++ b/GeneralMods/Revitalize/Framework/Objects/ResourceManager.cs @@ -310,11 +310,11 @@ namespace Revitalize.Framework.Objects CustomObject copperSand = new CustomObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Items.Resources.Ore.CopperSand", TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "CopperSand"), typeof(CustomObject), Color.White, true), new BasicItemInformation("Copper Sand", "Omegasis.Revitalize.Items.Resources.Ore.CopperSand", "Copper ore which has been crushed into sand. Smelt it to get copper bars.", "Ore", Color.Silver, -300, 0, false, 5, false, false, TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "CopperSand"), new AnimationManager(), Color.White, true, null, null), 1); CustomObject goldSand = new CustomObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Items.Resources.Ore.GoldSand", TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "GoldSand"), typeof(CustomObject), Color.White, true), new BasicItemInformation("Gold Sand", "Omegasis.Revitalize.Items.Resources.Ore.GoldSand", "Gold ore which has been crushed into sand. Smelt it to get gold bars.", "Ore", Color.Silver, -300, 0, false, 25, false, false, TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "GoldSand"), new AnimationManager(), Color.White, true, null, null), 1); CustomObject ironSand = new CustomObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Items.Resources.Ore.IronSand", TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "IronSand"), typeof(CustomObject), Color.White, true), new BasicItemInformation("Iron Sand", "Omegasis.Revitalize.Items.Resources.Ore.IronSand", "Iron ore which has been crushed into sand. Smelt it to get iron bars.", "Ore", Color.Silver, -300, 0, false, 10, false, false, TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "IronSand"), new AnimationManager(), Color.White, true, null, null), 1); - CustomObject iridiumSand = new CustomObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Items.Resources.Ore.IridiumSand", TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "IriduiumSand"), typeof(CustomObject), Color.White, true), new BasicItemInformation("Iridium Sand", "Omegasis.Revitalize.Items.Resources.Ore.IridiumSand", "Iridium ore which has been crushed into sand. Smelt it to get iridium bars.", "Ore", Color.Silver, -300, 0, false, 100, false, false, TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "IridiumSand"), new AnimationManager(), Color.White, true, null, null), 1); + CustomObject iridiumSand = new CustomObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Items.Resources.Ore.IridiumSand", TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "IridiumSand"), typeof(CustomObject), Color.White, true), new BasicItemInformation("Iridium Sand", "Omegasis.Revitalize.Items.Resources.Ore.IridiumSand", "Iridium ore which has been crushed into sand. Smelt it to get iridium bars.", "Ore", Color.Silver, -300, 0, false, 100, false, false, TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "IridiumSand"), new AnimationManager(), Color.White, true, null, null), 1); CustomObject leadSand = new CustomObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Items.Resources.Ore.LeadSand", TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "LeadSand"), typeof(CustomObject), Color.White, true), new BasicItemInformation("Lead Sand", "Omegasis.Revitalize.Items.Resources.Ore.LeadSand", "Lead ore which has been crushed into sand. Smelt it to get lead ingots.", "Ore", Color.Silver, -300, 0, false, 15, false, false, TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "LeadSand"), new AnimationManager(), Color.White, true, null, null), 1); CustomObject silverSand = new CustomObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Items.Resources.Ore.SilverSand", TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "SilverSand"), typeof(CustomObject), Color.White, true), new BasicItemInformation("Silver Sand", "Omegasis.Revitalize.Items.Resources.Ore.SilverSand", "Silver ore which has been crushed into sand. Smelt it to get silver ingots.", "Ore", Color.Silver, -300, 0, false, 20, false, false, TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "SilverSand"), new AnimationManager(), Color.White, true, null, null), 1); CustomObject tinSand = new CustomObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Items.Resources.Ore.TinSand", TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "TinSand"), typeof(CustomObject), Color.White, true), new BasicItemInformation("Tin Sand", "Omegasis.Revitalize.Items.Resources.Ore.TinSand", "Tin ore which has been crushed into sand. Smelt it to get tin ingots.", "Ore", Color.Silver, -300, 0, false, 7, false, false, TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "TinSand"), new AnimationManager(), Color.White, true, null, null), 1); - CustomObject titaniumSand = new CustomObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Items.Resources.Ore.TitaniumSand", TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "TitniumSand"), typeof(CustomObject), Color.White, true), new BasicItemInformation("Copper Sand", "Omegasis.Revitalize.Items.Resources.Ore.TitaniumSand", "Titanium ore which has been crushed into sand. Smelt it to get titanium bars.", "Ore", Color.Silver, -300, 0, false, 35, false, false, TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "TitaniumSand"), new AnimationManager(), Color.White, true, null, null), 1); + CustomObject titaniumSand = new CustomObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Items.Resources.Ore.TitaniumSand", TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "TitaniumSand"), typeof(CustomObject), Color.White, true), new BasicItemInformation("Copper Sand", "Omegasis.Revitalize.Items.Resources.Ore.TitaniumSand", "Titanium ore which has been crushed into sand. Smelt it to get titanium bars.", "Ore", Color.Silver, -300, 0, false, 35, false, false, TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "TitaniumSand"), new AnimationManager(), Color.White, true, null, null), 1); this.resources.Add("BauxiteSand", bauxiteSand); this.resources.Add("CopperSand", copperSand); diff --git a/GeneralMods/Revitalize/ModCore.cs b/GeneralMods/Revitalize/ModCore.cs index 0628973e..78ab90eb 100644 --- a/GeneralMods/Revitalize/ModCore.cs +++ b/GeneralMods/Revitalize/ModCore.cs @@ -569,7 +569,9 @@ namespace Revitalize ModCore.ObjectManager.GetItem("CopperWire",10), batteryBin, ModCore.ObjectManager.GetItem("Capacitor",1), - ModCore.ObjectManager.GetItem("ChargingStation",1) + ModCore.ObjectManager.GetItem("ChargingStation",1), + ModCore.ObjectManager.GetItem("Grinder",1), + new StardewValley.Object((int)Enums.SDVObject.CopperOre,10) }); } diff --git a/GeneralMods/Revitalize/Revitalize.csproj b/GeneralMods/Revitalize/Revitalize.csproj index a55ab562..37347172 100644 --- a/GeneralMods/Revitalize/Revitalize.csproj +++ b/GeneralMods/Revitalize/Revitalize.csproj @@ -161,6 +161,7 @@ + @@ -464,6 +465,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest