Resolves that make you flinch (#2423)
* argh * ouch * zap * adds default! * adressed review
This commit is contained in:
@@ -34,10 +34,8 @@ namespace Content.Shared.Prototypes.Cargo
|
||||
{
|
||||
if (_name.Trim().Length != 0)
|
||||
return _name;
|
||||
var protoMan = IoCManager.Resolve<IPrototypeManager>();
|
||||
if (protoMan == null)
|
||||
return _name;
|
||||
protoMan.TryIndex(_product, out EntityPrototype prototype);
|
||||
EntityPrototype prototype = null;
|
||||
IoCManager.Resolve<IPrototypeManager>()?.TryIndex(_product, out prototype);
|
||||
if (prototype?.Name != null)
|
||||
_name = prototype.Name;
|
||||
return _name;
|
||||
@@ -54,10 +52,8 @@ namespace Content.Shared.Prototypes.Cargo
|
||||
{
|
||||
if (_description.Trim().Length != 0)
|
||||
return _description;
|
||||
var protoMan = IoCManager.Resolve<IPrototypeManager>();
|
||||
if (protoMan == null)
|
||||
return _description;
|
||||
protoMan.TryIndex(_product, out EntityPrototype prototype);
|
||||
EntityPrototype prototype = null;
|
||||
IoCManager.Resolve<IPrototypeManager>()?.TryIndex(_product, out prototype);
|
||||
if (prototype?.Description != null)
|
||||
_description = prototype.Description;
|
||||
return _description;
|
||||
@@ -94,6 +90,11 @@ namespace Content.Shared.Prototypes.Cargo
|
||||
[ViewVariables]
|
||||
public string Group => _group;
|
||||
|
||||
public CargoProductPrototype()
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
}
|
||||
|
||||
public void LoadFrom(YamlMappingNode mapping)
|
||||
{
|
||||
var serializer = YamlObjectSerializer.NewReader(mapping);
|
||||
|
||||
Reference in New Issue
Block a user