Skip to content

Commit

Permalink
Игроки которые не наиграли 10 часов появляются сразу на станции.
Browse files Browse the repository at this point in the history
  • Loading branch information
VigersRay committed Jun 13, 2024
1 parent bb5f6f3 commit 315dcf8
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 27 deletions.
5 changes: 3 additions & 2 deletions Content.Client/Lobby/UI/HumanoidProfileEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'}" />
Expand Down
40 changes: 20 additions & 20 deletions Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -344,16 +344,16 @@ public HumanoidProfileEditor(

#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

Expand Down Expand Up @@ -737,7 +737,7 @@ public void SetProfile(HumanoidCharacterProfile? profile, int? slot)
UpdateSexControls();
UpdateGenderControls();
UpdateSkinColor();
UpdateSpawnPriorityControls();
//UpdateSpawnPriorityControls();
UpdateAgeEdit();
UpdateEyePickers();
UpdateSaveButton();
Expand Down Expand Up @@ -1405,15 +1405,15 @@ private void UpdateGenderControls()
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()
{
Expand Down
8 changes: 7 additions & 1 deletion Content.Server/GameTicking/GameTicker.Spawning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
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;
Expand All @@ -28,6 +30,7 @@ public sealed partial class GameTicker
{
[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";
Expand Down Expand Up @@ -229,10 +232,13 @@ private void SpawnPlayer(ICommonSession player,

_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;
Expand Down
3 changes: 3 additions & 0 deletions Content.Server/Shuttles/Systems/ArrivalsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@ public void HandlePlayerSpawning(PlayerSpawningEvent ev)
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ public void HandlePlayerSpawning(PlayerSpawningEvent args)
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))
{
Expand Down
6 changes: 4 additions & 2 deletions Content.Server/Spawners/EntitySystems/SpawnPointSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ private void OnPlayerSpawning(PlayerSpawningEvent args)
}
}

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))
{
Expand Down
10 changes: 10 additions & 0 deletions Content.Shared/_Sunrise/SunriseCCVars/SunriseCCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 315dcf8

Please sign in to comment.