Fixed robot save mechanic to include nodes and their states.
This commit is contained in:
@@ -60,6 +60,26 @@ public class IfNode : ProgramNode
|
||||
return $"Name: {DisplayText}, Item: {(selectedItem == null ? "Empty" : selectedItem.data.Id)}, Comparator: {comparator}, Amount: {amount}";
|
||||
}
|
||||
|
||||
public override NodeSaveData CreateSaveData()
|
||||
{
|
||||
NodeSaveData saveData = base.CreateSaveData();
|
||||
saveData.ItemId = selectedItem?.data.Id;
|
||||
saveData.Comparator = comparator;
|
||||
saveData.Amount = amount;
|
||||
return saveData;
|
||||
}
|
||||
|
||||
public override void Load(NodeSaveData saveData)
|
||||
{
|
||||
base.Load(saveData);
|
||||
amount = saveData.Amount;
|
||||
comparator = saveData.Comparator;
|
||||
if (string.IsNullOrEmpty(saveData.ItemId)) return;
|
||||
if (!GameData.availableItems.ContainsKey(saveData.ItemId)) return;
|
||||
|
||||
selectedItem = new Item { data = GameData.availableItems[saveData.ItemId] };
|
||||
}
|
||||
|
||||
public override void SetNextNode(
|
||||
List<Godot.Collections.Dictionary> connections,
|
||||
Dictionary<StringName, ProgramNode> availableNodes
|
||||
|
||||
Reference in New Issue
Block a user