-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed how per-player data is stored to work in multiplayer (I hope).
- Loading branch information
Showing
5 changed files
with
44 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// This module defines per-player data which is saved in the game save file. | ||
// References: | ||
// https://stardewcommunitywiki.com/Modding:Modder_Guide/APIs/Data | ||
// https://stardewvalleywiki.com/Modding:Migrate_to_Stardew_Valley_1.5#Custom_mod_data | ||
// | ||
// We keep around a singleton instance of this (instance), whiche any code that | ||
// has the need can read or update and the changes will get saved with the game. | ||
|
||
using System; | ||
using StardewValley; | ||
|
||
namespace Farmtronics { | ||
public static class PerPlayerData { | ||
|
||
static string HomeComputerNameKey { | ||
get { return $"{ModEntry.instance.ModManifest.UniqueID}/HomeComputerName"; } | ||
} | ||
|
||
public static string HomeComputerName { | ||
get { | ||
string result; | ||
if (Game1.player.modData.TryGetValue(HomeComputerNameKey, out result)) { | ||
return result; | ||
} | ||
return "Home Computer"; | ||
} | ||
set { | ||
Game1.player.modData[HomeComputerNameKey] = value; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters