Группы логиста: предметы и блоки мода - в «Некромантию» по его items/blocks.xml; факел - инструменты, гвозди - детали, жестянки с водой - напитки, жир - материалы, корм кур - сырое
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
17a4ab2e96
commit
38a8b3b417
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
|
||||
namespace NecromancerTome
|
||||
{
|
||||
@@ -48,8 +50,11 @@ namespace NecromancerTome
|
||||
static readonly HashSet<string> MaterialNames = new HashSet<string>
|
||||
{
|
||||
"resourceWood", "resourceWoodBundle", "resourceCloth", "resourceLeather", "resourceBone", "resourceFeather",
|
||||
"resourceYuccaFibers", "resourcePaper", "resourceCement", "resourceConcreteMix", "resourceBeeswax", "resourceCandleStick"
|
||||
"resourceYuccaFibers", "resourcePaper", "resourceCement", "resourceConcreteMix", "resourceBeeswax", "resourceCandleStick",
|
||||
"resourceAnimalFat"
|
||||
};
|
||||
/// <summary>Детали, которые теги отнесли бы не туда (гвозди - патроны гвоздомёта).</summary>
|
||||
static readonly HashSet<string> PartNames = new HashSet<string> { "resourceNail" };
|
||||
static readonly HashSet<string> AmmoParts = new HashSet<string>
|
||||
{
|
||||
"resourceArrowHeadIron", "resourceArrowHeadSteelAP", "resourceBuckshot", "resourceBulletCasing", "resourceBulletTip",
|
||||
@@ -57,9 +62,39 @@ namespace NecromancerTome
|
||||
};
|
||||
static readonly HashSet<string> RawNames = new HashSet<string>
|
||||
{
|
||||
"foodRawMeat", "foodRawMeatBundle", "foodEgg", "foodHoney", "foodRottingFlesh"
|
||||
"foodRawMeat", "foodRawMeatBundle", "foodEgg", "foodHoney", "foodRottingFlesh", "resourceChickenFeed"
|
||||
};
|
||||
|
||||
/// <summary>Предметы и блоки самого мода - по его Config/items.xml и blocks.xml (у многих нет «necro» в имени: книги
|
||||
/// призыва, браслет, камни портала, прах зомби, кожа жертвы). Читается один раз.</summary>
|
||||
static HashSet<string> _modNames;
|
||||
|
||||
static HashSet<string> ModNames()
|
||||
{
|
||||
if (_modNames != null)
|
||||
{
|
||||
return _modNames;
|
||||
}
|
||||
_modNames = new HashSet<string>();
|
||||
foreach (string f in new[] { "items.xml", "blocks.xml" })
|
||||
{
|
||||
try
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.Load(Path.Combine(ModEntry.Instance.Path, "Config", f));
|
||||
foreach (XmlNode n in doc.SelectNodes("//item[@name] | //block[@name]"))
|
||||
{
|
||||
_modNames.Add(n.Attributes["name"].Value);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UnityEngine.Debug.LogWarning("[NecromancerTome] CinerariumGroups: " + f + " мода не прочитан (" + e.Message + ")");
|
||||
}
|
||||
}
|
||||
return _modNames;
|
||||
}
|
||||
|
||||
static readonly Dictionary<int, int> _cache = new Dictionary<int, int>();
|
||||
|
||||
public static int Of(ItemValue _iv)
|
||||
@@ -85,7 +120,7 @@ namespace NecromancerTome
|
||||
static int Classify(ItemClass _ic, ItemValue _iv)
|
||||
{
|
||||
string n = _ic.GetItemName() ?? "";
|
||||
if (n.IndexOf("necro", StringComparison.OrdinalIgnoreCase) >= 0)
|
||||
if (n.IndexOf("necro", StringComparison.OrdinalIgnoreCase) >= 0 || ModNames().Contains(n))
|
||||
{
|
||||
return Necro;
|
||||
}
|
||||
@@ -117,6 +152,10 @@ namespace NecromancerTome
|
||||
{
|
||||
return Chemicals;
|
||||
}
|
||||
if (PartNames.Contains(n))
|
||||
{
|
||||
return Parts;
|
||||
}
|
||||
if (MaterialNames.Contains(n))
|
||||
{
|
||||
return Materials;
|
||||
@@ -129,6 +168,10 @@ namespace NecromancerTome
|
||||
{
|
||||
return Parts;
|
||||
}
|
||||
if (n.StartsWith("meleeTool"))
|
||||
{
|
||||
return Tools; // раньше оружия: у факела тег weapon
|
||||
}
|
||||
if (n.StartsWith("gun") || n.StartsWith("meleeWpn") || Tag(_ic, "weapon"))
|
||||
{
|
||||
return Weapons;
|
||||
@@ -153,7 +196,7 @@ namespace NecromancerTome
|
||||
{
|
||||
return Raw;
|
||||
}
|
||||
if (n.StartsWith("drink"))
|
||||
if (n.StartsWith("drink") || n.StartsWith("tinCan"))
|
||||
{
|
||||
return Drinks;
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user