Skip to content

Commit

Permalink
docs: split prefab list into two tables because it's too big
Browse files Browse the repository at this point in the history
  • Loading branch information
MSchmoecker committed Jun 2, 2024
1 parent 770b735 commit b9e9870
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 14 deletions.
45 changes: 31 additions & 14 deletions JotunnDoc/Docs/PrefabDoc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ private void DocPrefabs(Player self)
AddHeader(1, "Prefab list");
AddText("All of the prefabs currently in the game (ZNetScene and ZoneManager).");
AddText($"This file is automatically generated from Valheim {Version.GetVersionString(true)} using the JotunnDoc mod found on our GitHub.");
AddTableHeader("Name", "AssetID", "Components");

foreach (var location in ZoneSystem.instance.m_locations)
{
Expand All @@ -41,25 +40,43 @@ private void DocPrefabs(Player self)
allPrefabs.AddRange(ZNetScene.instance.m_prefabs);
allPrefabs.AddRange(ZoneSystem.instance.m_locations.Where(x => x.m_prefab.IsValid).Select(x => x.m_prefab.Asset));

foreach (GameObject obj in allPrefabs.Where(x => !CustomPrefab.IsCustomPrefab(x.name)).OrderBy(x => x.name))
{
string components = "<ul>";
allPrefabs.RemoveAll(x => CustomPrefab.IsCustomPrefab(x.name));
allPrefabs = allPrefabs.OrderBy(x => x.name).ToList();

foreach (Component comp in obj.GetComponents<Component>())
{
components += "<li>" + comp.GetType().Name + "</li>";
}
var prefabsAM = allPrefabs.Where(p => p.name.Length >= 1 && p.name.ToLower()[0] < 'm');
var prefabsMZ = allPrefabs.Where(p => p.name.Length >= 1 && p.name.ToLower()[0] >= 'm');

components += "</ul>";
AddTableHeader("Name", "AssetID", "Components");

AddTableRow(
obj.name,
AssetManager.Instance.GetAssetID<GameObject>(obj.name).ToString(),
components
);
foreach (GameObject obj in prefabsAM)
{
AddPrefabTableRow(obj);
}

AddTableHeader("Name", "AssetID", "Components");

foreach (GameObject obj in prefabsMZ)
{
AddPrefabTableRow(obj);
}

Save();
}

private void AddPrefabTableRow(GameObject prefab) {
string components = "<ul>";

foreach (Component comp in prefab.GetComponents<Component>()) {
components += "<li>" + comp.GetType().Name + "</li>";
}

components += "</ul>";

AddTableRow(
prefab.name,
AssetManager.Instance.GetAssetID<GameObject>(prefab.name).ToString(),
components
);
}
}
}
3 changes: 3 additions & 0 deletions JotunnLib/Documentation/data/prefabs/prefab-list.md
Original file line number Diff line number Diff line change
Expand Up @@ -1369,6 +1369,9 @@ This file is automatically generated from Valheim 0.218.15 using the JotunnDoc m
|LoxPie|6477d669541ef4347ae4529e76f20a0c|<ul><li>Transform</li><li>Rigidbody</li><li>ZNetView</li><li>ZSyncTransform</li><li>ItemDrop</li><li>ParticleSystemRenderer</li><li>ParticleSystem</li></ul>|
|LoxPieUncooked|0a341139bad932c499c83a8dcf7def81|<ul><li>Transform</li><li>Rigidbody</li><li>ZNetView</li><li>ZSyncTransform</li><li>ItemDrop</li><li>ParticleSystemRenderer</li><li>ParticleSystem</li></ul>|
|LuredWisp|c9a390a71253f885f9d46bb095765e7d|<ul><li>Transform</li><li>ZNetView</li><li>ZSyncTransform</li><li>LuredWisp</li><li>LODGroup</li><li>Pickable</li></ul>|

|Name |AssetID |Components |
|---|---|---|
|MaceBronze|4eaf59525c7234ce3b33c2522c8d0073|<ul><li>Transform</li><li>Rigidbody</li><li>ZNetView</li><li>ZSyncTransform</li><li>ItemDrop</li><li>Floating</li><li>ParticleSystemRenderer</li><li>ParticleSystem</li></ul>|
|MaceEldner|1b66128c1ba62dc418e590d1e2c2db83|<ul><li>Transform</li><li>Rigidbody</li><li>ZNetView</li><li>ZSyncTransform</li><li>ItemDrop</li><li>Floating</li><li>ParticleSystemRenderer</li><li>ParticleSystem</li></ul>|
|MaceEldnerBlood|8d333603ab41ec941bdb668bcd1cbc09|<ul><li>Transform</li><li>Rigidbody</li><li>ZNetView</li><li>ZSyncTransform</li><li>ItemDrop</li><li>Floating</li><li>ParticleSystemRenderer</li><li>ParticleSystem</li></ul>|
Expand Down

0 comments on commit b9e9870

Please sign in to comment.