API changes, renamed SpawnEntityAt to SpawnEntity.

This commit is contained in:
Acruid
2020-01-24 16:10:48 -08:00
parent 4ab7f1dcb3
commit a86363a6d2
20 changed files with 44 additions and 30 deletions

View File

@@ -13,6 +13,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Robust.Shared.Map;
namespace Content.Server.GameObjects.Components.Cargo
{
@@ -104,7 +105,7 @@ namespace Content.Server.GameObjects.Components.Cargo
continue;
for (var i = 0; i < order.Amount; i++)
{
Owner.EntityManager.SpawnEntityAt(product.Product, Owner.Transform.GridPosition);
Owner.EntityManager.SpawnEntity(product.Product, Owner.Transform.GridPosition);
}
}
break;

View File

@@ -12,6 +12,7 @@ using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.ViewVariables;
using static Content.Shared.Construction.ConstructionStepMaterial;
using static Content.Shared.Construction.ConstructionStepTool;
@@ -54,7 +55,7 @@ namespace Content.Server.GameObjects.Components.Construction
{
// Oh boy we get to finish construction!
var entMgr = IoCManager.Resolve<IServerEntityManager>();
var ent = entMgr.SpawnEntityAt(Prototype.Result, Transform.GridPosition);
var ent = entMgr.SpawnEntity(Prototype.Result, Transform.GridPosition);
ent.GetComponent<ITransformComponent>().LocalRotation = Transform.LocalRotation;
Owner.Delete();
return true;

View File

@@ -82,12 +82,12 @@ namespace Content.Server.GameObjects.Components.Construction
if (prototype.Stages.Count == 2)
{
// Exactly 2 stages, so don't make an intermediate frame.
var ent = _serverEntityManager.SpawnEntityAt(prototype.Result, loc);
var ent = _serverEntityManager.SpawnEntity(prototype.Result, loc);
ent.Transform.LocalRotation = angle;
}
else
{
var frame = _serverEntityManager.SpawnEntityAt("structureconstructionframe", loc);
var frame = _serverEntityManager.SpawnEntity("structureconstructionframe", loc);
var construction = frame.GetComponent<ConstructionComponent>();
construction.Init(prototype);
frame.Transform.LocalRotation = angle;

View File

@@ -7,6 +7,7 @@ using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Random;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
@@ -105,7 +106,7 @@ namespace Content.Server.GameObjects.Components.Destructible
{
if (!string.IsNullOrWhiteSpace(spawnOnDestroy) && eventArgs.IsSpawnWreck)
{
Owner.EntityManager.SpawnEntityAt(spawnOnDestroy, Owner.Transform.GridPosition);
Owner.EntityManager.SpawnEntity(spawnOnDestroy, Owner.Transform.GridPosition);
}
}
}

View File

@@ -3,6 +3,7 @@ using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.IoC;
using Robust.Shared.Map;
namespace Content.Server.GameObjects.Components.Items.Storage.Fill
{
@@ -21,7 +22,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage.Fill
void Spawn(string prototype)
{
storage.Insert(_entityManager.SpawnEntityAt(prototype, Owner.Transform.GridPosition));
storage.Insert(_entityManager.SpawnEntity(prototype, Owner.Transform.GridPosition));
}
Spawn("Brutepack");

View File

@@ -3,6 +3,7 @@ using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Random;
namespace Content.Server.GameObjects.Components.Items.Storage.Fill
@@ -23,7 +24,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage.Fill
void Spawn(string prototype)
{
storage.Insert(_entityManager.SpawnEntityAt(prototype, Owner.Transform.GridPosition));
storage.Insert(_entityManager.SpawnEntity(prototype, Owner.Transform.GridPosition));
}
Spawn("Screwdriver");

View File

@@ -235,11 +235,11 @@ namespace Content.Server.GameObjects.Components.Movement
{
// Call Delete here as the teleporter should have control over portal longevity
// Departure portal
var departurePortal = _serverEntityManager.SpawnEntityAt("Portal", user.Transform.GridPosition);
var departurePortal = _serverEntityManager.SpawnEntity("Portal", user.Transform.GridPosition);
departurePortal.TryGetComponent<ServerPortalComponent>(out var departureComponent);
// Arrival portal
var arrivalPortal = _serverEntityManager.SpawnEntityAt("Portal", targetGrid);
var arrivalPortal = _serverEntityManager.SpawnEntity("Portal", targetGrid);
arrivalPortal.TryGetComponent<ServerPortalComponent>(out var arrivalComponent);
// Connect. TODO: If the OnUpdate in ServerPortalComponent is changed this may need to change as well.

View File

@@ -4,8 +4,10 @@ using Content.Server.GameObjects.Components.Stack;
using Content.Server.GameObjects.EntitySystems;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Power
@@ -140,7 +142,7 @@ namespace Content.Server.GameObjects.Components.Power
if (eventArgs.AttackWith.TryGetComponent(out WirecutterComponent wirecutter))
{
Owner.Delete();
var droppedEnt = Owner.EntityManager.SpawnEntityAt("CableStack", eventArgs.ClickLocation);
var droppedEnt = Owner.EntityManager.SpawnEntity("CableStack", eventArgs.ClickLocation);
if (droppedEnt.TryGetComponent<StackComponent>(out var stackComp))
stackComp.Count = 1;

View File

@@ -4,8 +4,10 @@ using Robust.Server.GameObjects;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components.Transform;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.IoC;
using Robust.Shared.Map;
namespace Content.Server.GameObjects.Components.Power
{
@@ -50,7 +52,8 @@ namespace Content.Server.GameObjects.Components.Power
if (Owner.TryGetComponent(out StackComponent stack) && !stack.Use(1))
return;
var newWire = _entityManager.SpawnEntityAt("Wire", grid.GridTileToLocal(snapPos));
GridCoordinates coordinates = grid.GridTileToLocal(snapPos);
var newWire = _entityManager.SpawnEntity("Wire", coordinates);
if (newWire.TryGetComponent(out SpriteComponent wireSpriteComp) && hasItemSpriteComp)
{
wireSpriteComp.Color = itemSpriteComp.Color;

View File

@@ -12,6 +12,7 @@ using Robust.Server.GameObjects.Components.UserInterface;
using Robust.Server.Interfaces.GameObjects;
using Robust.Server.Interfaces.Player;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Timers;
using Robust.Shared.ViewVariables;
@@ -103,7 +104,7 @@ namespace Content.Server.GameObjects.Components.Research
{
Producing = false;
_producingRecipe = null;
Owner.EntityManager.SpawnEntityAt(recipe.Result, Owner.Transform.GridPosition);
Owner.EntityManager.SpawnEntity(recipe.Result, Owner.Transform.GridPosition);
_userInterface.SendMessage(new LatheStoppedProducingRecipeMessage());
});

View File

@@ -11,6 +11,7 @@ using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Serialization;
@@ -167,7 +168,7 @@ namespace Content.Server.GameObjects.Components.VendingMachines
{
TrySetVisualState(VendingMachineVisualState.Normal);
_ejecting = false;
Owner.EntityManager.SpawnEntityAt(id, Owner.Transform.GridPosition);
Owner.EntityManager.SpawnEntity(id, Owner.Transform.GridPosition);
});
}