From a86363a6d2dfb7b2f286d026acaeef8583d57dca Mon Sep 17 00:00:00 2001 From: Acruid Date: Fri, 24 Jan 2020 16:10:48 -0800 Subject: [PATCH] API changes, renamed SpawnEntityAt to SpawnEntity. --- .../Components/Construction/ConstructorComponent.cs | 2 +- .../GameObjects/EntitySystems/MeleeWeaponSystem.cs | 4 ++-- Content.Client/UserInterface/CharacterSetupGui.cs | 2 +- .../UserInterface/LobbyCharacterPreviewPanel.cs | 4 ++-- .../Tests/HumanInventoryUniformSlotsTest.cs | 10 +++++----- Content.Server/Administration/AGhost.cs | 4 ++-- .../Components/Cargo/CargoConsoleComponent.cs | 3 ++- .../Components/Construction/ConstructionComponent.cs | 3 ++- .../Components/Construction/ConstructorComponent.cs | 4 ++-- .../Components/Damage/DestructibleComponent.cs | 3 ++- .../Items/Storage/Fill/MedkitFillComponent.cs | 3 ++- .../Storage/Fill/ToolboxElectricalFillComponent.cs | 3 ++- .../Components/Movement/ServerTeleporterComponent.cs | 4 ++-- .../Components/Power/PowerTransferComponent.cs | 4 +++- .../Components/Power/WirePlacerComponent.cs | 5 ++++- .../GameObjects/Components/Research/LatheComponent.cs | 3 ++- .../VendingMachines/VendingMachineComponent.cs | 3 ++- .../GameObjects/EntitySystems/HandsSystem.cs | 2 +- Content.Server/GameTicking/GameTicker.cs | 6 ++++-- RobustToolbox | 2 +- 20 files changed, 44 insertions(+), 30 deletions(-) diff --git a/Content.Client/GameObjects/Components/Construction/ConstructorComponent.cs b/Content.Client/GameObjects/Components/Construction/ConstructorComponent.cs index f5b5edaf34..8c7a8d6722 100644 --- a/Content.Client/GameObjects/Components/Construction/ConstructorComponent.cs +++ b/Content.Client/GameObjects/Components/Construction/ConstructorComponent.cs @@ -78,7 +78,7 @@ namespace Content.Client.GameObjects.Components.Construction public void SpawnGhost(ConstructionPrototype prototype, GridCoordinates loc, Direction dir) { var entMgr = IoCManager.Resolve(); - var ghost = entMgr.SpawnEntityAt("constructionghost", loc); + var ghost = entMgr.SpawnEntity("constructionghost", loc); var comp = ghost.GetComponent(); comp.Prototype = prototype; comp.Master = this; diff --git a/Content.Client/GameObjects/EntitySystems/MeleeWeaponSystem.cs b/Content.Client/GameObjects/EntitySystems/MeleeWeaponSystem.cs index d907cc65e3..ae7b1d2ea9 100644 --- a/Content.Client/GameObjects/EntitySystems/MeleeWeaponSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/MeleeWeaponSystem.cs @@ -1,4 +1,4 @@ -using Content.Client.GameObjects.Components.Mobs; +using Content.Client.GameObjects.Components.Mobs; using Content.Client.GameObjects.Components.Weapons.Melee; using Content.Shared.GameObjects.Components.Weapons.Melee; using JetBrains.Annotations; @@ -71,7 +71,7 @@ namespace Content.Client.GameObjects.EntitySystems var lunge = attacker.EnsureComponent(); lunge.SetData(msg.Angle); - var entity = EntityManager.SpawnEntityAt("WeaponArc", attacker.Transform.GridPosition); + var entity = EntityManager.SpawnEntity("WeaponArc", attacker.Transform.GridPosition); entity.Transform.LocalRotation = msg.Angle; var weaponArcAnimation = entity.GetComponent(); diff --git a/Content.Client/UserInterface/CharacterSetupGui.cs b/Content.Client/UserInterface/CharacterSetupGui.cs index 3531d17845..11ea16d817 100644 --- a/Content.Client/UserInterface/CharacterSetupGui.cs +++ b/Content.Client/UserInterface/CharacterSetupGui.cs @@ -209,7 +209,7 @@ namespace Content.Client.UserInterface ButtonGroup group, ICharacterProfile profile) { - _previewDummy = entityManager.SpawnEntityAt("HumanMob_Dummy", MapCoordinates.Nullspace); + _previewDummy = entityManager.SpawnEntity("HumanMob_Dummy", MapCoordinates.Nullspace); _previewDummy.GetComponent().UpdateFromProfile(profile); var humanoid = profile as HumanoidCharacterProfile; if (humanoid != null) diff --git a/Content.Client/UserInterface/LobbyCharacterPreviewPanel.cs b/Content.Client/UserInterface/LobbyCharacterPreviewPanel.cs index 095f3dd797..6b9ed12a47 100644 --- a/Content.Client/UserInterface/LobbyCharacterPreviewPanel.cs +++ b/Content.Client/UserInterface/LobbyCharacterPreviewPanel.cs @@ -28,7 +28,7 @@ namespace Content.Client.UserInterface IClientPreferencesManager preferencesManager) { _preferencesManager = preferencesManager; - _previewDummy = entityManager.SpawnEntityAt("HumanMob_Dummy", MapCoordinates.Nullspace); + _previewDummy = entityManager.SpawnEntity("HumanMob_Dummy", MapCoordinates.Nullspace); var header = new NanoHeading { @@ -120,7 +120,7 @@ namespace Content.Client.UserInterface foreach (var (slot, itemType) in gear.Equipment) { - var item = entityMan.SpawnEntityAt(itemType, MapCoordinates.Nullspace); + var item = entityMan.SpawnEntity(itemType, MapCoordinates.Nullspace); inventory.SetSlotVisuals(slot, item); diff --git a/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs b/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs index 0907878804..8238c93da2 100644 --- a/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs +++ b/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs @@ -36,11 +36,11 @@ namespace Content.IntegrationTests.Tests var entityMan = IoCManager.Resolve(); - human = entityMan.SpawnEntityAt("HumanMob_Content", MapCoordinates.Nullspace); - uniform = entityMan.SpawnEntityAt("JanitorUniform", MapCoordinates.Nullspace); - idCard = entityMan.SpawnEntityAt("IDCardStandard", MapCoordinates.Nullspace); - pocketItem = entityMan.SpawnEntityAt("FlashlightLantern", MapCoordinates.Nullspace); - var tooBigItem = entityMan.SpawnEntityAt("RedToolboxItem", MapCoordinates.Nullspace); + human = entityMan.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace); + uniform = entityMan.SpawnEntity("JanitorUniform", MapCoordinates.Nullspace); + idCard = entityMan.SpawnEntity("IDCardStandard", MapCoordinates.Nullspace); + pocketItem = entityMan.SpawnEntity("FlashlightLantern", MapCoordinates.Nullspace); + var tooBigItem = entityMan.SpawnEntity("RedToolboxItem", MapCoordinates.Nullspace); inventory = human.GetComponent(); diff --git a/Content.Server/Administration/AGhost.cs b/Content.Server/Administration/AGhost.cs index b6d8055d1e..57d5882480 100644 --- a/Content.Server/Administration/AGhost.cs +++ b/Content.Server/Administration/AGhost.cs @@ -3,6 +3,7 @@ using Robust.Server.Interfaces.Console; using Robust.Server.Interfaces.Player; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.IoC; +using Robust.Shared.Map; namespace Content.Server.Administration { @@ -30,8 +31,7 @@ namespace Content.Server.Administration else { var entityManager = IoCManager.Resolve(); - var ghost = entityManager.SpawnEntityAt("AdminObserver", - player.AttachedEntity.Transform.GridPosition); + var ghost = entityManager.SpawnEntity("AdminObserver", player.AttachedEntity.Transform.GridPosition); mind.Visit(ghost); } diff --git a/Content.Server/GameObjects/Components/Cargo/CargoConsoleComponent.cs b/Content.Server/GameObjects/Components/Cargo/CargoConsoleComponent.cs index a2e21dec1a..b5e3fd4564 100644 --- a/Content.Server/GameObjects/Components/Cargo/CargoConsoleComponent.cs +++ b/Content.Server/GameObjects/Components/Cargo/CargoConsoleComponent.cs @@ -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; diff --git a/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs b/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs index 8f197e01ac..7e10507e50 100644 --- a/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs +++ b/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs @@ -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(); - var ent = entMgr.SpawnEntityAt(Prototype.Result, Transform.GridPosition); + var ent = entMgr.SpawnEntity(Prototype.Result, Transform.GridPosition); ent.GetComponent().LocalRotation = Transform.LocalRotation; Owner.Delete(); return true; diff --git a/Content.Server/GameObjects/Components/Construction/ConstructorComponent.cs b/Content.Server/GameObjects/Components/Construction/ConstructorComponent.cs index 8f13d8cf23..6dc83b2640 100644 --- a/Content.Server/GameObjects/Components/Construction/ConstructorComponent.cs +++ b/Content.Server/GameObjects/Components/Construction/ConstructorComponent.cs @@ -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(); construction.Init(prototype); frame.Transform.LocalRotation = angle; diff --git a/Content.Server/GameObjects/Components/Damage/DestructibleComponent.cs b/Content.Server/GameObjects/Components/Damage/DestructibleComponent.cs index 4bcdfe4c9a..468359c9a0 100644 --- a/Content.Server/GameObjects/Components/Damage/DestructibleComponent.cs +++ b/Content.Server/GameObjects/Components/Damage/DestructibleComponent.cs @@ -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); } } } diff --git a/Content.Server/GameObjects/Components/Items/Storage/Fill/MedkitFillComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/Fill/MedkitFillComponent.cs index bdfcc3149d..50221e238f 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/Fill/MedkitFillComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/Fill/MedkitFillComponent.cs @@ -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"); diff --git a/Content.Server/GameObjects/Components/Items/Storage/Fill/ToolboxElectricalFillComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/Fill/ToolboxElectricalFillComponent.cs index 77067b3f7f..8332822734 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/Fill/ToolboxElectricalFillComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/Fill/ToolboxElectricalFillComponent.cs @@ -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"); diff --git a/Content.Server/GameObjects/Components/Movement/ServerTeleporterComponent.cs b/Content.Server/GameObjects/Components/Movement/ServerTeleporterComponent.cs index bc03418d4b..94fa985dcb 100644 --- a/Content.Server/GameObjects/Components/Movement/ServerTeleporterComponent.cs +++ b/Content.Server/GameObjects/Components/Movement/ServerTeleporterComponent.cs @@ -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(out var departureComponent); // Arrival portal - var arrivalPortal = _serverEntityManager.SpawnEntityAt("Portal", targetGrid); + var arrivalPortal = _serverEntityManager.SpawnEntity("Portal", targetGrid); arrivalPortal.TryGetComponent(out var arrivalComponent); // Connect. TODO: If the OnUpdate in ServerPortalComponent is changed this may need to change as well. diff --git a/Content.Server/GameObjects/Components/Power/PowerTransferComponent.cs b/Content.Server/GameObjects/Components/Power/PowerTransferComponent.cs index 8eaae33d1a..754d007ef2 100644 --- a/Content.Server/GameObjects/Components/Power/PowerTransferComponent.cs +++ b/Content.Server/GameObjects/Components/Power/PowerTransferComponent.cs @@ -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(out var stackComp)) stackComp.Count = 1; diff --git a/Content.Server/GameObjects/Components/Power/WirePlacerComponent.cs b/Content.Server/GameObjects/Components/Power/WirePlacerComponent.cs index f2eed6a1cc..c6d77d42a8 100644 --- a/Content.Server/GameObjects/Components/Power/WirePlacerComponent.cs +++ b/Content.Server/GameObjects/Components/Power/WirePlacerComponent.cs @@ -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; diff --git a/Content.Server/GameObjects/Components/Research/LatheComponent.cs b/Content.Server/GameObjects/Components/Research/LatheComponent.cs index 380af4f594..d08a471024 100644 --- a/Content.Server/GameObjects/Components/Research/LatheComponent.cs +++ b/Content.Server/GameObjects/Components/Research/LatheComponent.cs @@ -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()); }); diff --git a/Content.Server/GameObjects/Components/VendingMachines/VendingMachineComponent.cs b/Content.Server/GameObjects/Components/VendingMachines/VendingMachineComponent.cs index 68ea4979df..76f7fe800a 100644 --- a/Content.Server/GameObjects/Components/VendingMachines/VendingMachineComponent.cs +++ b/Content.Server/GameObjects/Components/VendingMachines/VendingMachineComponent.cs @@ -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); }); } diff --git a/Content.Server/GameObjects/EntitySystems/HandsSystem.cs b/Content.Server/GameObjects/EntitySystems/HandsSystem.cs index fc2f7e4acc..5042016753 100644 --- a/Content.Server/GameObjects/EntitySystems/HandsSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/HandsSystem.cs @@ -170,7 +170,7 @@ namespace Content.Server.GameObjects.EntitySystems else { stackComp.Use(1); - throwEnt = throwEnt.EntityManager.SpawnEntityAt(throwEnt.Prototype.ID, plyEnt.Transform.GridPosition); + throwEnt = throwEnt.EntityManager.SpawnEntity(throwEnt.Prototype.ID, plyEnt.Transform.GridPosition); // can only throw one item at a time, regardless of what the prototype stack size is. if (throwEnt.TryGetComponent(out var newStackComp)) diff --git a/Content.Server/GameTicking/GameTicker.cs b/Content.Server/GameTicking/GameTicker.cs index 7da39da0ba..30e839fd53 100644 --- a/Content.Server/GameTicking/GameTicker.cs +++ b/Content.Server/GameTicking/GameTicker.cs @@ -260,7 +260,8 @@ namespace Content.Server.GameTicking private IEntity _spawnPlayerMob(Job job, bool lateJoin = true) { - var entity = _entityManager.SpawnEntityAt(PlayerPrototypeName, lateJoin ? _getLateJoinSpawnPoint() : _getJobSpawnPoint(job.Prototype.ID)); + GridCoordinates coordinates = lateJoin ? _getLateJoinSpawnPoint() : _getJobSpawnPoint(job.Prototype.ID); + var entity = _entityManager.SpawnEntity(PlayerPrototypeName, coordinates); if (entity.TryGetComponent(out InventoryComponent inventory)) { var gear = _prototypeManager.Index(job.StartingGear).Equipment; @@ -284,7 +285,8 @@ namespace Content.Server.GameTicking private IEntity _spawnObserverMob() { - return _entityManager.SpawnEntityAt(ObserverPrototypeName, _getLateJoinSpawnPoint()); + GridCoordinates coordinates = _getLateJoinSpawnPoint(); + return _entityManager.SpawnEntity(ObserverPrototypeName, coordinates); } private GridCoordinates _getLateJoinSpawnPoint() diff --git a/RobustToolbox b/RobustToolbox index df9be436c4..9f956cef95 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit df9be436c4c9a015651cb3babb169112fe1c7cdf +Subproject commit 9f956cef958c5c9d38de3f5b57af016d3e174f14