Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
RecipeUpdater Class Reference
Inheritance diagram for RecipeUpdater:
EClass

Public Types

enum  Mode { Passive , Immediate , Validate }
 

Public Member Functions

void Build (Point _p, Mode _mode=Mode.Passive)
 
void FixedUpdate ()
 
IEnumerable RunRecipe ()
 
IEnumerable RunDisassemble ()
 

Public Attributes

IEnumerator Enumerator
 
Point pos = new Point()
 

Static Public Attributes

static List< ThinglistD = new List<Thing>()
 
static List< ThinglastListD = new List<Thing>()
 
static HashSet< Reciperecipes = new HashSet<Recipe>()
 
static HashSet< RecipelastRecipes = new HashSet<Recipe>()
 
static HashSet< string > factories = new HashSet<string>()
 
static Mode mode
 
static int sync
 
static bool dirty
 
- Static Public Attributes inherited from EClass
static Core core
 

Additional Inherited Members

- Static Public Member Functions inherited from EClass
static int rnd (int a)
 
static int curve (int a, int start, int step, int rate=75)
 
static int rndHalf (int a)
 
static float rndf (float a)
 
static int rndSqrt (int a)
 
static void Wait (float a, Card c)
 
static void Wait (float a, Point p)
 
static int Bigger (int a, int b)
 
static int Smaller (int a, int b)
 
- Properties inherited from EClass
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Faction Wilds [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static SoundManager Sound [get]
 
static CoreDebug debug [get]
 

Detailed Description

Definition at line 5 of file RecipeUpdater.cs.

Member Enumeration Documentation

◆ Mode

Enumerator
Passive 
Immediate 
Validate 

Definition at line 7 of file RecipeUpdater.cs.

Member Function Documentation

◆ Build()

void RecipeUpdater.Build ( Point  _p,
Mode  _mode = Mode::Passive 
)
inline

Definition at line 34 of file RecipeUpdater.cs.

35 {
37 {
38 return;
39 }
40 pos.Set(_p);
41 mode = _mode;
42 sync++;
43 Enumerator = RunRecipe().GetEnumerator();
44 if (mode == Mode.Passive)
45 {
46 return;
47 }
48 for (int i = 0; i < 1000; i++)
49 {
51 if (Enumerator == null)
52 {
53 break;
54 }
55 }
56 }
static LayerCraftFloat Instance
Point Set(int _x, int _z)
Definition: Point.cs:479
IEnumerator Enumerator
static Mode mode
IEnumerable RunRecipe()
static int sync
void FixedUpdate()

References Enumerator, FixedUpdate(), LayerCraftFloat.Instance, mode, pos, RunRecipe(), Point.Set(), and sync.

Referenced by AM_Adv._OnUpdateInput(), Scene.Init(), AM_Adv.OnBecomeNoGoal(), LayerCraftFloat.OnSwitchContent(), and LayerCraftFloat.RefreshCraft().

◆ FixedUpdate()

void RecipeUpdater.FixedUpdate ( )
inline

Definition at line 58 of file RecipeUpdater.cs.

59 {
60 if (Enumerator != null && !Enumerator.MoveNext())
61 {
62 Enumerator = null;
63 }
64 }

References Enumerator.

Referenced by Build(), and GameUpdater.FixedUpdate().

◆ RunDisassemble()

IEnumerable RecipeUpdater.RunDisassemble ( )
inline

Definition at line 202 of file RecipeUpdater.cs.

203 {
204 lastListD.Clear();
205 foreach (Thing item in listD)
206 {
208 }
209 listD.Clear();
210 yield return true;
211 foreach (Card item2 in EClass.pc.pos.ListCards())
212 {
213 if (item2.isThing)
214 {
216 }
217 }
218 yield return true;
219 foreach (Thing thing in EClass.pc.things)
220 {
221 thing.GetDisassembles(listD);
222 }
223 yield return true;
224 if (mode == Mode.Passive && listD.SequenceEqual(lastListD))
225 {
226 yield return false;
227 }
228 else if (mode != Mode.Validate)
229 {
231 }
232 yield return null;
233 }
void Add(Act a, string s="")
Definition: ActPlan.cs:11
Definition: Card.cs:11
virtual bool isThing
Definition: Card.cs:1957
Point pos
Definition: Card.cs:55
ThingContainer things
Definition: Card.cs:34
virtual Thing Thing
Definition: Card.cs:1934
Definition: EClass.cs:5
static Chara pc
Definition: EClass.cs:14
List< Card > ListCards(bool includeMasked=false)
Definition: Point.cs:1015
static List< Thing > lastListD
static List< Thing > listD
Definition: Thing.cs:8
void GetDisassembles(List< Thing > list)
Definition: Thing.cs:1687

References ActPlan.List.Add(), Thing.GetDisassembles(), LayerCraftFloat.Instance, Card.isThing, item, lastListD, Point.ListCards(), listD, mode, EClass.pc, Card.pos, LayerCraftFloat.RefreshDisassemble(), Card.Thing, and Card.things.

◆ RunRecipe()

IEnumerable RecipeUpdater.RunRecipe ( )
inline

Definition at line 66 of file RecipeUpdater.cs.

67 {
68 recipes.Clear();
69 factories.Clear();
70 yield return true;
71 int count = 0;
72 for (int i = pos.x - 1; i < pos.x + 2; i++)
73 {
74 if (i < 0 || i >= EClass._map.Size)
75 {
76 continue;
77 }
78 for (int j = pos.z - 1; j < pos.z + 2; j++)
79 {
80 if (j < 0 || j >= EClass._map.Size)
81 {
82 continue;
83 }
84 Cell cell = EClass._map.cells[i, j];
85 if (cell.detail == null || cell.detail.things.Count == 0)
86 {
87 continue;
88 }
89 if (pos.cell.effect?.IsFire ?? false)
90 {
91 factories.Add("fire");
92 }
93 foreach (Thing thing in cell.detail.things)
94 {
95 if (thing.IsInstalled)
96 {
97 if (thing.trait.IsFactory)
98 {
99 factories.Add(thing.id);
100 }
101 if (thing.trait.ToggleType == ToggleType.Fire && thing.isOn)
102 {
103 factories.Add("fire");
104 }
105 }
106 }
107 }
108 }
109 yield return true;
111 yield return true;
112 foreach (Thing thing2 in EClass.pc.things)
113 {
114 thing2.GetRecipes(recipes);
115 count++;
116 }
117 yield return true;
118 for (int k = pos.x - 1; k < pos.x + 2; k++)
119 {
120 if (k < 0 || k >= EClass._map.Size)
121 {
122 continue;
123 }
124 for (int l = pos.z - 1; l < pos.z + 2; l++)
125 {
126 if (l < 0 || l >= EClass._map.Size)
127 {
128 continue;
129 }
130 Cell cell = EClass._map.cells[k, l];
131 if (cell.detail == null || cell.detail.things.Count == 0)
132 {
133 continue;
134 }
135 foreach (Thing thing3 in cell.detail.things)
136 {
137 if (thing3.isNPCProperty)
138 {
139 continue;
140 }
141 if (thing3.trait.IsContainer)
142 {
143 if (!thing3.IsInstalled)
144 {
145 continue;
146 }
147 }
148 else if (thing3.IsInstalled)
149 {
150 continue;
151 }
152 thing3.GetRecipes(recipes);
153 count++;
154 }
155 }
156 }
157 yield return true;
158 List<Recipe> list = new List<Recipe>();
159 foreach (Recipe recipe in recipes)
160 {
161 bool flag = true;
162 string id = recipe.id;
163 if ((id == "waystone" || id == "waystone_temp") && EClass.game.quests.GetPhase<QuestExploration>() >= 6)
164 {
165 list.Add(recipe);
166 continue;
167 }
168 foreach (Recipe.Ingredient ingredient in recipe.ingredients)
169 {
170 if (ingredient.thing == null)
171 {
172 flag = false;
173 break;
174 }
175 }
176 if (!flag)
177 {
178 list.Add(recipe);
179 }
180 }
181 foreach (Recipe item in list)
182 {
183 recipes.Remove(item);
184 }
185 yield return true;
186 if (mode == Mode.Passive && lastRecipes.SetEquals(recipes))
187 {
188 yield return false;
189 }
190 else if (mode != Mode.Validate)
191 {
193 }
194 lastRecipes.Clear();
195 foreach (Recipe recipe2 in recipes)
196 {
197 lastRecipes.Add(recipe2);
198 }
199 yield return null;
200 }
ToggleType
Definition: ToggleType.cs:2
string id
Definition: Card.cs:31
bool isNPCProperty
Definition: Card.cs:526
Trait trait
Definition: Card.cs:49
bool IsInstalled
Definition: Card.cs:2241
bool isOn
Definition: Card.cs:514
List< Thing > things
Definition: CellDetail.cs:11
bool IsFire
Definition: CellEffect.cs:135
Definition: Cell.cs:7
CellEffect effect
Definition: Cell.cs:94
CellDetail detail
Definition: Cell.cs:92
static Game game
Definition: EClass.cs:8
static Map _map
Definition: EClass.cs:18
QuestManager quests
Definition: Game.cs:179
int Size
Definition: MapBounds.cs:20
Cell[,] cells
Definition: Map.cs:85
int x
Definition: Point.cs:36
int z
Definition: Point.cs:39
Cell cell
Definition: Point.cs:51
static HashSet< Recipe > recipes
static HashSet< string > factories
static HashSet< Recipe > lastRecipes
Definition: Recipe.cs:7
string id
Definition: Recipe.cs:161
List< Ingredient > ingredients
Definition: Recipe.cs:164
void AddFactory(HashSet< string > hash)
void GetRecipes(HashSet< Recipe > recipes)
Definition: Thing.cs:1683
virtual bool IsFactory
Definition: Trait.cs:135
virtual ToggleType ToggleType
Definition: Trait.cs:456
virtual bool IsContainer
Definition: Trait.cs:205

References EClass._map, ThingContainer.AddFactory(), Point.cell, Map.cells, Cell.detail, Cell.effect, factories, EClass.game, Thing.GetRecipes(), Card.id, Recipe.id, Recipe.ingredients, LayerCraftFloat.Instance, Trait.IsContainer, Trait.IsFactory, CellEffect.IsFire, Card.IsInstalled, Card.isNPCProperty, Card.isOn, item, lastRecipes, mode, EClass.pc, pos, Game.quests, recipes, LayerCraftFloat.RefreshCraft(), MapBounds.Size, Card.things, CellDetail.things, Trait.ToggleType, Card.trait, Point.x, and Point.z.

Referenced by Build().

Member Data Documentation

◆ dirty

bool RecipeUpdater.dirty
static

Definition at line 32 of file RecipeUpdater.cs.

Referenced by AM_Adv._OnUpdateInput().

◆ Enumerator

IEnumerator RecipeUpdater.Enumerator

Definition at line 14 of file RecipeUpdater.cs.

Referenced by Build(), and FixedUpdate().

◆ factories

HashSet<string> RecipeUpdater.factories = new HashSet<string>()
static

Definition at line 26 of file RecipeUpdater.cs.

Referenced by RunRecipe().

◆ lastListD

List<Thing> RecipeUpdater.lastListD = new List<Thing>()
static

Definition at line 20 of file RecipeUpdater.cs.

Referenced by RunDisassemble().

◆ lastRecipes

HashSet<Recipe> RecipeUpdater.lastRecipes = new HashSet<Recipe>()
static

Definition at line 24 of file RecipeUpdater.cs.

Referenced by RunRecipe().

◆ listD

List<Thing> RecipeUpdater.listD = new List<Thing>()
static

Definition at line 18 of file RecipeUpdater.cs.

Referenced by LayerCraftFloat.RefreshDisassemble(), and RunDisassemble().

◆ mode

Mode RecipeUpdater.mode
static

Definition at line 28 of file RecipeUpdater.cs.

Referenced by Build(), RunDisassemble(), and RunRecipe().

◆ pos

Point RecipeUpdater.pos = new Point()

Definition at line 16 of file RecipeUpdater.cs.

Referenced by Build(), and RunRecipe().

◆ recipes

HashSet<Recipe> RecipeUpdater.recipes = new HashSet<Recipe>()
static

Definition at line 22 of file RecipeUpdater.cs.

Referenced by LayerCraftFloat.RefreshCraft(), and RunRecipe().

◆ sync

int RecipeUpdater.sync
static

Definition at line 30 of file RecipeUpdater.cs.

Referenced by Build().


The documentation for this class was generated from the following file: