Merge remote-tracking branch 'WD-core/master' into upstream-core

This commit is contained in:
BIGZi0348
2025-01-13 21:27:57 +03:00
34 changed files with 284 additions and 67 deletions

View File

@@ -5,4 +5,4 @@ namespace Content.Server.Speech.Components;
/// </summary>
[RegisterComponent]
public sealed partial class GnomeAccentComponent : Component
{}
{ }

View File

@@ -1,5 +1,4 @@
using Content.Server.Speech.Components;
using System.Text.RegularExpressions;
namespace Content.Server.Speech.EntitySystems;
@@ -22,25 +21,6 @@ public sealed class GnomeAccentSystem : EntitySystem
msg = _replacement.ApplyReplacements(msg, "gnome");
// Пиздец, а не код
msg = Regex.Replace(msg, @"(?<!\w)\bне", "ГНЕМ", RegexOptions.IgnoreCase);
msg = Regex.Replace(msg, @"(?<!\w)\bнет", "ГНЕМТ", RegexOptions.IgnoreCase);
msg = Regex.Replace(msg, @"(?<!\w)\bнахуй", "ГНАМХУЙ", RegexOptions.IgnoreCase);
msg = Regex.Replace(msg, @"(?<!\w)\bпидоры", "ГНОМЕРЫ", RegexOptions.IgnoreCase);
msg = Regex.Replace(msg, @"(?<!\w)\bхуесос", "ГНОХУСОМ", RegexOptions.IgnoreCase);
msg = Regex.Replace(msg, @"(?<!\w)\bебал", "ГНОМИЛ", RegexOptions.IgnoreCase);
msg = Regex.Replace(msg, @"(?<!\w)\bзаебал", "ЗАГНОМИЛ", RegexOptions.IgnoreCase);
msg = Regex.Replace(msg, @"(?<!\w)\bубил", "УГНОМИЛ", RegexOptions.IgnoreCase);
msg = Regex.Replace(msg, @"(?<!\w)\bубит", "УГНОМЛЕН", RegexOptions.IgnoreCase);
msg = Regex.Replace(msg, @"(?<!\w)\bебнул", "УГНОМЛЕН", RegexOptions.IgnoreCase);
msg = Regex.Replace(msg, @"(?<!\w)\bстрелял", "СТРЕГНОМИЛ", RegexOptions.IgnoreCase);
msg = Regex.Replace(msg, @"(?<!\w)\bзаколол", "СГНОМИЛ", RegexOptions.IgnoreCase);
msg = Regex.Replace(msg, @"(?<!\w)\bмой", "муй", RegexOptions.None);
msg = Regex.Replace(msg, @"(?<!\w)\bдруг", "бро", RegexOptions.None);
msg = Regex.Replace(msg, @"(?<!\w)\bдрузья", "друганы", RegexOptions.None);
return msg;
}

View File

@@ -104,7 +104,7 @@ public sealed class ERTRecruitmentRule : StationEventSystem<ERTRecruitmentRuleCo
}
*/
_recruitment.StartRecruitment(ERTRecruitmentRuleComponent.EventName);
_recruitment.StartRecruitment(ERTRecruitmentRuleComponent.EventName, component.OverallPlaytime);
}
protected override void Ended(EntityUid uid, ERTRecruitmentRuleComponent component, GameRuleComponent gameRule, GameRuleEndedEvent args)

View File

@@ -16,6 +16,11 @@ public sealed partial class ERTRecruitmentRuleComponent : Component
/// </summary>
[DataField] public int MinPlayers = 3;
/// <summary>
/// Minimal playtime to be eligible for recruitment.
/// </summary>
[DataField] public TimeSpan OverallPlaytime = TimeSpan.FromHours(10);
public static SoundSpecifier ERTYes = new SoundPathSpecifier("/Audio/Announcements/ert_yes.ogg");
public static SoundSpecifier ERTNo = new SoundPathSpecifier("/Audio/Announcements/ert_no.ogg");

View File

@@ -11,6 +11,12 @@ using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Player;
using Robust.Shared.Random;
using Content.Shared.Roles;
using Content.Server.Roles;
using Content.Shared.Roles.Jobs;
using Content.Server.Station.Systems;
using Robust.Shared.Prototypes;
using Content.Server.Players.PlayTimeTracking;
namespace Content.Server._White.GhostRecruitment;
@@ -23,18 +29,26 @@ public sealed class GhostRecruitmentSystem : EntitySystem
[Dependency] private readonly MindSystem _mind = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly SharedRoleSystem _roleSystem = default!;
[Dependency] private readonly StationSpawningSystem _spawningSystem = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IPlayTimeTrackingManager _playTimeTracking = default!;
private readonly Dictionary<ICommonSession, GhostRecruitmentEuiAccept> _openUis = new();
/// <summary>
/// starts recruiting ghosts, showing them a menu with a choice to recruit.
/// </summary>
/// <param name="recruitmentName">name of recruitment. <see cref="GhostRecruitmentSpawnPointComponent"/></param>
public void StartRecruitment(string recruitmentName)
/// <param name="recruitmentName">Name of recruitment. <see cref="GhostRecruitmentSpawnPointComponent"/></param>
/// <param name="overallPlaytime">Minimal playtime to be eligible for recruitment.</param>
public void StartRecruitment(string recruitmentName, TimeSpan? overallPlaytime)
{
var query = EntityQueryEnumerator<GhostComponent, ActorComponent>();
while (query.MoveNext(out var uid, out _, out var actorComponent))
{
if (overallPlaytime != null && _playTimeTracking.GetOverallPlaytime(actorComponent.PlayerSession) < overallPlaytime)
continue;
OpenEui(uid, recruitmentName, actorComponent);
}
}
@@ -121,13 +135,20 @@ public sealed class GhostRecruitmentSystem : EntitySystem
if (!entityUid.HasValue)
return;
var mind = actorComponent.PlayerSession.GetMind();
var userId = actorComponent.PlayerSession.UserId;
var entityName = EntityManager.GetComponent<MetaDataComponent>((EntityUid) entityUid).EntityName;
if (!mind.HasValue)
return;
var newMind = _mind.CreateMind(userId, entityName);
_mind.TransferTo(mind.Value, entityUid.Value);
_mind.UnVisit(mind.Value);
var job = new JobComponent { Prototype = component.JobId };
_roleSystem.MindAddRole(newMind, job);
_mind.SetUserId(newMind, userId);
_mind.TransferTo(newMind, entityUid);
_prototypeManager.TryIndex(job.Prototype, out var jobProto);
if (jobProto != null)
_spawningSystem.SetPdaAndIdCardData((EntityUid) entityUid, entityName, jobProto, null);
}
private EntityUid? Spawn(EntityUid spawnerUid, GhostRecruitmentSpawnPointComponent? component = null)