Skip to content

Commit 11c9338

Browse files
committed
Fixed save/load issues, and bumped version number to 1.0.3.
1 parent df65a47 commit 11c9338

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

M1/Bot.cs

+10-6
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,10 @@ static StardewValley.Objects.Chest ConvertBotToChest(Bot bot) {
150150
chest.modData[facingKey] = bot.facingDirection.ToString();
151151
var inventory = bot.inventory;
152152
if (inventory != null) {
153-
for (int i=0; i<chest.items.Count && i<bot.inventory.Count; i++) {
154-
chest.items[i] = inventory[i];
153+
if (chest.items.Count < inventory.Count) chest.items.Set(inventory);
154+
for (int i=0; i<chest.items.Count && i<inventory.Count; i++) {
155+
//chest.items[i] = inventory[i];
156+
Debug.Log($"Moved {chest.items[i]} in slot {i} from bot to chest");
155157
}
156158
int convertedItems = ConvertBotsInListToChests(chest.items);
157159
if (convertedItems > 0) Debug.Log($"Converted {convertedItems} bots inside a bot");
@@ -197,7 +199,9 @@ public static int ConvertBotsInMapToChests(GameLocation inLocation=null) {
197199
}
198200
foreach (var tileLoc in targetTileLocs) {
199201
Debug.Log($"Found bot in {inLocation.Name} at {tileLoc}; converting");
200-
inLocation.objects[tileLoc] = ConvertBotToChest(inLocation.objects[tileLoc] as Bot);
202+
var chest = ConvertBotToChest(inLocation.objects[tileLoc] as Bot);
203+
inLocation.objects.Remove(tileLoc);
204+
inLocation.objects.Add(tileLoc, chest);
201205
countInLoc++;
202206
}
203207
if (countInLoc > 0) Debug.Log($"Converted {countInLoc} bots in {inLocation.Name}");
@@ -210,7 +214,7 @@ public static int ConvertBotsInMapToChests(GameLocation inLocation=null) {
210214

211215

212216
/// <summary>
213-
/// Convert all chests with appropriate metadat into bots, everywhere.
217+
/// Convert all chests with appropriate metadata into bots, everywhere.
214218
/// </summary>
215219
public static void ConvertChestsToBots() {
216220
// Convert chests in the world.
@@ -259,10 +263,10 @@ static void ConvertChestsInMapToBots(GameLocation inLocation=null) {
259263

260264
Bot bot = new Bot(tileLoc, inLocation, false);
261265
inLocation.objects.Remove(tileLoc);
262-
inLocation.overlayObjects[tileLoc] = bot;
266+
inLocation.overlayObjects.Add(tileLoc, bot);
263267
bot.farmer.faceDirection(facing);
264268
for (int i=0; i<chest.items.Count && i<bot.inventory.Count; i++) {
265-
Debug.Log($"Moving {chest.items[i]} from chest to bot in slot {i}");
269+
//Debug.Log($"Moving {chest.items[i]} from chest to bot in slot {i}");
266270
bot.inventory[i] = chest.items[i];
267271
}
268272
chest.items.Clear();

M1/M1API.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public static void Init(Shell shell) {
5454

5555
if (shell.bot == null) HostInfo.name = "Farmtronics Home Computer";
5656
else HostInfo.name = "Farmtronics Bot";
57-
HostInfo.version = 1.02;
57+
HostInfo.version = 1.03;
5858
HostInfo.info = "https://github.com/JoeStrout/Farmtronics/";
5959

6060
Intrinsic f;

M1/ModEntry.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public void print(string s) {
5757

5858
// HACK used only for early testing/development:
5959
public void OnButtonPressed(object sender, ButtonPressedEventArgs e) {
60-
print($"OnButtonPressed: {e.Button}");
60+
//print($"OnButtonPressed: {e.Button}");
6161
if (e.Button == SButton.PageUp) {
6262
print($"CurrentSavePath: {Constants.CurrentSavePath}");
6363
// Create a bot.

M1/manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"Name": "Farmtronics",
33
"Author": "Joe Strout",
4-
"Version": "1.0.2",
4+
"Version": "1.0.3",
55
"Description": "Adds a high-tech \"home computer\" to your TV!",
66
"UniqueID": "strout.farmtronics",
77
"EntryDll": "Farmtronics.dll",

ROADMAP.md

+1-5
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,14 @@ This is our "minimum viable product".
4141

4242
These will be addressed ASAP.
4343

44-
+ If you break a bot (e.g. using a pickaxe) while it is running, it will duplicate it (you'll pick up one but the original continues to run on the ground).
45-
+ When you exit to title while a bot is running, it continues to run and will still be there if you return.
46-
+ If you leave the farm while a bot is running, it leaves an invisible bot behind at its last location. This invisible bot can't be destroyed; whacking it produces a duplicate bot.
4744
- The command line cursor gets misplaced if, at the bottom of the screen, you type a command longer than 40 characters (so that it wraps) and then back up with the left arrow key to the previous line.
4845
- If you pick up a bot by repeatedly left-clicking it with empty hands, it leaves a "ghost" image behind until you put it down again.
49-
+ If you use a hoe on a bot, it turns into a chest. (Work-around for this and the previous issue: pick up a bot with axe or pickaxe only.)
5046

5147
## Unscheduled Future Version
5248

5349
The following features are definitely things we want to include, but they have not yet been scheduled for a particular version.
5450

55-
- tile info should include information about crops and soil water statusa
51+
- multiplayer support
5652
- improved copy/paste support in the editor
5753
- console autocompletion (as in Mini Micro)
5854
- `mouse` module (allowing for point-and-click UI)

0 commit comments

Comments
 (0)