Fix prototype hot reloading.

This commit is contained in:
Pieter-Jan Briers
2023-01-14 21:08:27 +01:00
parent 87ce6dd4b5
commit 2a957f1423
2 changed files with 20 additions and 17 deletions

View File

@@ -305,6 +305,11 @@ namespace Robust.Client.GameObjects
void ISerializationHooks.AfterDeserialization()
{
// Please somebody burn this to the ground
// Fix prototype reload trying to update tree on deserialization dummy instances.
if (!Owner.IsValid())
return;
IoCManager.InjectDependencies(this);
{

View File

@@ -253,21 +253,27 @@ namespace Robust.Shared.Prototypes
}
}
if (nonPushedParent) continue;
if (nonPushedParent)
continue;
// TODO DON'T FORGET TO FIX THIS
/*foreach (var parent in parents)
var parentMaps = new MappingDataNode[parents.Length];
for (var i = 0; i < parentMaps.Length; i++)
{
PushInstanceInheritance(type, id, parent);
}*/
parentMaps[i] = kindData.Results[parents[i]];
}
kindData.Results[id] = _serializationManager.PushCompositionWithGenericNode(
kind,
parentMaps,
kindData.Results[id]);
}
var prototype = TryReadPrototype(kind, id, kindData.Results[id], SerializationHookContext.DontSkipHooks);
if (prototype == null)
continue;
kindData.Instances[id] = prototype;
if (prototype != null)
{
kindData.Instances[id] = prototype;
}
pushedSet.Add(id);
}
@@ -496,14 +502,6 @@ namespace Robust.Shared.Prototypes
}
}
private MappingDataNode PushInstanceInheritance(Type type, MappingDataNode result, MappingDataNode[] parents)
{
return _serializationManager.PushCompositionWithGenericNode(
type,
parents,
result);
}
#endregion IPrototypeManager members
private void ReloadPrototypeKinds()