started entities
This commit is contained in:
parent
6e9d89b045
commit
69a8eaea62
5 changed files with 352 additions and 3 deletions
|
|
@ -77,6 +77,8 @@ public partial class MemoryViewModel : ObservableObject
|
|||
private MemoryNodeViewModel? _playerEs;
|
||||
private MemoryNodeViewModel? _terrainCells;
|
||||
private MemoryNodeViewModel? _terrainGrid;
|
||||
private MemoryNodeViewModel? _entitySummary;
|
||||
private MemoryNodeViewModel? _entityTypesNode;
|
||||
|
||||
partial void OnIsEnabledChanged(bool value)
|
||||
{
|
||||
|
|
@ -170,6 +172,13 @@ public partial class MemoryViewModel : ObservableObject
|
|||
player.Children.Add(_playerMana);
|
||||
player.Children.Add(_playerEs);
|
||||
|
||||
// Entities
|
||||
var entitiesGroup = new MemoryNodeViewModel("Entities");
|
||||
_entitySummary = new MemoryNodeViewModel("Summary:");
|
||||
_entityTypesNode = new MemoryNodeViewModel("Types:") { IsExpanded = false };
|
||||
entitiesGroup.Children.Add(_entitySummary);
|
||||
entitiesGroup.Children.Add(_entityTypesNode);
|
||||
|
||||
// Terrain
|
||||
var terrain = new MemoryNodeViewModel("Terrain");
|
||||
_terrainCells = new MemoryNodeViewModel("Cells:");
|
||||
|
|
@ -179,6 +188,7 @@ public partial class MemoryViewModel : ObservableObject
|
|||
|
||||
inGameStateGroup.Children.Add(areaInstanceGroup);
|
||||
inGameStateGroup.Children.Add(player);
|
||||
inGameStateGroup.Children.Add(entitiesGroup);
|
||||
inGameStateGroup.Children.Add(terrain);
|
||||
|
||||
RootNodes.Add(process);
|
||||
|
|
@ -279,6 +289,38 @@ public partial class MemoryViewModel : ObservableObject
|
|||
_playerEs!.Set("? (set LifeComponentIndex)", false);
|
||||
}
|
||||
|
||||
// Entities
|
||||
if (snap.Entities is { Count: > 0 })
|
||||
{
|
||||
var withPath = snap.Entities.Count(e => e.Path is not null);
|
||||
var withPos = snap.Entities.Count(e => e.HasPosition);
|
||||
_entitySummary!.Set($"{snap.Entities.Count} entities, {withPath} with path, {withPos} with pos");
|
||||
|
||||
// Group by path category: "Metadata/Monsters/..." → "Monsters"
|
||||
var typeCounts = snap.Entities
|
||||
.GroupBy(e =>
|
||||
{
|
||||
if (e.Path is null) return "?";
|
||||
var parts = e.Path.Split('/');
|
||||
return parts.Length >= 2 ? parts[1] : "?";
|
||||
})
|
||||
.OrderByDescending(g => g.Count())
|
||||
.Take(20);
|
||||
|
||||
_entityTypesNode!.Children.Clear();
|
||||
foreach (var group in typeCounts)
|
||||
{
|
||||
var node = new MemoryNodeViewModel($"{group.Key}:");
|
||||
node.Set(group.Count().ToString());
|
||||
_entityTypesNode.Children.Add(node);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_entitySummary!.Set("—", false);
|
||||
_entityTypesNode!.Children.Clear();
|
||||
}
|
||||
|
||||
// Terrain
|
||||
if (snap.TerrainCols > 0 && snap.TerrainRows > 0)
|
||||
{
|
||||
|
|
@ -411,6 +453,18 @@ public partial class MemoryViewModel : ObservableObject
|
|||
ScanResult = _reader.DiagnoseEntity();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void ScanEntitiesExecute()
|
||||
{
|
||||
if (_reader is null || !_reader.IsAttached)
|
||||
{
|
||||
ScanResult = "Error: not attached";
|
||||
return;
|
||||
}
|
||||
|
||||
ScanResult = _reader.ScanEntities();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void ScanStructureExecute()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue