mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
Fix Prototype inline errors
This commit is contained in:
@@ -30,13 +30,13 @@ namespace Robust.Shared.Localization
|
||||
return true;
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityPrototype == null)
|
||||
if (IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityPrototype is not {} prototype)
|
||||
{
|
||||
value = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
var data = GetEntityData(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityPrototype.ID);
|
||||
var data = GetEntityData(prototype.ID);
|
||||
return data.Attributes.TryGetValue(attribute, out value);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
@@ -185,12 +186,12 @@ namespace Robust.Shared.Prototypes
|
||||
|
||||
var factory = IoCManager.Resolve<IComponentFactory>();
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
var oldPrototype = IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityPrototype;
|
||||
var oldPrototype = entityManager.GetComponent<MetaDataComponent>(entity.Uid).EntityPrototype;
|
||||
|
||||
var oldPrototypeComponents = oldPrototype.Components.Keys
|
||||
var oldPrototypeComponents = oldPrototype?.Components.Keys
|
||||
.Where(n => n != "Transform" && n != "MetaData")
|
||||
.Select(name => (name, factory.GetRegistration(name).Type))
|
||||
.ToList();
|
||||
.ToList() ?? new List<(string name, Type Type)>();
|
||||
var newPrototypeComponents = Components.Keys
|
||||
.Where(n => n != "Transform" && n != "MetaData")
|
||||
.Select(name => (name, factory.GetRegistration(name).Type))
|
||||
|
||||
@@ -362,7 +362,7 @@ namespace Robust.Shared.Prototypes
|
||||
foreach (var prototype in pushed[typeof(EntityPrototype)])
|
||||
{
|
||||
foreach (var entity in _entityManager.GetEntities()
|
||||
.Where(e => IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(e.Uid).EntityPrototype != null && IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(e.Uid).EntityPrototype.ID == prototype))
|
||||
.Where(e => IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(e.Uid).EntityPrototype != null && IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(e.Uid).EntityPrototype?.ID == prototype))
|
||||
{
|
||||
((EntityPrototype) entityPrototypes[prototype]).UpdateEntity((IEntity) entity);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user