generated from AriasCreations/vsmodtemplate
Fix: #5
This commit is contained in:
parent
b00e56fdf7
commit
7fb2d38c3d
1 changed files with 7 additions and 7 deletions
|
@ -357,8 +357,6 @@ namespace AriasServerUtils
|
||||||
if (TotalOnline == 0) return; // No one on, just abort the checks.
|
if (TotalOnline == 0) return; // No one on, just abort the checks.
|
||||||
int TotalInBed = 0;
|
int TotalInBed = 0;
|
||||||
|
|
||||||
bool isAlreadySleeping = false;
|
|
||||||
|
|
||||||
List<BlockEntityBed> BEBs = new();
|
List<BlockEntityBed> BEBs = new();
|
||||||
|
|
||||||
foreach (var player in API.World.AllOnlinePlayers)
|
foreach (var player in API.World.AllOnlinePlayers)
|
||||||
|
@ -368,9 +366,12 @@ namespace AriasServerUtils
|
||||||
{
|
{
|
||||||
BEBs.Add(beb);
|
BEBs.Add(beb);
|
||||||
TotalInBed++;
|
TotalInBed++;
|
||||||
|
//API.Logger.Notification($"Bed found for player {player.PlayerName}");
|
||||||
}
|
}
|
||||||
if (ePlay.MountedOn == null)
|
if (ePlay.MountedOn == null)
|
||||||
{
|
{
|
||||||
|
//API.Logger.Notification($"No bed found for player {player.PlayerName}");
|
||||||
|
|
||||||
if (SleepingPlayers.Contains(ePlay))
|
if (SleepingPlayers.Contains(ePlay))
|
||||||
{
|
{
|
||||||
EntityBehaviorTiredness ebt = ePlay.GetBehavior<EntityBehaviorTiredness>();
|
EntityBehaviorTiredness ebt = ePlay.GetBehavior<EntityBehaviorTiredness>();
|
||||||
|
@ -378,17 +379,16 @@ namespace AriasServerUtils
|
||||||
ebt.IsSleeping = false;
|
ebt.IsSleeping = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityBehaviorTiredness EBT = ePlay.GetBehavior<EntityBehaviorTiredness>();
|
|
||||||
if (EBT == null) continue;
|
|
||||||
if (EBT.IsSleeping) isAlreadySleeping = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isAlreadySleeping) return; // Abort
|
if (Sleeping) return; // Abort
|
||||||
|
|
||||||
SleepingPlayers.Clear();
|
SleepingPlayers.Clear();
|
||||||
|
|
||||||
int Percentage = TotalInBed * 100 / TotalOnline;
|
int Percentage = TotalInBed * 100 / TotalOnline;
|
||||||
|
|
||||||
|
API.Logger.Notification($"Percentage of players in bed: ${Percentage}, Required percentage: ${config.PlayerSleepingPercentage}");
|
||||||
|
|
||||||
if (Percentage >= config.PlayerSleepingPercentage)
|
if (Percentage >= config.PlayerSleepingPercentage)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue