Meow hotfix (#553)

This commit is contained in:
Cinkafox
2023-11-11 14:43:59 +03:00
committed by Aviu00
parent 8d804dd28b
commit 0bd5b16c4b
2 changed files with 17 additions and 0 deletions

View File

@@ -61,6 +61,7 @@ public sealed class MeatyOreStoreSystem : EntitySystem
private static readonly string MeatyOreCurrencyPrototype = "MeatyOreCoin";
private bool _meatyOrePanelEnabled;
private bool _antagGrantEnabled;
private readonly Dictionary<NetUserId, StoreComponent> _meatyOreStores = new();
@@ -72,6 +73,7 @@ public sealed class MeatyOreStoreSystem : EntitySystem
_configurationManager.OnValueChanged(WhiteCVars.MeatyOrePanelEnabled, OnPanelEnableChanged, true);
_configurationManager.OnValueChanged(WhiteCVars.OnlyInOhio, s => _apiUrl = s, true);
_configurationManager.OnValueChanged(WhiteCVars.EnableGrantAntag, b => _antagGrantEnabled = b, true );
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnPostRoundCleanup);
SubscribeNetworkEvent<MeatyOreShopRequestEvent>(OnShopRequested);
@@ -81,6 +83,9 @@ public sealed class MeatyOreStoreSystem : EntitySystem
private void MeatyOreVerbs(GetVerbsEvent<Verb> ev)
{
if(!_antagGrantEnabled)
return;
if (!EntityManager.TryGetComponent<ActorComponent>(ev.User, out var actorComponent))
return;
@@ -209,6 +214,12 @@ public sealed class MeatyOreStoreSystem : EntitySystem
return;
}
if (!store.Balance.TryGetValue(MeatyOreCurrencyPrototype, out var currency))
return;
if(currency - 10 < 0)
return;
var fake = _roleSystem.MindIsAntagonist(targetMind.Mind.Value) || _jobSystem.CanBeAntag(mindComponent.Session);

View File

@@ -335,4 +335,10 @@ public sealed class WhiteCVars
public static readonly CVarDef<float> SlipPowerModifier =
CVarDef.Create("white.slip_power_modifier", 1.0f, CVar.REPLICATED);
/*
* Antag grant
*/
public static readonly CVarDef<bool> EnableGrantAntag =
CVarDef.Create("white.antag_grant_enabled", true, CVar.SERVERONLY);
}