Inline Prototype
This commit is contained in:
@@ -18,6 +18,7 @@ using Robust.Shared.Input.Binding;
|
|||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
namespace Content.Client.ContextMenu.UI
|
namespace Content.Client.ContextMenu.UI
|
||||||
{
|
{
|
||||||
@@ -84,7 +85,7 @@ namespace Content.Client.ContextMenu.UI
|
|||||||
|
|
||||||
var entitySpriteStates = GroupEntities(entities);
|
var entitySpriteStates = GroupEntities(entities);
|
||||||
var orderedStates = entitySpriteStates.ToList();
|
var orderedStates = entitySpriteStates.ToList();
|
||||||
orderedStates.Sort((x, y) => string.CompareOrdinal(x.First().Prototype?.Name, y.First().Prototype?.Name));
|
orderedStates.Sort((x, y) => string.CompareOrdinal(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(x.First().Uid).EntityPrototype?.Name, IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(y.First().Uid).EntityPrototype?.Name));
|
||||||
Elements.Clear();
|
Elements.Clear();
|
||||||
AddToUI(orderedStates);
|
AddToUI(orderedStates);
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.Client.ContextMenu.UI
|
namespace Content.Client.ContextMenu.UI
|
||||||
{
|
{
|
||||||
@@ -20,7 +22,7 @@ namespace Content.Client.ContextMenu.UI
|
|||||||
{
|
{
|
||||||
if (GroupingContextMenuType == 0)
|
if (GroupingContextMenuType == 0)
|
||||||
{
|
{
|
||||||
var newEntities = entities.GroupBy(e => e.Name + (e.Prototype?.ID ?? string.Empty)).ToList();
|
var newEntities = entities.GroupBy(e => e.Name + (IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(e.Uid).EntityPrototype?.ID ?? string.Empty)).ToList();
|
||||||
return newEntities.Select(grp => grp.ToList()).ToList();
|
return newEntities.Select(grp => grp.ToList()).ToList();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -34,7 +36,7 @@ namespace Content.Client.ContextMenu.UI
|
|||||||
{
|
{
|
||||||
private static readonly List<Func<IEntity, IEntity, bool>> EqualsList = new()
|
private static readonly List<Func<IEntity, IEntity, bool>> EqualsList = new()
|
||||||
{
|
{
|
||||||
(a, b) => a.Prototype!.ID == b.Prototype!.ID,
|
(a, b) => IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(a.Uid).EntityPrototype!.ID == IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(b.Uid).EntityPrototype!.ID,
|
||||||
(a, b) =>
|
(a, b) =>
|
||||||
{
|
{
|
||||||
a.TryGetComponent<ISpriteComponent>(out var spriteA);
|
a.TryGetComponent<ISpriteComponent>(out var spriteA);
|
||||||
@@ -51,7 +53,7 @@ namespace Content.Client.ContextMenu.UI
|
|||||||
};
|
};
|
||||||
private static readonly List<Func<IEntity, int>> GetHashCodeList = new()
|
private static readonly List<Func<IEntity, int>> GetHashCodeList = new()
|
||||||
{
|
{
|
||||||
e => EqualityComparer<string>.Default.GetHashCode(e.Prototype!.ID),
|
e => EqualityComparer<string>.Default.GetHashCode(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(e.Uid).EntityPrototype!.ID),
|
||||||
e =>
|
e =>
|
||||||
{
|
{
|
||||||
var hash = 0;
|
var hash = 0;
|
||||||
|
|||||||
@@ -73,12 +73,12 @@ namespace Content.IntegrationTests.Tests.Destructible
|
|||||||
|
|
||||||
foreach (var entity in entitiesInRange)
|
foreach (var entity in entitiesInRange)
|
||||||
{
|
{
|
||||||
if (entity.Prototype == null)
|
if (IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityPrototype == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity.Prototype.Name != SpawnedEntityId)
|
if (IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityPrototype.Name != SpawnedEntityId)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using NUnit.Framework;
|
|||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
using static Content.Shared.Inventory.EquipmentSlotDefines;
|
using static Content.Shared.Inventory.EquipmentSlotDefines;
|
||||||
|
|
||||||
namespace Content.IntegrationTests.Tests
|
namespace Content.IntegrationTests.Tests
|
||||||
@@ -71,7 +72,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
|
|
||||||
// Do we actually have the uniform equipped?
|
// Do we actually have the uniform equipped?
|
||||||
Assert.That(inventory.TryGetSlotItem(Slots.INNERCLOTHING, out ItemComponent uniform));
|
Assert.That(inventory.TryGetSlotItem(Slots.INNERCLOTHING, out ItemComponent uniform));
|
||||||
Assert.That(uniform.Owner.Prototype != null && uniform.Owner.Prototype.ID == "InventoryJumpsuitJanitorDummy");
|
Assert.That(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(uniform.Owner.Uid).EntityPrototype != null && IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(uniform.Owner.Uid).EntityPrototype.ID == "InventoryJumpsuitJanitorDummy");
|
||||||
|
|
||||||
EntitySystem.Get<StunSystem>().TryStun(human.Uid, TimeSpan.FromSeconds(1f));
|
EntitySystem.Get<StunSystem>().TryStun(human.Uid, TimeSpan.FromSeconds(1f));
|
||||||
|
|
||||||
@@ -84,7 +85,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
// Let's try skipping the interaction check and see if it equips it!
|
// Let's try skipping the interaction check and see if it equips it!
|
||||||
Assert.That(inventory.SpawnItemInSlot(Slots.IDCARD, "InventoryIDCardDummy"));
|
Assert.That(inventory.SpawnItemInSlot(Slots.IDCARD, "InventoryIDCardDummy"));
|
||||||
Assert.That(inventory.TryGetSlotItem(Slots.IDCARD, out ItemComponent id));
|
Assert.That(inventory.TryGetSlotItem(Slots.IDCARD, out ItemComponent id));
|
||||||
Assert.That(id.Owner.Prototype != null && id.Owner.Prototype.ID == "InventoryIDCardDummy");
|
Assert.That(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(id.Owner.Uid).EntityPrototype != null && IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(id.Owner.Uid).EntityPrototype.ID == "InventoryIDCardDummy");
|
||||||
});
|
});
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Robust.Shared.Console;
|
|||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.Server.Administration.Commands
|
namespace Content.Server.Administration.Commands
|
||||||
{
|
{
|
||||||
@@ -23,7 +24,7 @@ namespace Content.Server.Administration.Commands
|
|||||||
|
|
||||||
var id = args[0].ToLower();
|
var id = args[0].ToLower();
|
||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
var entities = entityManager.GetEntities().Where(e => e.Prototype?.ID.ToLower() == id);
|
var entities = entityManager.GetEntities().Where(e => IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(e.Uid).EntityPrototype?.ID.ToLower() == id);
|
||||||
var i = 0;
|
var i = 0;
|
||||||
|
|
||||||
foreach (var entity in entities)
|
foreach (var entity in entities)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Content.Shared.Administration;
|
|||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.Server.Administration.Commands
|
namespace Content.Server.Administration.Commands
|
||||||
{
|
{
|
||||||
@@ -52,12 +53,12 @@ namespace Content.Server.Administration.Commands
|
|||||||
|
|
||||||
foreach (var entity in entitiesWithAllComponents)
|
foreach (var entity in entitiesWithAllComponents)
|
||||||
{
|
{
|
||||||
if (entity.Prototype == null)
|
if (IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityPrototype == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
entityIds.Add(entity.Prototype.ID);
|
entityIds.Add(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityPrototype.ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entityIds.Count == 0)
|
if (entityIds.Count == 0)
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace Content.Server.Administration.Commands
|
|||||||
|
|
||||||
foreach (var entity in entityManager.GetEntities())
|
foreach (var entity in entityManager.GetEntities())
|
||||||
{
|
{
|
||||||
if (checkPrototype && entity.Prototype != prototype || entity.Prototype == null)
|
if (checkPrototype && IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityPrototype != prototype || IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityPrototype == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -41,7 +41,7 @@ namespace Content.Server.Administration.Commands
|
|||||||
|
|
||||||
foreach (var component in entity.GetAllComponents())
|
foreach (var component in entity.GetAllComponents())
|
||||||
{
|
{
|
||||||
if (entity.Prototype.Components.ContainsKey(component.Name))
|
if (IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityPrototype.Components.ContainsKey(component.Name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
entityManager.RemoveComponent(entity.Uid, component);
|
entityManager.RemoveComponent(entity.Uid, component);
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ namespace Content.Server.Chemistry.Components
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void Spread()
|
public void Spread()
|
||||||
{
|
{
|
||||||
if (Owner.Prototype == null)
|
if (IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner.Uid).EntityPrototype == null)
|
||||||
{
|
{
|
||||||
Logger.Error("AreaEffectComponent needs its owner to be spawned by a prototype.");
|
Logger.Error("AreaEffectComponent needs its owner to be spawned by a prototype.");
|
||||||
return;
|
return;
|
||||||
@@ -83,7 +83,7 @@ namespace Content.Server.Chemistry.Components
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var newEffect = IoCManager.Resolve<IEntityManager>().SpawnEntity(Owner.Prototype.ID, grid.DirectionToGrid(coords, dir));
|
var newEffect = IoCManager.Resolve<IEntityManager>().SpawnEntity(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner.Uid).EntityPrototype.ID, grid.DirectionToGrid(coords, dir));
|
||||||
|
|
||||||
if (!newEffect.TryGetComponent(out SolutionAreaEffectComponent? effectComponent))
|
if (!newEffect.TryGetComponent(out SolutionAreaEffectComponent? effectComponent))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ namespace Content.Server.Construction.Commands
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var prototype = childEntity.Prototype;
|
var prototype = IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(childEntity.Uid).EntityPrototype;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (prototype?.Parent == null)
|
if (prototype?.Parent == null)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Content.Server.Stack;
|
|||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Construction.Components
|
namespace Content.Server.Construction.Components
|
||||||
@@ -66,7 +67,7 @@ namespace Content.Server.Construction.Components
|
|||||||
|
|
||||||
if (!_boardContainer.Insert(board))
|
if (!_boardContainer.Insert(board))
|
||||||
{
|
{
|
||||||
throw new Exception($"Couldn't insert board with prototype {BoardPrototype} to machine with prototype {Owner.Prototype?.ID ?? "N/A"}!");
|
throw new Exception($"Couldn't insert board with prototype {BoardPrototype} to machine with prototype {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner.Uid).EntityPrototype?.ID ?? "N/A"}!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!board.TryGetComponent<MachineBoardComponent>(out var machineBoard))
|
if (!board.TryGetComponent<MachineBoardComponent>(out var machineBoard))
|
||||||
@@ -81,7 +82,7 @@ namespace Content.Server.Construction.Components
|
|||||||
var p = entityManager.SpawnEntity(MachinePartComponent.Prototypes[part], Owner.Transform.Coordinates);
|
var p = entityManager.SpawnEntity(MachinePartComponent.Prototypes[part], Owner.Transform.Coordinates);
|
||||||
|
|
||||||
if (!partContainer.Insert(p))
|
if (!partContainer.Insert(p))
|
||||||
throw new Exception($"Couldn't insert machine part of type {part} to machine with prototype {Owner.Prototype?.ID ?? "N/A"}!");
|
throw new Exception($"Couldn't insert machine part of type {part} to machine with prototype {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner.Uid).EntityPrototype?.ID ?? "N/A"}!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,7 +91,7 @@ namespace Content.Server.Construction.Components
|
|||||||
var stack = EntitySystem.Get<StackSystem>().Spawn(amount, stackType, Owner.Transform.Coordinates);
|
var stack = EntitySystem.Get<StackSystem>().Spawn(amount, stackType, Owner.Transform.Coordinates);
|
||||||
|
|
||||||
if (!partContainer.Insert(IoCManager.Resolve<IEntityManager>().GetEntity(stack)))
|
if (!partContainer.Insert(IoCManager.Resolve<IEntityManager>().GetEntity(stack)))
|
||||||
throw new Exception($"Couldn't insert machine material of type {stackType} to machine with prototype {Owner.Prototype?.ID ?? "N/A"}");
|
throw new Exception($"Couldn't insert machine material of type {stackType} to machine with prototype {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner.Uid).EntityPrototype?.ID ?? "N/A"}");
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var (compName, info) in machineBoard.ComponentRequirements)
|
foreach (var (compName, info) in machineBoard.ComponentRequirements)
|
||||||
@@ -100,7 +101,7 @@ namespace Content.Server.Construction.Components
|
|||||||
var c = entityManager.SpawnEntity(info.DefaultPrototype, Owner.Transform.Coordinates);
|
var c = entityManager.SpawnEntity(info.DefaultPrototype, Owner.Transform.Coordinates);
|
||||||
|
|
||||||
if(!partContainer.Insert(c))
|
if(!partContainer.Insert(c))
|
||||||
throw new Exception($"Couldn't insert machine component part with default prototype '{compName}' to machine with prototype {Owner.Prototype?.ID ?? "N/A"}");
|
throw new Exception($"Couldn't insert machine component part with default prototype '{compName}' to machine with prototype {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner.Uid).EntityPrototype?.ID ?? "N/A"}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,7 +112,7 @@ namespace Content.Server.Construction.Components
|
|||||||
var c = entityManager.SpawnEntity(info.DefaultPrototype, Owner.Transform.Coordinates);
|
var c = entityManager.SpawnEntity(info.DefaultPrototype, Owner.Transform.Coordinates);
|
||||||
|
|
||||||
if(!partContainer.Insert(c))
|
if(!partContainer.Insert(c))
|
||||||
throw new Exception($"Couldn't insert machine component part with default prototype '{tagName}' to machine with prototype {Owner.Prototype?.ID ?? "N/A"}");
|
throw new Exception($"Couldn't insert machine component part with default prototype '{tagName}' to machine with prototype {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner.Uid).EntityPrototype?.ID ?? "N/A"}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,13 +51,13 @@ namespace Content.Server.Construction
|
|||||||
{
|
{
|
||||||
if (GetCurrentGraph(uid, construction) is not {} graph)
|
if (GetCurrentGraph(uid, construction) is not {} graph)
|
||||||
{
|
{
|
||||||
_sawmill.Warning($"Prototype {construction.Owner.Prototype?.ID}'s construction component has an invalid graph specified.");
|
_sawmill.Warning($"Prototype {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(construction.Owner.Uid).EntityPrototype?.ID}'s construction component has an invalid graph specified.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetNodeFromGraph(graph, construction.Node) is not {} node)
|
if (GetNodeFromGraph(graph, construction.Node) is not {} node)
|
||||||
{
|
{
|
||||||
_sawmill.Warning($"Prototype {construction.Owner.Prototype?.ID}'s construction component has an invalid node specified.");
|
_sawmill.Warning($"Prototype {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(construction.Owner.Uid).EntityPrototype?.ID}'s construction component has an invalid node specified.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ namespace Content.Server.Construction
|
|||||||
{
|
{
|
||||||
if (GetEdgeFromNode(node, edgeIndex) is not {} currentEdge)
|
if (GetEdgeFromNode(node, edgeIndex) is not {} currentEdge)
|
||||||
{
|
{
|
||||||
_sawmill.Warning($"Prototype {construction.Owner.Prototype?.ID}'s construction component has an invalid edge index specified.");
|
_sawmill.Warning($"Prototype {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(construction.Owner.Uid).EntityPrototype?.ID}'s construction component has an invalid edge index specified.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ namespace Content.Server.Construction
|
|||||||
{
|
{
|
||||||
if (GetNodeFromGraph(graph, targetNodeId) is not { } targetNode)
|
if (GetNodeFromGraph(graph, targetNodeId) is not { } targetNode)
|
||||||
{
|
{
|
||||||
_sawmill.Warning($"Prototype {construction.Owner.Prototype?.ID}'s construction component has an invalid target node specified.");
|
_sawmill.Warning($"Prototype {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(construction.Owner.Uid).EntityPrototype?.ID}'s construction component has an invalid target node specified.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.Server.Containers
|
namespace Content.Server.Containers
|
||||||
{
|
{
|
||||||
@@ -11,7 +14,7 @@ namespace Content.Server.Containers
|
|||||||
{
|
{
|
||||||
foreach (var entity in container.ContainedEntities)
|
foreach (var entity in container.ContainedEntities)
|
||||||
{
|
{
|
||||||
if (entity.Prototype?.ID == prototypeId) total++;
|
if (IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityPrototype?.ID == prototypeId) total++;
|
||||||
if(!entity.TryGetComponent<ContainerManagerComponent>(out var component)) continue;
|
if(!entity.TryGetComponent<ContainerManagerComponent>(out var component)) continue;
|
||||||
total += component.CountPrototypeOccurencesRecursive(prototypeId);
|
total += component.CountPrototypeOccurencesRecursive(prototypeId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ using Robust.Shared.Map;
|
|||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.Server.Fluids.EntitySystems
|
namespace Content.Server.Fluids.EntitySystems
|
||||||
{
|
{
|
||||||
@@ -328,7 +329,7 @@ namespace Content.Server.Fluids.EntitySystems
|
|||||||
}
|
}
|
||||||
|
|
||||||
puddle ??= () =>
|
puddle ??= () =>
|
||||||
IoCManager.Resolve<IEntityManager>().SpawnEntity(puddleComponent.Owner.Prototype?.ID,
|
IoCManager.Resolve<IEntityManager>().SpawnEntity(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(puddleComponent.Owner.Uid).EntityPrototype?.ID,
|
||||||
mapGrid.DirectionToGrid(coords, direction))
|
mapGrid.DirectionToGrid(coords, direction))
|
||||||
.GetComponent<PuddleComponent>();
|
.GetComponent<PuddleComponent>();
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,10 @@ using Content.Server.Administration;
|
|||||||
using Content.Shared.Administration;
|
using Content.Shared.Administration;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
@@ -74,7 +76,8 @@ namespace Content.Server.GameTicking.Commands
|
|||||||
shell.ExecuteCommand($"addmap {mapId} false");
|
shell.ExecuteCommand($"addmap {mapId} false");
|
||||||
shell.ExecuteCommand($"loadbp {mapId} \"{CommandParsing.Escape(mapName)}\" true");
|
shell.ExecuteCommand($"loadbp {mapId} \"{CommandParsing.Escape(mapName)}\" true");
|
||||||
|
|
||||||
if (player.AttachedEntity?.Prototype?.ID != "AdminObserver")
|
IEntity? tempQualifier = player.AttachedEntity;
|
||||||
|
if ((tempQualifier != null ? IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(tempQualifier.Uid).EntityPrototype : null)?.ID != "AdminObserver")
|
||||||
shell.ExecuteCommand("aghost");
|
shell.ExecuteCommand("aghost");
|
||||||
|
|
||||||
shell.ExecuteCommand($"tp 0 0 {mapId}");
|
shell.ExecuteCommand($"tp 0 0 {mapId}");
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ using Robust.Shared.GameObjects;
|
|||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
@@ -311,18 +312,18 @@ namespace Content.Server.Kitchen.Components
|
|||||||
var solidsDict = new Dictionary<string, int>();
|
var solidsDict = new Dictionary<string, int>();
|
||||||
foreach (var item in _storage.ContainedEntities)
|
foreach (var item in _storage.ContainedEntities)
|
||||||
{
|
{
|
||||||
if (item.Prototype == null)
|
if (IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(item.Uid).EntityPrototype == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (solidsDict.ContainsKey(item.Prototype.ID))
|
if (solidsDict.ContainsKey(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(item.Uid).EntityPrototype.ID))
|
||||||
{
|
{
|
||||||
solidsDict[item.Prototype.ID]++;
|
solidsDict[IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(item.Uid).EntityPrototype.ID]++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
solidsDict.Add(item.Prototype.ID, 1);
|
solidsDict.Add(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(item.Uid).EntityPrototype.ID, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -450,12 +451,12 @@ namespace Content.Server.Kitchen.Components
|
|||||||
{
|
{
|
||||||
foreach (var item in _storage.ContainedEntities)
|
foreach (var item in _storage.ContainedEntities)
|
||||||
{
|
{
|
||||||
if (item.Prototype == null)
|
if (IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(item.Uid).EntityPrototype == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.Prototype.ID == recipeSolid.Key)
|
if (IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(item.Uid).EntityPrototype.ID == recipeSolid.Key)
|
||||||
{
|
{
|
||||||
_storage.Remove(item);
|
_storage.Remove(item);
|
||||||
item.Delete();
|
item.Delete();
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace Content.Server.Stack
|
|||||||
// Get a prototype ID to spawn the new entity. Null is also valid, although it should rarely be picked...
|
// Get a prototype ID to spawn the new entity. Null is also valid, although it should rarely be picked...
|
||||||
var prototype = _prototypeManager.TryIndex<StackPrototype>(stack.StackTypeId, out var stackType)
|
var prototype = _prototypeManager.TryIndex<StackPrototype>(stack.StackTypeId, out var stackType)
|
||||||
? stackType.Spawn
|
? stackType.Spawn
|
||||||
: stack.Owner.Prototype?.ID;
|
: IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(stack.Owner.Uid).EntityPrototype?.ID;
|
||||||
|
|
||||||
// Try to remove the amount of things we want to split from the original stack...
|
// Try to remove the amount of things we want to split from the original stack...
|
||||||
if (!Use(uid, amount, stack))
|
if (!Use(uid, amount, stack))
|
||||||
|
|||||||
@@ -330,7 +330,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
projectile =
|
projectile =
|
||||||
IoCManager.Resolve<IEntityManager>().SpawnEntity(baseProjectile.Prototype?.ID, baseProjectile.Transform.Coordinates);
|
IoCManager.Resolve<IEntityManager>().SpawnEntity(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(baseProjectile.Uid).EntityPrototype?.ID, baseProjectile.Transform.Coordinates);
|
||||||
}
|
}
|
||||||
|
|
||||||
firedProjectiles[i] = projectile.Uid;
|
firedProjectiles[i] = projectile.Uid;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Robust.Shared.GameObjects;
|
|||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
@@ -113,7 +114,7 @@ namespace Content.Shared.Body.Components
|
|||||||
|
|
||||||
protected virtual void OnAddMechanism(SharedMechanismComponent mechanism)
|
protected virtual void OnAddMechanism(SharedMechanismComponent mechanism)
|
||||||
{
|
{
|
||||||
var prototypeId = mechanism.Owner.Prototype!.ID;
|
var prototypeId = IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(mechanism.Owner.Uid).EntityPrototype!.ID;
|
||||||
|
|
||||||
if (!_mechanismIds.Contains(prototypeId))
|
if (!_mechanismIds.Contains(prototypeId))
|
||||||
{
|
{
|
||||||
@@ -128,7 +129,7 @@ namespace Content.Shared.Body.Components
|
|||||||
|
|
||||||
protected virtual void OnRemoveMechanism(SharedMechanismComponent mechanism)
|
protected virtual void OnRemoveMechanism(SharedMechanismComponent mechanism)
|
||||||
{
|
{
|
||||||
_mechanismIds.Remove(mechanism.Owner.Prototype!.ID);
|
_mechanismIds.Remove(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(mechanism.Owner.Uid).EntityPrototype!.ID);
|
||||||
mechanism.Part = null;
|
mechanism.Part = null;
|
||||||
SizeUsed -= mechanism.Size;
|
SizeUsed -= mechanism.Size;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user