Игроки которые не наиграли 10 часов появляются сразу на станции. (#108)

This commit is contained in:
Vigers Ray 2024-06-13 14:09:28 +03:00 • committed by GitHub
parent bb5f6f3cdc
commit e4c7ebb031
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 51 additions and 27 deletions

View file

@ -84,11 +84,12 @@
<Button Name="ShowClothes" Pressed="True" ToggleMode="True" Text="{Loc 'humanoid-profile-editor-clothing-show'}" HorizontalAlignment="Right" />
</BoxContainer>
<!-- Spawn Priority -->
<BoxContainer HorizontalExpand="True">
<!-- SunriseEdit -->
<!--<BoxContainer HorizontalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-spawn-priority-label'}" />
<Control HorizontalExpand="True"/>
<OptionButton Name="SpawnPriorityButton" HorizontalAlignment="Right" />
</BoxContainer>
</BoxContainer> -->
<!-- Sunrise-TTS-Start -->
<BoxContainer HorizontalExpand="True" Visible="False" Name="TTSContainer">
<Label Text="{Loc 'humanoid-profile-editor-voice-label'}" />

View file

@ -344,16 +344,16 @@ namespace Content.Client.Lobby.UI
#region SpawnPriority
foreach (var value in Enum.GetValues<SpawnPriorityPreference>())
{
SpawnPriorityButton.AddItem(Loc.GetString($"humanoid-profile-editor-preference-spawn-priority-{value.ToString().ToLower()}"), (int) value);
}
SpawnPriorityButton.OnItemSelected += args =>
{
SpawnPriorityButton.SelectId(args.Id);
SetSpawnPriority((SpawnPriorityPreference) args.Id);
};
// foreach (var value in Enum.GetValues<SpawnPriorityPreference>())
// {
// SpawnPriorityButton.AddItem(Loc.GetString($"humanoid-profile-editor-preference-spawn-priority-{value.ToString().ToLower()}"), (int) value);
// }
//
// SpawnPriorityButton.OnItemSelected += args =>
// {
// SpawnPriorityButton.SelectId(args.Id);
// SetSpawnPriority((SpawnPriorityPreference) args.Id);
// };
#endregion SpawnPriority
@ -737,7 +737,7 @@ namespace Content.Client.Lobby.UI
UpdateSexControls();
UpdateGenderControls();
UpdateSkinColor();
UpdateSpawnPriorityControls();
//UpdateSpawnPriorityControls();
UpdateAgeEdit();
UpdateEyePickers();
UpdateSaveButton();
@ -1405,15 +1405,15 @@ namespace Content.Client.Lobby.UI
PronounsButton.SelectId((int) Profile.Gender);
}
private void UpdateSpawnPriorityControls()
{
if (Profile == null)
{
return;
}
SpawnPriorityButton.SelectId((int) Profile.SpawnPriority);
}
// private void UpdateSpawnPriorityControls()
// {
// if (Profile == null)
// {
// return;
// }
//
// SpawnPriorityButton.SelectId((int) Profile.SpawnPriority);
// }
private void UpdateHairPickers()
{

View file

@ -4,9 +4,11 @@ using System.Numerics;
using Content.Server.Administration.Managers;
using Content.Server.GameTicking.Events;
using Content.Server.Ghost;
using Content.Server.Players.PlayTimeTracking;
using Content.Server.Spawners.Components;
using Content.Server.Speech.Components;
using Content.Server.Station.Components;
using Content.Shared._Sunrise.SunriseCCVars;
using Content.Shared.Database;
using Content.Shared.Mind;
using Content.Shared.Players;
@ -28,6 +30,7 @@ namespace Content.Server.GameTicking
{
[Dependency] private readonly IAdminManager _adminManager = default!;
[Dependency] private readonly SharedJobSystem _jobs = default!;
[Dependency] private readonly PlayTimeTrackingManager _playTimeTracking = default!;
[ValidatePrototypeId<EntityPrototype>]
public const string ObserverPrototypeName = "MobObserver";
@ -229,10 +232,13 @@ namespace Content.Server.GameTicking
_playTimeTrackings.PlayerRolesChanged(player);
var overall = _playTimeTracking.GetOverallPlaytime(player);
// Все появляются в прибытии в начале раунда. Зачем? А мне нравится эта бегающаа орящая толпа.
// Игроки у которых наиграно меньше ArrivalsMinHours часов будут появляеться всегда по спавнеру професии.
EntityUid? mobMaybe = null;
var spawnPointType = SpawnPointType.Arrivals;
if (jobPrototype.AlwaysUseSpawner)
if (jobPrototype.AlwaysUseSpawner || overall < TimeSpan.FromHours(_configurationManager.GetCVar(SunriseCCVars.ArrivalsMinHours)))
{
lateJoin = false;
spawnPointType = SpawnPointType.Job;

View file

@ -338,6 +338,9 @@ public sealed class ArrivalsSystem : EntitySystem
if (ev.SpawnResult != null)
return;
if (ev.DesiredSpawnPointType == SpawnPointType.Job)
return;
// Only works on latejoin even if enabled.
if (!Enabled || _ticker.RunLevel != GameRunLevel.InRound)
return;

View file

@ -37,12 +37,14 @@ public sealed class ContainerSpawnPointSystem : EntitySystem
continue;
}
if (_gameTicker.RunLevel == GameRunLevel.InRound && spawnPoint.SpawnType == SpawnPointType.LateJoin)
if (_gameTicker.RunLevel == GameRunLevel.InRound &&
spawnPoint.SpawnType == SpawnPointType.LateJoin &&
args.DesiredSpawnPointType != SpawnPointType.Job)
{
possibleContainers.Add((uid, spawnPoint, container, xform));
}
if (_gameTicker.RunLevel != GameRunLevel.InRound &&
if ((_gameTicker.RunLevel != GameRunLevel.InRound || args.DesiredSpawnPointType == SpawnPointType.Job) &&
spawnPoint.SpawnType == SpawnPointType.Job &&
(args.Job == null || spawnPoint.Job == args.Job.Prototype))
{

View file

@ -51,12 +51,14 @@ public sealed class SpawnPointSystem : EntitySystem
}
}
if (_gameTicker.RunLevel == GameRunLevel.InRound && spawnPoint.SpawnType == SpawnPointType.LateJoin)
if (_gameTicker.RunLevel == GameRunLevel.InRound &&
spawnPoint.SpawnType == SpawnPointType.LateJoin &&
args.DesiredSpawnPointType != SpawnPointType.Job)
{
possiblePositions.Add(xform.Coordinates);
}
if (_gameTicker.RunLevel != GameRunLevel.InRound &&
if ((_gameTicker.RunLevel != GameRunLevel.InRound || args.DesiredSpawnPointType == SpawnPointType.Job) &&
spawnPoint.SpawnType == SpawnPointType.Job &&
(args.Job == null || spawnPoint.Job == args.Job.Prototype))
{

View file

@ -100,4 +100,14 @@ public sealed class SunriseCCVars
/// </summary>
public static readonly CVarDef<string> ServersHubList =
CVarDef.Create("servers_hub.urls", "", CVar.SERVERONLY);
/**
* Transit hub
*/
/// <summary>
/// До сколько часов общего наиграного времени игроки будут появляться на станции даже в позднем присоединеии.
/// </summary>
public static readonly CVarDef<int> ArrivalsMinHours =
CVarDef.Create("transithub.arrivals_min_hours", 10, CVar.SERVER | CVar.ARCHIVE);
}