Fix serialization of home mount flag

Part of #6
This commit is contained in:
zontreck 2025-06-05 12:41:22 -07:00
parent bd12021575
commit ac8ac62d27
4 changed files with 16 additions and 15 deletions

View file

@ -202,10 +202,11 @@ namespace AriasServerUtils
if (args.Caller.Player is IServerPlayer isp) if (args.Caller.Player is IServerPlayer isp)
{ {
bool withMount = false;
if (args.Command.FullName == "sethomemount") if (args.Command.Name == "sethomemount")
{ {
// Check for the gears and pay here, or show error. // Check for the gears and pay here, or show error.
withMount = true;
} }
bool bypass = isOp && ServerUtilities.config.AdminsBypassMaxHomes; bool bypass = isOp && ServerUtilities.config.AdminsBypassMaxHomes;
@ -213,16 +214,8 @@ namespace AriasServerUtils
if (bypass || data.Homes.Count < ServerUtilities.config.MaxHomes || data.Homes.ContainsKey(homeName)) if (bypass || data.Homes.Count < ServerUtilities.config.MaxHomes || data.Homes.ContainsKey(homeName))
{ {
data.Homes[homeName] = Home.MakeHome(args.Caller.Player.Entity, homeName); data.Homes[homeName] = Home.MakeHome(args.Caller.Player.Entity, homeName, withMount: withMount);
ServerUtilities.SendMessageTo(isp, Lang.Get($"{ServerUtilities.MOD_ID}:home-set")); ServerUtilities.SendMessageTo(isp, Lang.Get($"{ServerUtilities.MOD_ID}:home-set"));
if (args.Command.FullName == "sethomemount")
{
// Enable mount in the home
data.Homes[homeName].CanHaveMount = true;
}
} }
else else
{ {

View file

@ -96,12 +96,13 @@ namespace AriasServerUtils
public bool CanHaveMount = false; public bool CanHaveMount = false;
public static Warp Create(IServerPlayer player) public static Warp Create(IServerPlayer player, bool withMount = false)
{ {
Warp warp = new Warp(); Warp warp = new Warp();
warp.Location = PlayerPosition.from(player.Entity); warp.Location = PlayerPosition.from(player.Entity);
warp.CreatedBy = player.PlayerName; warp.CreatedBy = player.PlayerName;
warp.CreatedAt = DateTime.Now; warp.CreatedAt = DateTime.Now;
warp.CanHaveMount = withMount;
return warp; return warp;
} }
@ -113,6 +114,12 @@ namespace AriasServerUtils
public Dictionary<string, Warp> warps = new Dictionary<string, Warp>(); public Dictionary<string, Warp> warps = new Dictionary<string, Warp>();
} }
[Serializable]
public class Costs
{
}
public class BackCaches public class BackCaches
{ {

View file

@ -97,10 +97,11 @@ namespace AriasServerUtils
public PlayerPosition Location { get; set; } public PlayerPosition Location { get; set; }
public bool CanHaveMount = false; public bool CanHaveMount = false;
public static Home MakeHome(Entity player, string homeName) public static Home MakeHome(Entity player, string homeName, bool withMount = false)
{ {
Home home = new Home(); Home home = new Home();
home.Location = PlayerPosition.from(player); home.Location = PlayerPosition.from(player);
home.CanHaveMount = withMount;
return home; return home;

View file

@ -3,8 +3,8 @@
"modid": "ariasserverutils", "modid": "ariasserverutils",
"name": "Aria's Server Utilities", "name": "Aria's Server Utilities",
"authors": ["zontreck"], "authors": ["zontreck"],
"description": "A collection of server utilities\n\nBuild Date: 06-05-2025 @ 11:56 AM MST", "description": "A collection of server utilities\n\nBuild Date: 06-05-2025 @ 12:38 PM MST",
"version": "1.1.0-dev.1", "version": "1.1.0-dev.2",
"dependencies": { "dependencies": {
"game": "" "game": ""
} }