diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs index ec5b88851..cbb751f50 100644 --- a/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs @@ -656,6 +656,13 @@ namespace Barotrauma msg.Timer -= deltaTime; msg.Pos += msg.Velocity * deltaTime; } + + foreach (GUIMessage msg in messages) + { + if (!msg.WorldSpace) continue; + msg.Timer -= deltaTime; + msg.Pos += msg.Velocity * deltaTime; + } } messages.RemoveAll(m => m.Timer <= 0.0f); diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs index 2dafda0cc..42567d00b 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs @@ -1216,43 +1216,6 @@ namespace Barotrauma targetingTag = "room"; } if (door != null) - { - // If there's not a more specific tag for the door - if (string.IsNullOrEmpty(targetingTag) || targetingTag == "room") - { - targetingTag = "door"; - } - bool isOutdoor = door.LinkedGap?.FlowTargetHull != null && !door.LinkedGap.IsRoomToRoom; - bool isOpen = door.IsOpen || door.Item.Condition <= 0.0f; - //increase priority if the character is outside and an aggressive boarder, and the door is from outside to inside - if (aggressiveBoarding) - { - if (character.CurrentHull == null) - { - valueModifier = isOutdoor ? 1 : 0; - valueModifier *= isOpen ? 5 : 1; - } - } - else - { - // Ignore disabled walls - bool isDisabled = true; - for (int i = 0; i < s.Sections.Length; i++) - { - valueModifier = isOutdoor ? 0 : 1; - valueModifier *= isOpen ? 0 : 1; - } - if (isDisabled) - { - valueModifier = 0; - } - } - } - else - { - targetingTag = "room"; - } - if (door != null) { // If there's not a more specific tag for the door if (string.IsNullOrEmpty(targetingTag) || targetingTag == "room") @@ -1279,10 +1242,6 @@ namespace Barotrauma { continue; } - else if (isOpen) //ignore broken and open doors - { - continue; - } } else if (target.Entity is IDamageable targetDamageable && targetDamageable.Health <= 0.0f) { diff --git a/Barotrauma/BarotraumaShared/Source/Items/ItemPrefab.cs b/Barotrauma/BarotraumaShared/Source/Items/ItemPrefab.cs index 0414286bf..6b4e03bfb 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/ItemPrefab.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/ItemPrefab.cs @@ -639,899 +639,6 @@ namespace Barotrauma } } - AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); - - if (sprite == null) - { - DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!"); -#if SERVER - sprite = new Sprite("", Vector2.Zero); - sprite.SourceRect = new Rectangle(0, 0, 32, 32); -#else - sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null) - { - Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2 - }; -#endif - size = sprite.size; - sprite.EntityID = identifier; - } - - if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier)) - { - DebugConsole.ThrowError( - "Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading."); - } - if (!string.IsNullOrEmpty(identifier)) - { - MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier); - if (existingPrefab != null) - { - DebugConsole.ThrowError( - "Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!"); - } - } - - AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); - - if (sprite == null) - { - DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!"); -#if SERVER - sprite = new Sprite("", Vector2.Zero); - sprite.SourceRect = new Rectangle(0, 0, 32, 32); -#else - sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null) - { - Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2 - }; -#endif - size = sprite.size; - sprite.EntityID = identifier; - } - - if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier)) - { - DebugConsole.ThrowError( - "Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading."); - } - if (!string.IsNullOrEmpty(identifier)) - { - MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier); - if (existingPrefab != null) - { - DebugConsole.ThrowError( - "Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!"); - } - } - - AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); - - if (sprite == null) - { - DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!"); -#if SERVER - sprite = new Sprite("", Vector2.Zero); - sprite.SourceRect = new Rectangle(0, 0, 32, 32); -#else - sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null) - { - Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2 - }; -#endif - size = sprite.size; - sprite.EntityID = identifier; - } - - if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier)) - { - DebugConsole.ThrowError( - "Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading."); - } - if (!string.IsNullOrEmpty(identifier)) - { - MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier); - if (existingPrefab != null) - { - DebugConsole.ThrowError( - "Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!"); - } - } - - AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); - - if (sprite == null) - { - DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!"); -#if SERVER - sprite = new Sprite("", Vector2.Zero); - sprite.SourceRect = new Rectangle(0, 0, 32, 32); -#else - sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null) - { - Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2 - }; -#endif - size = sprite.size; - sprite.EntityID = identifier; - } - - if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier)) - { - DebugConsole.ThrowError( - "Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading."); - } - if (!string.IsNullOrEmpty(identifier)) - { - MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier); - if (existingPrefab != null) - { - DebugConsole.ThrowError( - "Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!"); - } - } - - AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); - - if (sprite == null) - { - DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!"); -#if SERVER - sprite = new Sprite("", Vector2.Zero); - sprite.SourceRect = new Rectangle(0, 0, 32, 32); -#else - sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null) - { - Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2 - }; -#endif - size = sprite.size; - sprite.EntityID = identifier; - } - - if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier)) - { - DebugConsole.ThrowError( - "Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading."); - } - if (!string.IsNullOrEmpty(identifier)) - { - MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier); - if (existingPrefab != null) - { - DebugConsole.ThrowError( - "Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!"); - } - } - - AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); - - if (sprite == null) - { - DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!"); -#if SERVER - sprite = new Sprite("", Vector2.Zero); - sprite.SourceRect = new Rectangle(0, 0, 32, 32); -#else - sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null) - { - Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2 - }; -#endif - size = sprite.size; - sprite.EntityID = identifier; - } - - if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier)) - { - DebugConsole.ThrowError( - "Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading."); - } - if (!string.IsNullOrEmpty(identifier)) - { - MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier); - if (existingPrefab != null) - { - DebugConsole.ThrowError( - "Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!"); - } - } - - AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); - - if (sprite == null) - { - DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!"); -#if SERVER - sprite = new Sprite("", Vector2.Zero); - sprite.SourceRect = new Rectangle(0, 0, 32, 32); -#else - sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null) - { - Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2 - }; -#endif - size = sprite.size; - sprite.EntityID = identifier; - } - - if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier)) - { - DebugConsole.ThrowError( - "Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading."); - } - if (!string.IsNullOrEmpty(identifier)) - { - MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier); - if (existingPrefab != null) - { - DebugConsole.ThrowError( - "Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!"); - } - } - - AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); - - if (sprite == null) - { - DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!"); -#if SERVER - sprite = new Sprite("", Vector2.Zero); - sprite.SourceRect = new Rectangle(0, 0, 32, 32); -#else - sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null) - { - Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2 - }; -#endif - size = sprite.size; - sprite.EntityID = identifier; - } - - if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier)) - { - DebugConsole.ThrowError( - "Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading."); - } - if (!string.IsNullOrEmpty(identifier)) - { - MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier); - if (existingPrefab != null) - { - DebugConsole.ThrowError( - "Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!"); - } - } - - AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); - - if (sprite == null) - { - DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!"); -#if SERVER - sprite = new Sprite("", Vector2.Zero); - sprite.SourceRect = new Rectangle(0, 0, 32, 32); -#else - sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null) - { - Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2 - }; -#endif - size = sprite.size; - sprite.EntityID = identifier; - } - - if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier)) - { - DebugConsole.ThrowError( - "Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading."); - } - if (!string.IsNullOrEmpty(identifier)) - { - MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier); - if (existingPrefab != null) - { - DebugConsole.ThrowError( - "Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!"); - } - } - - AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); - - if (sprite == null) - { - DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!"); -#if SERVER - sprite = new Sprite("", Vector2.Zero); - sprite.SourceRect = new Rectangle(0, 0, 32, 32); -#else - sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null) - { - Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2 - }; -#endif - size = sprite.size; - sprite.EntityID = identifier; - } - - if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier)) - { - DebugConsole.ThrowError( - "Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading."); - } - if (!string.IsNullOrEmpty(identifier)) - { - MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier); - if (existingPrefab != null) - { - DebugConsole.ThrowError( - "Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!"); - } - } - - AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); - - if (sprite == null) - { - DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!"); -#if SERVER - sprite = new Sprite("", Vector2.Zero); - sprite.SourceRect = new Rectangle(0, 0, 32, 32); -#else - sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null) - { - Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2 - }; -#endif - size = sprite.size; - sprite.EntityID = identifier; - } - - if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier)) - { - DebugConsole.ThrowError( - "Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading."); - } - if (!string.IsNullOrEmpty(identifier)) - { - MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier); - if (existingPrefab != null) - { - DebugConsole.ThrowError( - "Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!"); - } - } - - AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); - - if (sprite == null) - { - DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!"); -#if SERVER - sprite = new Sprite("", Vector2.Zero); - sprite.SourceRect = new Rectangle(0, 0, 32, 32); -#else - sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null) - { - Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2 - }; -#endif - size = sprite.size; - sprite.EntityID = identifier; - } - - if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier)) - { - DebugConsole.ThrowError( - "Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading."); - } - if (!string.IsNullOrEmpty(identifier)) - { - MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier); - if (existingPrefab != null) - { - DebugConsole.ThrowError( - "Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!"); - } - } - - AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); - - if (sprite == null) - { - DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!"); -#if SERVER - sprite = new Sprite("", Vector2.Zero); - sprite.SourceRect = new Rectangle(0, 0, 32, 32); -#else - sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null) - { - Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2 - }; -#endif - size = sprite.size; - sprite.EntityID = identifier; - } - - if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier)) - { - DebugConsole.ThrowError( - "Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading."); - } - if (!string.IsNullOrEmpty(identifier)) - { - MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier); - if (existingPrefab != null) - { - DebugConsole.ThrowError( - "Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!"); - } - } - - AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); - - if (sprite == null) - { - DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!"); -#if SERVER - sprite = new Sprite("", Vector2.Zero); - sprite.SourceRect = new Rectangle(0, 0, 32, 32); -#else - sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null) - { - Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2 - }; -#endif - size = sprite.size; - sprite.EntityID = identifier; - } - - if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier)) - { - DebugConsole.ThrowError( - "Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading."); - } - if (!string.IsNullOrEmpty(identifier)) - { - MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier); - if (existingPrefab != null) - { - DebugConsole.ThrowError( - "Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!"); - } - } - - AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); - - if (sprite == null) - { - DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!"); -#if SERVER - sprite = new Sprite("", Vector2.Zero); - sprite.SourceRect = new Rectangle(0, 0, 32, 32); -#else - sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null) - { - Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2 - }; -#endif - size = sprite.size; - sprite.EntityID = identifier; - } - - if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier)) - { - DebugConsole.ThrowError( - "Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading."); - } - if (!string.IsNullOrEmpty(identifier)) - { - MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier); - if (existingPrefab != null) - { - DebugConsole.ThrowError( - "Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!"); - } - } - - AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); - - if (sprite == null) - { - DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!"); -#if SERVER - sprite = new Sprite("", Vector2.Zero); - sprite.SourceRect = new Rectangle(0, 0, 32, 32); -#else - sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null) - { - Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2 - }; -#endif - size = sprite.size; - sprite.EntityID = identifier; - } - - if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier)) - { - DebugConsole.ThrowError( - "Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading."); - } - if (!string.IsNullOrEmpty(identifier)) - { - MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier); - if (existingPrefab != null) - { - DebugConsole.ThrowError( - "Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!"); - } - } - - AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); - - if (sprite == null) - { - DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!"); -#if SERVER - sprite = new Sprite("", Vector2.Zero); - sprite.SourceRect = new Rectangle(0, 0, 32, 32); -#else - sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null) - { - Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2 - }; -#endif - size = sprite.size; - sprite.EntityID = identifier; - } - - if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier)) - { - DebugConsole.ThrowError( - "Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading."); - } - if (!string.IsNullOrEmpty(identifier)) - { - MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier); - if (existingPrefab != null) - { - DebugConsole.ThrowError( - "Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!"); - } - } - - AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); - - if (sprite == null) - { - DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!"); -#if SERVER - sprite = new Sprite("", Vector2.Zero); - sprite.SourceRect = new Rectangle(0, 0, 32, 32); -#else - sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null) - { - Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2 - }; -#endif - size = sprite.size; - sprite.EntityID = identifier; - } - - if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier)) - { - DebugConsole.ThrowError( - "Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading."); - } - if (!string.IsNullOrEmpty(identifier)) - { - MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier); - if (existingPrefab != null) - { - DebugConsole.ThrowError( - "Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!"); - } - } - - AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); - - if (sprite == null) - { - DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!"); -#if SERVER - sprite = new Sprite("", Vector2.Zero); - sprite.SourceRect = new Rectangle(0, 0, 32, 32); -#else - sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null) - { - Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2 - }; -#endif - size = sprite.size; - sprite.EntityID = identifier; - } - - if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier)) - { - DebugConsole.ThrowError( - "Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading."); - } - if (!string.IsNullOrEmpty(identifier)) - { - MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier); - if (existingPrefab != null) - { - DebugConsole.ThrowError( - "Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!"); - } - } - - AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); - - if (sprite == null) - { - DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!"); -#if SERVER - sprite = new Sprite("", Vector2.Zero); - sprite.SourceRect = new Rectangle(0, 0, 32, 32); -#else - sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null) - { - Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2 - }; -#endif - size = sprite.size; - sprite.EntityID = identifier; - } - - if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier)) - { - DebugConsole.ThrowError( - "Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading."); - } - if (!string.IsNullOrEmpty(identifier)) - { - MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier); - if (existingPrefab != null) - { - DebugConsole.ThrowError( - "Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!"); - } - } - - AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); - - if (sprite == null) - { - DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!"); -#if SERVER - sprite = new Sprite("", Vector2.Zero); - sprite.SourceRect = new Rectangle(0, 0, 32, 32); -#else - sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null) - { - Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2 - }; -#endif - size = sprite.size; - sprite.EntityID = identifier; - } - - if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier)) - { - DebugConsole.ThrowError( - "Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading."); - } - if (!string.IsNullOrEmpty(identifier)) - { - MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier); - if (existingPrefab != null) - { - DebugConsole.ThrowError( - "Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!"); - } - } - - AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); - - if (sprite == null) - { - DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!"); -#if SERVER - sprite = new Sprite("", Vector2.Zero); - sprite.SourceRect = new Rectangle(0, 0, 32, 32); -#else - sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null) - { - Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2 - }; -#endif - size = sprite.size; - sprite.EntityID = identifier; - } - - if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier)) - { - DebugConsole.ThrowError( - "Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading."); - } - if (!string.IsNullOrEmpty(identifier)) - { - MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier); - if (existingPrefab != null) - { - DebugConsole.ThrowError( - "Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!"); - } - } - - AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); - - if (sprite == null) - { - DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!"); -#if SERVER - sprite = new Sprite("", Vector2.Zero); - sprite.SourceRect = new Rectangle(0, 0, 32, 32); -#else - sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null) - { - Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2 - }; -#endif - size = sprite.size; - sprite.EntityID = identifier; - } - - if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier)) - { - DebugConsole.ThrowError( - "Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading."); - } - if (!string.IsNullOrEmpty(identifier)) - { - MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier); - if (existingPrefab != null) - { - DebugConsole.ThrowError( - "Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!"); - } - } - - AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); - - if (sprite == null) - { - DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!"); -#if SERVER - sprite = new Sprite("", Vector2.Zero); - sprite.SourceRect = new Rectangle(0, 0, 32, 32); -#else - sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null) - { - Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2 - }; -#endif - size = sprite.size; - sprite.EntityID = identifier; - } - - if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier)) - { - DebugConsole.ThrowError( - "Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading."); - } - if (!string.IsNullOrEmpty(identifier)) - { - MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier); - if (existingPrefab != null) - { - DebugConsole.ThrowError( - "Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!"); - } - } - - AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); - - if (sprite == null) - { - DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!"); -#if SERVER - sprite = new Sprite("", Vector2.Zero); - sprite.SourceRect = new Rectangle(0, 0, 32, 32); -#else - sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null) - { - Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2 - }; -#endif - size = sprite.size; - sprite.EntityID = identifier; - } - - if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier)) - { - DebugConsole.ThrowError( - "Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading."); - } - if (!string.IsNullOrEmpty(identifier)) - { - MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier); - if (existingPrefab != null) - { - DebugConsole.ThrowError( - "Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!"); - } - } - - AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); - - if (sprite == null) - { - DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!"); -#if SERVER - sprite = new Sprite("", Vector2.Zero); - sprite.SourceRect = new Rectangle(0, 0, 32, 32); -#else - sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null) - { - Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2 - }; -#endif - size = sprite.size; - sprite.EntityID = identifier; - } - - if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier)) - { - DebugConsole.ThrowError( - "Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading."); - } - if (!string.IsNullOrEmpty(identifier)) - { - MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier); - if (existingPrefab != null) - { - DebugConsole.ThrowError( - "Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!"); - } - } - - AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); - - if (sprite == null) - { - DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!"); -#if SERVER - sprite = new Sprite("", Vector2.Zero); - sprite.SourceRect = new Rectangle(0, 0, 32, 32); -#else - sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null) - { - Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2 - }; -#endif - size = sprite.size; - sprite.EntityID = identifier; - } - - if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier)) - { - DebugConsole.ThrowError( - "Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading."); - } - if (!string.IsNullOrEmpty(identifier)) - { - MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier); - if (existingPrefab != null) - { - DebugConsole.ThrowError( - "Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!"); - } - } - - AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); - if (sprite == null) { DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!");