Change cvar usages to use CVarDef and define them in CCVars (#2250)
* Change cvar usages to use CVarDef and define them in CCVars * Merge fixes * Remove duplicate cvar registration
This commit is contained in:
@@ -3,6 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.GameObjects.Components.Movement;
|
||||
using Content.Shared;
|
||||
using Content.Shared.GameObjects.Components.Movement;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.AI;
|
||||
@@ -42,7 +43,6 @@ namespace Content.Server.GameObjects.EntitySystems.AI
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
_configurationManager.RegisterCVar("ai.maxupdates", 64);
|
||||
SubscribeLocalEvent<SleepAiMessage>(HandleAiSleep);
|
||||
|
||||
var processors = _reflectionManager.GetAllChildren<AiLogicProcessor>();
|
||||
@@ -58,7 +58,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI
|
||||
/// <inheritdoc />
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
var cvarMaxUpdates = _configurationManager.GetCVar<int>("ai.maxupdates");
|
||||
var cvarMaxUpdates = _configurationManager.GetCVar(CCVars.AIMaxUpdates);
|
||||
if (cvarMaxUpdates <= 0)
|
||||
return;
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI
|
||||
break;
|
||||
case false:
|
||||
_awakeAi.Add(message.Processor);
|
||||
|
||||
|
||||
if (_awakeAi.Count > cvarMaxUpdates)
|
||||
{
|
||||
Logger.Warning($"AI limit exceeded: {_awakeAi.Count} / {cvarMaxUpdates}");
|
||||
@@ -101,7 +101,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI
|
||||
toRemove.Add(processor);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
processor.Update(frameTime);
|
||||
count++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user