Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MAPS] Paper fix #2316

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion Content.Server/Corvax/StationGoal/StationGoalPaperSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Content.Shared.Fax.Components;
using Content.Shared.GameTicking;
using Content.Shared.Paper;
using Robust.Server.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;

Expand All @@ -16,6 +17,7 @@ public sealed class StationGoalPaperSystem : EntitySystem
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly FaxSystem _faxSystem = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;

public override void Initialize()
{
Expand All @@ -31,7 +33,18 @@ private void OnRoundStarted(RoundStartedEvent ev)
public bool SendRandomGoal()
{
var availableGoals = _prototypeManager.EnumeratePrototypes<StationGoalPrototype>().ToList();
var goal = _random.Pick(availableGoals);
var playerCount = _playerManager.PlayerCount;

var validGoals = availableGoals.Where(goal =>
(!goal.MinPlayers.HasValue || playerCount >= goal.MinPlayers.Value) &&
(!goal.MaxPlayers.HasValue || playerCount <= goal.MaxPlayers.Value)).ToList();

if (!validGoals.Any())
{
return false;
}

var goal = _random.Pick(validGoals);
return SendStationGoal(goal);
}

Expand Down
13 changes: 11 additions & 2 deletions Content.Server/Corvax/StationGoal/StationGoalPrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,17 @@ namespace Content.Server.Corvax.StationGoal
[Serializable, Prototype("stationGoal")]
public sealed class StationGoalPrototype : IPrototype
{
[IdDataFieldAttribute] public string ID { get; } = default!;
[IdDataFieldAttribute]
public string ID { get; } = default!;

[DataField]
public string Text { get; set; } = string.Empty;

[DataField]
public int? MinPlayers;

[DataField]
public int? MaxPlayers;

[DataField("text")] public string Text { get; set; } = string.Empty;
}
}
21 changes: 15 additions & 6 deletions Content.Server/Speech/EntitySystems/FrontalLispSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,21 @@ private void OnAccent(EntityUid uid, FrontalLispComponent component, AccentGetEv
message = RegexLowerEcks.Replace(message, "ekth");

// Corvax-Localization Start
// с, в, ч, т in ф or ш
message = Regex.Replace(message, @"\B[СВЧТ]\B", _random.Prob(0.5f) ? "Ф" : "Ш");
message = Regex.Replace(message, @"\B[свчт]\B", _random.Prob(0.5f) ? "ф" : "ш");
// д in ф
message = Regex.Replace(message, @"\b[Д](?![ИЕЁЮЯЬ])\b|\B[Д]\B", "Ф");
message = Regex.Replace(message, @"\b[Дд](?![ИиЕеЁёЮюЯяЬь])\b|\B[Дд]\B", "ф");
// с - ш
message = Regex.Replace(message, @"с", _random.Prob(0.90f) ? "ш" : "с");
message = Regex.Replace(message, @"С", _random.Prob(0.90f) ? "Ш" : "С");
// ч - ш
message = Regex.Replace(message, @"ч", _random.Prob(0.90f) ? "ш" : "ч");
message = Regex.Replace(message, @"Ч", _random.Prob(0.90f) ? "Ш" : "Ч");
// ц - ч
message = Regex.Replace(message, @"ц", _random.Prob(0.90f) ? "ч" : "ц");
message = Regex.Replace(message, @"Ц", _random.Prob(0.90f) ? "Ч" : "Ц");
// т - ч
message = Regex.Replace(message, @"\B[т](?![АЕЁИОУЫЭЮЯаеёиоуыэюя])", _random.Prob(0.90f) ? "ч" : "т");
message = Regex.Replace(message, @"\B[Т](?![АЕЁИОУЫЭЮЯаеёиоуыэюя])", _random.Prob(0.90f) ? "Ч" : "Т");
// з - ж
message = Regex.Replace(message, @"з", _random.Prob(0.90f) ? "ж" : "з");
message = Regex.Replace(message, @"З", _random.Prob(0.90f) ? "Ж" : "З");
// Corvax-Localization End

args.Message = message;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
loadout-group-inventory = Мой инвентарь
loadout-group-psychologist-backpack = Рюкзак психолога
loadout-group-chief-engineer-backpack = Рюкзак старшего инженера
Loading
Loading