1using System.Collections.Generic;
10 public Dictionary<string, PropSet>
cardMap =
new Dictionary<string, PropSet>();
12 public Dictionary<string, PropSetCategory>
categoryMap =
new Dictionary<string, PropSetCategory>();
14 public Dictionary<string, PropSet>
raceMap =
new Dictionary<string, PropSet>();
16 public Dictionary<string, PropSet>
workMap =
new Dictionary<string, PropSet>();
20 public List<Thing>
things =
new List<Thing>();
56 if (value.
source.parent !=
null)
70 Debug.LogError(t?.ToString() +
" alreadin in " +
this);
86 if (t.placeState != 0)
94 cardMap.GetOrCreate(t.id).Add(t);
95 if (t.sourceCard.origin !=
null)
97 cardMap.GetOrCreate(t.sourceCard.origin.id).Add(t);
100 if (!t.Thing.source.workTag.IsEmpty())
102 workMap.GetOrCreate(t.Thing.source.workTag).Add(t);
109 if (t.isDeconstructing)
126 if (thing.
props !=
null)
131 if (!
all.Contains(t))
133 Debug.LogError(t?.ToString() +
" isn't in " +
this);
140 if (t.sourceCard.origin !=
null)
142 cardMap[t.sourceCard.origin.id].Remove(t);
145 if (!t.Thing.source.workTag.IsEmpty())
147 workMap[t.Thing.source.workTag].Remove(t);
154 if (t.isDeconstructing)
180 if (
card.isSale || !
card.trait.CanUseContent)
196 if (
item.idMaterial == idMat)
208 string tag = (ing.tag.IsEmpty() ? null : ing.tag);
217 foreach (
string item in ing.idOther)
225 foreach (
string item2
in ing.idOther)
245 if (!(item3.
parent is
Thing thing) || (thing.c_lockLv == 0 && thing.trait.CanUseContent))
252 void FindCat(
string id)
285 List<Thing> list =
new List<Thing>();
298 Dictionary<string, ThingStack> dictionary =
new Dictionary<string, ThingStack>();
311 if (thingStack ==
null)
314 stacks.Add(t.
id, thingStack);
316 thingStack.count += t.
Num;
325 if (thing.
trait is T)
361 if (thing.
uid == uid)
371 return Find(
id, -1, -1, shared:
true);
379 public Thing Find(
string id,
int idMat = -1,
int refVal = -1,
bool shared =
false)
386 if ((!shared ||
item.parent is
Thing { IsSharedContainer: not false }) && (idMat == -1 ||
item.material.id == idMat) && (refVal == -1 ||
item.refVal == refVal))
395 public int GetNum(
string id,
bool onlyShared =
false)
400 if (!onlyShared || (
item.parentThing !=
null &&
item.parentThing.IsSharedContainer))
415 foreach (KeyValuePair<string, PropSet>
item in cardMap)
422 if (num !=
item.Value.num)
424 Debug.LogError(
"prop num:" +
item.Key +
" " +
item.Value.num +
"/" + num);
void Add(Act a, string s="")
SourceMaterial.Row material
bool IsExcludeFromCraft()
Thing Add(string id, int num=1, int lv=1)
SourceCategory.Row category
static SourceManager sources
SourceCategory.Row source
List< Card > deconstructing
List< Thing > ListThingsInCategory(SourceCategory.Row cat)
Dictionary< string, PropSet > raceMap
void OnNumChange(Card c, int a)
Dictionary< string, ThingStack > ListThingStacksInCategory(SourceCategory.Row cat)
Dictionary< string, PropSet > cardMap
Thing Find(string id, string idMat)
static int GetNumStockedAndRoaming(string id)
Dictionary< string, PropSet > workMap
Thing GetAvailableThing(string id, int idMat)
void ListThingStacksInCategory(SourceCategory.Row cat, Dictionary< string, ThingStack > stacks, Thing t)
int GetNum(string id, bool onlyShared=false)
Thing FindEmptyContainer< T >()
Thing Find(string id, int idMat=-1, int refVal=-1, bool shared=false)
Dictionary< string, PropSetCategory > categoryMap
Thing FindShared(string id)
bool ShouldListAsResource(Thing t)
ThingStack ListThingStack(Recipe.Ingredient ing, StockSearchMode searchMode)
Dictionary< string, CardRow > map
SourceCategory categories
void Foreach(Action< Thing > action, bool onlyAccessible=true)
void OnRemoveCard(Card c)