Merge remote-tracking branch 'upstream/master' into 20-10-30-admins
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Movement;
|
||||
using Content.Shared;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.GameObjects.Components.Movement;
|
||||
using JetBrains.Annotations;
|
||||
@@ -44,7 +44,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>();
|
||||
@@ -60,7 +59,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;
|
||||
|
||||
|
||||
@@ -328,9 +328,16 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
|
||||
return;
|
||||
}
|
||||
|
||||
var newGridId = moveEvent.NewPosition.GetGridId(_entityManager);
|
||||
if (newGridId == GridId.Invalid)
|
||||
{
|
||||
HandleEntityRemove(moveEvent.Sender);
|
||||
return;
|
||||
}
|
||||
|
||||
// The pathfinding graph is tile-based so first we'll check if they're on a different tile and if we need to update.
|
||||
// If you get entities bigger than 1 tile wide you'll need some other system so god help you.
|
||||
var newTile = _mapManager.GetGrid(moveEvent.NewPosition.GetGridId(_entityManager)).GetTileRef(moveEvent.NewPosition);
|
||||
var newTile = _mapManager.GetGrid(newGridId).GetTileRef(moveEvent.NewPosition);
|
||||
|
||||
if (oldNode == null || oldNode.TileRef == newTile)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user