Entities now require a location when being spawned.
This commit is contained in:
@@ -252,7 +252,7 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
{
|
||||
return;
|
||||
}
|
||||
var cell = Owner.EntityManager.SpawnEntity("PowerCellSmallHyper");
|
||||
var cell = Owner.EntityManager.SpawnEntity("PowerCellSmallHyper", Owner.Transform.GridPosition);
|
||||
_cellContainer.Insert(cell);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,8 +43,7 @@ namespace Content.Server.GameObjects.Components.Interactable.Tools
|
||||
mapGrid.SetTile(eventArgs.ClickLocation, new Tile(underplating.TileId));
|
||||
_entitySystemManager.GetEntitySystem<AudioSystem>().Play("/Audio/items/crowbar.ogg", Owner);
|
||||
//Actually spawn the relevant tile item at the right position and give it some offset to the corner.
|
||||
var tileItem = Owner.EntityManager.SpawnEntity(tileDef.ItemDropPrototypeName);
|
||||
tileItem.Transform.GridPosition = coordinates;
|
||||
var tileItem = Owner.EntityManager.SpawnEntity(tileDef.ItemDropPrototypeName, coordinates);
|
||||
tileItem.Transform.WorldPosition += (0.2f, 0.2f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage.Fill
|
||||
|
||||
void Spawn(string prototype)
|
||||
{
|
||||
storage.Insert(_entityManager.SpawnEntity(prototype));
|
||||
storage.Insert(_entityManager.SpawnEntityAt(prototype, Owner.Transform.GridPosition));
|
||||
}
|
||||
|
||||
Spawn("Brutepack");
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage.Fill
|
||||
|
||||
void Spawn(string prototype)
|
||||
{
|
||||
storage.Insert(_entityManager.SpawnEntity(prototype));
|
||||
storage.Insert(_entityManager.SpawnEntity(prototype, Owner.Transform.GridPosition));
|
||||
}
|
||||
|
||||
if (random.Prob(0.4f))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
@@ -23,7 +23,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage.Fill
|
||||
|
||||
void Spawn(string prototype)
|
||||
{
|
||||
storage.Insert(_entityManager.SpawnEntity(prototype));
|
||||
storage.Insert(_entityManager.SpawnEntityAt(prototype, Owner.Transform.GridPosition));
|
||||
}
|
||||
|
||||
Spawn("Screwdriver");
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage.Fill
|
||||
|
||||
void Spawn(string prototype)
|
||||
{
|
||||
storage.Insert(_entityManager.SpawnEntity(prototype));
|
||||
storage.Insert(_entityManager.SpawnEntity(prototype, Owner.Transform.GridPosition));
|
||||
}
|
||||
|
||||
Spawn("Crowbar");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using Content.Server.GameObjects.Components.Chemistry;
|
||||
using Content.Server.GameObjects.Components.Sound;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
@@ -162,7 +162,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
||||
|
||||
if (_finishPrototype != null)
|
||||
{
|
||||
var finisher = Owner.EntityManager.SpawnEntity(_finishPrototype);
|
||||
var finisher = Owner.EntityManager.SpawnEntity(_finishPrototype, Owner.Transform.GridPosition);
|
||||
if (user.TryGetComponent(out HandsComponent handsComponent) && finisher.TryGetComponent(out ItemComponent itemComponent))
|
||||
{
|
||||
if (handsComponent.CanPutInHand(itemComponent))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.GameObjects.Components.Sound;
|
||||
@@ -148,7 +148,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
||||
if (_availableSpawnCount > 0)
|
||||
{
|
||||
var prototypeName = _getProbItem(_prototypes);
|
||||
item = Owner.EntityManager.SpawnEntity(prototypeName);
|
||||
item = Owner.EntityManager.SpawnEntity(prototypeName, Owner.Transform.GridPosition);
|
||||
_availableSpawnCount -= 1;
|
||||
|
||||
}
|
||||
@@ -166,7 +166,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
||||
// Ideally this takes priority to be put into inventory rather than the desired item
|
||||
if (_finishPrototype != null)
|
||||
{
|
||||
var item = Owner.EntityManager.SpawnEntity(_finishPrototype);
|
||||
var item = Owner.EntityManager.SpawnEntity(_finishPrototype, Owner.Transform.GridPosition);
|
||||
item.Transform.GridPosition = Owner.Transform.GridPosition;
|
||||
Owner.Delete();
|
||||
if (user.TryGetComponent(out HandsComponent handsComponent) &&
|
||||
|
||||
@@ -160,7 +160,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
||||
|
||||
if (_finishPrototype != null)
|
||||
{
|
||||
var finisher = Owner.EntityManager.SpawnEntity(_finishPrototype);
|
||||
var finisher = Owner.EntityManager.SpawnEntity(_finishPrototype, Owner.Transform.GridPosition);
|
||||
if (user.TryGetComponent(out HandsComponent handsComponent) && finisher.TryGetComponent(out ItemComponent itemComponent))
|
||||
{
|
||||
if (handsComponent.CanPutInHand(itemComponent))
|
||||
|
||||
@@ -202,10 +202,10 @@ namespace Content.Server.GameObjects.Components.Power
|
||||
switch (BulbType)
|
||||
{
|
||||
case LightBulbType.Tube:
|
||||
_lightBulbContainer.Insert(Owner.EntityManager.SpawnEntity("LightTube"));
|
||||
_lightBulbContainer.Insert(Owner.EntityManager.SpawnEntity("LightTube", Owner.Transform.GridPosition));
|
||||
break;
|
||||
case LightBulbType.Bulb:
|
||||
_lightBulbContainer.Insert(Owner.EntityManager.SpawnEntity("LightBulb"));
|
||||
_lightBulbContainer.Insert(Owner.EntityManager.SpawnEntity("LightBulb", Owner.Transform.GridPosition));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
|
||||
}
|
||||
|
||||
_availableSpawnCount -= 1;
|
||||
bullet = Owner.EntityManager.SpawnEntity(FillType);
|
||||
bullet = Owner.EntityManager.SpawnEntity(FillType, Owner.Transform.GridPosition);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
|
||||
}
|
||||
|
||||
_availableSpawnCount -= 1;
|
||||
bullet = Owner.EntityManager.SpawnEntity(FillType);
|
||||
bullet = Owner.EntityManager.SpawnEntity(FillType, Owner.Transform.GridPosition);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -280,7 +280,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
|
||||
{
|
||||
if (_defaultMagazine != null)
|
||||
{
|
||||
var magazine = Owner.EntityManager.SpawnEntity(_defaultMagazine);
|
||||
var magazine = Owner.EntityManager.SpawnEntity(_defaultMagazine, Owner.Transform.GridPosition);
|
||||
InsertMagazine(magazine, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using Content.Server.GameObjects.Components.Sound;
|
||||
using Robust.Server.GameObjects.Components.Container;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
@@ -78,7 +78,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
|
||||
return null;
|
||||
}
|
||||
|
||||
var projectile = Owner.EntityManager.SpawnEntity(bullet.ProjectileType);
|
||||
var projectile = Owner.EntityManager.SpawnEntity(bullet.ProjectileType, Owner.Transform.GridPosition);
|
||||
bullet.Spent = true;
|
||||
|
||||
CycleChamberedBullet(0);
|
||||
|
||||
@@ -278,7 +278,7 @@ namespace Content.Server.GameTicking
|
||||
Logger.Error("{0} is an invalid equipment slot.", slotStr);
|
||||
continue;
|
||||
}
|
||||
var equipmentEntity = _entityManager.SpawnEntity(equipmentStr);
|
||||
var equipmentEntity = _entityManager.SpawnEntity(equipmentStr, entity.Transform.GridPosition);
|
||||
inventory.Equip(slot, equipmentEntity.GetComponent<ClothingComponent>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,18 +14,14 @@ namespace Content.Server.Placement
|
||||
/// <summary>
|
||||
/// Spawns a spotlight ground turret that will track any living entities in range.
|
||||
/// </summary>
|
||||
/// <param name="grid"></param>
|
||||
/// <param name="localPosition"></param>
|
||||
public static void SpawnLightTurret(IMapGrid grid, Vector2 localPosition)
|
||||
/// <param name="position"></param>
|
||||
public static void SpawnLightTurret(GridCoordinates position)
|
||||
{
|
||||
var entMan = IoCManager.Resolve<IServerEntityManager>();
|
||||
var tBase = entMan.SpawnEntity("TurretBase");
|
||||
tBase.GetComponent<ITransformComponent>().GridPosition = new GridCoordinates(localPosition, grid);
|
||||
var tBase = entMan.SpawnEntity("TurretBase", position);
|
||||
|
||||
var tTop = entMan.SpawnEntity("TurretTopLight");
|
||||
var topTransform = tTop.GetComponent<ITransformComponent>();
|
||||
topTransform.GridPosition = new GridCoordinates(localPosition, grid);
|
||||
topTransform.AttachParent(tBase);
|
||||
var tTop = entMan.SpawnEntity("TurretTopLight", position);
|
||||
tTop.Transform.AttachParent(tBase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Submodule RobustToolbox updated: 5ff164e762...df34ce025a
Reference in New Issue
Block a user