Husk improvements, option for admin to talk to dead players, spectators or one specific player, entitygrid bugfix

This commit is contained in:
Regalis
2016-02-14 22:22:24 +02:00
parent 94e34c0ed9
commit ef78f2d0f6
12 changed files with 81 additions and 32 deletions

View File

@@ -32,16 +32,17 @@ namespace Barotrauma
Rectangle rect = entity.Rect;
//if (Submarine.Loaded != null) rect.Offset(-Submarine.HiddenSubPosition);
Rectangle indices = GetIndices(rect);
if (indices.X < 0 || indices.Width >= entities.GetLength(0) ||
indices.Y < 0 || indices.Height >= entities.GetLength(1))
if (indices.Width < 0 || indices.X >= entities.GetLength(0) ||
indices.Height < 0 || indices.Y >= entities.GetLength(1))
{
DebugConsole.ThrowError("Error in EntityGrid.InsertEntity: " + entity + " is outside the grid");
return;
}
for (int x = indices.X; x <= indices.Width; x++)
for (int x = Math.Max(indices.X, 0); x <= Math.Min(indices.Width, entities.GetLength(0)); x++)
{
for (int y = indices.Y; y <= indices.Height; y++)
for (int y = Math.Max(indices.Y,0); y <= Math.Min(indices.Height, entities.GetLength(1)); y++)
{
entities[x, y].Add(entity);
}