Added in simple machines and tested to make sure they produce items. They do for non-energy consuming items. Also added in the sandbox which is a wip.

This commit is contained in:
JoshuaNavarro 2019-09-09 15:44:25 -07:00
parent a89cbc2c82
commit 877e40ae39
15 changed files with 533 additions and 24 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

View File

@ -19,11 +19,17 @@ namespace Revitalize.Framework.Configs
public Shops_BlacksmithConfig shops_blacksmithConfig;
public FurnitureConfig furnitureConfig;
/// <summary>
/// The config file to be used for machines.
/// </summary>
public GlobalMachineConfig machinesConfig;
public ConfigManager()
{
this.vanillaMachineConfig = VanillaMachineRecipeConfig.InitializeConfig();
this.shops_blacksmithConfig = Shops_BlacksmithConfig.InitializeConfig();
this.furnitureConfig = FurnitureConfig.InitializeConfig();
this.machinesConfig = GlobalMachineConfig.InitializeConfig();
}
}
}

View File

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Revitalize.Framework.Configs
{
public class GlobalMachineConfig
{
public bool doMachinesConsumeEnergy;
public GlobalMachineConfig()
{
this.doMachinesConsumeEnergy = true;
}
public static GlobalMachineConfig InitializeConfig()
{
if (File.Exists(Path.Combine(ModCore.ModHelper.DirectoryPath, "Configs", "MachinesConfig.json")))
return ModCore.ModHelper.Data.ReadJsonFile<GlobalMachineConfig>(Path.Combine("Configs", "MachinesConfig.json"));
else
{
GlobalMachineConfig Config = new GlobalMachineConfig();
ModCore.ModHelper.Data.WriteJsonFile<GlobalMachineConfig>(Path.Combine("Configs", "MachinesConfig.json"), Config);
return Config;
}
}
}
}

View File

@ -24,7 +24,7 @@ namespace Revitalize.Framework.Factories.Objects.Resources
/// <summary>
/// Extra information that holds drop chances on extra drops.
/// </summary>
public List<ResourceInformaton> ExtraDrops;
public List<ResourceInformation> ExtraDrops;
/// <summary>
/// The health of the ore vein.
/// </summary>

View File

@ -168,10 +168,11 @@ namespace Revitalize.Framework.Objects
}
}
[JsonIgnore]
/// <summary>
/// Accesses the energy manager for all objects.
/// </summary>
public EnergyManager EnergyManager
public virtual EnergyManager EnergyManager
{
get
{

View File

@ -9,7 +9,7 @@ using StardewValley;
namespace Revitalize.Framework.Objects.InformationFiles
{
public class OreResourceInformation:ResourceInformaton
public class OreResourceInformation:ResourceInformation
{

View File

@ -10,7 +10,7 @@ namespace Revitalize.Framework.Objects.InformationFiles
/// <summary>
/// Deals with information reguarding resources.
/// </summary>
public class ResourceInformaton
public class ResourceInformation
{
/// <summary>
/// The item to drop.
@ -60,7 +60,7 @@ namespace Revitalize.Framework.Objects.InformationFiles
/// <summary>
/// Empty constructor.
/// </summary>
public ResourceInformaton()
public ResourceInformation()
{
}
@ -79,7 +79,7 @@ namespace Revitalize.Framework.Objects.InformationFiles
/// <param name="SpawnAmountLuckFactor"></param>
/// <param name="DropChanceLuckFactor"></param>
/// <param name="DropAmountLuckFactor"></param>
public ResourceInformaton(StardewValley.Object I, int MinDropAmount, int MaxDropAmount, int MinNumberOfNodes, int MaxNumberOfNodes,double ChanceToSpawn=1f,double ChanceToDrop=1f, double SpawnChanceLuckFactor = 0f, double SpawnAmountLuckFactor = 0f,double DropChanceLuckFactor=0f, double DropAmountLuckFactor = 0f)
public ResourceInformation(StardewValley.Object I, int MinDropAmount, int MaxDropAmount, int MinNumberOfNodes, int MaxNumberOfNodes,double ChanceToSpawn=1f,double ChanceToDrop=1f, double SpawnChanceLuckFactor = 0f, double SpawnAmountLuckFactor = 0f,double DropChanceLuckFactor=0f, double DropAmountLuckFactor = 0f)
{
this.droppedItem = I;
this.minResourcePerDrop = MinDropAmount;
@ -174,5 +174,16 @@ namespace Revitalize.Framework.Objects.InformationFiles
if (this.chanceToDrop >= chance) return true;
else return false;
}
/// <summary>
/// Gets an item that should be dropped from this resource with the appropriate drop amount;
/// </summary>
/// <returns></returns>
public Item getItemDrops()
{
Item I = this.droppedItem.getOne();
I.Stack = this.getNumberOfDropsToSpawn();
return I;
}
}
}

View File

@ -3,10 +3,364 @@ 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
{
public class Machine
public class Machine:MultiTiledComponent
{
[JsonIgnore]
public override string ItemInfo
{
get
{
string info = Revitalize.ModCore.Serializer.ToJSONString(this.info);
string guidStr = this.guid.ToString();
string pyTkData = ModCore.Serializer.ToJSONString(this.data);
string offsetKey = this.offsetKey != null ? ModCore.Serializer.ToJSONString(this.offsetKey) : "";
string container = this.containerObject != null ? this.containerObject.guid.ToString() : "";
string resources = ModCore.Serializer.ToJSONString(this.producedResources);
string energyRequired = this.energyRequiredPer10Minutes.ToString();
string timeToProduce = this.timeToProduce.ToString();
string updatesContainer = this.updatesContainerObjectForProduction.ToString();
return info + "<" + guidStr + "<" + pyTkData + "<" + offsetKey + "<" + container+"<"+resources+"<"+energyRequired+"<"+timeToProduce+"<"+updatesContainer;
}
set
{
if (string.IsNullOrEmpty(value)) return;
string[] data = value.Split('<');
string infoString = data[0];
string guidString = data[1];
string pyTKData = data[2];
string offsetVec = data[3];
string containerObject = data[4];
string resourcesString = data[5];
string energyRequired = data[6];
string time = data[7];
string updates = data[8];
this.info = (BasicItemInformation)Revitalize.ModCore.Serializer.DeserializeFromJSONString(infoString, typeof(BasicItemInformation));
this.data = Revitalize.ModCore.Serializer.DeserializeFromJSONString<CustomObjectData>(pyTKData);
this.energyRequiredPer10Minutes = Convert.ToInt32(energyRequired);
this.timeToProduce = Convert.ToInt32(time);
this.updatesContainerObjectForProduction = Convert.ToBoolean(updates);
if (string.IsNullOrEmpty(offsetVec)) return;
if (string.IsNullOrEmpty(containerObject)) return;
this.offsetKey = ModCore.Serializer.DeserializeFromJSONString<Vector2>(offsetVec);
Guid oldGuid = this.guid;
this.guid = Guid.Parse(guidString);
if (ModCore.CustomObjects.ContainsKey(this.guid))
{
//ModCore.log("Update item with guid: " + this.guid);
ModCore.CustomObjects[this.guid] = this;
}
else
{
//ModCore.log("Add in new guid: " + this.guid);
ModCore.CustomObjects.Add(this.guid, this);
}
if (this.containerObject == null)
{
//ModCore.log(containerObject);
Guid containerGuid = Guid.Parse(containerObject);
if (ModCore.CustomObjects.ContainsKey(containerGuid))
{
this.containerObject = (MultiTiledObject)ModCore.CustomObjects[containerGuid];
this.containerObject.removeComponent(this.offsetKey);
this.containerObject.addComponent(this.offsetKey, this);
//ModCore.log("Set container object from existing object!");
}
else
{
//ModCore.log("Container hasn't been synced???");
MultiplayerUtilities.RequestGuidObject(containerGuid);
MultiplayerUtilities.RequestGuidObject_Tile(this.guid);
}
}
else
{
this.containerObject.updateInfo();
}
if (ModCore.CustomObjects.ContainsKey(oldGuid) && ModCore.CustomObjects.ContainsKey(this.guid))
{
if (ModCore.CustomObjects[oldGuid] == ModCore.CustomObjects[this.guid] && oldGuid != this.guid)
{
//ModCore.CustomObjects.Remove(oldGuid);
}
}
if (string.IsNullOrEmpty(resourcesString) == false)
{
this.producedResources = ModCore.Serializer.DeserializeFromJSONString<List<ResourceInformation>>(resourcesString);
}
else
{
if (this.producedResources == null) this.producedResources = new List<ResourceInformation>();
}
}
}
public List<ResourceInformation> producedResources;
public int energyRequiredPer10Minutes;
public int timeToProduce;
public bool updatesContainerObjectForProduction;
[JsonIgnore]
public bool ProducesItems
{
get
{
return this.producedResources.Count > 0;
}
}
[JsonIgnore]
public bool ConsumesEnergy
{
get
{
if (ModCore.Configs.machinesConfig.doMachinesConsumeEnergy == false) return false;
if (this.energyRequiredPer10Minutes == 0) return false;
if (this.EnergyManager.energyInteractionType == Enums.EnergyInteractionType.Consumes) return true;
return false;
}
}
public Machine() { }
public Machine(CustomObjectData PyTKData, BasicItemInformation info,List<ResourceInformation> ProducedResources=null, int EnergyRequiredPer10Minutes = 0,int TimeToProduce=0,bool UpdatesContainer=false) : base(PyTKData, info) {
this.producedResources = ProducedResources?? new List<ResourceInformation>();
this.energyRequiredPer10Minutes = EnergyRequiredPer10Minutes;
this.timeToProduce = TimeToProduce;
this.updatesContainerObjectForProduction = UpdatesContainer;
this.MinutesUntilReady = TimeToProduce;
}
public Machine(CustomObjectData PyTKData, BasicItemInformation info, Vector2 TileLocation, List<ResourceInformation> ProducedResources=null,int EnergyRequiredPer10Minutes=0,int TimeToProduce=0,bool UpdatesContainer=false,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;
}
public Machine(CustomObjectData PyTKData, BasicItemInformation info, Vector2 TileLocation, Vector2 offsetKey,List<ResourceInformation> ProducedResources=null, int EnergyRequiredPer10Minutes = 0, int TimeToProduce=0,bool UpdatesContainer=false,MultiTiledObject obj = null) : base(PyTKData, info, TileLocation)
{
this.offsetKey = offsetKey;
this.containerObject = obj;
this.producedResources = ProducedResources?? new List<ResourceInformation>();
this.timeToProduce = TimeToProduce;
this.updatesContainerObjectForProduction = UpdatesContainer;
this.MinutesUntilReady = TimeToProduce;
}
public override void updateWhenCurrentLocation(GameTime time, GameLocation environment)
{
base.updateWhenCurrentLocation(time, environment);
}
public override bool minutesElapsed(int minutes, GameLocation environment)
{
if (this.updatesContainerObjectForProduction)
{
//ModCore.log("Update container object for production!");
//this.MinutesUntilReady -= minutes;
int remaining = minutes;
//ModCore.log("Minutes elapsed: " + remaining);
List<MultiTiledObject> energySources = new List<MultiTiledObject>();
if (this.ConsumesEnergy)
{
energySources = this.EnergyGraphSearchSources(); //Only grab the network once.
}
if (this.ProducesItems)
{
//ModCore.log("This produces items!");
while (remaining > 0)
{
if (this.ConsumesEnergy)
{
this.drainEnergyFromNetwork(energySources); //Continually drain from the network.
if (this.EnergyManager.remainingEnergy < this.energyRequiredPer10Minutes) return false;
}
else
{
//ModCore.log("Does not produce energy!");
}
remaining -= 10;
this.containerObject.MinutesUntilReady -= 10;
if (this.containerObject.MinutesUntilReady <= 0)
{
this.produceItem();
this.containerObject.MinutesUntilReady = this.timeToProduce;
}
}
}
if (this.EnergyManager.energyInteractionType == Enums.EnergyInteractionType.Produces)
{
while (remaining > 0)
{
remaining -= 10;
this.produceEnergy();
}
}
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;
if (this.containerObject.info.inventory != null && Game1.activeClickableMenu == null)
{
Game1.activeClickableMenu = new Revitalize.Framework.Menus.InventoryTransferMenu(100, 100, 500, 500, this.containerObject.info.inventory.items, this.containerObject.info.inventory.capacity);
}
//ModCore.playerInfo.sittingInfo.sit(this, Vector2.Zero);
return true;
}
public override Item getOne()
{
Machine component = new Machine(this.data, this.info.Copy(), this.TileLocation, this.offsetKey, this.producedResources,this.energyRequiredPer10Minutes,this.timeToProduce,this.updatesContainerObjectForProduction,this.containerObject);
return component;
}
public override ICustomObject recreate(Dictionary<string, string> 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"]));
Machine self = Revitalize.ModCore.Serializer.DeserializeGUID<Machine>(additionalSaveData["GUID"]);
if (self == null)
{
return null;
}
if (!Revitalize.ModCore.ObjectGroups.ContainsKey(additionalSaveData["ParentGUID"]))
{
//Get new container
MultiTiledObject obj = (MultiTiledObject)Revitalize.ModCore.Serializer.DeserializeGUID<MultiTiledObject>(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.ignoreBoundingBox == true)
{
x *= -1;
y *= -1;
}
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);
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 virtual void produceItem()
{
foreach(ResourceInformation r in this.producedResources)
{
if (r.shouldDropResource())
{
Item i = r.getItemDrops();
this.InventoryManager.addItem(i);
//ModCore.log("Produced an item!");
}
}
}
public virtual void produceEnergy()
{
if (this.EnergyManager.canReceieveEnergy)
{
this.EnergyManager.produceEnergy(this.energyRequiredPer10Minutes);
}
}
}
}

View File

@ -4,7 +4,9 @@ using System.IO;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Newtonsoft.Json;
using PyTK.CustomElementHandler;
using Revitalize.Framework.Energy;
using Revitalize.Framework.Utilities;
using StardewValley;
using StardewValley.Objects;
@ -14,6 +16,7 @@ namespace Revitalize.Framework.Objects
public class MultiTiledComponent : CustomObject,ISaveElement
{
[JsonIgnore]
public override string ItemInfo
{
get
@ -89,6 +92,53 @@ namespace Revitalize.Framework.Objects
public Vector2 offsetKey;
[JsonIgnore]
public override EnergyManager EnergyManager
{
get
{
if (this.info == null || this.containerObject==null)
{
this.updateInfo();
if (this.containerObject == null) return null;
return this.containerObject.info.EnergyManager;
}
else
{
return this.containerObject.info.EnergyManager;
}
}
set
{
this.containerObject.info.EnergyManager = value;
}
}
/// <summary>
/// The inventory for the object.
/// </summary>
[JsonIgnore]
public virtual InventoryManager InventoryManager
{
get
{
if (this.info == null || this.containerObject == null)
{
this.updateInfo();
if (this.containerObject == null) return null;
return this.containerObject.info.inventory;
}
else
{
return this.containerObject.info.inventory;
}
}
set
{
this.containerObject.info.inventory = value;
}
}
public MultiTiledComponent() { }
public MultiTiledComponent(CustomObjectData PyTKData,BasicItemInformation info) : base(PyTKData,info) { }
@ -562,6 +612,17 @@ namespace Revitalize.Framework.Objects
}
}
public void drainEnergyFromNetwork(List<MultiTiledObject> energySources)
{
int index = 0;
for (int i = 0; i < energySources.Count; i++)
{
this.EnergyManager.transferEnergyFromAnother(energySources[i].EnergyManager, this.EnergyManager.capacityRemaining);
if (this.EnergyManager.hasMaxEnergy) break;
}
}
/// <summary>
/// Gets all of the nodes in a connected energy network and tries to store the necessary amount of energy from the network.
/// </summary>

View File

@ -9,6 +9,7 @@ using Revitalize.Framework.Objects.Extras;
using Revitalize.Framework.Objects.Furniture;
using Revitalize.Framework.Objects.Interfaces;
using Revitalize.Framework.Objects.Items.Tools;
using Revitalize.Framework.Objects.Machines;
using Revitalize.Framework.Utilities;
using StardewModdingAPI;
using StardewValley;
@ -147,6 +148,38 @@ namespace Revitalize.Framework.Objects
trashCan.addComponent(new Vector2(0, 1), trash2);
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<InformationFiles.ResourceInformation>()
{
new InformationFiles.ResourceInformation(new StardewValley.Object((int)Enums.SDVObject.Clay,1),1,1,1,1,1,1,0,0,0,0)
}, 0, 10, true);
Machine sandBox_1_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(16, 0, 16, 16)), Color.White, false, new InventoryManager(36), null, null), new List<InformationFiles.ResourceInformation>()
{
new InformationFiles.ResourceInformation(new StardewValley.Object((int)Enums.SDVObject.Clay,1),1,1,1,1,1,1,0,0,0,0)
}, 0, 10, false);
Machine sandBox_0_1 = 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, 16, 16, 16)), Color.White, false, new InventoryManager(36), null, null), new List<InformationFiles.ResourceInformation>()
{
new InformationFiles.ResourceInformation(new StardewValley.Object((int)Enums.SDVObject.Clay,1),1,1,1,1,1,1,0,0,0,0)
}, 0, 10, false);
Machine sandBox_1_1 = 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(16, 16, 16, 16)), Color.White, false, new InventoryManager(36), null, null), new List<InformationFiles.ResourceInformation>()
{
new InformationFiles.ResourceInformation(new StardewValley.Object((int)Enums.SDVObject.Clay,1),1,1,1,1,1,1,0,0,0,0)
}, 0, 10, false);
sandBox.addComponent(new Vector2(0,0),sandBox_0_0);
sandBox.addComponent(new Vector2(1, 0), sandBox_1_0);
sandBox.addComponent(new Vector2(0, 1), sandBox_0_1);
sandBox.addComponent(new Vector2(1, 1), sandBox_1_1);
this.AddItem("SandBox", sandBox);
}
private void loadInTools()

View File

@ -141,7 +141,7 @@ namespace Revitalize.Framework.Objects
}, new List<IntRange>()
{
new IntRange(0,9999)
}, null,null, 0.80d, 0.20d, 0.25d, 1d, 1d, 1, 1, 1, 1), new List<ResourceInformaton>(), 4);
}, null,null, 0.80d, 0.20d, 0.25d, 1d, 1d, 1, 1, 1, 1), new List<ResourceInformation>(), 4);
OreFactoryInfo tinOre_0_0_file = new OreFactoryInfo(tinOre_0_0);
OreFactoryInfo tinOre_file = new OreFactoryInfo(tinOre);
@ -161,7 +161,7 @@ namespace Revitalize.Framework.Objects
}, new List<IntRange>()
{
new IntRange(0,9999)
}, null, null, .70d, 0.16d, 0.20d, 1d, 1d, 0, 0, 0, 0), new List<ResourceInformaton>(), 5);
}, null, null, .70d, 0.16d, 0.20d, 1d, 1d, 0, 0, 0, 0), new List<ResourceInformation>(), 5);
OreFactoryInfo bauxiteOre_0_0_file = new OreFactoryInfo(bauxiteOre_0_0);
OreFactoryInfo bauxiteOre_file = new OreFactoryInfo(bauxiteOre);
@ -181,7 +181,7 @@ namespace Revitalize.Framework.Objects
}, new List<IntRange>()
{
new IntRange(0,9999)
}, null, null, .50d, 0.10d, 0.14d, 1d, 1d, 0, 0, 0, 0), new List<ResourceInformaton>(), 6);
}, null, null, .50d, 0.10d, 0.14d, 1d, 1d, 0, 0, 0, 0), new List<ResourceInformation>(), 6);
OreFactoryInfo silverOre_0_0_file = new OreFactoryInfo(silverOre_0_0);
OreFactoryInfo silverOre_file = new OreFactoryInfo(silverOre);
@ -201,7 +201,7 @@ namespace Revitalize.Framework.Objects
}, new List<IntRange>()
{
new IntRange(0,9999)
}, null, null, .60d, 0.13d, 0.17d, 1d, 1d, 0, 0, 0, 0), new List<ResourceInformaton>(), 7);
}, null, null, .60d, 0.13d, 0.17d, 1d, 1d, 0, 0, 0, 0), new List<ResourceInformation>(), 7);
OreFactoryInfo leadOre_0_0_file = new OreFactoryInfo(leadOre_0_0);
OreFactoryInfo leadOre_file = new OreFactoryInfo(leadOre);
@ -222,7 +222,7 @@ namespace Revitalize.Framework.Objects
}, new List<IntRange>()
{
new IntRange(0,9999)
}, null, null, .40d, 0.05d, 0.10d, 1d, 1d, 0, 0, 0, 0), new List<ResourceInformaton>(), 8);
}, null, null, .40d, 0.05d, 0.10d, 1d, 1d, 0, 0, 0, 0), new List<ResourceInformation>(), 8);
OreFactoryInfo titaniumOre_0_0_file = new OreFactoryInfo(titaniumOre_0_0);
OreFactoryInfo titaniumOre_file = new OreFactoryInfo(titaniumOre);
@ -241,7 +241,7 @@ namespace Revitalize.Framework.Objects
new IntRange(1,9999)
}, new List<IntRange>()
{
}, null, null, .05d, 0.01d, 0.01d, 0.10, 1d, 1, 1, 1,1), new List<ResourceInformaton>(), 10);
}, null, null, .05d, 0.01d, 0.01d, 0.10, 1d, 1, 1, 1,1), new List<ResourceInformation>(), 10);
OreFactoryInfo prismaticOre_0_0_file = new OreFactoryInfo(prismaticOre_0_0);
OreFactoryInfo prismaticOre_file = new OreFactoryInfo(prismaticOre);
@ -336,7 +336,7 @@ namespace Revitalize.Framework.Objects
}
}
public List<ResourceInformaton> getExtraDropInformationFromOres(string id)
public List<ResourceInformation> getExtraDropInformationFromOres(string id)
{
if (this.oreVeins.ContainsKey(id))
{

View File

@ -15,7 +15,7 @@ namespace Revitalize.Framework.Objects.Resources.OreVeins
public class OreVeinObj:MultiTiledObject
{
[JsonIgnore]
public ResourceInformaton resourceInfo
public ResourceInformation resourceInfo
{
get
{

View File

@ -21,7 +21,7 @@ namespace Revitalize.Framework.Objects.Resources.OreVeins
/// Deals with information tied to the resource itself.
/// </summary>
public OreResourceInformation resourceInfo;
public List<ResourceInformaton> extraDrops;
public List<ResourceInformation> extraDrops;
private int _healthValue;
public int healthValue
@ -70,7 +70,7 @@ namespace Revitalize.Framework.Objects.Resources.OreVeins
//Instead of serializing this info it's static pretty much always so just pull the info from the resource manager.
OreResourceInformation oreResource = ModCore.ObjectManager.resources.getOreResourceInfo(this.info.id);
List<ResourceInformaton> extraDrops = ModCore.ObjectManager.resources.getExtraDropInformationFromOres(this.info.id);
List<ResourceInformation> extraDrops = ModCore.ObjectManager.resources.getExtraDropInformationFromOres(this.info.id);
if (this.resourceInfo == null)
{
this.resourceInfo = oreResource;
@ -137,21 +137,21 @@ namespace Revitalize.Framework.Objects.Resources.OreVeins
}
public OreVeinTile(CustomObjectData PyTKData, BasicItemInformation Info, OreResourceInformation Resource,List<ResourceInformaton> ExtraDrops,int Health) : base(PyTKData, Info)
public OreVeinTile(CustomObjectData PyTKData, BasicItemInformation Info, OreResourceInformation Resource,List<ResourceInformation> ExtraDrops,int Health) : base(PyTKData, Info)
{
this.healthValue = Health;
this.resourceInfo = Resource;
this.extraDrops = ExtraDrops != null ? ExtraDrops : new List<ResourceInformaton>();
this.extraDrops = ExtraDrops != null ? ExtraDrops : new List<ResourceInformation>();
this.setHealth(this.healthValue);
this.Price = Info.price;
}
public OreVeinTile(CustomObjectData PyTKData, BasicItemInformation Info, Vector2 TileLocation, OreResourceInformation Resource, List<ResourceInformaton> ExtraDrops,int Health) : base(PyTKData, Info, TileLocation)
public OreVeinTile(CustomObjectData PyTKData, BasicItemInformation Info, Vector2 TileLocation, OreResourceInformation Resource, List<ResourceInformation> ExtraDrops,int Health) : base(PyTKData, Info, TileLocation)
{
this.healthValue = Health;
this.resourceInfo = Resource;
this.extraDrops = ExtraDrops != null ? ExtraDrops : new List<ResourceInformaton>();
this.extraDrops = ExtraDrops != null ? ExtraDrops : new List<ResourceInformation>();
this.setHealth(this.healthValue);
this.Price = Info.price;
}
@ -292,7 +292,7 @@ namespace Revitalize.Framework.Objects.Resources.OreVeins
if (this.extraDrops != null)
{
foreach (ResourceInformaton extra in this.extraDrops)
foreach (ResourceInformation extra in this.extraDrops)
{
if (extra.shouldDropResource())
{

View File

@ -294,6 +294,8 @@ namespace Revitalize
{
TextureManager.AddTextureManager(Manifest, "Furniture");
TextureManager.GetTextureManager(Manifest, "Furniture").searchForTextures(ModHelper, this.ModManifest, Path.Combine("Content", "Graphics", "Objects", "Furniture"));
TextureManager.AddTextureManager(Manifest, "Machines");
TextureManager.GetTextureManager(Manifest, "Machines").searchForTextures(ModHelper, this.ModManifest, Path.Combine("Content", "Graphics", "Objects", "Machines"));
TextureManager.AddTextureManager(Manifest, "InventoryMenu");
TextureManager.GetTextureManager(Manifest, "InventoryMenu").searchForTextures(ModHelper, this.ModManifest, Path.Combine("Content", "Graphics", "Menus", "InventoryMenu"));
TextureManager.AddTextureManager(Manifest, "Resources.Ore");
@ -523,12 +525,16 @@ namespace Revitalize
//Game1.player.addItemToInventory(ObjectManager.getChair("Omegasis.Revitalize.Furniture.Chairs.OakChair"));
Game1.player.addItemToInventoryBool(ObjectManager.GetItem("Workbench"));
//PickaxeExtended pick = new PickaxeExtended(new BasicItemInformation("My First Pickaxe", "Omegasis.Revitalize.Items.Tools.MyFirstPickaxe", "A testing pickaxe. Does it work?", "Tool", Color.SlateGray, 0, 0, false, 500, false, false, TextureManager.GetTexture(Manifest, "Tools", "Pickaxe"), new AnimationManager(TextureManager.GetExtendedTexture(Manifest, "Tools", "Pickaxe"), new Animation(0, 0, 16, 16)), Color.White, true, null, null),2,TextureManager.GetExtendedTexture(Manifest,"Tools","TestingPickaxeWorking"));
Game1.player.addItemsByMenuIfNecessary(new List<Item>()
{
new StardewValley.Object((int)Enums.SDVObject.Wood,100),
ModCore.ObjectManager.GetItem("SteelIngot", 20),
ModCore.ObjectManager.GetItem("TrashCan",1)
ModCore.ObjectManager.GetItem("TrashCan",1),
ModCore.ObjectManager.GetItem("SandBox",1)
});
}

View File

@ -55,6 +55,7 @@
<ItemGroup>
<Compile Include="Framework\Configs\ConfigManager.cs" />
<Compile Include="Framework\Configs\FurnitureConfig.cs" />
<Compile Include="Framework\Configs\GlobalMachineConfig.cs" />
<Compile Include="Framework\Configs\Shops_BlacksmithConfig.cs" />
<Compile Include="Framework\Configs\VanillaMachineRecipeConfig.cs" />
<Compile Include="Framework\Crafting\CraftingRecipeBook.cs" />
@ -145,7 +146,7 @@
<Compile Include="Framework\Objects\InformationFiles\Furniture\ArcadeCabinetInformation.cs" />
<Compile Include="Framework\Objects\InformationFiles\Furniture\ChairInformation.cs" />
<Compile Include="Framework\Objects\InformationFiles\Furniture\TableInformation.cs" />
<Compile Include="Framework\Objects\InformationFiles\ResourceInformaton.cs" />
<Compile Include="Framework\Objects\InformationFiles\ResourceInformation.cs" />
<Compile Include="Framework\Objects\Interfaces\IItemInfo.cs" />
<Compile Include="Framework\Objects\Items\Resources\Ore.cs" />
<Compile Include="Framework\Objects\Items\Tools\AxeExtended.cs" />
@ -386,6 +387,9 @@
<Content Include="Content\Graphics\Objects\Furniture\Tables\Oak Table.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Objects\Machines\Sandbox.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Objects\Resources\Ore\Bauxite.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>