* fix borg (#719)

* Automatic changelog update

* Переводы снаряжения и прочей мелочи в стартовом меню (#720)

* Сумки, мешки и прочее

* Перевод снаряжения

* перевод черт персонажа

* Добавлено ничего

* Automatic changelog update

* Фикс отображения потери мастера для импланта подчинения (#721)

* фикс отображения

* brain damage is real

* я блять запустил райдер ради рефактора одного ифа

* а лучше даже так

* Automatic changelog update

* add coderabbitai config (#722)

* fix (#723)

* Шприц теперь является оружием массового поражения (#724)

* Automatic changelog update

* Пиздец (#725)

Я на это потратил 2 недели

* Automatic changelog update

* Honk FM (#136) (#726)

* Fix Cosmic Temperance и новые песенки в jukebox

* Новая музыка в jucebox x2

Co-authored-by: Vorge7 <vorge228@gmail.com>

* Automatic changelog update

* Флаф (fluff) мне (big_zi_348) (#727)

* Заработал

* brain damage

* fuck (#729)

* Automatic changelog update

* FUCKERS (#732)

* Удаление ненужных суффиксов (#731)

* Перевод захардкукоженной строки (#728)

* Пластырь поможет

* очапятка

* Перевод ревенанта

* Карповый перекат

* Create shakeable-component.ftl

* Криогеника

* Хранилища скафандров

* Update autotranslate-14.ftl

* Update Cyborgs.xml

* Комоды

* Кредиты

* Удалил дубликат

* Информация

* Пластырь миму и клоуну

* Переводы всего

* Перевод аплинка

* Удалил ненужные суффиксы

* Revert "Удалил ненужные суффиксы"

This reverts commit d82f05f30c37ec2c11e5736b91239fe9dd1a4d17.

* Удаление ненужных суффиксов

* Перевод реагентовых слизней

* Перевод аномалий

* Перевод маяков

* Перевод различной мелочи

* Automatic changelog update

* Переводы и правки Гайдов (#730)

* Automatic changelog update

* aaaaa (#733)

---------

Co-authored-by: RavmorganButOnCocaine <valtos@nextmail.ru>
Co-authored-by: BIGZi0348 <118811750+BIGZi0348@users.noreply.github.com>
Co-authored-by: ThereDrD <88589686+ThereDrD0@users.noreply.github.com>
Co-authored-by: Vorge7 <vorge228@gmail.com>
Co-authored-by: Valtos <valtos@spaces.ru>
Co-authored-by: haiwwkes <49613070+rhailrake@users.noreply.github.com>
This commit is contained in:
Jabak
2024-10-13 19:11:01 +03:00
committed by GitHub
parent b0aa1479f4
commit ace45578a3
830 changed files with 3240 additions and 6210 deletions

View File

@@ -1,27 +1,35 @@
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Robust.Shared.Player;
using Robust.Shared.Random;
namespace Content.Server.Antag;
public sealed class AntagSelectionPlayerPool (List<List<ICommonSession>> orderedPools)
public sealed class AntagSelectionPlayerPool
{
private readonly List<ICommonSession> _premiumPool;
private readonly List<ICommonSession> _defaultPool;
public AntagSelectionPlayerPool(List<List<ICommonSession>> orderedPools)
{
_premiumPool = orderedPools[0];
_defaultPool = orderedPools[1];
}
public bool TryPickAndTake(IRobustRandom random, [NotNullWhen(true)] out ICommonSession? session)
{
session = null;
foreach (var pool in orderedPools)
if (_premiumPool.Count > 0)
{
if (pool.Count == 0)
continue;
session = random.PickAndTake(pool);
break;
session = random.PickAndTake(_premiumPool);
}
else if (_defaultPool.Count > 0)
{
session = random.PickAndTake(_defaultPool);
}
return session != null;
}
public int Count => orderedPools.Sum(p => p.Count);
public int Count => _premiumPool.Count + _defaultPool.Count;
}

View File

@@ -26,6 +26,7 @@ using Robust.Shared.Map;
using Robust.Shared.Player;
using Robust.Shared.Random;
using Content.Server._Miracle.GulagSystem;
using Content.Server._White.Sponsors;
using Content.Server.Inventory;
using Robust.Shared.Utility;
@@ -45,6 +46,7 @@ public sealed partial class AntagSelectionSystem : GameRuleSystem<AntagSelection
[Dependency] private readonly TransformSystem _transform = default!;
[Dependency] private readonly GulagSystem _gulag = default!; // WD
[Dependency] private readonly ServerInventorySystem _inventory = default!; // WD
[Dependency] private readonly SponsorsManager _sponsors = default!; // WD
// arbitrary random number to give late joining some mild interest.
public const float LateJoinRandomChance = 0.5f;
@@ -333,8 +335,9 @@ public sealed partial class AntagSelectionSystem : GameRuleSystem<AntagSelection
/// </summary>
public AntagSelectionPlayerPool GetPlayerPool(Entity<AntagSelectionComponent> ent, IList<ICommonSession> sessions, AntagSelectionDefinition def)
{
var preferredList = new List<ICommonSession>();
var fallbackList = new List<ICommonSession>();
var premiumPool = new List<ICommonSession>();
var defaultPool = new List<ICommonSession>();
foreach (var session in sessions)
{
if (!IsSessionValid(ent, session, def) ||
@@ -342,17 +345,36 @@ public sealed partial class AntagSelectionSystem : GameRuleSystem<AntagSelection
continue;
var pref = (HumanoidCharacterProfile) _pref.GetPreferences(session.UserId).SelectedCharacter;
if (def.PrefRoles.Count != 0 && pref.AntagPreferences.Any(p => def.PrefRoles.Contains(p)))
var hasPreference = def.PrefRoles.Count != 0 && pref.AntagPreferences.Any(p => def.PrefRoles.Contains(p));
var hasFallbackPreference = def.FallbackRoles.Count != 0 && pref.AntagPreferences.Any(p => def.FallbackRoles.Contains(p));
if (RobustRandom.Prob(GetPremiumPoolChance(session)))
{
preferredList.Add(session);
if (hasPreference || hasFallbackPreference)
premiumPool.Add(session);
}
else if (def.FallbackRoles.Count != 0 && pref.AntagPreferences.Any(p => def.FallbackRoles.Contains(p)))
else
{
fallbackList.Add(session);
if (hasPreference)
defaultPool.Add(session);
else if (hasFallbackPreference)
defaultPool.Add(session);
}
}
return new AntagSelectionPlayerPool(new() { preferredList, fallbackList });
if (premiumPool.Count == 0 && defaultPool.Count == 0)
{
foreach (var session in sessions)
{
if (IsSessionValid(ent, session, def) && IsEntityValid(session.AttachedEntity, def))
{
defaultPool.Add(session);
}
}
}
return new AntagSelectionPlayerPool(new() { premiumPool, defaultPool });
}
/// <summary>
@@ -432,6 +454,20 @@ public sealed partial class AntagSelectionSystem : GameRuleSystem<AntagSelection
return true;
}
public float GetPremiumPoolChance(ICommonSession session)
{
if (!_sponsors.TryGetInfo(session.UserId, out var info))
return 0f;
var antagChance = info.AntagChance;
// Ensure antagChance is within 0-100 range
antagChance = Math.Clamp(antagChance, 0, 100);
// Convert clamped antagChance from 0-100 range to 0-1 range
return antagChance / 100f;
}
}
/// <summary>

View File

@@ -80,13 +80,19 @@ public sealed class MindslaveSystem : SharedMindslaveSystem
return;
}
var master = GetEntity(mindslave.Master);
if (Mind.TryGetMind(args.Target, out var mindId, out _))
{
_role.MindTryRemoveRole<RoleBriefingComponent>(mindId);
Popup.PopupEntity(Loc.GetString("mindslave-freed", ("player", mindslave.Master)), args.Target, args.Target);
var popupNoMaster = master == EntityUid.Invalid
? Loc.GetString("mindslave-freed-no-master")
: Loc.GetString("mindslave-freed", ("player", master));
Popup.PopupEntity(popupNoMaster, args.Target, args.Target);
}
var master = GetEntity(mindslave.Master);
if (TryComp(master, out MindSlaveComponent? masterMindslave))
{
masterMindslave.Slaves.Remove(GetNetEntity(args.Target));