Skip to content

Commit

Permalink
Batteries now fully recharge bot, instead of adding +100 energy.
Browse files Browse the repository at this point in the history
Also removed some debug spew (in non-debug builds).
  • Loading branch information
JoeStrout committed May 12, 2024
1 parent 142fdf8 commit e9ba108
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
12 changes: 10 additions & 2 deletions Farmtronics/Bot/BotObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,18 @@ public void UseTool() {
ModEntry.instance.Monitor.Log($"UseBattery called: Stamina already full, battery not used.", LogLevel.Trace);
return;
}
farmer.stamina = Math.Min(Farmer.startingStamina, farmer.stamina + 100);
farmer.stamina = Farmer.startingStamina;
ModEntry.instance.Monitor.Log($"UseBattery called: Stamina increased from {oldStamina} to {farmer.stamina}", LogLevel.Trace);
farmer.removeFirstOfThisItemFromInventory("(O)787");
return;
}

if (farmer == null || inventory == null || farmer.CurrentTool == null) return;
Vector2 toolLocation = farmer.GetToolLocation(true);
#if DEBUG
ModEntry.instance.Monitor.Log($"UseTool called: {farmer.CurrentTool.Name}[{farmer.CurrentToolIndex}] {toolLocation}", LogLevel.Trace);

#endif

// Check ResourceClumps and current UpgradeLevel before hitting them
var clump = currentLocation.GetCollidingResourceClump(toolLocation);
if (clump != null && farmer.CurrentTool.UpgradeLevel < 4) {
Expand All @@ -193,7 +195,9 @@ public void UseTool() {
}

if (farmer.CurrentTool is not MeleeWeapon) {
#if DEBUG
ModEntry.instance.Monitor.Log($"farmer.CurrentTool.DoFunction", LogLevel.Trace);
#endif
farmer.CurrentTool.DoFunction(farmer.currentLocation, toolLocation.GetIntX(), toolLocation.GetIntY(), 1, farmer);
farmer.checkForExhaustion(oldStamina);
data.Update();
Expand Down Expand Up @@ -523,7 +527,9 @@ public void Move(int dColumn, int dRow) {

// start moving
targetPos = newTile.GetAbsolutePosition();
#if DEBUG
ModEntry.instance.Monitor.Log($"MoveForward: Facing: {facingDirection}; Position: {Position}; newTile: {newTile}; targetPos: {targetPos}");
#endif

// Do collision actions (shake the grass, etc.)
if (currentLocation.terrainFeatures.ContainsKey(newTile)) {
Expand All @@ -545,7 +551,9 @@ public bool IsMoving() {
public void Rotate(int stepsClockwise) {
farmer.faceDirection((farmer.FacingDirection + 4 + stepsClockwise) % 4);
data.Update();
#if DEBUG
ModEntry.instance.Monitor.Log($"{Name} Rotate({stepsClockwise}): now facing {farmer.FacingDirection}");
#endif
}

void ApplyScytheToTile() {
Expand Down
8 changes: 7 additions & 1 deletion Farmtronics/Farmtronics.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@
<TargetFramework>net6.0</TargetFramework>
<ModFolderName>Farmtronics</ModFolderName>
<BundleExtraAssemblies>ThirdParty</BundleExtraAssemblies>
<ReleaseVersion>1.3</ReleaseVersion>
<ReleaseVersion>1.4</ReleaseVersion>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="4.1.1" />
<PackageReference Include="Pathoschild.Stardew.ModTranslationClassBuilder" Version="2.0.1" />
Expand Down
2 changes: 1 addition & 1 deletion Farmtronics/Farmtronics.sln
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Global
SolutionGuid = {1A1D1271-8E80-4A8D-A57B-267C68FE3D68}
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
version = 1.3
version = 1.4
Policies = $0
$0.DotNetNamingPolicy = $1
$1.DirectoryNamespaceAssociation = PrefixedHierarchical
Expand Down

0 comments on commit e9ba108

Please sign in to comment.