generated from AriasCreations/vsmodtemplate
Adds a initial basic version of player sleeping percentage.
This commit is contained in:
parent
d2b92f95c5
commit
3ab3dc099f
3 changed files with 24 additions and 19 deletions
|
@ -238,7 +238,7 @@ namespace AriasServerUtils
|
||||||
.HandleWith(Events.HandleASU)
|
.HandleWith(Events.HandleASU)
|
||||||
.WithDescription("Lists all Aria's Server Utils commands")
|
.WithDescription("Lists all Aria's Server Utils commands")
|
||||||
.EndSubCommand()
|
.EndSubCommand()
|
||||||
.BeginSubCommand("test")
|
/*.BeginSubCommand("test")
|
||||||
.RequiresPlayer()
|
.RequiresPlayer()
|
||||||
.RequiresPrivilege(Privilege.controlserver)
|
.RequiresPrivilege(Privilege.controlserver)
|
||||||
.BeginSubCommand("sleep")
|
.BeginSubCommand("sleep")
|
||||||
|
@ -251,7 +251,7 @@ namespace AriasServerUtils
|
||||||
.RequiresPrivilege(Privilege.controlserver)
|
.RequiresPrivilege(Privilege.controlserver)
|
||||||
.HandleWith(TestCalendarSpeed)
|
.HandleWith(TestCalendarSpeed)
|
||||||
.EndSubCommand()
|
.EndSubCommand()
|
||||||
.EndSubCommand();
|
.EndSubCommand()*/ ;
|
||||||
|
|
||||||
api.ChatCommands.Create("setwarp").RequiresPlayer().RequiresPrivilege(Privilege.chat).WithDescription("Creates a new server warp").WithArgs(parsers.OptionalWord("name")).HandleWith(Events.HandleWarpUpdate);
|
api.ChatCommands.Create("setwarp").RequiresPlayer().RequiresPrivilege(Privilege.chat).WithDescription("Creates a new server warp").WithArgs(parsers.OptionalWord("name")).HandleWith(Events.HandleWarpUpdate);
|
||||||
api.ChatCommands.Create("warp").RequiresPlayer().RequiresPrivilege(Privilege.chat).WithDescription("Warp to the specified server warp").WithArgs(parsers.OptionalWord("name")).HandleWith(Events.HandleWarp);
|
api.ChatCommands.Create("warp").RequiresPlayer().RequiresPrivilege(Privilege.chat).WithDescription("Warp to the specified server warp").WithArgs(parsers.OptionalWord("name")).HandleWith(Events.HandleWarp);
|
||||||
|
@ -286,7 +286,7 @@ namespace AriasServerUtils
|
||||||
Sleeping = true
|
Sleeping = true
|
||||||
});
|
});
|
||||||
|
|
||||||
API.World.Calendar.SetTimeSpeedModifier("asu_psp", 500);
|
API.World.Calendar.SetTimeSpeedModifier("asu_psp", 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TextCommandResult.Success($"Test initiated, original calendar multiplier: '{OriginalSpeed}'");
|
return TextCommandResult.Success($"Test initiated, original calendar multiplier: '{OriginalSpeed}'");
|
||||||
|
@ -313,7 +313,7 @@ namespace AriasServerUtils
|
||||||
Sleeping = true
|
Sleeping = true
|
||||||
});
|
});
|
||||||
|
|
||||||
API.World.Calendar.SetTimeSpeedModifier("asu_psp", 500);
|
API.World.Calendar.SetTimeSpeedModifier("asu_psp", 1000);
|
||||||
|
|
||||||
SendMessageTo(isp, "Applied calendar speed multiplier");
|
SendMessageTo(isp, "Applied calendar speed multiplier");
|
||||||
}
|
}
|
||||||
|
@ -349,6 +349,7 @@ namespace AriasServerUtils
|
||||||
{
|
{
|
||||||
EntityBehaviorTiredness ebt = player.GetBehavior("tiredness") as EntityBehaviorTiredness;
|
EntityBehaviorTiredness ebt = player.GetBehavior("tiredness") as EntityBehaviorTiredness;
|
||||||
ebt.IsSleeping = false;
|
ebt.IsSleeping = false;
|
||||||
|
ebt.Tiredness = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SleepingPlayers.Clear();
|
SleepingPlayers.Clear();
|
||||||
|
@ -403,6 +404,14 @@ namespace AriasServerUtils
|
||||||
int Percentage = TotalInBed * 100 / TotalOnline;
|
int Percentage = TotalInBed * 100 / TotalOnline;
|
||||||
if (Percentage >= config.PlayerSleepingPercentage)
|
if (Percentage >= config.PlayerSleepingPercentage)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
ServerNetworkChannel.BroadcastPacket(new ASUTimeAcceleration
|
||||||
|
{
|
||||||
|
Sleeping = true
|
||||||
|
});
|
||||||
|
|
||||||
|
API.World.Calendar.SetTimeSpeedModifier("asu_psp", 1000);
|
||||||
|
|
||||||
// Call the API to make sleep happen
|
// Call the API to make sleep happen
|
||||||
foreach (var bed in BEBs)
|
foreach (var bed in BEBs)
|
||||||
{
|
{
|
||||||
|
@ -412,19 +421,12 @@ namespace AriasServerUtils
|
||||||
EntityBehaviorTiredness EBT = bed.MountedBy.GetBehavior("tiredness") as EntityBehaviorTiredness;
|
EntityBehaviorTiredness EBT = bed.MountedBy.GetBehavior("tiredness") as EntityBehaviorTiredness;
|
||||||
|
|
||||||
EBT.IsSleeping = true;
|
EBT.IsSleeping = true;
|
||||||
|
bed.MountedBy.TryUnmount(); // Stand up. We cant trigger the real sleep phase, but all code for starting time accel has been executed.
|
||||||
|
}
|
||||||
|
|
||||||
// Get current calendar speed
|
// Get current calendar speed
|
||||||
OriginalSpeed = API.World.Calendar.CalendarSpeedMul;
|
|
||||||
Hours = API.World.Calendar.TotalHours;
|
Hours = API.World.Calendar.TotalHours;
|
||||||
Sleeping = true;
|
Sleeping = true;
|
||||||
|
|
||||||
ServerNetworkChannel.BroadcastPacket(new ASUTimeAcceleration
|
|
||||||
{
|
|
||||||
Sleeping = true
|
|
||||||
});
|
|
||||||
|
|
||||||
API.World.Calendar.SetTimeSpeedModifier("asu_psp", 500);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,5 +40,8 @@
|
||||||
"rtp-fail": "Giving up on RTP search. No valid position could be found. Try again later",
|
"rtp-fail": "Giving up on RTP search. No valid position could be found. Try again later",
|
||||||
"rtp-capped": "The distance you tried to go [{0}] is greater than the maximum allowable by the server [{1}]",
|
"rtp-capped": "The distance you tried to go [{0}] is greater than the maximum allowable by the server [{1}]",
|
||||||
|
|
||||||
"cmd-cooldown": "[{0}] is currently on cooldown. You can use this command again in [{1}]"
|
"cmd-cooldown": "[{0}] is currently on cooldown. You can use this command again in [{1}]",
|
||||||
|
|
||||||
|
"psp": "[ASU] PSP Starting... you do not need to stay in bed",
|
||||||
|
"psp-ending": "[ASU] PSP Complete"
|
||||||
}
|
}
|
||||||
|
|
|
@ -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: 03-11-2025 @ 00:37 AM MST",
|
"description": "A collection of server utilities\n\nBuild Date: 03-11-2025 @ 00:52 AM MST",
|
||||||
"version": "1.0.7-dev.3",
|
"version": "1.0.7",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"game": ""
|
"game": ""
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue