Fix actions not initially appearing (#19990)

This commit is contained in:
Leon Friedrich
2023-09-11 12:45:35 +12:00
committed by GitHub
parent 51f2eea45b
commit 965de89362

View File

@@ -67,7 +67,7 @@ namespace Content.Client.Actions
return;
component.Actions.Clear();
component.Actions.UnionWith(GetEntitySet(state.Actions));
component.Actions.UnionWith(EnsureEntitySet<ActionsComponent>(state.Actions, uid));
_actionHoldersQueue.Enqueue(uid);
}
@@ -200,28 +200,6 @@ namespace Content.Client.Actions
}
}
/*public void SaveActionAssignments(string path)
{
// Currently only tested with temporary innate actions (i.e., mapping actions). No guarantee it works with
// other actions. If its meant to be used for full game state saving/loading, the entity that provides
// actions needs to keep the same uid.
var sequence = new SequenceDataNode();
foreach (var (action, assigns) in Assignments.Assignments)
{
var slot = new MappingDataNode();
slot.Add("action", _serializationManager.WriteValue(action));
slot.Add("assignments", _serializationManager.WriteValue(assigns));
sequence.Add(slot);
}
using var writer = _resourceManager.UserData.OpenWriteText(new ResourcePath(path).ToRootedPath());
var stream = new YamlStream { new(sequence.ToSequenceNode()) };
stream.Save(new YamlMappingFix(new Emitter(writer)), false);
}*/
/// <summary>
/// Load actions and their toolbar assignments from a file.
/// </summary>