Probably going to quit. Multiplayer can't sync inventories effectively so what's the point?
This commit is contained in:
parent
1c6e04929c
commit
0d373b5d83
|
@ -122,7 +122,7 @@ namespace Revitalize.Framework.Energy
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnergyManager(int Capacity,Enums.EnergyInteractionType EnergyType) : this(0, Capacity,EnergyType)
|
public EnergyManager(int Capacity, Enums.EnergyInteractionType EnergyType) : this(0, Capacity, EnergyType)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,27 +149,21 @@ namespace Revitalize.Framework.Energy
|
||||||
{
|
{
|
||||||
int amountBeforeConsumption = this.remainingEnergy;
|
int amountBeforeConsumption = this.remainingEnergy;
|
||||||
this.remainingEnergy = Math.Max(0, this.remainingEnergy - amount);
|
this.remainingEnergy = Math.Max(0, this.remainingEnergy - amount);
|
||||||
if (this.remainingEnergy != amountBeforeConsumption)
|
|
||||||
{
|
|
||||||
this.requiresUpdate = true;
|
this.requiresUpdate = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void produceEnergy(int amount)
|
public void produceEnergy(int amount)
|
||||||
{
|
{
|
||||||
int amountBeforeProduction = this.remainingEnergy;
|
int amountBeforeProduction = this.remainingEnergy;
|
||||||
this.remainingEnergy = Math.Min(this.maxEnergy, this.remainingEnergy + amount);
|
this.remainingEnergy = Math.Min(this.maxEnergy, this.remainingEnergy + amount);
|
||||||
if (this.remainingEnergy != amountBeforeProduction)
|
|
||||||
{
|
|
||||||
this.requiresUpdate = true;
|
this.requiresUpdate = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void transferEnergyFromAnother(EnergyManager other,int amount)
|
public void transferEnergyFromAnother(EnergyManager other, int amount)
|
||||||
{
|
{
|
||||||
if (this.canReceieveEnergy)
|
if (this.canReceieveEnergy)
|
||||||
{
|
{
|
||||||
int actualAmount = Math.Min(amount,other.remainingEnergy);
|
int actualAmount = Math.Min(amount, other.remainingEnergy);
|
||||||
int selfCapacity = this.capacityRemaining;
|
int selfCapacity = this.capacityRemaining;
|
||||||
this.produceEnergy(Math.Min(actualAmount, selfCapacity));
|
this.produceEnergy(Math.Min(actualAmount, selfCapacity));
|
||||||
other.consumeEnergy(Math.Min(actualAmount, selfCapacity));
|
other.consumeEnergy(Math.Min(actualAmount, selfCapacity));
|
||||||
|
@ -197,7 +191,7 @@ namespace Revitalize.Framework.Energy
|
||||||
|
|
||||||
public EnergyManager Copy()
|
public EnergyManager Copy()
|
||||||
{
|
{
|
||||||
return new EnergyManager(this.maxEnergy,this.energyInteractionType);
|
return new EnergyManager(this.maxEnergy, this.energyInteractionType);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,12 +8,7 @@ namespace Revitalize.Framework.Energy
|
||||||
{
|
{
|
||||||
public interface IEnergyInterface
|
public interface IEnergyInterface
|
||||||
{
|
{
|
||||||
EnergyManager EnergyManager
|
ref EnergyManager GetEnergyManager();
|
||||||
{
|
void SetEnergyManager(ref EnergyManager Manager);
|
||||||
get;
|
|
||||||
set;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@ namespace Revitalize.Framework.Menus
|
||||||
{
|
{
|
||||||
if (this.infoButton.recipe.timeToCraft == 0)
|
if (this.infoButton.recipe.timeToCraft == 0)
|
||||||
{
|
{
|
||||||
this.machine.InventoryManager.dumpBufferToItems();
|
this.machine.GetInventoryManager().dumpBufferToItems();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -145,12 +145,12 @@ namespace Revitalize.Framework.Menus
|
||||||
this.hoverText = "Crafting in progress...";
|
this.hoverText = "Crafting in progress...";
|
||||||
hovered = true;
|
hovered = true;
|
||||||
}
|
}
|
||||||
if (this.machine.MinutesUntilReady == 0 && this.machine.InventoryManager.hasItemsInBuffer)
|
if (this.machine.MinutesUntilReady == 0 && this.machine.GetInventoryManager().hasItemsInBuffer)
|
||||||
{
|
{
|
||||||
this.hoverText = "Items in buffer. Please make room in the inventory for: " + System.Environment.NewLine + this.machine.InventoryManager + " items.";
|
this.hoverText = "Items in buffer. Please make room in the inventory for: " + System.Environment.NewLine + this.machine.GetInventoryManager() + " items.";
|
||||||
hovered = true;
|
hovered = true;
|
||||||
}
|
}
|
||||||
if (this.machine.InventoryManager.IsFull)
|
if (this.machine.GetInventoryManager().IsFull)
|
||||||
{
|
{
|
||||||
this.hoverText = "Inventory is full!";
|
this.hoverText = "Inventory is full!";
|
||||||
hovered = true;
|
hovered = true;
|
||||||
|
@ -196,8 +196,8 @@ namespace Revitalize.Framework.Menus
|
||||||
|
|
||||||
if (this.machine != null)
|
if (this.machine != null)
|
||||||
{
|
{
|
||||||
if (this.machine.InventoryManager.hasItemsInBuffer) canCraft = false;
|
if (this.machine.GetInventoryManager().hasItemsInBuffer) canCraft = false;
|
||||||
if (this.machine.InventoryManager.IsFull) canCraft = false;
|
if (this.machine.GetInventoryManager().IsFull) canCraft = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return canCraft;
|
return canCraft;
|
||||||
|
|
|
@ -57,7 +57,7 @@ namespace Revitalize.Framework.Menus.Machines
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return this.objectSource.EnergyManager;
|
return this.objectSource.GetEnergyManager();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -259,19 +259,7 @@ namespace Revitalize.Framework.Objects
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private InventoryManager _inventory;
|
public InventoryManager inventory;
|
||||||
public InventoryManager inventory
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return this._inventory;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
this._inventory = value;
|
|
||||||
this.requiresUpdate = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private LightManager _lightManager;
|
private LightManager _lightManager;
|
||||||
|
@ -317,7 +305,8 @@ namespace Revitalize.Framework.Objects
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Energy.EnergyManager _energyManager;
|
//private Energy.EnergyManager _energyManager;
|
||||||
|
/*
|
||||||
public Energy.EnergyManager EnergyManager
|
public Energy.EnergyManager EnergyManager
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -330,6 +319,9 @@ namespace Revitalize.Framework.Objects
|
||||||
this.requiresUpdate = true;
|
this.requiresUpdate = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Energy.EnergyManager EnergyManager;
|
||||||
|
|
||||||
private bool _alwaysDrawAbovePlayer;
|
private bool _alwaysDrawAbovePlayer;
|
||||||
public bool AlwaysDrawAbovePlayer
|
public bool AlwaysDrawAbovePlayer
|
||||||
|
@ -399,6 +391,7 @@ namespace Revitalize.Framework.Objects
|
||||||
this.shakeTimer = 0;
|
this.shakeTimer = 0;
|
||||||
this.EnergyManager = new Energy.EnergyManager();
|
this.EnergyManager = new Energy.EnergyManager();
|
||||||
this._alwaysDrawAbovePlayer = false;
|
this._alwaysDrawAbovePlayer = false;
|
||||||
|
this.ColorManager = new ColorManager(Enums.DyeBlendMode.Blend, 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BasicItemInformation(string name, string id, string description, string categoryName, Color categoryColor,int edibility, int fragility, bool isLamp, int price, bool canBeSetOutdoors, bool canBeSetIndoors, Texture2D texture, AnimationManager animationManager, Color drawColor, bool ignoreBoundingBox, InventoryManager Inventory, LightManager Lights,Energy.EnergyManager EnergyManager=null,bool AlwaysDrawAbovePlayer=false,NamedColor DyedColor=null, ColorManager ColorManager=null)
|
public BasicItemInformation(string name, string id, string description, string categoryName, Color categoryColor,int edibility, int fragility, bool isLamp, int price, bool canBeSetOutdoors, bool canBeSetIndoors, Texture2D texture, AnimationManager animationManager, Color drawColor, bool ignoreBoundingBox, InventoryManager Inventory, LightManager Lights,Energy.EnergyManager EnergyManager=null,bool AlwaysDrawAbovePlayer=false,NamedColor DyedColor=null, ColorManager ColorManager=null)
|
||||||
|
@ -453,12 +446,12 @@ namespace Revitalize.Framework.Objects
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public BasicItemInformation Copy()
|
public BasicItemInformation Copy()
|
||||||
{
|
{
|
||||||
return new BasicItemInformation(this.name, this.id,this.description, this.categoryName, this.categoryColor, this.edibility, this.fragility, this.isLamp, this.price, this.canBeSetOutdoors, this.canBeSetIndoors, this.animationManager.getTexture(), this.animationManager, this.DrawColor, this.ignoreBoundingBox, this._inventory.Copy(), this._lightManager.Copy(),this._energyManager.Copy(),this.AlwaysDrawAbovePlayer,this.DyedColor,this.ColorManager);
|
return new BasicItemInformation(this.name, this.id,this.description, this.categoryName, this.categoryColor, this.edibility, this.fragility, this.isLamp, this.price, this.canBeSetOutdoors, this.canBeSetIndoors, this.animationManager.getTexture(), this.animationManager, this.DrawColor, this.ignoreBoundingBox, this.inventory.Copy(), this._lightManager.Copy(),this.EnergyManager.Copy(),this.AlwaysDrawAbovePlayer,this.DyedColor,this.ColorManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool requiresSyncUpdate()
|
public bool requiresSyncUpdate()
|
||||||
{
|
{
|
||||||
return this.requiresUpdate || this.animationManagerRequiresUpdate() || this.inventoryManagerRequiresUpdate() || this.lightManagerRequiresUpdate() || this.energyManagerRequiresUpdate();
|
return this.requiresUpdate || this.animationManagerRequiresUpdate() || this.inventoryManagerRequiresUpdate() || this.lightManagerRequiresUpdate() || this.energyManagerRequiresUpdate() || this.colorManagerRequiresUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void forceUpdate()
|
public void forceUpdate()
|
||||||
|
@ -472,8 +465,8 @@ namespace Revitalize.Framework.Objects
|
||||||
}
|
}
|
||||||
private bool inventoryManagerRequiresUpdate()
|
private bool inventoryManagerRequiresUpdate()
|
||||||
{
|
{
|
||||||
if (this._inventory == null) return false;
|
if (this.inventory == null) return false;
|
||||||
else return this._inventory.requiresUpdate;
|
else return this.inventory.requiresUpdate;
|
||||||
}
|
}
|
||||||
private bool lightManagerRequiresUpdate()
|
private bool lightManagerRequiresUpdate()
|
||||||
{
|
{
|
||||||
|
@ -483,17 +476,35 @@ namespace Revitalize.Framework.Objects
|
||||||
|
|
||||||
private bool energyManagerRequiresUpdate()
|
private bool energyManagerRequiresUpdate()
|
||||||
{
|
{
|
||||||
if (this._energyManager == null) return false;
|
if (this.EnergyManager == null)
|
||||||
else return this._energyManager.requiresUpdate;
|
{
|
||||||
|
//ModCore.log("Energy manager is NULL! " + this.name);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (this.EnergyManager.requiresUpdate)
|
||||||
|
{
|
||||||
|
//ModCore.log("Energy manager requres an update: " + this.name);
|
||||||
|
}
|
||||||
|
return this.EnergyManager.requiresUpdate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool colorManagerRequiresUpdate()
|
||||||
|
{
|
||||||
|
if (this._colorManager == null) return false;
|
||||||
|
else return this._colorManager.requiresUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cleanAfterUpdate()
|
public void cleanAfterUpdate()
|
||||||
{
|
{
|
||||||
this.requiresUpdate = false;
|
this.requiresUpdate = false;
|
||||||
this._inventory.requiresUpdate = false;
|
this.inventory.requiresUpdate = false;
|
||||||
this._animationManager.requiresUpdate = false;
|
this._animationManager.requiresUpdate = false;
|
||||||
this._lightManager.requiresUpdate = false;
|
this._lightManager.requiresUpdate = false;
|
||||||
this._energyManager.requiresUpdate = false;
|
this.EnergyManager.requiresUpdate = false;
|
||||||
|
this._colorManager.requiresUpdate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -20,9 +20,9 @@ namespace Revitalize.Framework.Objects
|
||||||
// -Inventories
|
// -Inventories
|
||||||
|
|
||||||
/// <summary>A custom object template.</summary>
|
/// <summary>A custom object template.</summary>
|
||||||
public class CustomObject : PySObject,IEnergyInterface
|
public class CustomObject : PySObject, IEnergyInterface
|
||||||
{
|
{
|
||||||
|
[JsonIgnore]
|
||||||
public virtual string text
|
public virtual string text
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -42,7 +42,7 @@ namespace Revitalize.Framework.Objects
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
public override string Name
|
public override string Name
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ namespace Revitalize.Framework.Objects
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
[JsonIgnore]
|
||||||
public override string DisplayName
|
public override string DisplayName
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -107,7 +107,7 @@ namespace Revitalize.Framework.Objects
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
public string id
|
public string id
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -130,12 +130,8 @@ namespace Revitalize.Framework.Objects
|
||||||
public GameLocation location
|
public GameLocation location
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
|
||||||
if (this.info == null)
|
|
||||||
{
|
{
|
||||||
this.updateInfo();
|
this.updateInfo();
|
||||||
}
|
|
||||||
|
|
||||||
//ModCore.log("Location Name is: " + this.info.locationName);
|
//ModCore.log("Location Name is: " + this.info.locationName);
|
||||||
if (this._location == null)
|
if (this._location == null)
|
||||||
{
|
{
|
||||||
|
@ -174,30 +170,6 @@ namespace Revitalize.Framework.Objects
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
/// <summary>
|
|
||||||
/// Accesses the energy manager for all objects.
|
|
||||||
/// </summary>
|
|
||||||
public virtual EnergyManager EnergyManager
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (this.info == null)
|
|
||||||
{
|
|
||||||
this.updateInfo();
|
|
||||||
return this.info.EnergyManager;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return this.info.EnergyManager;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
this.info.EnergyManager = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>The display texture for this object.</summary>
|
/// <summary>The display texture for this object.</summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public Texture2D displayTexture => this.animationManager.getTexture();
|
public Texture2D displayTexture => this.animationManager.getTexture();
|
||||||
|
@ -330,13 +302,13 @@ namespace Revitalize.Framework.Objects
|
||||||
MouseState mState = Mouse.GetState();
|
MouseState mState = Mouse.GetState();
|
||||||
KeyboardState keyboardState = Game1.GetKeyboardState();
|
KeyboardState keyboardState = Game1.GetKeyboardState();
|
||||||
|
|
||||||
if (mState.RightButton == ButtonState.Pressed && keyboardState.IsKeyDown(Keys.LeftShift)==false && keyboardState.IsKeyDown(Keys.RightShift)==false)
|
if (mState.RightButton == ButtonState.Pressed && keyboardState.IsKeyDown(Keys.LeftShift) == false && keyboardState.IsKeyDown(Keys.RightShift) == false)
|
||||||
{
|
{
|
||||||
//ModCore.log("Right clicked!");
|
//ModCore.log("Right clicked!");
|
||||||
return this.rightClicked(who);
|
return this.rightClicked(who);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mState.RightButton == ButtonState.Pressed && (keyboardState.IsKeyDown(Keys.LeftShift)==true || keyboardState.IsKeyDown(Keys.RightShift)==true))
|
if (mState.RightButton == ButtonState.Pressed && (keyboardState.IsKeyDown(Keys.LeftShift) == true || keyboardState.IsKeyDown(Keys.RightShift) == true))
|
||||||
return this.shiftRightClicked(who);
|
return this.shiftRightClicked(who);
|
||||||
|
|
||||||
return base.checkForAction(who, justCheckingForActivity);
|
return base.checkForAction(who, justCheckingForActivity);
|
||||||
|
@ -628,7 +600,7 @@ namespace Revitalize.Framework.Objects
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>What happens when the object is drawn when held by a player.</summary>
|
/// <summary>What happens when the object is drawn when held by a player.</summary>
|
||||||
public virtual void drawFullyInMenu(SpriteBatch spriteBatch, Vector2 objectPosition,float Depth)
|
public virtual void drawFullyInMenu(SpriteBatch spriteBatch, Vector2 objectPosition, float Depth)
|
||||||
{
|
{
|
||||||
this.updateInfo();
|
this.updateInfo();
|
||||||
if (this.animationManager == null)
|
if (this.animationManager == null)
|
||||||
|
@ -637,7 +609,7 @@ namespace Revitalize.Framework.Objects
|
||||||
}
|
}
|
||||||
if (this.displayTexture == null) Revitalize.ModCore.log("Display texture is null");
|
if (this.displayTexture == null) Revitalize.ModCore.log("Display texture is null");
|
||||||
|
|
||||||
spriteBatch.Draw(this.displayTexture, objectPosition, this.animationManager.currentAnimation.sourceRectangle, this.info.DrawColor, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None,Depth);
|
spriteBatch.Draw(this.displayTexture, objectPosition, this.animationManager.currentAnimation.sourceRectangle, this.info.DrawColor, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, Depth);
|
||||||
//base.drawWhenHeld(spriteBatch, objectPosition, f);
|
//base.drawWhenHeld(spriteBatch, objectPosition, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -671,7 +643,7 @@ namespace Revitalize.Framework.Objects
|
||||||
{
|
{
|
||||||
if (ModCore.Configs.objectsConfig.showDyedColorName)
|
if (ModCore.Configs.objectsConfig.showDyedColorName)
|
||||||
{
|
{
|
||||||
return this.info.getDyedColorName() +" "+ this.info.name;
|
return this.info.getDyedColorName() + " " + this.info.name;
|
||||||
}
|
}
|
||||||
//Load in a file that has all object names referenced here or something.
|
//Load in a file that has all object names referenced here or something.
|
||||||
return this.info.name;
|
return this.info.name;
|
||||||
|
@ -768,17 +740,43 @@ namespace Revitalize.Framework.Objects
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public override void updateWhenCurrentLocation(GameTime time, GameLocation environment)
|
public override void updateWhenCurrentLocation(GameTime time, GameLocation environment)
|
||||||
{
|
|
||||||
if (this.info == null)
|
|
||||||
{
|
{
|
||||||
this.updateInfo();
|
this.updateInfo();
|
||||||
}
|
|
||||||
|
|
||||||
if (this.location == null)
|
if (this.location == null)
|
||||||
{
|
{
|
||||||
this.location = environment;
|
this.location = environment;
|
||||||
}
|
}
|
||||||
base.updateWhenCurrentLocation(time, environment);
|
base.updateWhenCurrentLocation(time, environment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual ref EnergyManager GetEnergyManager()
|
||||||
|
{
|
||||||
|
if (this.info == null)
|
||||||
|
{
|
||||||
|
this.updateInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
return ref this.info.EnergyManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void SetEnergyManager(ref EnergyManager Manager)
|
||||||
|
{
|
||||||
|
this.info.EnergyManager = Manager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual ref InventoryManager GetInventoryManager()
|
||||||
|
{
|
||||||
|
if (this.info == null)
|
||||||
|
{
|
||||||
|
this.updateInfo();
|
||||||
|
return ref this.info.inventory;
|
||||||
|
}
|
||||||
|
return ref this.info.inventory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void SetInventoryManager(InventoryManager Manager)
|
||||||
|
{
|
||||||
|
this.info.inventory = Manager;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -249,5 +249,15 @@ namespace Revitalize.Framework.Objects.Items.Tools
|
||||||
{
|
{
|
||||||
return this.UpgradeLevel + 1;
|
return this.UpgradeLevel + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ref EnergyManager GetEnergyManager()
|
||||||
|
{
|
||||||
|
return ref this.info.EnergyManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetEnergyManager(ref EnergyManager Manager)
|
||||||
|
{
|
||||||
|
this.info.EnergyManager = Manager;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,17 +22,6 @@ namespace Revitalize.Framework.Objects.Items.Tools
|
||||||
private int hitsToBoulder;
|
private int hitsToBoulder;
|
||||||
private Texture2D energyTexture;
|
private Texture2D energyTexture;
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public EnergyManager EnergyManager
|
|
||||||
{
|
|
||||||
get => this.info.EnergyManager;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
this.info.EnergyManager = value;
|
|
||||||
this.info.requiresUpdate = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public MiningDrill()
|
public MiningDrill()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -75,7 +64,7 @@ namespace Revitalize.Framework.Objects.Items.Tools
|
||||||
{
|
{
|
||||||
this.initializeEnergyTexture();
|
this.initializeEnergyTexture();
|
||||||
}
|
}
|
||||||
spriteBatch.Draw(this.energyTexture, new Rectangle((int)location.X + 8, (int)location.Y + Game1.tileSize / 2, (int)((Game1.tileSize - 16) * this.EnergyManager.energyPercentRemaining), (int)16), new Rectangle(0, 0, 1, 1), EnergyUtilities.GetEnergyRemainingColor(this.EnergyManager), 0f, Vector2.Zero, SpriteEffects.None, layerDepth);
|
spriteBatch.Draw(this.energyTexture, new Rectangle((int)location.X + 8, (int)location.Y + Game1.tileSize / 2, (int)((Game1.tileSize - 16) * this.GetEnergyManager().energyPercentRemaining), (int)16), new Rectangle(0, 0, 1, 1), EnergyUtilities.GetEnergyRemainingColor(this.GetEnergyManager()), 0f, Vector2.Zero, SpriteEffects.None, layerDepth);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool beginUsing(GameLocation location, int x, int y, Farmer who)
|
public override bool beginUsing(GameLocation location, int x, int y, Farmer who)
|
||||||
|
@ -89,7 +78,7 @@ namespace Revitalize.Framework.Objects.Items.Tools
|
||||||
|
|
||||||
public override void endUsing(GameLocation location, Farmer who)
|
public override void endUsing(GameLocation location, Farmer who)
|
||||||
{
|
{
|
||||||
if (this.EnergyManager.hasEnoughEnergy(this.getEnergyConsumptionRate()) == false)
|
if (this.GetEnergyManager().hasEnoughEnergy(this.getEnergyConsumptionRate()) == false)
|
||||||
{
|
{
|
||||||
Game1.toolAnimationDone(who);
|
Game1.toolAnimationDone(who);
|
||||||
who.canReleaseTool = false;
|
who.canReleaseTool = false;
|
||||||
|
@ -148,7 +137,7 @@ namespace Revitalize.Framework.Objects.Items.Tools
|
||||||
public override void DoFunction(GameLocation location, int x, int y, int power, Farmer who)
|
public override void DoFunction(GameLocation location, int x, int y, int power, Farmer who)
|
||||||
{
|
{
|
||||||
//base.DoFunction(location, x, y, power, who);
|
//base.DoFunction(location, x, y, power, who);
|
||||||
if (this.EnergyManager.hasEnoughEnergy(this.getEnergyConsumptionRate()) == true)
|
if (this.GetEnergyManager().hasEnoughEnergy(this.getEnergyConsumptionRate()) == true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -160,7 +149,7 @@ namespace Revitalize.Framework.Objects.Items.Tools
|
||||||
power = who.toolPower;
|
power = who.toolPower;
|
||||||
//who.Stamina -= (float)(2 * (power + 1)) - (float)who.MiningLevel * 0.1f;
|
//who.Stamina -= (float)(2 * (power + 1)) - (float)who.MiningLevel * 0.1f;
|
||||||
//Drain energy here;
|
//Drain energy here;
|
||||||
this.EnergyManager.consumeEnergy(this.getEnergyConsumptionRate());
|
this.GetEnergyManager().consumeEnergy(this.getEnergyConsumptionRate());
|
||||||
//Double check to prevent animation from happening with even no power
|
//Double check to prevent animation from happening with even no power
|
||||||
|
|
||||||
|
|
||||||
|
@ -358,9 +347,9 @@ namespace Revitalize.Framework.Objects.Items.Tools
|
||||||
{
|
{
|
||||||
StringBuilder b = new StringBuilder();
|
StringBuilder b = new StringBuilder();
|
||||||
b.Append("Energy: ");
|
b.Append("Energy: ");
|
||||||
b.Append(this.EnergyManager.remainingEnergy);
|
b.Append(this.GetEnergyManager().remainingEnergy);
|
||||||
b.Append("/");
|
b.Append("/");
|
||||||
b.Append(this.EnergyManager.maxEnergy);
|
b.Append(this.GetEnergyManager().maxEnergy);
|
||||||
b.Append(System.Environment.NewLine);
|
b.Append(System.Environment.NewLine);
|
||||||
b.Append(this.info.description);
|
b.Append(this.info.description);
|
||||||
return b.ToString();
|
return b.ToString();
|
||||||
|
@ -387,5 +376,15 @@ namespace Revitalize.Framework.Objects.Items.Tools
|
||||||
{
|
{
|
||||||
return this.UpgradeLevel + 1;
|
return this.UpgradeLevel + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ref EnergyManager GetEnergyManager()
|
||||||
|
{
|
||||||
|
return ref this.info.EnergyManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetEnergyManager(ref EnergyManager Manager)
|
||||||
|
{
|
||||||
|
this.info.EnergyManager = Manager;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,7 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
|
|
||||||
public override bool minutesElapsed(int minutes, GameLocation environment)
|
public override bool minutesElapsed(int minutes, GameLocation environment)
|
||||||
{
|
{
|
||||||
|
this.updateInfo();
|
||||||
if (this.updatesContainerObjectForProduction)
|
if (this.updatesContainerObjectForProduction)
|
||||||
{
|
{
|
||||||
//ModCore.log("Update container object for production!");
|
//ModCore.log("Update container object for production!");
|
||||||
|
@ -73,22 +74,22 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
int remaining = minutes;
|
int remaining = minutes;
|
||||||
//ModCore.log("Minutes elapsed: " + remaining);
|
//ModCore.log("Minutes elapsed: " + remaining);
|
||||||
List<MultiTiledObject> energySources = new List<MultiTiledObject>();
|
List<MultiTiledObject> energySources = new List<MultiTiledObject>();
|
||||||
if (this.ConsumesEnergy || this.EnergyManager.energyInteractionType == Enums.EnergyInteractionType.Storage)
|
if (this.ConsumesEnergy || this.GetEnergyManager().energyInteractionType == Enums.EnergyInteractionType.Storage)
|
||||||
{
|
{
|
||||||
//ModCore.log("This machine drains energy: " + this.info.name);
|
//ModCore.log("This machine drains energy: " + this.info.name);
|
||||||
energySources = this.EnergyGraphSearchSources(); //Only grab the network once.
|
energySources = this.EnergyGraphSearchSources(); //Only grab the network once.
|
||||||
}
|
}
|
||||||
this.drainEnergyFromNetwork(energySources);
|
this.drainEnergyFromNetwork(energySources);
|
||||||
foreach(Item I in this.InventoryManager.items)
|
foreach(Item I in this.GetInventoryManager().items)
|
||||||
{
|
{
|
||||||
if (I is null) continue;
|
if (I is null) continue;
|
||||||
if (I is IEnergyInterface==false) continue;
|
if (I is IEnergyInterface==false) continue;
|
||||||
IEnergyInterface o = (IEnergyInterface)I;
|
IEnergyInterface o = (IEnergyInterface)I;
|
||||||
if (o.EnergyManager.canReceieveEnergy)
|
if (o.GetEnergyManager().canReceieveEnergy)
|
||||||
{
|
{
|
||||||
this.EnergyManager.transferEnergyToAnother(o.EnergyManager, Math.Min(this.EnergyManager.remainingEnergy, o.EnergyManager.capacityRemaining));
|
this.GetEnergyManager().transferEnergyToAnother(o.GetEnergyManager(), Math.Min(this.GetEnergyManager().remainingEnergy, o.GetEnergyManager().capacityRemaining));
|
||||||
}
|
}
|
||||||
if (this.EnergyManager.hasEnergy == false) break;
|
if (this.GetEnergyManager().hasEnergy == false) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -80,7 +80,7 @@ namespace Revitalize.Framework.Objects.Machines.EnergyGeneration
|
||||||
|
|
||||||
public override void produceEnergy()
|
public override void produceEnergy()
|
||||||
{
|
{
|
||||||
if (this.EnergyManager.canReceieveEnergy)
|
if (this.GetEnergyManager().canReceieveEnergy)
|
||||||
{
|
{
|
||||||
int energy= this.energyRequiredPer10Minutes;
|
int energy= this.energyRequiredPer10Minutes;
|
||||||
if (WeatherUtilities.IsWetWeather())
|
if (WeatherUtilities.IsWetWeather())
|
||||||
|
@ -96,7 +96,7 @@ namespace Revitalize.Framework.Objects.Machines.EnergyGeneration
|
||||||
{
|
{
|
||||||
if (this.location.IsOutdoors == false) return;
|
if (this.location.IsOutdoors == false) return;
|
||||||
}
|
}
|
||||||
this.EnergyManager.produceEnergy(energy);
|
this.GetEnergyManager().produceEnergy(energy);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -104,11 +104,6 @@ namespace Revitalize.Framework.Objects.Machines.EnergyGeneration
|
||||||
public override void draw(SpriteBatch spriteBatch, int x, int y, float alpha = 1f)
|
public override void draw(SpriteBatch spriteBatch, int x, int y, float alpha = 1f)
|
||||||
{
|
{
|
||||||
this.updateInfo();
|
this.updateInfo();
|
||||||
if (this.info.ignoreBoundingBox == true)
|
|
||||||
{
|
|
||||||
x *= -1;
|
|
||||||
y *= -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.info == null)
|
if (this.info == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -64,10 +64,10 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
|
|
||||||
public override bool minutesElapsed(int minutes, GameLocation environment)
|
public override bool minutesElapsed(int minutes, GameLocation environment)
|
||||||
{
|
{
|
||||||
|
this.updateInfo();
|
||||||
if (this.updatesContainerObjectForProduction)
|
if (this.updatesContainerObjectForProduction)
|
||||||
{
|
{
|
||||||
if (this.energyRequiredPer10Minutes != ModCore.Configs.machinesConfig.grinderEnergyConsumption) this.energyRequiredPer10Minutes = ModCore.Configs.machinesConfig.grinderEnergyConsumption;
|
if (this.energyRequiredPer10Minutes != ModCore.Configs.machinesConfig.grinderEnergyConsumption) this.energyRequiredPer10Minutes = ModCore.Configs.machinesConfig.grinderEnergyConsumption;
|
||||||
ModCore.log("Update container object for production!");
|
|
||||||
|
|
||||||
//this.MinutesUntilReady -= minutes;
|
//this.MinutesUntilReady -= minutes;
|
||||||
int remaining = minutes;
|
int remaining = minutes;
|
||||||
|
@ -85,10 +85,10 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
if (this.ConsumesEnergy)
|
if (this.ConsumesEnergy)
|
||||||
{
|
{
|
||||||
this.drainEnergyFromNetwork(energySources); //Continually drain from the network.
|
this.drainEnergyFromNetwork(energySources); //Continually drain from the network.
|
||||||
if (this.EnergyManager.remainingEnergy < ModCore.Configs.machinesConfig.grinderEnergyConsumption) return false;
|
if (this.GetEnergyManager().remainingEnergy < ModCore.Configs.machinesConfig.grinderEnergyConsumption) return false;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.EnergyManager.consumeEnergy(ModCore.Configs.machinesConfig.grinderEnergyConsumption); //Consume the required amount of energy necessary.
|
this.GetEnergyManager().consumeEnergy(ModCore.Configs.machinesConfig.grinderEnergyConsumption); //Consume the required amount of energy necessary.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -98,7 +98,7 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
remaining -= 10;
|
remaining -= 10;
|
||||||
this.containerObject.MinutesUntilReady -= 10;
|
this.containerObject.MinutesUntilReady -= 10;
|
||||||
|
|
||||||
if (this.containerObject.MinutesUntilReady <= 0 && this.InventoryManager.IsFull == false)
|
if (this.containerObject.MinutesUntilReady <= 0 && this.GetInventoryManager().IsFull == false)
|
||||||
{
|
{
|
||||||
this.produceItem();
|
this.produceItem();
|
||||||
this.consumeItemForGrinding();
|
this.consumeItemForGrinding();
|
||||||
|
@ -205,8 +205,11 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
this.drawStatusBubble(spriteBatch, x, y, alpha);
|
this.drawStatusBubble(spriteBatch, x, y, alpha);
|
||||||
|
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
if (this.animationManager.canTickAnimation())
|
||||||
{
|
{
|
||||||
this.animationManager.tickAnimation();
|
this.animationManager.tickAnimation();
|
||||||
|
}
|
||||||
// Log.AsyncC("Tick animation");
|
// Log.AsyncC("Tick animation");
|
||||||
}
|
}
|
||||||
catch (Exception err)
|
catch (Exception err)
|
||||||
|
@ -220,9 +223,9 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
|
|
||||||
public override void produceItem()
|
public override void produceItem()
|
||||||
{
|
{
|
||||||
if (this.InventoryManager.hasItemsInBuffer)
|
if (this.GetInventoryManager().hasItemsInBuffer)
|
||||||
{
|
{
|
||||||
this.InventoryManager.dumpBufferToItems();
|
this.GetInventoryManager().dumpBufferToItems();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,31 +233,31 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
{
|
{
|
||||||
|
|
||||||
Item itemToRemove = null;
|
Item itemToRemove = null;
|
||||||
foreach(Item I in this.InventoryManager.items)
|
foreach(Item I in this.GetInventoryManager().items)
|
||||||
{
|
{
|
||||||
if(I.canStackWith(new StardewValley.Object((int)Enums.SDVObject.CopperOre, 1))){
|
if(I.canStackWith(new StardewValley.Object((int)Enums.SDVObject.CopperOre, 1))){
|
||||||
this.InventoryManager.bufferItems.Add(ModCore.ObjectManager.resources.getResource("CopperSand", 2));
|
this.GetInventoryManager().bufferItems.Add(ModCore.ObjectManager.resources.getResource("CopperSand", 2));
|
||||||
itemToRemove = I;
|
itemToRemove = I;
|
||||||
this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind;
|
this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (I.canStackWith(new StardewValley.Object((int)Enums.SDVObject.IronOre, 1)))
|
if (I.canStackWith(new StardewValley.Object((int)Enums.SDVObject.IronOre, 1)))
|
||||||
{
|
{
|
||||||
this.InventoryManager.bufferItems.Add(ModCore.ObjectManager.resources.getResource("IronSand", 2));
|
this.GetInventoryManager().bufferItems.Add(ModCore.ObjectManager.resources.getResource("IronSand", 2));
|
||||||
itemToRemove = I;
|
itemToRemove = I;
|
||||||
this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind;
|
this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (I.canStackWith(new StardewValley.Object((int)Enums.SDVObject.GoldOre, 1)))
|
if (I.canStackWith(new StardewValley.Object((int)Enums.SDVObject.GoldOre, 1)))
|
||||||
{
|
{
|
||||||
this.InventoryManager.bufferItems.Add(ModCore.ObjectManager.resources.getResource("GoldSand", 2));
|
this.GetInventoryManager().bufferItems.Add(ModCore.ObjectManager.resources.getResource("GoldSand", 2));
|
||||||
itemToRemove = I;
|
itemToRemove = I;
|
||||||
this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind;
|
this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (I.canStackWith(new StardewValley.Object((int)Enums.SDVObject.IridiumOre, 1)))
|
if (I.canStackWith(new StardewValley.Object((int)Enums.SDVObject.IridiumOre, 1)))
|
||||||
{
|
{
|
||||||
this.InventoryManager.bufferItems.Add(ModCore.ObjectManager.resources.getResource("IridiumSand", 2));
|
this.GetInventoryManager().bufferItems.Add(ModCore.ObjectManager.resources.getResource("IridiumSand", 2));
|
||||||
itemToRemove = I;
|
itemToRemove = I;
|
||||||
this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind;
|
this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind;
|
||||||
break;
|
break;
|
||||||
|
@ -262,35 +265,35 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
|
|
||||||
if (I.canStackWith(ModCore.ObjectManager.resources.getOre("BauxiteOre")))
|
if (I.canStackWith(ModCore.ObjectManager.resources.getOre("BauxiteOre")))
|
||||||
{
|
{
|
||||||
this.InventoryManager.bufferItems.Add(ModCore.ObjectManager.resources.getResource("BauxiteSand", 2));
|
this.GetInventoryManager().bufferItems.Add(ModCore.ObjectManager.resources.getResource("BauxiteSand", 2));
|
||||||
itemToRemove = I;
|
itemToRemove = I;
|
||||||
this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind;
|
this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (I.canStackWith(ModCore.ObjectManager.resources.getOre("LeadOre")))
|
if (I.canStackWith(ModCore.ObjectManager.resources.getOre("LeadOre")))
|
||||||
{
|
{
|
||||||
this.InventoryManager.bufferItems.Add(ModCore.ObjectManager.resources.getResource("LeadSand", 2));
|
this.GetInventoryManager().bufferItems.Add(ModCore.ObjectManager.resources.getResource("LeadSand", 2));
|
||||||
itemToRemove = I;
|
itemToRemove = I;
|
||||||
this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind;
|
this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (I.canStackWith(ModCore.ObjectManager.resources.getOre("SilverOre")))
|
if (I.canStackWith(ModCore.ObjectManager.resources.getOre("SilverOre")))
|
||||||
{
|
{
|
||||||
this.InventoryManager.bufferItems.Add(ModCore.ObjectManager.resources.getResource("SilverSand", 2));
|
this.GetInventoryManager().bufferItems.Add(ModCore.ObjectManager.resources.getResource("SilverSand", 2));
|
||||||
itemToRemove = I;
|
itemToRemove = I;
|
||||||
this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind;
|
this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (I.canStackWith(ModCore.ObjectManager.resources.getOre("TinOre")))
|
if (I.canStackWith(ModCore.ObjectManager.resources.getOre("TinOre")))
|
||||||
{
|
{
|
||||||
this.InventoryManager.bufferItems.Add(ModCore.ObjectManager.resources.getResource("TinSand", 2));
|
this.GetInventoryManager().bufferItems.Add(ModCore.ObjectManager.resources.getResource("TinSand", 2));
|
||||||
itemToRemove = I;
|
itemToRemove = I;
|
||||||
this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind;
|
this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (I.canStackWith(ModCore.ObjectManager.resources.getOre("TitaniumOre")))
|
if (I.canStackWith(ModCore.ObjectManager.resources.getOre("TitaniumOre")))
|
||||||
{
|
{
|
||||||
this.InventoryManager.bufferItems.Add(ModCore.ObjectManager.resources.getResource("TitaniumSand", 2));
|
this.GetInventoryManager().bufferItems.Add(ModCore.ObjectManager.resources.getResource("TitaniumSand", 2));
|
||||||
itemToRemove = I;
|
itemToRemove = I;
|
||||||
this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind;
|
this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind;
|
||||||
break;
|
break;
|
||||||
|
@ -298,7 +301,7 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
|
|
||||||
if (I.canStackWith(new StardewValley.Object((int)Enums.SDVObject.Stone, 1)))
|
if (I.canStackWith(new StardewValley.Object((int)Enums.SDVObject.Stone, 1)))
|
||||||
{
|
{
|
||||||
this.InventoryManager.bufferItems.Add(ModCore.ObjectManager.resources.getResource("Sand", 1));
|
this.GetInventoryManager().bufferItems.Add(ModCore.ObjectManager.resources.getResource("Sand", 1));
|
||||||
itemToRemove = I;
|
itemToRemove = I;
|
||||||
this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind;
|
this.containerObject.MinutesUntilReady = ModCore.Configs.machinesConfig.grinderTimeToGrind;
|
||||||
break;
|
break;
|
||||||
|
@ -313,7 +316,7 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
}
|
}
|
||||||
else if (itemToRemove.Stack == 1)
|
else if (itemToRemove.Stack == 1)
|
||||||
{
|
{
|
||||||
this.InventoryManager.items.Remove(itemToRemove);
|
this.GetInventoryManager().items.Remove(itemToRemove);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ using Revitalize.Framework.Menus.Machines;
|
||||||
using Revitalize.Framework.Objects.InformationFiles;
|
using Revitalize.Framework.Objects.InformationFiles;
|
||||||
using Revitalize.Framework.Utilities;
|
using Revitalize.Framework.Utilities;
|
||||||
using StardewValley;
|
using StardewValley;
|
||||||
|
using StardewValley.Objects;
|
||||||
using StardustCore.Animations;
|
using StardustCore.Animations;
|
||||||
using StardustCore.UIUtilities;
|
using StardustCore.UIUtilities;
|
||||||
using StardustCore.UIUtilities.MenuComponents.ComponentsV2.Buttons;
|
using StardustCore.UIUtilities.MenuComponents.ComponentsV2.Buttons;
|
||||||
|
@ -32,12 +33,29 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
string pyTkData = ModCore.Serializer.ToJSONString(this.data);
|
string pyTkData = ModCore.Serializer.ToJSONString(this.data);
|
||||||
string offsetKey = this.offsetKey != null ? ModCore.Serializer.ToJSONString(this.offsetKey) : "";
|
string offsetKey = this.offsetKey != null ? ModCore.Serializer.ToJSONString(this.offsetKey) : "";
|
||||||
string container = this.containerObject != null ? this.containerObject.guid.ToString() : "";
|
string container = this.containerObject != null ? this.containerObject.guid.ToString() : "";
|
||||||
string resources = ModCore.Serializer.ToJSONString(this.producedResources);
|
|
||||||
string energyRequired = this.energyRequiredPer10Minutes.ToString();
|
string energyRequired = this.energyRequiredPer10Minutes.ToString();
|
||||||
string timeToProduce = this.timeToProduce.ToString();
|
string timeToProduce = this.timeToProduce.ToString();
|
||||||
string updatesContainer = this.updatesContainerObjectForProduction.ToString();
|
string updatesContainer = this.updatesContainerObjectForProduction.ToString();
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
return info + "<" + guidStr + "<" + pyTkData + "<" + offsetKey + "<" + container + "<" + resources + "<" + energyRequired + "<" + timeToProduce + "<" + updatesContainer + "<" + this.craftingRecipeBook;
|
b.Append(info);
|
||||||
|
b.Append("<");
|
||||||
|
b.Append(guidStr);
|
||||||
|
b.Append("<");
|
||||||
|
b.Append(pyTkData);
|
||||||
|
b.Append("<");
|
||||||
|
b.Append(offsetKey);
|
||||||
|
b.Append("<");
|
||||||
|
b.Append(container);
|
||||||
|
b.Append("<");
|
||||||
|
b.Append(energyRequired);
|
||||||
|
b.Append("<");
|
||||||
|
b.Append(timeToProduce);
|
||||||
|
b.Append("<");
|
||||||
|
b.Append(updatesContainer);
|
||||||
|
b.Append("<");
|
||||||
|
b.Append(this.craftingRecipeBook);
|
||||||
|
//ModCore.log("Setting info: " + b.ToString());
|
||||||
|
return b.ToString();
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
@ -48,16 +66,16 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
string pyTKData = data[2];
|
string pyTKData = data[2];
|
||||||
string offsetVec = data[3];
|
string offsetVec = data[3];
|
||||||
string containerObject = data[4];
|
string containerObject = data[4];
|
||||||
string resourcesString = data[5];
|
string energyRequired = data[5];
|
||||||
string energyRequired = data[6];
|
string time = data[6];
|
||||||
string time = data[7];
|
string updates = data[7];
|
||||||
string updates = data[8];
|
this.craftingRecipeBook = data[8];
|
||||||
this.craftingRecipeBook = data[9];
|
|
||||||
this.info = (BasicItemInformation)Revitalize.ModCore.Serializer.DeserializeFromJSONString(infoString, typeof(BasicItemInformation));
|
this.info = (BasicItemInformation)Revitalize.ModCore.Serializer.DeserializeFromJSONString(infoString, typeof(BasicItemInformation));
|
||||||
this.data = Revitalize.ModCore.Serializer.DeserializeFromJSONString<CustomObjectData>(pyTKData);
|
this.data = Revitalize.ModCore.Serializer.DeserializeFromJSONString<CustomObjectData>(pyTKData);
|
||||||
this.energyRequiredPer10Minutes = Convert.ToInt32(energyRequired);
|
this.energyRequiredPer10Minutes = Convert.ToInt32(energyRequired);
|
||||||
this.timeToProduce = Convert.ToInt32(time);
|
this.timeToProduce = Convert.ToInt32(time);
|
||||||
this.updatesContainerObjectForProduction = Convert.ToBoolean(updates);
|
this.updatesContainerObjectForProduction = Convert.ToBoolean(updates);
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(offsetVec)) return;
|
if (string.IsNullOrEmpty(offsetVec)) return;
|
||||||
if (string.IsNullOrEmpty(containerObject)) return;
|
if (string.IsNullOrEmpty(containerObject)) return;
|
||||||
this.offsetKey = ModCore.Serializer.DeserializeFromJSONString<Vector2>(offsetVec);
|
this.offsetKey = ModCore.Serializer.DeserializeFromJSONString<Vector2>(offsetVec);
|
||||||
|
@ -104,19 +122,26 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
//ModCore.CustomObjects.Remove(oldGuid);
|
//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;
|
[JsonIgnore]
|
||||||
|
public List<ResourceInformation> producedResources
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return MachineUtilities.GetResourcesProducedByThisMachine(this.info.id);
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (MachineUtilities.ResourcesForMachines == null) MachineUtilities.InitializeResourceList();
|
||||||
|
if (MachineUtilities.ResourcesForMachines.ContainsKey(this.info.id)) return;
|
||||||
|
MachineUtilities.ResourcesForMachines.Add(this.info.id, value);
|
||||||
|
|
||||||
|
|
||||||
|
Chest c = new Chest();
|
||||||
|
}
|
||||||
|
}
|
||||||
public int energyRequiredPer10Minutes;
|
public int energyRequiredPer10Minutes;
|
||||||
public int timeToProduce;
|
public int timeToProduce;
|
||||||
public bool updatesContainerObjectForProduction;
|
public bool updatesContainerObjectForProduction;
|
||||||
|
@ -140,6 +165,7 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
this.updateInfo();
|
||||||
if (ModCore.Configs.machinesConfig.doMachinesConsumeEnergy == false)
|
if (ModCore.Configs.machinesConfig.doMachinesConsumeEnergy == false)
|
||||||
{
|
{
|
||||||
//ModCore.log("Machine config disables energy consumption.");
|
//ModCore.log("Machine config disables energy consumption.");
|
||||||
|
@ -150,12 +176,12 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
//ModCore.log("Machine rquires 0 energy to run.");
|
//ModCore.log("Machine rquires 0 energy to run.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (this.EnergyManager.energyInteractionType == Enums.EnergyInteractionType.Consumes)
|
if (this.GetEnergyManager().energyInteractionType == Enums.EnergyInteractionType.Consumes)
|
||||||
{
|
{
|
||||||
//ModCore.log("Machine does consume energy.");
|
//ModCore.log("Machine does consume energy.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (this.EnergyManager.energyInteractionType == Enums.EnergyInteractionType.Storage)
|
if (this.GetEnergyManager().energyInteractionType == Enums.EnergyInteractionType.Storage)
|
||||||
{
|
{
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -216,20 +242,17 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
|
|
||||||
public override void updateWhenCurrentLocation(GameTime time, GameLocation environment)
|
public override void updateWhenCurrentLocation(GameTime time, GameLocation environment)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
base.updateWhenCurrentLocation(time, environment);
|
base.updateWhenCurrentLocation(time, environment);
|
||||||
|
|
||||||
|
this.animationManager.prepareForNextUpdateTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override bool minutesElapsed(int minutes, GameLocation environment)
|
public override bool minutesElapsed(int minutes, GameLocation environment)
|
||||||
{
|
{
|
||||||
if (this.info == null)
|
|
||||||
{
|
|
||||||
this.updateInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
ModCore.log(this.info.animationManager.currentAnimationName);
|
this.updateInfo();
|
||||||
|
//ModCore.log(this.info.animationManager.currentAnimationName);
|
||||||
|
|
||||||
if (this.updatesContainerObjectForProduction)
|
if (this.updatesContainerObjectForProduction)
|
||||||
{
|
{
|
||||||
|
@ -238,7 +261,7 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
int remaining = minutes;
|
int remaining = minutes;
|
||||||
//ModCore.log("Minutes elapsed: " + remaining);
|
//ModCore.log("Minutes elapsed: " + remaining);
|
||||||
List<MultiTiledObject> energySources = new List<MultiTiledObject>();
|
List<MultiTiledObject> energySources = new List<MultiTiledObject>();
|
||||||
if (this.ConsumesEnergy || this.EnergyManager.energyInteractionType == Enums.EnergyInteractionType.Storage)
|
if (this.ConsumesEnergy || this.GetEnergyManager().energyInteractionType == Enums.EnergyInteractionType.Storage)
|
||||||
{
|
{
|
||||||
//ModCore.log("This machine drains energy: " + this.info.name);
|
//ModCore.log("This machine drains energy: " + this.info.name);
|
||||||
energySources = this.EnergyGraphSearchSources(); //Only grab the network once.
|
energySources = this.EnergyGraphSearchSources(); //Only grab the network once.
|
||||||
|
@ -246,17 +269,16 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
|
|
||||||
if (this.ProducesItems)
|
if (this.ProducesItems)
|
||||||
{
|
{
|
||||||
ModCore.log("This machine produces items: " + this.info.name);
|
|
||||||
while (remaining > 0)
|
while (remaining > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (this.ConsumesEnergy)
|
if (this.ConsumesEnergy)
|
||||||
{
|
{
|
||||||
this.drainEnergyFromNetwork(energySources); //Continually drain from the network.
|
this.drainEnergyFromNetwork(energySources); //Continually drain from the network.
|
||||||
if (this.EnergyManager.remainingEnergy < this.energyRequiredPer10Minutes) return false;
|
if (this.GetEnergyManager().remainingEnergy < this.energyRequiredPer10Minutes) return false;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.EnergyManager.consumeEnergy(this.energyRequiredPer10Minutes); //Consume the required amount of energy necessary.
|
this.GetEnergyManager().consumeEnergy(this.energyRequiredPer10Minutes); //Consume the required amount of energy necessary.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -266,14 +288,14 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
remaining -= 10;
|
remaining -= 10;
|
||||||
this.containerObject.MinutesUntilReady -= 10;
|
this.containerObject.MinutesUntilReady -= 10;
|
||||||
|
|
||||||
if (this.containerObject.MinutesUntilReady <= 0 && this.InventoryManager.IsFull == false)
|
if (this.containerObject.MinutesUntilReady <= 0 && this.GetInventoryManager().IsFull == false)
|
||||||
{
|
{
|
||||||
this.produceItem();
|
this.produceItem();
|
||||||
this.containerObject.MinutesUntilReady = this.timeToProduce;
|
this.containerObject.MinutesUntilReady = this.timeToProduce;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.EnergyManager.energyInteractionType == Enums.EnergyInteractionType.Produces)
|
if (this.GetEnergyManager().energyInteractionType == Enums.EnergyInteractionType.Produces)
|
||||||
{
|
{
|
||||||
while (remaining > 0)
|
while (remaining > 0)
|
||||||
{
|
{
|
||||||
|
@ -286,9 +308,9 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
{
|
{
|
||||||
this.MinutesUntilReady = Math.Max(0, this.MinutesUntilReady - minutes);
|
this.MinutesUntilReady = Math.Max(0, this.MinutesUntilReady - minutes);
|
||||||
|
|
||||||
if (this.InventoryManager.hasItemsInBuffer && this.MinutesUntilReady == 0)
|
if (this.GetInventoryManager().hasItemsInBuffer && this.MinutesUntilReady == 0)
|
||||||
{
|
{
|
||||||
this.InventoryManager.dumpBufferToItems();
|
this.GetInventoryManager().dumpBufferToItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -298,7 +320,7 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
if (this.EnergyManager.energyInteractionType == Enums.EnergyInteractionType.Produces)
|
if (this.GetEnergyManager().energyInteractionType == Enums.EnergyInteractionType.Produces)
|
||||||
{
|
{
|
||||||
this.storeEnergyToNetwork();
|
this.storeEnergyToNetwork();
|
||||||
}
|
}
|
||||||
|
@ -330,15 +352,15 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
MachineSummaryMenu m = new Framework.Menus.Machines.MachineSummaryMenu((Game1.viewport.Width / 2) - 400, 48, 800, 600, Color.White, this.containerObject, this.energyRequiredPer10Minutes);
|
MachineSummaryMenu m = new Framework.Menus.Machines.MachineSummaryMenu((Game1.viewport.Width / 2) - 400, 48, 800, 600, Color.White, this.containerObject, this.energyRequiredPer10Minutes);
|
||||||
machineMenu.addInMenuTab("Summary", new AnimatedButton(new StardustCore.Animations.AnimatedSprite("SummaryTab", new Vector2(), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus", "MenuTab"), new Animation(0, 0, 24, 24)), Color.White), new Rectangle(0, 0, 24, 24), 2f), m, true);
|
machineMenu.addInMenuTab("Summary", new AnimatedButton(new StardustCore.Animations.AnimatedSprite("SummaryTab", new Vector2(), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus", "MenuTab"), new Animation(0, 0, 24, 24)), Color.White), new Rectangle(0, 0, 24, 24), 2f), m, true);
|
||||||
|
|
||||||
if (this.InventoryManager.capacity > 0)
|
if (this.GetInventoryManager().capacity > 0)
|
||||||
{
|
{
|
||||||
InventoryTransferMenu transferMenu = new InventoryTransferMenu(100, 150, 500, 600, this.InventoryManager.items, this.InventoryManager.capacity, this.InventoryManager.displayRows, this.InventoryManager.displayColumns);
|
InventoryTransferMenu transferMenu = new InventoryTransferMenu(100, 150, 500, 600, this.GetInventoryManager().items, this.GetInventoryManager().capacity, this.GetInventoryManager().displayRows, this.GetInventoryManager().displayColumns);
|
||||||
machineMenu.addInMenuTab("Inventory", new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Inventory Tab", new Vector2(), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus", "MenuTab"), new Animation(0, 0, 24, 24)), Color.White), new Rectangle(0, 0, 24, 24), 2f), transferMenu, false);
|
machineMenu.addInMenuTab("Inventory", new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Inventory Tab", new Vector2(), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus", "MenuTab"), new Animation(0, 0, 24, 24)), Color.White), new Rectangle(0, 0, 24, 24), 2f), transferMenu, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(this.craftingRecipeBook) == false)
|
if (string.IsNullOrEmpty(this.craftingRecipeBook) == false)
|
||||||
{
|
{
|
||||||
CraftingMenuV1 craftingMenu = CraftingRecipeBook.CraftingRecipesByGroup[this.craftingRecipeBook].getCraftingMenuForMachine(100, 100, 400, 700, ref this.InventoryManager.items, ref this.InventoryManager.items, this);
|
CraftingMenuV1 craftingMenu = CraftingRecipeBook.CraftingRecipesByGroup[this.craftingRecipeBook].getCraftingMenuForMachine(100, 100, 400, 700, ref this.GetInventoryManager().items, ref this.GetInventoryManager().items, this);
|
||||||
machineMenu.addInMenuTab("Crafting", new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Crafting Tab", new Vector2(), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus", "MenuTab"), new Animation(0, 0, 24, 24)), Color.White), new Rectangle(0, 0, 24, 24), 2f), craftingMenu, false);
|
machineMenu.addInMenuTab("Crafting", new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Crafting Tab", new Vector2(), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus", "MenuTab"), new Animation(0, 0, 24, 24)), Color.White), new Rectangle(0, 0, 24, 24), 2f), craftingMenu, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,11 +406,6 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
public override void draw(SpriteBatch spriteBatch, int x, int y, float alpha = 1f)
|
public override void draw(SpriteBatch spriteBatch, int x, int y, float alpha = 1f)
|
||||||
{
|
{
|
||||||
this.updateInfo();
|
this.updateInfo();
|
||||||
if (this.info.ignoreBoundingBox == true)
|
|
||||||
{
|
|
||||||
x *= -1;
|
|
||||||
y *= -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.info == null)
|
if (this.info == null)
|
||||||
{
|
{
|
||||||
|
@ -427,8 +444,11 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
this.drawStatusBubble(spriteBatch, x, y, alpha);
|
this.drawStatusBubble(spriteBatch, x, y, alpha);
|
||||||
|
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
if (this.animationManager.canTickAnimation())
|
||||||
{
|
{
|
||||||
this.animationManager.tickAnimation();
|
this.animationManager.tickAnimation();
|
||||||
|
}
|
||||||
// Log.AsyncC("Tick animation");
|
// Log.AsyncC("Tick animation");
|
||||||
}
|
}
|
||||||
catch (Exception err)
|
catch (Exception err)
|
||||||
|
@ -448,7 +468,7 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
if (r.shouldDropResource())
|
if (r.shouldDropResource())
|
||||||
{
|
{
|
||||||
Item i = r.getItemDrops();
|
Item i = r.getItemDrops();
|
||||||
this.InventoryManager.addItem(i);
|
this.GetInventoryManager().addItem(i);
|
||||||
//ModCore.log("Produced an item!");
|
//ModCore.log("Produced an item!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -457,9 +477,9 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
|
|
||||||
public virtual void produceEnergy()
|
public virtual void produceEnergy()
|
||||||
{
|
{
|
||||||
if (this.EnergyManager.canReceieveEnergy)
|
if (this.GetEnergyManager().canReceieveEnergy)
|
||||||
{
|
{
|
||||||
this.EnergyManager.produceEnergy(this.energyRequiredPer10Minutes);
|
this.GetEnergyManager().produceEnergy(this.energyRequiredPer10Minutes);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -467,7 +487,10 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
protected virtual void drawStatusBubble(SpriteBatch b, int x, int y, float Alpha)
|
protected virtual void drawStatusBubble(SpriteBatch b, int x, int y, float Alpha)
|
||||||
{
|
{
|
||||||
if (this.updatesContainerObjectForProduction == false) return;
|
if (this.updatesContainerObjectForProduction == false) return;
|
||||||
if (this.InventoryManager.IsFull && this.ProducesItems && ModCore.Configs.machinesConfig.showMachineNotificationBubble_InventoryFull)
|
if (this.machineStatusBubbleBox == null) this.createStatusBubble();
|
||||||
|
this.updateInfo();
|
||||||
|
if (this.GetInventoryManager() == null) return;
|
||||||
|
if (this.GetInventoryManager().IsFull && this.ProducesItems && ModCore.Configs.machinesConfig.showMachineNotificationBubble_InventoryFull)
|
||||||
{
|
{
|
||||||
y--;
|
y--;
|
||||||
float num = (float)(4.0 * Math.Round(Math.Sin(DateTime.UtcNow.TimeOfDay.TotalMilliseconds / 250.0), 2));
|
float num = (float)(4.0 * Math.Round(Math.Sin(DateTime.UtcNow.TimeOfDay.TotalMilliseconds / 250.0), 2));
|
||||||
|
@ -480,6 +503,26 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void updateInfo()
|
||||||
|
{
|
||||||
|
if (this.info == null || this.containerObject == null)
|
||||||
|
{
|
||||||
|
this.ItemInfo = this.text;
|
||||||
|
//ModCore.log("Updated item info!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.requiresUpdate())
|
||||||
|
{
|
||||||
|
//this.ItemInfo = this.text;
|
||||||
|
this.text = this.ItemInfo;
|
||||||
|
this.info.cleanAfterUpdate();
|
||||||
|
this.containerObject.updateInfo();
|
||||||
|
//ModCore.log("Force an update for machine: " + this.info.name);
|
||||||
|
MultiplayerUtilities.RequestUpdateSync(this.guid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ namespace Revitalize.Framework.Objects.Machines
|
||||||
|
|
||||||
public override bool minutesElapsed(int minutes, GameLocation environment)
|
public override bool minutesElapsed(int minutes, GameLocation environment)
|
||||||
{
|
{
|
||||||
|
this.updateInfo();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,52 +92,6 @@ namespace Revitalize.Framework.Objects
|
||||||
|
|
||||||
public Vector2 offsetKey;
|
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() { }
|
||||||
|
|
||||||
|
@ -422,6 +376,7 @@ namespace Revitalize.Framework.Objects
|
||||||
if (this.info == null || this.containerObject==null)
|
if (this.info == null || this.containerObject==null)
|
||||||
{
|
{
|
||||||
this.ItemInfo = this.text;
|
this.ItemInfo = this.text;
|
||||||
|
|
||||||
//ModCore.log("Updated item info!");
|
//ModCore.log("Updated item info!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -460,7 +415,7 @@ namespace Revitalize.Framework.Objects
|
||||||
StardewValley.Object obj = this.location.getObjectAtTile((int)neighborTile.X, (int)neighborTile.Y);
|
StardewValley.Object obj = this.location.getObjectAtTile((int)neighborTile.X, (int)neighborTile.Y);
|
||||||
if (obj is MultiTiledComponent)
|
if (obj is MultiTiledComponent)
|
||||||
{
|
{
|
||||||
if ((obj as MultiTiledComponent).EnergyManager.energyInteractionType == Enums.EnergyInteractionType.Produces || (obj as MultiTiledComponent).EnergyManager.energyInteractionType == Enums.EnergyInteractionType.Transfers || (obj as MultiTiledComponent).EnergyManager.energyInteractionType == Enums.EnergyInteractionType.Storage)
|
if ((obj as MultiTiledComponent).GetEnergyManager().energyInteractionType == Enums.EnergyInteractionType.Produces || (obj as MultiTiledComponent).GetEnergyManager().energyInteractionType == Enums.EnergyInteractionType.Transfers || (obj as MultiTiledComponent).GetEnergyManager().energyInteractionType == Enums.EnergyInteractionType.Storage)
|
||||||
{
|
{
|
||||||
customObjects.Add((MultiTiledComponent)obj);
|
customObjects.Add((MultiTiledComponent)obj);
|
||||||
}
|
}
|
||||||
|
@ -498,7 +453,7 @@ namespace Revitalize.Framework.Objects
|
||||||
StardewValley.Object obj = this.location.getObjectAtTile((int)neighborTile.X, (int)neighborTile.Y);
|
StardewValley.Object obj = this.location.getObjectAtTile((int)neighborTile.X, (int)neighborTile.Y);
|
||||||
if (obj is MultiTiledComponent)
|
if (obj is MultiTiledComponent)
|
||||||
{
|
{
|
||||||
if ((obj as MultiTiledComponent).EnergyManager.energyInteractionType == Enums.EnergyInteractionType.Consumes || (obj as MultiTiledComponent).EnergyManager.energyInteractionType == Enums.EnergyInteractionType.Transfers || (obj as MultiTiledComponent).EnergyManager.energyInteractionType == Enums.EnergyInteractionType.Storage)
|
if ((obj as MultiTiledComponent).GetEnergyManager().energyInteractionType == Enums.EnergyInteractionType.Consumes || (obj as MultiTiledComponent).GetEnergyManager().energyInteractionType == Enums.EnergyInteractionType.Transfers || (obj as MultiTiledComponent).GetEnergyManager().energyInteractionType == Enums.EnergyInteractionType.Storage)
|
||||||
{
|
{
|
||||||
customObjects.Add((MultiTiledComponent)obj);
|
customObjects.Add((MultiTiledComponent)obj);
|
||||||
}
|
}
|
||||||
|
@ -519,15 +474,15 @@ namespace Revitalize.Framework.Objects
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
protected virtual List<MultiTiledComponent> getAppropriateEnergyNeighbors()
|
protected virtual List<MultiTiledComponent> getAppropriateEnergyNeighbors()
|
||||||
{
|
{
|
||||||
if (this.EnergyManager.consumesEnergy)
|
if (this.GetEnergyManager().consumesEnergy)
|
||||||
{
|
{
|
||||||
return this.GetNeighboringOutputEnergySources();
|
return this.GetNeighboringOutputEnergySources();
|
||||||
}
|
}
|
||||||
else if (this.EnergyManager.producesEnergy)
|
else if (this.GetEnergyManager().producesEnergy)
|
||||||
{
|
{
|
||||||
return this.GetNeighboringInputEnergySources();
|
return this.GetNeighboringInputEnergySources();
|
||||||
}
|
}
|
||||||
else if (this.EnergyManager.transfersEnergy)
|
else if (this.GetEnergyManager().transfersEnergy)
|
||||||
{
|
{
|
||||||
List<MultiTiledComponent> objs = new List<MultiTiledComponent>();
|
List<MultiTiledComponent> objs = new List<MultiTiledComponent>();
|
||||||
objs.AddRange(this.GetNeighboringInputEnergySources());
|
objs.AddRange(this.GetNeighboringInputEnergySources());
|
||||||
|
@ -620,8 +575,8 @@ namespace Revitalize.Framework.Objects
|
||||||
|
|
||||||
for(int i = 0; i < energySources.Count; i++)
|
for(int i = 0; i < energySources.Count; i++)
|
||||||
{
|
{
|
||||||
this.EnergyManager.transferEnergyFromAnother(energySources[i].EnergyManager, this.EnergyManager.capacityRemaining);
|
this.GetEnergyManager().transferEnergyFromAnother(energySources[i].GetEnergyManager(), this.GetEnergyManager().capacityRemaining);
|
||||||
if (this.EnergyManager.hasMaxEnergy) break;
|
if (this.GetEnergyManager().hasMaxEnergy) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -631,8 +586,8 @@ namespace Revitalize.Framework.Objects
|
||||||
|
|
||||||
for (int i = 0; i < energySources.Count; i++)
|
for (int i = 0; i < energySources.Count; i++)
|
||||||
{
|
{
|
||||||
this.EnergyManager.transferEnergyFromAnother(energySources[i].EnergyManager, this.EnergyManager.capacityRemaining);
|
this.GetEnergyManager().transferEnergyFromAnother(energySources[i].GetEnergyManager(), this.GetEnergyManager().capacityRemaining);
|
||||||
if (this.EnergyManager.hasMaxEnergy) break;
|
if (this.GetEnergyManager().hasMaxEnergy) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -647,8 +602,8 @@ namespace Revitalize.Framework.Objects
|
||||||
|
|
||||||
for (int i = 0; i < energySources.Count; i++)
|
for (int i = 0; i < energySources.Count; i++)
|
||||||
{
|
{
|
||||||
this.EnergyManager.transferEnergyToAnother(energySources[i].EnergyManager, this.EnergyManager.capacityRemaining);
|
this.GetEnergyManager().transferEnergyToAnother(energySources[i].GetEnergyManager(), this.GetEnergyManager().capacityRemaining);
|
||||||
if (this.EnergyManager.hasEnergy==false) break;
|
if (this.GetEnergyManager().hasEnergy==false) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -659,8 +614,57 @@ namespace Revitalize.Framework.Objects
|
||||||
|
|
||||||
for (int i = 0; i < energySources.Count; i++)
|
for (int i = 0; i < energySources.Count; i++)
|
||||||
{
|
{
|
||||||
this.EnergyManager.transferEnergyToAnother(energySources[i].EnergyManager, this.EnergyManager.capacityRemaining);
|
this.GetEnergyManager().transferEnergyToAnother(energySources[i].GetEnergyManager(), this.GetEnergyManager().capacityRemaining);
|
||||||
if (this.EnergyManager.hasEnergy==false) break;
|
if (this.GetEnergyManager().hasEnergy==false) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override ref EnergyManager GetEnergyManager()
|
||||||
|
{
|
||||||
|
if (this.info == null || this.containerObject == null)
|
||||||
|
{
|
||||||
|
this.updateInfo();
|
||||||
|
if (this.containerObject == null) return ref this.info.EnergyManager;
|
||||||
|
return ref this.containerObject.info.EnergyManager;
|
||||||
|
}
|
||||||
|
return ref this.containerObject.info.EnergyManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void SetEnergyManager(ref EnergyManager Manager)
|
||||||
|
{
|
||||||
|
this.info.EnergyManager = Manager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override ref InventoryManager GetInventoryManager()
|
||||||
|
{
|
||||||
|
if (this.info == null || this.containerObject == null)
|
||||||
|
{
|
||||||
|
this.updateInfo();
|
||||||
|
if (this.containerObject == null)
|
||||||
|
{
|
||||||
|
return ref this.info.inventory;
|
||||||
|
}
|
||||||
|
return ref this.containerObject.info.inventory;
|
||||||
|
}
|
||||||
|
return ref this.containerObject.info.inventory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void SetInventoryManager(InventoryManager Manager)
|
||||||
|
{
|
||||||
|
this.info.inventory = Manager;
|
||||||
|
this.containerObject.info.inventory = Manager;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override bool requiresUpdate()
|
||||||
|
{
|
||||||
|
if (this.info.requiresSyncUpdate() || this.containerObject.info.requiresSyncUpdate())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,7 +183,7 @@ namespace Revitalize.Framework.Objects
|
||||||
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));
|
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>()
|
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(this.resources.getResource("Sand",1),1,1,1,1,1,1,0,0,0,0)
|
new InformationFiles.ResourceInformation(this.resources.getResource("Sand",1),1,1,1,1,1,1,0,0,0,0)
|
||||||
|
|
||||||
}, 0, TimeUtilities.GetMinutesFromTime(0, 1, 0), true,"Workbench");
|
}, 0, TimeUtilities.GetMinutesFromTime(0, 1, 0), true,"Workbench");
|
||||||
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>()
|
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>()
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Revitalize.Framework.Objects.InformationFiles;
|
||||||
|
|
||||||
|
namespace Revitalize.Framework.Utilities
|
||||||
|
{
|
||||||
|
public class MachineUtilities
|
||||||
|
{
|
||||||
|
|
||||||
|
public static Dictionary<string, List<ResourceInformation>> ResourcesForMachines;
|
||||||
|
|
||||||
|
|
||||||
|
public static List<ResourceInformation> GetResourcesProducedByThisMachine(string ID)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (ResourcesForMachines == null) InitializeResourceList();
|
||||||
|
|
||||||
|
if (ResourcesForMachines.ContainsKey(ID))
|
||||||
|
{
|
||||||
|
return ResourcesForMachines[ID];
|
||||||
|
}
|
||||||
|
else if (ID.Equals("Omegasis.Revitalize.Objects.Machines.MiningDrillV1"))
|
||||||
|
{
|
||||||
|
return ModCore.ObjectManager.resources.miningDrillResources.Values.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
return new List<ResourceInformation>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void InitializeResourceList()
|
||||||
|
{
|
||||||
|
|
||||||
|
ResourcesForMachines = new Dictionary<string, List<ResourceInformation>>()
|
||||||
|
{
|
||||||
|
{"Omegasis.Revitalize.Objects.Machines.BatteryBin" ,new List<ResourceInformation>(){
|
||||||
|
new Objects.InformationFiles.ResourceInformation(new StardewValley.Object((int)Enums.SDVObject.BatteryPack,1),1,1,1,1,1,1,0,0,0,0)
|
||||||
|
} },
|
||||||
|
{"Omegasis.Revitalize.Objects.Machines.Sandbox",new List<ResourceInformation>(){
|
||||||
|
new Objects.InformationFiles.ResourceInformation(ModCore.ObjectManager.resources.getResource("Sand",1),1,1,1,1,1,1,0,0,0,0)
|
||||||
|
} }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -335,7 +335,7 @@ namespace Revitalize
|
||||||
*/
|
*/
|
||||||
if (e.Button == SButton.U)
|
if (e.Button == SButton.U)
|
||||||
{
|
{
|
||||||
CraftingMenuV1 craft = new CraftingMenuV1(100, 100, 600, 800, Color.White, Game1.player.Items);
|
CraftingMenuV1 craft = new CraftingMenuV1(100, 100, 600, 800, Color.White, Game1.player.Items.ToList());
|
||||||
craft.addInCraftingPageTab("Default", new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Default Tab", new Vector2(100 + 48, 100 + (24 * 4)), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus", "MenuTabHorizontal"), new Animation(0, 0, 24, 24)), Color.White), new Rectangle(0, 0, 24, 24), 2f));
|
craft.addInCraftingPageTab("Default", new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Default Tab", new Vector2(100 + 48, 100 + (24 * 4)), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus", "MenuTabHorizontal"), new Animation(0, 0, 24, 24)), Color.White), new Rectangle(0, 0, 24, 24), 2f));
|
||||||
craft.addInCraftingRecipe(new Framework.Menus.MenuComponents.CraftingRecipeButton(new Recipe(new List<CraftingRecipeComponent>()
|
craft.addInCraftingRecipe(new Framework.Menus.MenuComponents.CraftingRecipeButton(new Recipe(new List<CraftingRecipeComponent>()
|
||||||
{
|
{
|
||||||
|
|
|
@ -183,6 +183,7 @@
|
||||||
<Compile Include="Framework\Utilities\IntRange.cs" />
|
<Compile Include="Framework\Utilities\IntRange.cs" />
|
||||||
<Compile Include="Framework\Utilities\InventoryManager.cs" />
|
<Compile Include="Framework\Utilities\InventoryManager.cs" />
|
||||||
<Compile Include="Framework\Utilities\LocationUtilities.cs" />
|
<Compile Include="Framework\Utilities\LocationUtilities.cs" />
|
||||||
|
<Compile Include="Framework\Utilities\MachineUtilities.cs" />
|
||||||
<Compile Include="Framework\Utilities\MultiplayerUtilities.cs" />
|
<Compile Include="Framework\Utilities\MultiplayerUtilities.cs" />
|
||||||
<Compile Include="Framework\Utilities\ObjectUtilities.cs" />
|
<Compile Include="Framework\Utilities\ObjectUtilities.cs" />
|
||||||
<Compile Include="Framework\Utilities\PlayerUtilities.cs" />
|
<Compile Include="Framework\Utilities\PlayerUtilities.cs" />
|
||||||
|
|
|
@ -27,6 +27,8 @@ namespace StardustCore.Animations
|
||||||
public bool requiresUpdate;
|
public bool requiresUpdate;
|
||||||
public bool IsNull => this.defaultDrawFrame == null && this.objectTexture == null;
|
public bool IsNull => this.defaultDrawFrame == null && this.objectTexture == null;
|
||||||
|
|
||||||
|
public bool hasRecievedUpdateTick;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks to see if there is an animation playing.
|
/// Checks to see if there is an animation playing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -107,6 +109,7 @@ namespace StardustCore.Animations
|
||||||
this.getNextAnimationFrame();
|
this.getNextAnimationFrame();
|
||||||
this.currentAnimation.tickAnimationFrame();
|
this.currentAnimation.tickAnimationFrame();
|
||||||
//this.requiresUpdate = true;
|
//this.requiresUpdate = true;
|
||||||
|
this.hasRecievedUpdateTick = true;
|
||||||
}
|
}
|
||||||
catch (Exception err)
|
catch (Exception err)
|
||||||
{
|
{
|
||||||
|
@ -115,6 +118,16 @@ namespace StardustCore.Animations
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void prepareForNextUpdateTick()
|
||||||
|
{
|
||||||
|
this.hasRecievedUpdateTick = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool canTickAnimation()
|
||||||
|
{
|
||||||
|
return this.hasRecievedUpdateTick == false;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>Get the next animation frame in the list of animations.</summary>
|
/// <summary>Get the next animation frame in the list of animations.</summary>
|
||||||
private void getNextAnimationFrame()
|
private void getNextAnimationFrame()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue