All entities are now allocated with a TransformComponent.

Prototypes will now use existing components, like transform, when loading an entity. Previously they blindly created new ones on the entity.
AddComponent now cannot overwrite a protected component, ie TransformComponent and MetaDataComponent. Entity caches these components, they cannot be changed.
Regular RemoveComponent functions are now not able to remove protected components.
This commit is contained in:
Acruid
2019-08-30 00:40:19 -07:00
parent c0b19dcca1
commit 8765c67872
5 changed files with 76 additions and 15 deletions

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Robust.Shared.GameObjects.Components.Transform;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.Interfaces.Network;
@@ -278,6 +279,9 @@ namespace Robust.Shared.GameObjects
// allocate the required MetaDataComponent
_componentManager.AddComponent<MetaDataComponent>(entity);
// allocate the required TransformComponent
_componentManager.AddComponent<TransformComponent>(entity);
Entities[entity.Uid] = entity;
_allEntities.Add(entity);
@@ -322,7 +326,7 @@ namespace Robust.Shared.GameObjects
#endregion Entity Management
#region ComponentEvents
public void SubscribeEvent<T>(EntityEventHandler<T> eventHandler, IEntityEventSubscriber s)
where T : EntityEventArgs
{