Shooting NPCs and more (#18042)
* Add pirate shooting * Shooting working * Basics working * Refactor time * More conversion * Update primitives * Update yml * weh * Building again * Draft * weh * b * Start shutdown * Starting to take form * Code side done * is it worky * Fix prototypes * stuff * Shitty working * Juke events working * Even more cleanup * RTX * Fix interaction combat mode and compquery * GetAmmoCount relays * Fix rotation speed * Juke fixes * fixes * weh * The collision avoidance never ends * Fixes * Pause support * framework * lazy * Fix idling * Fix drip * goobed * Fix takeover shutdown bug * Merge fixes * shitter * Fix carpos
This commit is contained in:
@@ -16,31 +16,31 @@ public sealed class NPCBlackboardSerializer : ITypeReader<NPCBlackboard, Mapping
|
||||
{
|
||||
var validated = new List<ValidationNode>();
|
||||
|
||||
if (node.Count > 0)
|
||||
if (node.Count <= 0)
|
||||
return new ValidatedSequenceNode(validated);
|
||||
|
||||
var reflection = dependencies.Resolve<IReflectionManager>();
|
||||
|
||||
foreach (var data in node)
|
||||
{
|
||||
var reflection = dependencies.Resolve<IReflectionManager>();
|
||||
var key = data.Key.ToYamlNode().AsString();
|
||||
|
||||
foreach (var data in node)
|
||||
if (data.Value.Tag == null)
|
||||
{
|
||||
var key = data.Key.ToYamlNode().AsString();
|
||||
|
||||
if (data.Value.Tag == null)
|
||||
{
|
||||
validated.Add(new ErrorNode(data.Key, $"Unable to validate {key}'s type"));
|
||||
continue;
|
||||
}
|
||||
|
||||
var typeString = data.Value.Tag[6..];
|
||||
|
||||
if (!reflection.TryLooseGetType(typeString, out var type))
|
||||
{
|
||||
validated.Add(new ErrorNode(data.Key, $"Unable to find type for {typeString}"));
|
||||
continue;
|
||||
}
|
||||
|
||||
var validatedNode = serializationManager.ValidateNode(type, data.Value, context);
|
||||
validated.Add(validatedNode);
|
||||
validated.Add(new ErrorNode(data.Key, $"Unable to validate {key}'s type"));
|
||||
continue;
|
||||
}
|
||||
|
||||
var typeString = data.Value.Tag[6..];
|
||||
|
||||
if (!reflection.TryLooseGetType(typeString, out var type))
|
||||
{
|
||||
validated.Add(new ErrorNode(data.Key, $"Unable to find type for {typeString}"));
|
||||
continue;
|
||||
}
|
||||
|
||||
var validatedNode = serializationManager.ValidateNode(type, data.Value, context);
|
||||
validated.Add(validatedNode);
|
||||
}
|
||||
|
||||
return new ValidatedSequenceNode(validated);
|
||||
@@ -53,29 +53,29 @@ public sealed class NPCBlackboardSerializer : ITypeReader<NPCBlackboard, Mapping
|
||||
{
|
||||
var value = instanceProvider != null ? instanceProvider() : new NPCBlackboard();
|
||||
|
||||
if (node.Count > 0)
|
||||
if (node.Count <= 0)
|
||||
return value;
|
||||
|
||||
var reflection = dependencies.Resolve<IReflectionManager>();
|
||||
|
||||
foreach (var data in node)
|
||||
{
|
||||
var reflection = dependencies.Resolve<IReflectionManager>();
|
||||
var key = data.Key.ToYamlNode().AsString();
|
||||
|
||||
foreach (var data in node)
|
||||
{
|
||||
var key = data.Key.ToYamlNode().AsString();
|
||||
if (data.Value.Tag == null)
|
||||
throw new NullReferenceException($"Found null tag for {key}");
|
||||
|
||||
if (data.Value.Tag == null)
|
||||
throw new NullReferenceException($"Found null tag for {key}");
|
||||
var typeString = data.Value.Tag[6..];
|
||||
|
||||
var typeString = data.Value.Tag[6..];
|
||||
if (!reflection.TryLooseGetType(typeString, out var type))
|
||||
throw new NullReferenceException($"Found null type for {key}");
|
||||
|
||||
if (!reflection.TryLooseGetType(typeString, out var type))
|
||||
throw new NullReferenceException($"Found null type for {key}");
|
||||
var bbData = serializationManager.Read(type, data.Value, hookCtx, context);
|
||||
|
||||
var bbData = serializationManager.Read(type, data.Value, hookCtx, context);
|
||||
if (bbData == null)
|
||||
throw new NullReferenceException($"Found null data for {key}, expected {type}");
|
||||
|
||||
if (bbData == null)
|
||||
throw new NullReferenceException($"Found null data for {key}, expected {type}");
|
||||
|
||||
value.SetValue(key, bbData);
|
||||
}
|
||||
value.SetValue(key, bbData);
|
||||
}
|
||||
|
||||
return value;
|
||||
|
||||
Reference in New Issue
Block a user