Added in the mining drill.
This commit is contained in:
parent
3ca7468fb9
commit
1c6e04929c
Binary file not shown.
After Width: | Height: | Size: 829 B |
|
@ -25,6 +25,8 @@ namespace Revitalize.Framework.Configs
|
|||
/// </summary>
|
||||
public GlobalMachineConfig machinesConfig;
|
||||
|
||||
public MiningDrillConfig miningDrillConfig;
|
||||
|
||||
public ConfigManager()
|
||||
{
|
||||
this.vanillaMachineConfig = VanillaMachineRecipeConfig.InitializeConfig();
|
||||
|
@ -32,6 +34,7 @@ namespace Revitalize.Framework.Configs
|
|||
this.furnitureConfig = FurnitureConfig.InitializeConfig();
|
||||
this.machinesConfig = GlobalMachineConfig.InitializeConfig();
|
||||
this.objectsConfig = ObjectsConfig.InitializeConfig();
|
||||
this.miningDrillConfig = MiningDrillConfig.InitializeConfig();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,9 @@ namespace Revitalize.Framework.Configs
|
|||
public int grinderEnergyConsumption;
|
||||
public int grinderTimeToGrind;
|
||||
|
||||
public int miningDrillEnergyConsumption;
|
||||
public int miningDrillTimeToMine;
|
||||
|
||||
public GlobalMachineConfig()
|
||||
{
|
||||
this.doMachinesConsumeEnergy = true;
|
||||
|
@ -28,6 +31,8 @@ namespace Revitalize.Framework.Configs
|
|||
this.machineNotificationBubbleAlpha = 0.75f;
|
||||
this.grinderEnergyConsumption = 20;
|
||||
this.grinderTimeToGrind = 30;
|
||||
this.miningDrillEnergyConsumption = 50;
|
||||
this.miningDrillTimeToMine = 60;
|
||||
}
|
||||
|
||||
public static GlobalMachineConfig InitializeConfig()
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Revitalize.Framework.Objects.InformationFiles;
|
||||
using Revitalize.Framework.Utilities;
|
||||
using StardewValley;
|
||||
|
||||
namespace Revitalize.Framework.Configs
|
||||
{
|
||||
public class MiningDrillConfig
|
||||
{
|
||||
|
||||
public double bauxiteMineChance;
|
||||
public double tinMineChance;
|
||||
public double leadMineChance;
|
||||
public double silverMineChance;
|
||||
public double titaniumMineChance;
|
||||
public double prismaticNuggetMineChance;
|
||||
public double copperMineChance;
|
||||
public double ironMineChance;
|
||||
public double goldMineChance;
|
||||
public double iridiumMineChance;
|
||||
public double stoneMineChance;
|
||||
public double clayMineChance;
|
||||
public double sandMineChance;
|
||||
public double geodeMineChance;
|
||||
public double frozenGeodeMineChance;
|
||||
public double magmaGeodeMineChance;
|
||||
public double omniGeodeMineChance;
|
||||
//If requested put in all gems/minerals here. Otherwise hope that geodes do the trick.
|
||||
|
||||
|
||||
public IntRange amountOfBauxiteToMine;
|
||||
public IntRange amountOfTinToMine;
|
||||
public IntRange amountOfLeadToMine;
|
||||
public IntRange amountOfSilverToMine;
|
||||
public IntRange amountOfTitaniumToMine;
|
||||
public IntRange amountOfPrismaticNuggetsToMine;
|
||||
public IntRange amountOfCopperToMine;
|
||||
public IntRange amountOfIronToMine;
|
||||
public IntRange amountOfGoldToMine;
|
||||
public IntRange amountOfIridiumToMine;
|
||||
public IntRange amountOfStoneToMine;
|
||||
public IntRange amountOfClayToMine;
|
||||
public IntRange amountOfSandToMine;
|
||||
public IntRange amountOfGeodesToMine;
|
||||
public IntRange amountOfFrozenGeodesToMine;
|
||||
public IntRange amountOfMagmaGeodesToMine;
|
||||
public IntRange amountOfOmniGeodesToMine;
|
||||
|
||||
public MiningDrillConfig()
|
||||
{
|
||||
this.bauxiteMineChance = 0.25f;
|
||||
this.tinMineChance = 0.3f;
|
||||
this.leadMineChance = 0.15f;
|
||||
this.silverMineChance = 0.10f;
|
||||
this.titaniumMineChance = 0.05f;
|
||||
this.prismaticNuggetMineChance = 0.005f;
|
||||
this.copperMineChance = 0.35f;
|
||||
this.ironMineChance = 0.20f;
|
||||
this.goldMineChance = 0.10f;
|
||||
this.iridiumMineChance = 0.005f;
|
||||
this.stoneMineChance = 1.0f;
|
||||
this.clayMineChance = 0.30f;
|
||||
this.sandMineChance = 0.20f;
|
||||
this.geodeMineChance = 0.25f;
|
||||
this.frozenGeodeMineChance = 0.15f;
|
||||
this.magmaGeodeMineChance = 0.05f;
|
||||
this.omniGeodeMineChance = 0.01f;
|
||||
|
||||
this.amountOfBauxiteToMine = new IntRange(1, 3);
|
||||
this.amountOfClayToMine = new IntRange(1, 3);
|
||||
this.amountOfCopperToMine = new IntRange(1, 3);
|
||||
this.amountOfFrozenGeodesToMine = new IntRange(1, 1);
|
||||
this.amountOfGeodesToMine = new IntRange(1, 1);
|
||||
this.amountOfGoldToMine = new IntRange(1, 3);
|
||||
this.amountOfIronToMine = new IntRange(1, 3);
|
||||
this.amountOfIridiumToMine = new IntRange(1, 3);
|
||||
this.amountOfLeadToMine = new IntRange(1, 3);
|
||||
this.amountOfMagmaGeodesToMine = new IntRange(1, 1);
|
||||
this.amountOfOmniGeodesToMine = new IntRange(1, 1);
|
||||
this.amountOfPrismaticNuggetsToMine = new IntRange(1, 1);
|
||||
this.amountOfSandToMine = new IntRange(1, 2);
|
||||
this.amountOfSilverToMine = new IntRange(1, 3);
|
||||
this.amountOfStoneToMine = new IntRange(1, 5);
|
||||
this.amountOfTinToMine = new IntRange(1, 3);
|
||||
this.amountOfTitaniumToMine = new IntRange(1, 3);
|
||||
}
|
||||
|
||||
|
||||
public static MiningDrillConfig InitializeConfig()
|
||||
{
|
||||
if (File.Exists(Path.Combine(ModCore.ModHelper.DirectoryPath, "Configs", "MiningDrillMachine.json")))
|
||||
return ModCore.ModHelper.Data.ReadJsonFile<MiningDrillConfig>(Path.Combine("Configs", "MiningDrillMachine.json"));
|
||||
else
|
||||
{
|
||||
MiningDrillConfig Config = new MiningDrillConfig();
|
||||
ModCore.ModHelper.Data.WriteJsonFile<MiningDrillConfig>(Path.Combine("Configs", "MiningDrillMachine.json"), Config);
|
||||
return Config;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -131,6 +131,11 @@ namespace Revitalize.Framework.Objects
|
|||
{
|
||||
get
|
||||
{
|
||||
if (this.info == null)
|
||||
{
|
||||
this.updateInfo();
|
||||
}
|
||||
|
||||
//ModCore.log("Location Name is: " + this.info.locationName);
|
||||
if (this._location == null)
|
||||
{
|
||||
|
@ -764,6 +769,11 @@ namespace Revitalize.Framework.Objects
|
|||
|
||||
public override void updateWhenCurrentLocation(GameTime time, GameLocation environment)
|
||||
{
|
||||
if (this.info == null)
|
||||
{
|
||||
this.updateInfo();
|
||||
}
|
||||
|
||||
if (this.location == null)
|
||||
{
|
||||
this.location = environment;
|
||||
|
|
|
@ -216,12 +216,21 @@ namespace Revitalize.Framework.Objects.Machines
|
|||
|
||||
public override void updateWhenCurrentLocation(GameTime time, GameLocation environment)
|
||||
{
|
||||
|
||||
|
||||
base.updateWhenCurrentLocation(time, environment);
|
||||
}
|
||||
|
||||
|
||||
public override bool minutesElapsed(int minutes, GameLocation environment)
|
||||
{
|
||||
if (this.info == null)
|
||||
{
|
||||
this.updateInfo();
|
||||
}
|
||||
|
||||
ModCore.log(this.info.animationManager.currentAnimationName);
|
||||
|
||||
if (this.updatesContainerObjectForProduction)
|
||||
{
|
||||
//ModCore.log("Update container object for production!");
|
||||
|
|
|
@ -92,8 +92,8 @@ namespace Revitalize.Framework.Objects.Machines
|
|||
public override Dictionary<string, string> getAdditionalSaveData()
|
||||
{
|
||||
Dictionary<string, string> saveData = base.getAdditionalSaveData();
|
||||
saveData.Add("GUID", this.guid.ToString());
|
||||
Revitalize.ModCore.Serializer.SerializeGUID(this.guid.ToString(), this);
|
||||
//saveData.Add("GUID", this.guid.ToString());
|
||||
//Revitalize.ModCore.Serializer.SerializeGUID(this.guid.ToString(), this);
|
||||
return saveData;
|
||||
}
|
||||
|
||||
|
|
|
@ -451,7 +451,7 @@ namespace Revitalize.Framework.Objects
|
|||
{
|
||||
Dictionary<string, string> saveData = base.getAdditionalSaveData();
|
||||
saveData.Add("GUID", this.guid.ToString());
|
||||
Revitalize.ModCore.Serializer.SerializeGUID(this.guid.ToString(), this);
|
||||
//Revitalize.ModCore.Serializer.SerializeGUID(this.guid.ToString(), this);
|
||||
return saveData;
|
||||
}
|
||||
|
||||
|
|
|
@ -268,6 +268,34 @@ namespace Revitalize.Framework.Objects
|
|||
grinder.addComponent(new Vector2(1, 1), grinder_1_1);
|
||||
this.AddItem("Grinder", grinder);
|
||||
|
||||
MultiTiledObject miningDrillMachine = new MultiTiledObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.MiningDrillV1", TextureManager.GetTexture(ModCore.Manifest, "Machines", "MiningDrillMachine"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Mining Drill", "Omegasis.Revitalize.Objects.Machines.MiningDrill", "Digs up rocks and ores. Requires energy to run.", "Machine", Color.SteelBlue, -300, 0, false, 4000, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "MiningDrillMachine"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "MiningDrillMachine"), new Animation(0, 0, 16, 16)), Color.White, false, new InventoryManager(18, 3, 6), null, new Energy.EnergyManager(1000, Enums.EnergyInteractionType.Consumes)));
|
||||
Machine miningDrillMachine_0_0 = new Machine(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.MiningDrillV1", TextureManager.GetTexture(ModCore.Manifest, "Machines", "MiningDrillMachine"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Mining Drill", "Omegasis.Revitalize.Objects.Machines.MiningDrill", "Digs up rocks and ores. Requires energy to run.", "Machine", Color.SteelBlue, -300, 0, false, 4000, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "MiningDrillMachine"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "MiningDrillMachine"), new Animation(0, 0, 16, 16), new Dictionary<string, List<Animation>>() {
|
||||
{"Default",new List<Animation>(){new Animation(0,0,16,16) } },
|
||||
{ "Mining",new List<Animation>(){
|
||||
new Animation(0,0,16,16,30),
|
||||
new Animation(16,0,16,16,30),
|
||||
new Animation(32,0,16,16,30),
|
||||
new Animation(48,0,16,16,30),
|
||||
} }
|
||||
}, "Mining"), Color.White, false, new InventoryManager(18, 3, 6), null, new Energy.EnergyManager(1000, Enums.EnergyInteractionType.Consumes)), ModCore.ObjectManager.resources.miningDrillResources.Values.ToList(), ModCore.Configs.machinesConfig.miningDrillEnergyConsumption, ModCore.Configs.machinesConfig.miningDrillTimeToMine, true, "");
|
||||
|
||||
Machine miningDrillMachine_0_1 = new Machine(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Machines.MiningDrillV1", TextureManager.GetTexture(ModCore.Manifest, "Machines", "MiningDrillMachine"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("Mining Drill", "Omegasis.Revitalize.Objects.Machines.MiningDrill", "Digs up rocks and ores. Requires energy to run.", "Machine", Color.SteelBlue, -300, 0, false, 4000, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "MiningDrillMachine"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "MiningDrillMachine"), new Animation(0, 16, 16, 16),new Dictionary<string, List<Animation>>() {
|
||||
{"Default",new List<Animation>(){new Animation(0,16,16,16) } },
|
||||
{ "Mining",new List<Animation>(){
|
||||
new Animation(0,16,16,16,30),
|
||||
new Animation(16,16,16,16,30),
|
||||
new Animation(32,16,16,16,30),
|
||||
new Animation(48,16,16,16,30),
|
||||
} }
|
||||
}, "Mining"), Color.White, false, new InventoryManager(18, 3, 6), null, new Energy.EnergyManager(1000, Enums.EnergyInteractionType.Consumes)), ModCore.ObjectManager.resources.miningDrillResources.Values.ToList(), ModCore.Configs.machinesConfig.miningDrillEnergyConsumption, ModCore.Configs.machinesConfig.miningDrillTimeToMine, false, "");
|
||||
miningDrillMachine.addComponent(new Vector2(0, 0), miningDrillMachine_0_0);
|
||||
miningDrillMachine.addComponent(new Vector2(0, 1), miningDrillMachine_0_1);
|
||||
miningDrillMachine_0_0.animationManager.setAnimation("Mining");
|
||||
miningDrillMachine_0_0.animationManager.playAnimation("Mining");
|
||||
miningDrillMachine_0_1.animationManager.setAnimation("Mining");
|
||||
miningDrillMachine_0_1.animationManager.playAnimation("Mining");
|
||||
this.AddItem("MiningDrillMachineV1",miningDrillMachine);
|
||||
|
||||
}
|
||||
|
||||
private void loadInWires()
|
||||
|
|
|
@ -32,6 +32,8 @@ namespace Revitalize.Framework.Objects
|
|||
public Dictionary<string, Ore> ores;
|
||||
public Dictionary<string, CustomObject> resources;
|
||||
|
||||
public Dictionary<string, ResourceInformation> miningDrillResources;
|
||||
|
||||
/// <summary>
|
||||
/// A list of all visited floors on the current visit to the mines.
|
||||
/// </summary>
|
||||
|
@ -48,7 +50,7 @@ namespace Revitalize.Framework.Objects
|
|||
this.ores = new Dictionary<string, Ore>();
|
||||
this.visitedFloors = new List<int>();
|
||||
this.resources = new Dictionary<string, CustomObject>();
|
||||
|
||||
this.miningDrillResources = new Dictionary<string, ResourceInformation>();
|
||||
}
|
||||
|
||||
|
||||
|
@ -59,6 +61,28 @@ namespace Revitalize.Framework.Objects
|
|||
this.loadInResourceItems();
|
||||
this.serializeOreVeins();
|
||||
this.loadOreVeins();
|
||||
this.loadInMiningDrillLootTable();
|
||||
}
|
||||
|
||||
private void loadInMiningDrillLootTable()
|
||||
{
|
||||
this.miningDrillResources.Add("Bauxite", new ResourceInformation(this.getResource("Bauxite"), ModCore.Configs.miningDrillConfig.amountOfBauxiteToMine.min, ModCore.Configs.miningDrillConfig.amountOfBauxiteToMine.max, 1, 1, 1,ModCore.Configs.miningDrillConfig.bauxiteMineChance, 0, 0, 0, 0));
|
||||
this.miningDrillResources.Add("Tin", new ResourceInformation(this.getResource("Tin"), ModCore.Configs.miningDrillConfig.amountOfTinToMine.min, ModCore.Configs.miningDrillConfig.amountOfTinToMine.max, 1, 1,1,ModCore.Configs.miningDrillConfig.tinMineChance, 0, 0, 0, 0));
|
||||
this.miningDrillResources.Add("Lead", new ResourceInformation(this.getResource("Lead"), ModCore.Configs.miningDrillConfig.amountOfLeadToMine.min, ModCore.Configs.miningDrillConfig.amountOfLeadToMine.max, 1, 1, 1,ModCore.Configs.miningDrillConfig.leadMineChance, 0, 0, 0, 0));
|
||||
this.miningDrillResources.Add("Silver", new ResourceInformation(this.getResource("Silver"), ModCore.Configs.miningDrillConfig.amountOfSilverToMine.min, ModCore.Configs.miningDrillConfig.amountOfSilverToMine.max, 1, 1, 1,ModCore.Configs.miningDrillConfig.silverMineChance, 0, 0, 0, 0));
|
||||
this.miningDrillResources.Add("Titanium", new ResourceInformation(this.getResource("Titanium"), ModCore.Configs.miningDrillConfig.amountOfTitaniumToMine.min, ModCore.Configs.miningDrillConfig.amountOfTitaniumToMine.max, 1, 1, 1,ModCore.Configs.miningDrillConfig.titaniumMineChance, 0, 0, 0, 0));
|
||||
this.miningDrillResources.Add("Prismatic", new ResourceInformation(this.getResource("PrismaticNugget"), ModCore.Configs.miningDrillConfig.amountOfPrismaticNuggetsToMine.min, ModCore.Configs.miningDrillConfig.amountOfPrismaticNuggetsToMine.max, 1, 1, 1,ModCore.Configs.miningDrillConfig.prismaticNuggetMineChance, 0, 0, 0, 0));
|
||||
this.miningDrillResources.Add("Copper", new ResourceInformation(new StardewValley.Object((int)Enums.SDVObject.CopperOre, 1), ModCore.Configs.miningDrillConfig.amountOfCopperToMine.min, ModCore.Configs.miningDrillConfig.amountOfCopperToMine.max, 1, 1, 1,ModCore.Configs.miningDrillConfig.copperMineChance, 0, 0, 0, 0));
|
||||
this.miningDrillResources.Add("Iron", new ResourceInformation(new StardewValley.Object((int)Enums.SDVObject.IronOre, 1), ModCore.Configs.miningDrillConfig.amountOfIronToMine.min, ModCore.Configs.miningDrillConfig.amountOfIronToMine.max, 1, 1, 1,ModCore.Configs.miningDrillConfig.ironMineChance, 0, 0, 0, 0));
|
||||
this.miningDrillResources.Add("Gold", new ResourceInformation(new StardewValley.Object((int)Enums.SDVObject.GoldOre, 1), ModCore.Configs.miningDrillConfig.amountOfGoldToMine.min, ModCore.Configs.miningDrillConfig.amountOfGoldToMine.max, 1, 1, 1,ModCore.Configs.miningDrillConfig.goldMineChance, 0, 0, 0, 0));
|
||||
this.miningDrillResources.Add("Iridium", new ResourceInformation(new StardewValley.Object((int)Enums.SDVObject.IridiumOre,1), ModCore.Configs.miningDrillConfig.amountOfIridiumToMine.min, ModCore.Configs.miningDrillConfig.amountOfIridiumToMine.max, 1, 1, 1,ModCore.Configs.miningDrillConfig.iridiumMineChance, 0, 0, 0, 0));
|
||||
this.miningDrillResources.Add("Stone", new ResourceInformation(new StardewValley.Object((int)Enums.SDVObject.Stone, 1), ModCore.Configs.miningDrillConfig.amountOfStoneToMine.min, ModCore.Configs.miningDrillConfig.amountOfStoneToMine.max, 1, 1, 1,ModCore.Configs.miningDrillConfig.stoneMineChance, 0, 0, 0, 0));
|
||||
this.miningDrillResources.Add("Clay", new ResourceInformation(new StardewValley.Object((int)Enums.SDVObject.Clay, 1), ModCore.Configs.miningDrillConfig.amountOfClayToMine.min, ModCore.Configs.miningDrillConfig.amountOfClayToMine.max, 1, 1, 1,ModCore.Configs.miningDrillConfig.clayMineChance, 0, 0, 0, 0));
|
||||
this.miningDrillResources.Add("Sand", new ResourceInformation(this.getResource("Sand"), ModCore.Configs.miningDrillConfig.amountOfSandToMine.min, ModCore.Configs.miningDrillConfig.amountOfSandToMine.max, 1, 1, 1,ModCore.Configs.miningDrillConfig.sandMineChance, 0, 0, 0, 0));
|
||||
this.miningDrillResources.Add("Geode", new ResourceInformation(new StardewValley.Object((int)Enums.SDVObject.Geode,1), ModCore.Configs.miningDrillConfig.amountOfGeodesToMine.min, ModCore.Configs.miningDrillConfig.amountOfGeodesToMine.max, 1, 1, 1,ModCore.Configs.miningDrillConfig.geodeMineChance, 0, 0, 0, 0));
|
||||
this.miningDrillResources.Add("FrozenGeode", new ResourceInformation(new StardewValley.Object((int)Enums.SDVObject.FrozenGeode, 1), ModCore.Configs.miningDrillConfig.amountOfFrozenGeodesToMine.min, ModCore.Configs.miningDrillConfig.amountOfFrozenGeodesToMine.max, 1, 1, 1,ModCore.Configs.miningDrillConfig.frozenGeodeMineChance, 0, 0, 0, 0));
|
||||
this.miningDrillResources.Add("MagmaGeode", new ResourceInformation(new StardewValley.Object((int)Enums.SDVObject.MagmaGeode, 1), ModCore.Configs.miningDrillConfig.amountOfMagmaGeodesToMine.min, ModCore.Configs.miningDrillConfig.amountOfMagmaGeodesToMine.max, 1, 1, 1,ModCore.Configs.miningDrillConfig.magmaGeodeMineChance, 0, 0, 0, 0));
|
||||
this.miningDrillResources.Add("OmniGeode", new ResourceInformation(new StardewValley.Object((int)Enums.SDVObject.OmniGeode, 1), ModCore.Configs.miningDrillConfig.amountOfOmniGeodesToMine.min, ModCore.Configs.miningDrillConfig.amountOfOmniGeodesToMine.max, 1, 1, 1,ModCore.Configs.miningDrillConfig.omniGeodeMineChance, 0, 0, 0, 0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -573,7 +573,8 @@ namespace Revitalize
|
|||
ModCore.ObjectManager.GetItem("Grinder",1),
|
||||
new StardewValley.Object((int)Enums.SDVObject.CopperOre,10),
|
||||
ModCore.ObjectManager.GetTool("MiningDrillV1"),
|
||||
ModCore.ObjectManager.GetTool("ChainsawV1")
|
||||
ModCore.ObjectManager.GetTool("ChainsawV1"),
|
||||
ModCore.ObjectManager.GetItem("MiningDrillMachineV1")
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
<Compile Include="Framework\Configs\ConfigManager.cs" />
|
||||
<Compile Include="Framework\Configs\FurnitureConfig.cs" />
|
||||
<Compile Include="Framework\Configs\GlobalMachineConfig.cs" />
|
||||
<Compile Include="Framework\Configs\MiningDrillConfig.cs" />
|
||||
<Compile Include="Framework\Configs\ObjectsConfig.cs" />
|
||||
<Compile Include="Framework\Configs\Shops_BlacksmithConfig.cs" />
|
||||
<Compile Include="Framework\Configs\VanillaMachineRecipeConfig.cs" />
|
||||
|
@ -483,6 +484,9 @@
|
|||
<Content Include="Content\Graphics\Objects\Machines\Grinder.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Graphics\Objects\Machines\MiningDrillMachine.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Graphics\Objects\Machines\Sandbox.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
|
|
@ -84,7 +84,11 @@ namespace StardustCore.Animations
|
|||
|
||||
this.animations = animationString;
|
||||
if (this.animations.TryGetValue(startingAnimationKey, out this.currentAnimationList))
|
||||
{
|
||||
this.setAnimation(startingAnimationKey, startingAnimationFrame);
|
||||
this.playAnimation(startingAnimationKey, true, startingAnimationFrame);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
this.currentAnimation = this.defaultDrawFrame;
|
||||
|
@ -100,9 +104,9 @@ namespace StardustCore.Animations
|
|||
if (this.currentAnimation.frameDuration == -1 || !this.enabled || this.currentAnimation == this.defaultDrawFrame)
|
||||
return; //This is if this is a default animation or the animation stops here.
|
||||
if (this.currentAnimation.frameCountUntilNextAnimation == 0)
|
||||
this.getNextAnimation();
|
||||
this.getNextAnimationFrame();
|
||||
this.currentAnimation.tickAnimationFrame();
|
||||
this.requiresUpdate = true;
|
||||
//this.requiresUpdate = true;
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
|
@ -112,25 +116,30 @@ namespace StardustCore.Animations
|
|||
}
|
||||
|
||||
/// <summary>Get the next animation frame in the list of animations.</summary>
|
||||
private void getNextAnimation()
|
||||
private void getNextAnimationFrame()
|
||||
{
|
||||
this.currentAnimationListIndex++;
|
||||
if (this.currentAnimationListIndex == this.currentAnimationList.Count) //If the animation frame I'm tryting to get is 1 outside my list length, reset the list.
|
||||
if (this.currentAnimationListIndex == this.currentAnimationList.Count)
|
||||
{ //If the animation frame I'm tryting to get is 1 outside my list length, reset the list.
|
||||
if (this.loopAnimation)
|
||||
{
|
||||
this.currentAnimationListIndex = 0;
|
||||
this.currentAnimation = this.currentAnimationList[this.currentAnimationListIndex];
|
||||
this.currentAnimation.startAnimation();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.requiresUpdate = true;
|
||||
//this.requiresUpdate = true;
|
||||
this.playDefaultAnimation();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//Get the next animation from the list and reset it's counter to the starting frame value.
|
||||
this.currentAnimation = this.currentAnimationList[this.currentAnimationListIndex];
|
||||
this.currentAnimation.startAnimation();
|
||||
this.requiresUpdate = true;
|
||||
//this.requiresUpdate = true;
|
||||
}
|
||||
|
||||
/// <summary>Gets the animation from the dictionary of all animations available.</summary>
|
||||
|
@ -171,7 +180,7 @@ namespace StardustCore.Animations
|
|||
/// <param name="overrideSameAnimation"></param>
|
||||
/// <param name="StartingFrame"></param>
|
||||
/// <returns></returns>
|
||||
public bool playAnimation(string AnimationName,bool overrideSameAnimation=false,int StartingFrame = 0)
|
||||
public bool playAnimation(string AnimationName, bool overrideSameAnimation = false, int StartingFrame = 0)
|
||||
{
|
||||
if (this.animations.TryGetValue(AnimationName, out List<Animation> dummyList))
|
||||
{
|
||||
|
@ -379,7 +388,7 @@ namespace StardustCore.Animations
|
|||
/// <param name="scale"></param>
|
||||
/// <param name="flipped"></param>
|
||||
/// <param name="depth"></param>
|
||||
public void draw(SpriteBatch b,Vector2 Position,Color drawColor,float scale,SpriteEffects flipped,float depth)
|
||||
public void draw(SpriteBatch b, Vector2 Position, Color drawColor, float scale, SpriteEffects flipped, float depth)
|
||||
{
|
||||
b.Draw(this.objectTexture.texture, Position, this.currentAnimation.sourceRectangle, drawColor, 0f, Vector2.Zero, scale, flipped, depth);
|
||||
try
|
||||
|
@ -393,7 +402,7 @@ namespace StardustCore.Animations
|
|||
}
|
||||
}
|
||||
|
||||
public void draw(SpriteBatch b, Vector2 Position, Color drawColor, float scale,float Rotation ,SpriteEffects flipped, float depth)
|
||||
public void draw(SpriteBatch b, Vector2 Position, Color drawColor, float scale, float Rotation, SpriteEffects flipped, float depth)
|
||||
{
|
||||
b.Draw(this.objectTexture.texture, Position, this.currentAnimation.sourceRectangle, drawColor, Rotation, Vector2.Zero, scale, flipped, depth);
|
||||
try
|
||||
|
@ -430,7 +439,7 @@ namespace StardustCore.Animations
|
|||
}
|
||||
}
|
||||
|
||||
public void draw(SpriteBatch b, Vector2 Position, Color drawColor, Vector2 scale, float Rotation,SpriteEffects flipped, float depth)
|
||||
public void draw(SpriteBatch b, Vector2 Position, Color drawColor, Vector2 scale, float Rotation, SpriteEffects flipped, float depth)
|
||||
{
|
||||
b.Draw(this.objectTexture.texture, Position, this.currentAnimation.sourceRectangle, drawColor, Rotation, Vector2.Zero, scale, flipped, depth);
|
||||
try
|
||||
|
|
Loading…
Reference in New Issue