Skip to content

Commit

Permalink
Merge branch 'develop' into feature/npc-schedules
Browse files Browse the repository at this point in the history
  • Loading branch information
b3nk3lly committed Oct 30, 2024
2 parents 30928fd + 8f39cce commit e77755f
Show file tree
Hide file tree
Showing 156 changed files with 799 additions and 1,272 deletions.
8 changes: 2 additions & 6 deletions Automate/Framework/GameLocationNameComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ internal class GameLocationNameComparer : IEqualityComparer<GameLocation>
/*********
** Public methods
*********/
/// <summary>Determines whether the specified objects are equal.</summary>
/// <returns>true if the specified objects are equal; otherwise, false.</returns>
/// <param name="left">The first object to compare.</param>
/// <param name="right">The second object to compare.</param>
/// <inheritdoc />
public bool Equals(GameLocation? left, GameLocation? right)
{
string? leftName = left?.NameOrUniqueName;
Expand All @@ -27,8 +24,7 @@ public bool Equals(GameLocation? left, GameLocation? right)
return leftName == rightName;
}

/// <summary>Get a hash code for the specified object.</summary>
/// <param name="obj">The value.</param>
/// <inheritdoc />
public int GetHashCode(GameLocation obj)
{
return (obj.NameOrUniqueName ?? string.Empty).GetHashCode();
Expand Down
4 changes: 2 additions & 2 deletions Automate/Framework/GenericObjectMachine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ internal abstract class GenericObjectMachine<TMachine> : BaseMachine<TMachine> w
/*********
** Public methods
*********/
/// <summary>Get the machine's processing state.</summary>
/// <inheritdoc />
public override MachineState GetState()
{
return this.GetGenericState();
}

/// <summary>Get the output item.</summary>
/// <inheritdoc />
public override ITrackedStack? GetOutput()
{
return this.GetTracked(this.Machine.heldObject.Value, onEmpty: this.GenericReset);
Expand Down
8 changes: 3 additions & 5 deletions Automate/Framework/Machines/Buildings/FishPondMachine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal class FishPondMachine : BaseMachineForBuilding<FishPond>
public FishPondMachine(FishPond pond, GameLocation location)
: base(pond, location, BaseMachine.GetTileAreaFor(pond)) { }

/// <summary>Get the machine's processing state.</summary>
/// <inheritdoc />
public override MachineState GetState()
{
if (this.Machine.isUnderConstruction())
Expand All @@ -28,15 +28,13 @@ public override MachineState GetState()
: MachineState.Processing;
}

/// <summary>Get the machine output.</summary>
/// <inheritdoc />
public override ITrackedStack? GetOutput()
{
return this.GetTracked(this.Machine.output.Value, onEmpty: this.OnOutputTaken);
}

/// <summary>Provide input to the machine.</summary>
/// <param name="input">The available items.</param>
/// <returns>Returns whether the machine started processing an item.</returns>
/// <inheritdoc />
public override bool SetInput(IStorage input)
{
return false; // no input
Expand Down
8 changes: 3 additions & 5 deletions Automate/Framework/Machines/Buildings/JunimoHutMachine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ gemBehavior is not JunimoHutBehavior.MoveIntoChests
|| seedBehavior is not JunimoHutBehavior.MoveIntoChests;
}

/// <summary>Get the machine's processing state.</summary>
/// <inheritdoc />
public override MachineState GetState()
{
if (this.Machine.isUnderConstruction())
Expand All @@ -71,15 +71,13 @@ public override MachineState GetState()
: MachineState.Processing;
}

/// <summary>Get the machine output.</summary>
/// <inheritdoc />
public override ITrackedStack? GetOutput()
{
return this.GetTracked(this.GetNextOutput(), onEmpty: this.OnOutputTaken);
}

/// <summary>Provide input to the machine.</summary>
/// <param name="input">The available items.</param>
/// <returns>Returns whether the machine started processing an item.</returns>
/// <inheritdoc />
public override bool SetInput(IStorage input)
{
if (!this.HasInput)
Expand Down
8 changes: 3 additions & 5 deletions Automate/Framework/Machines/Buildings/ShippingBinMachine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public ShippingBinMachine(ShippingBin bin, GameLocation location)
this.Bin = bin;
}

/// <summary>Get the machine's processing state.</summary>
/// <inheritdoc />
public override MachineState GetState()
{
if (this.Bin?.isUnderConstruction() == true)
Expand All @@ -56,15 +56,13 @@ public override MachineState GetState()
return MachineState.Empty; // always accepts items
}

/// <summary>Get the output item.</summary>
/// <inheritdoc />
public override ITrackedStack? GetOutput()
{
return null; // no output
}

/// <summary>Provide input to the machine.</summary>
/// <param name="input">The available items.</param>
/// <returns>Returns whether the machine started processing an item.</returns>
/// <inheritdoc />
public override bool SetInput(IStorage input)
{
// get next item
Expand Down
2 changes: 1 addition & 1 deletion Automate/Framework/Machines/DataBasedObjectMachine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public override bool SetInput(IStorage input)
return addedInput;
}

/// <summary>Get the output item.</summary>
/// <inheritdoc />
/// <remarks>This implementation is based on <see cref="SObject.CheckForActionOnMachine"/>.</remarks>
public override ITrackedStack? GetOutput()
{
Expand Down
8 changes: 3 additions & 5 deletions Automate/Framework/Machines/Objects/AutoGrabberMachine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,21 @@ internal class AutoGrabberMachine : GenericObjectMachine<SObject>
public AutoGrabberMachine(SObject machine, GameLocation location, Vector2 tile)
: base(machine, location, tile) { }

/// <summary>Get the machine's processing state.</summary>
/// <inheritdoc />
public override MachineState GetState()
{
return this.GetNextOutput() != null
? MachineState.Done
: MachineState.Processing;
}

/// <summary>Get the output item.</summary>
/// <inheritdoc />
public override ITrackedStack? GetOutput()
{
return this.GetTracked(this.GetNextOutput(), onEmpty: this.OnOutputTaken);
}

/// <summary>Provide input to the machine.</summary>
/// <param name="input">The available items.</param>
/// <returns>Returns whether the machine started processing an item.</returns>
/// <inheritdoc />
public override bool SetInput(IStorage input)
{
return false;
Expand Down
8 changes: 3 additions & 5 deletions Automate/Framework/Machines/Objects/FeedHopperMachine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,21 @@ public FeedHopperMachine(GameLocation location, Vector2 tile)
public FeedHopperMachine(Building silo, GameLocation location)
: base(location, BaseMachine.GetTileAreaFor(silo)) { }

/// <summary>Get the machine's processing state.</summary>
/// <inheritdoc />
public override MachineState GetState()
{
return this.CanStoreHay(out _, out _)
? MachineState.Empty // 'empty' insofar as it will accept more input, not necessarily empty
: MachineState.Disabled;
}

/// <summary>Get the output item.</summary>
/// <inheritdoc />
public override ITrackedStack? GetOutput()
{
return null;
}

/// <summary>Provide input to the machine.</summary>
/// <param name="input">The available items.</param>
/// <returns>Returns whether the machine started processing an item.</returns>
/// <inheritdoc />
public override bool SetInput(IStorage input)
{
if (!this.CanStoreHay(out GameLocation location, out int freeSpace))
Expand Down
8 changes: 3 additions & 5 deletions Automate/Framework/Machines/Objects/MiniShippingBinMachine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,19 @@ public MiniShippingBinMachine(Chest miniBin, GameLocation location)
this.MiniBin = new ChestContainer(miniBin, location, miniBin.TileLocation, migrateLegacyOptions: false);
}

/// <summary>Get the machine's processing state.</summary>
/// <inheritdoc />
public override MachineState GetState()
{
return MachineState.Empty; // always accepts items
}

/// <summary>Get the output item.</summary>
/// <inheritdoc />
public override ITrackedStack? GetOutput()
{
return null; // no output
}

/// <summary>Provide input to the machine.</summary>
/// <param name="input">The available items.</param>
/// <returns>Returns whether the machine started processing an item.</returns>
/// <inheritdoc />
public override bool SetInput(IStorage input)
{
foreach (ITrackedStack tracker in input.GetItems().Where(p => p.Sample.canBeShipped()))
Expand Down
6 changes: 2 additions & 4 deletions Automate/Framework/Machines/Objects/TapperMachine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,13 @@ public TapperMachine(SObject machine, GameLocation location, Vector2 tile, Tree
this.Tree = tree;
}

/// <summary>Get the output item.</summary>
/// <inheritdoc />
public override ITrackedStack? GetOutput()
{
return this.GetTracked(this.Machine.heldObject.Value, onEmpty: this.Reset);
}

/// <summary>Provide input to the machine.</summary>
/// <param name="input">The available items.</param>
/// <returns>Returns whether the machine started processing an item.</returns>
/// <inheritdoc />
public override bool SetInput(IStorage input)
{
return false; // no input
Expand Down
8 changes: 3 additions & 5 deletions Automate/Framework/Machines/TerrainFeatures/BushMachine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public BushMachine(Bush bush, GameLocation location, Rectangle tileArea)
);
}

/// <summary>Get the output item.</summary>
/// <inheritdoc />
public override ITrackedStack GetOutput()
{
string itemId = this.Machine.GetShakeOffItem();
Expand All @@ -65,7 +65,7 @@ public override ITrackedStack GetOutput()
return new TrackedItem(ItemRegistry.Create(itemId, count, quality), onReduced: this.OnOutputReduced);
}

/// <summary>Get the machine's processing state.</summary>
/// <inheritdoc />
public override MachineState GetState()
{
if (!this.IsInSeason.Value)
Expand All @@ -76,9 +76,7 @@ public override MachineState GetState()
: MachineState.Processing;
}

/// <summary>Provide input to the machine.</summary>
/// <param name="input">The available items.</param>
/// <returns>Returns whether the machine started processing an item.</returns>
/// <inheritdoc />
public override bool SetInput(IStorage input)
{
return false; // no input required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal class FruitTreeMachine : BaseMachine<FruitTree>
public FruitTreeMachine(FruitTree tree, GameLocation location, Vector2 tile)
: base(tree, location, BaseMachine.GetTileAreaFor(tile)) { }

/// <summary>Get the machine's processing state.</summary>
/// <inheritdoc />
public override MachineState GetState()
{
if (this.Machine.growthStage.Value < FruitTree.treeStage)
Expand All @@ -30,7 +30,7 @@ public override MachineState GetState()
: MachineState.Processing;
}

/// <summary>Get the output item.</summary>
/// <inheritdoc />
public override ITrackedStack GetOutput()
{
FruitTree tree = this.Machine;
Expand All @@ -43,9 +43,7 @@ public override ITrackedStack GetOutput()
return new TrackedItem(tree.fruit[^1], onReduced: item => tree.fruit.Remove(item));
}

/// <summary>Provide input to the machine.</summary>
/// <param name="input">The available items.</param>
/// <returns>Returns whether the machine started processing an item.</returns>
/// <inheritdoc />
public override bool SetInput(IStorage input)
{
return false; // no input
Expand Down
8 changes: 3 additions & 5 deletions Automate/Framework/Machines/TerrainFeatures/TreeMachine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public TreeMachine(Tree tree, GameLocation location, Vector2 tile, bool collectM
);
}

/// <summary>Get the machine's processing state.</summary>
/// <inheritdoc />
public override MachineState GetState()
{
if (this.Machine.growthStage.Value < Tree.treeStage || this.Machine.stump.Value)
Expand All @@ -69,7 +69,7 @@ public override MachineState GetState()
: MachineState.Processing;
}

/// <summary>Get the output item.</summary>
/// <inheritdoc />
public override ITrackedStack? GetOutput()
{
Tree tree = this.Machine;
Expand Down Expand Up @@ -102,9 +102,7 @@ public override MachineState GetState()
return null;
}

/// <summary>Provide input to the machine.</summary>
/// <param name="input">The available items.</param>
/// <returns>Returns whether the machine started processing an item.</returns>
/// <inheritdoc />
public override bool SetInput(IStorage input)
{
return false; // no input
Expand Down
8 changes: 3 additions & 5 deletions Automate/Framework/Machines/Tiles/TrashCanMachine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public TrashCanMachine(GameLocation location, Vector2 tile, string trashCanId)
this.TrashCanId = this.GetActualTrashCanId(trashCanId);
}

/// <summary>Get the machine's processing state.</summary>
/// <inheritdoc />
public override MachineState GetState()
{
if (Game1.netWorldState.Value.CheckedGarbage.Contains(this.TrashCanId))
Expand All @@ -37,7 +37,7 @@ public override MachineState GetState()
return MachineState.Done;
}

/// <summary>Get the output item.</summary>
/// <inheritdoc />
public override ITrackedStack? GetOutput()
{
// get item
Expand All @@ -50,9 +50,7 @@ public override MachineState GetState()
return null;
}

/// <summary>Provide input to the machine.</summary>
/// <param name="input">The available items.</param>
/// <returns>Returns whether the machine started processing an item.</returns>
/// <inheritdoc />
public override bool SetInput(IStorage input)
{
return false; // no input
Expand Down
3 changes: 1 addition & 2 deletions Automate/Framework/OverlayMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ public OverlayMenu(IModEvents events, IInputHelper inputHelper, IReflectionHelpe
/*********
** Protected
*********/
/// <summary>Draw the overlay to the screen under the UI.</summary>
/// <param name="spriteBatch">The sprite batch being drawn.</param>
/// <inheritdoc />
[SuppressMessage("ReSharper", "PossibleLossOfFraction", Justification = "Deliberate discarded for conversion to tile coordinates.")]
protected override void DrawWorld(SpriteBatch spriteBatch)
{
Expand Down
Loading

0 comments on commit e77755f

Please sign in to comment.