Elin Decompiled Documentation EA 23.289 Nightly
Loading...
Searching...
No Matches
GrowSystem Class Reference
Inheritance diagram for GrowSystem:
EClass GrowSystemCrop GrowSystemDeco GrowSystemKinoko GrowSystemPlant GrowSystemTree GrowSystemWeed GrowSystemBerry GrowSystemCactus GrowSystemWheat GrowSystemFlower GrowSystemHerb GrowSystemTreeFeywood GrowSystemTreeSingle GrowSystemPasture GrowSystemRice GrowSystemSeaweed GrowSystemSunFlower GrowSystemTreeCoralwood

Classes

class  Stage
 

Public Member Functions

bool IsLastStage ()
 
virtual bool BlockSight (Cell cell)
 
virtual bool BlockPass (Cell cell)
 
virtual string GetSoundProgress ()
 
virtual Stage CreateStage ()
 
void Init (SourceObj.Row _row)
 
virtual void SetGenericFirstStageTile (Stage s)
 
virtual void SetStageTile (Stage s)
 
virtual int GetStageTile ()
 
virtual int GetShadow (int index)
 
virtual void OnRenderTileMap (RenderParam p, bool drawShadow=true)
 
void SetRandomStage ()
 
void SetDefaultStage ()
 
virtual void OnSetObj ()
 
bool CanGrow (VirtualDate date)
 
void TryGrow (VirtualDate date)
 
void EqualizePlants (Point pos)
 
void Grow (int mtp=1)
 
virtual void OnReachNextStage ()
 
virtual void OnExceedLastStage ()
 
void SetStage (int idx, bool renewHarvest=false)
 
virtual void OnSetStage (int idx)
 
bool HaltGrowth ()
 
void Perish ()
 
bool IsWithered ()
 
bool CanHarvest ()
 
virtual bool CanReapSeed ()
 
virtual void OnHit (Chara c)
 
virtual void OnHitFail (Chara c)
 
void OnProgressComplete (Chara c)
 
void PopMineObj (Chara c=null)
 
virtual void OnMineObj (Chara c=null)
 
void TryPick (Cell cell, Thing t, Chara c, bool applySeed=false)
 
void TryPick (Cell cell, string idThing, int idMat=-1, int num=1, bool applySeed=false)
 
Thing TryPopSeed (Chara c)
 
void Harvest (Chara c)
 
void PopHarvest (Chara c, string idThing, int num=-1)
 
void PopHarvest (Chara c, Thing t=null, int num=-1)
 
void ApplySeed (Thing t)
 
virtual int GetHp ()
 

Public Attributes

SourceObj.Row source
 
Stage[] stages
 
int[] baseTiles
 
int harvestTile
 
int afterHarvestTile
 
string idHarvestThing
 

Static Public Attributes

const int DivStage = 30
 
static Cell cell
 
static Stage currentStage
 
- Static Public Attributes inherited from EClass
static Core core
 

Protected Member Functions

virtual bool IsHarvestStage (int idx)
 

Properties

static SourceObj.Row[] SourceSnowTree [get]
 
virtual RenderData RenderHarvest [get]
 
virtual int Step [get]
 
virtual int StageLength [get]
 
virtual int DefaultStage [get]
 
virtual int HarvestStage [get]
 
virtual int AutoMineStage [get]
 
virtual int HaltStage [get]
 
virtual bool DrawHarvestOnTop [get]
 
virtual bool UseGenericFirstStageTile [get]
 
virtual bool WitherOnLastStage [get]
 
virtual bool CanRegrow [get]
 
virtual bool CanLevelSeed [get]
 
virtual int ShadowStage [get]
 
virtual bool IsTree [get]
 
virtual bool IsCrimeToHarvest [get]
 
virtual float MtpProgress [get]
 
virtual bool NeedSunlight [get]
 
virtual bool GrowOnLand [get]
 
virtual bool GrowUndersea [get]
 
virtual AnimeID AnimeProgress [get]
 
Stage stage [get]
 
virtual bool IsMature [get]
 
- 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]
 

Static Private Attributes

static SourceObj.Row[] _sourceSnowTree
 

Additional Inherited Members

- Static Public Member Functions inherited from EClass
static int rndSeed (int a, int seed)
 
static int rnd (long a)
 
static int rnd (int a)
 
static int curve (long _a, int start, int step, int rate=75)
 
static int sqrt (int a)
 
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)
 

Detailed Description

Definition at line 3 of file GrowSystem.cs.

Member Function Documentation

◆ ApplySeed()

void GrowSystem.ApplySeed ( Thing  t)
inline

Definition at line 713 of file GrowSystem.cs.

714 {
717 {
718 thing = null;
719 }
720 if (thing == null)
721 {
722 return;
723 }
724 int encLv = thing.encLV / 10 + ((thing.encLV > 0) ? 1 : 0);
725 bool flag = t.IsFood || t.Evalue(10) > 0 || t.id == "grass";
726 foreach (Element value in thing.elements.dict.Values)
727 {
728 if ((!value.IsFoodTrait || flag) && (value.IsFoodTrait || value.id == 2))
729 {
730 t.elements.ModBase(value.id, value.Value / 10 * 10);
731 }
732 }
733 t.SetEncLv(encLv);
734 t.c_refText = thing.c_refText;
735 t.isCrafted = true;
736 }
ElementContainerCard elements
Definition: Card.cs:42
string c_refText
Definition: Card.cs:1655
void SetEncLv(int a)
Definition: Card.cs:3946
int Evalue(int ele)
Definition: Card.cs:2611
Definition: EClass.cs:6
static Zone _zone
Definition: EClass.cs:21
static Map _map
Definition: EClass.cs:19
Dictionary< int, Element > dict
Element ModBase(int ele, int v)
int id
Definition: ELEMENT.cs:255
int Value
Definition: ELEMENT.cs:297
bool IsFoodTrait
Definition: ELEMENT.cs:369
static Cell cell
Definition: GrowSystem.cs:41
PlantData TryGetPlant(Point p)
Definition: Map.cs:1942
Thing seed
Definition: PlantData.cs:6
Definition: Thing.cs:8
virtual bool IsUserZone
Definition: Zone.cs:273

References EClass._map, EClass._zone, cell, Card.Evalue(), Element.id, Element.IsFoodTrait, Zone.IsUserZone, PlantData.seed, Map.TryGetPlant(), and Element.Value.

Referenced by PopHarvest(), and TryPick().

◆ BlockPass()

virtual bool GrowSystem.BlockPass ( Cell  cell)
inlinevirtual

Reimplemented in GrowSystemTree, and GrowSystemTreeCoralwood.

Definition at line 134 of file GrowSystem.cs.

135 {
136 return false;
137 }

◆ BlockSight()

virtual bool GrowSystem.BlockSight ( Cell  cell)
inlinevirtual

Reimplemented in GrowSystemTree, and GrowSystemTreeCoralwood.

Definition at line 129 of file GrowSystem.cs.

130 {
131 return false;
132 }

Referenced by Cell.Refresh().

◆ CanGrow()

bool GrowSystem.CanGrow ( VirtualDate  date)
inline

Definition at line 287 of file GrowSystem.cs.

288 {
289 if (source.id == 0)
290 {
291 return false;
292 }
293 if (cell.HasBlock && !cell.sourceBlock.tileType.IsFence)
294 {
295 return false;
296 }
297 if (GrowUndersea)
298 {
299 if (EClass._zone.IsUnderwater || cell.sourceFloor.tileType.IsDeepWater)
300 {
301 return true;
302 }
303 }
304 else if (EClass._zone.IsUnderwater)
305 {
306 return false;
307 }
308 if (!GrowOnLand)
309 {
310 return false;
311 }
312 if (NeedSunlight)
313 {
314 if (date.sunMap == null)
315 {
316 date.BuildSunMap();
317 }
318 if ((cell.HasRoof || date.IsWinter || EClass._map.IsIndoor) && !date.sunMap.Contains(cell.index))
319 {
320 return false;
321 }
322 }
323 return true;
324 }
SourceBlock.Row sourceBlock
Definition: Cell.cs:1052
bool HasBlock
Definition: Cell.cs:643
SourceFloor.Row sourceFloor
Definition: Cell.cs:1054
bool HasRoof
Definition: Cell.cs:648
int index
Definition: Cell.cs:114
bool IsWinter
Definition: Date.cs:192
SourceObj.Row source
Definition: GrowSystem.cs:45
virtual bool GrowOnLand
Definition: GrowSystem.cs:109
virtual bool NeedSunlight
Definition: GrowSystem.cs:107
virtual bool GrowUndersea
Definition: GrowSystem.cs:111
bool IsIndoor
Definition: Map.cs:131
void BuildSunMap()
Definition: VirtualDate.cs:54
HashSet< int > sunMap
Definition: VirtualDate.cs:9
virtual bool IsUnderwater
Definition: Zone.cs:271

References EClass._map, EClass._zone, VirtualDate.BuildSunMap(), cell, GrowOnLand, GrowUndersea, Cell.HasBlock, Cell.HasRoof, Cell.index, Map.IsIndoor, Zone.IsUnderwater, Date.IsWinter, NeedSunlight, source, Cell.sourceBlock, Cell.sourceFloor, and VirtualDate.sunMap.

Referenced by Zone.GrowPlants(), and TryGrow().

◆ CanHarvest()

bool GrowSystem.CanHarvest ( )
inline

Definition at line 520 of file GrowSystem.cs.

521 {
523 {
524 return false;
525 }
526 return true;
527 }
bool isHarvested
Definition: Cell.cs:330
Stage stage
Definition: GrowSystem.cs:115

References cell, GrowSystem.Stage.harvest, Cell.isHarvested, and stage.

Referenced by Cell.CanHarvest(), CanReapSeed(), Grow(), TaskHarvest.OnCreateProgress(), and Perish().

◆ CanReapSeed()

virtual bool GrowSystem.CanReapSeed ( )
inlinevirtual

Reimplemented in GrowSystemDeco, GrowSystemFlower, GrowSystemHerb, GrowSystemKinoko, GrowSystemPasture, GrowSystemSeaweed, and GrowSystemWeed.

Definition at line 529 of file GrowSystem.cs.

530 {
531 return CanHarvest();
532 }
bool CanHarvest()
Definition: GrowSystem.cs:520

References CanHarvest().

Referenced by Cell.CanReapSeed().

◆ CreateStage()

virtual Stage GrowSystem.CreateStage ( )
inlinevirtual

Definition at line 144 of file GrowSystem.cs.

145 {
146 return new Stage();
147 }

Referenced by Init().

◆ EqualizePlants()

void GrowSystem.EqualizePlants ( Point  pos)
inline

Definition at line 334 of file GrowSystem.cs.

335 {
337 if (p1 == null || p1.seed == null)
338 {
339 return;
340 }
341 pos.ForeachNeighbor(delegate(Point pos2)
342 {
343 Thing thing = EClass._map.TryGetPlant(pos2)?.seed;
344 if (thing == null)
345 {
347 if (installed != null && installed.id == p1.seed.id)
348 {
349 thing = installed;
350 }
351 }
352 if (thing != null && p1.seed.refVal == thing.refVal && thing.encLV >= p1.seed.encLV)
353 {
354 p1.seed = thing;
355 }
356 }, diagonal: false);
357 }
@ seed
string id
Definition: Card.cs:36
int refVal
Definition: Card.cs:207
int encLV
Definition: Card.cs:327
Definition: Point.cs:9
Thing Installed
Definition: Point.cs:327
void ForeachNeighbor(Action< Point > action, bool diagonal=true)
Definition: Point.cs:1397

References EClass._map, Card.encLV, Point.ForeachNeighbor(), Card.id, installed, Point.Installed, Card.refVal, seed, PlantData.seed, and Map.TryGetPlant().

Referenced by Grow().

◆ GetHp()

virtual int GrowSystem.GetHp ( )
inlinevirtual

Reimplemented in GrowSystemTree.

Definition at line 738 of file GrowSystem.cs.

739 {
740 return source.hp;
741 }

References source.

◆ GetShadow()

virtual int GrowSystem.GetShadow ( int  index)
inlinevirtual

Reimplemented in GrowSystemTree, GrowSystemTreeCoralwood, and GrowSystemTreeSingle.

Definition at line 202 of file GrowSystem.cs.

203 {
204 return -1;
205 }

Referenced by OnRenderTileMap().

◆ GetSoundProgress()

virtual string GrowSystem.GetSoundProgress ( )
inlinevirtual

Reimplemented in GrowSystemWheat.

Definition at line 139 of file GrowSystem.cs.

140 {
141 return "Material/grass";
142 }

Referenced by TaskHarvest.OnCreateProgress().

◆ GetStageTile()

virtual int GrowSystem.GetStageTile ( )
inlinevirtual

Reimplemented in GrowSystemDeco, GrowSystemTreeCoralwood, and GrowSystemWheat.

Definition at line 197 of file GrowSystem.cs.

198 {
199 return currentStage.tiles[cell.objDir % currentStage.tiles.Length];
200 }
static Stage currentStage
Definition: GrowSystem.cs:43

References currentStage, and GrowSystem.Stage.tiles.

Referenced by OnRenderTileMap().

◆ Grow()

void GrowSystem.Grow ( int  mtp = 1)
inline

Definition at line 359 of file GrowSystem.cs.

360 {
361 bool flag = cell.isWatered || (cell.IsTopWater && (source.tag.Contains("flood") || source.tag.Contains("undersea")));
362 PlantData plantData = EClass._map.TryGetPlant(cell);
363 if (plantData != null && flag)
364 {
365 plantData.water++;
366 }
367 int num = Step * mtp * ((!flag) ? 1 : 2);
368 int num2 = cell.objVal / 30;
369 int num3 = (cell.objVal + num) / 30;
370 if (num2 != num3)
371 {
373 {
374 PopHarvest(null);
375 }
377 {
378 Point point = cell.GetPoint();
379 EqualizePlants(point);
380 Thing thing = TryPopSeed(null);
381 PopMineObj();
382 if (thing != null)
383 {
384 point.SetObj();
385 EClass._zone.AddCard(thing, point).Install();
386 }
387 }
388 else if (num2 == StageLength - 1)
389 {
391 {
392 Point point2 = cell.GetPoint();
393 EqualizePlants(point2);
394 Thing thing2 = TryPopSeed(null);
395 if (thing2 != null)
396 {
397 point2.SetObj();
398 EClass._zone.AddCard(thing2, point2).Install();
399 }
400 }
401 else
402 {
404 }
405 }
406 else
407 {
409 }
410 }
411 else
412 {
413 cell.objVal += (byte)num;
414 }
415 cell.Refresh();
417 }
Card Install()
Definition: Card.cs:3823
void Refresh()
Definition: Cell.cs:1152
byte z
Definition: Cell.cs:58
byte x
Definition: Cell.cs:56
Point GetPoint()
Definition: Cell.cs:1101
static Player player
Definition: EClass.cs:13
virtual int StageLength
Definition: GrowSystem.cs:79
virtual void OnReachNextStage()
Definition: GrowSystem.cs:419
virtual int AutoMineStage
Definition: GrowSystem.cs:85
virtual int HarvestStage
Definition: GrowSystem.cs:83
void PopMineObj(Chara c=null)
Definition: GrowSystem.cs:547
void EqualizePlants(Point pos)
Definition: GrowSystem.cs:334
virtual int Step
Definition: GrowSystem.cs:77
virtual void OnExceedLastStage()
Definition: GrowSystem.cs:424
void PopHarvest(Chara c, string idThing, int num=-1)
Definition: GrowSystem.cs:644
Thing TryPopSeed(Chara c)
Definition: GrowSystem.cs:604
void RefreshFOV(int x, int z, int radius=6, bool recalculate=false)
Definition: Map.cs:929
int water
Definition: PlantData.cs:9
bool isAutoFarming
Definition: Player.cs:1239
void SetObj(int id=0, int value=1, int dir=0)
Definition: Point.cs:928
Card AddCard(Card t, Point point)
Definition: Zone.cs:2017

References EClass._map, EClass._zone, Zone.AddCard(), AutoMineStage, CanHarvest(), cell, EqualizePlants(), Cell.GetPoint(), HarvestStage, Card.Install(), Player.isAutoFarming, OnExceedLastStage(), OnReachNextStage(), EClass.player, PopHarvest(), PopMineObj(), Cell.Refresh(), Map.RefreshFOV(), Point.SetObj(), source, StageLength, Step, Map.TryGetPlant(), TryPopSeed(), PlantData.water, Cell.x, and Cell.z.

Referenced by ActionMode.RotateUnderMouse(), and TryGrow().

◆ HaltGrowth()

bool GrowSystem.HaltGrowth ( )
inline

Definition at line 474 of file GrowSystem.cs.

475 {
476 return stage.idx == HarvestStage;
477 }

References HarvestStage.

◆ Harvest()

void GrowSystem.Harvest ( Chara  c)
inline

Definition at line 637 of file GrowSystem.cs.

638 {
639 cell.isHarvested = true;
640 cell.gatherCount = 0;
641 PopHarvest(c);
642 }

References PopHarvest().

Referenced by TaskHarvest.OnCreateProgress().

◆ Init()

void GrowSystem.Init ( SourceObj::Row  _row)
inline

Definition at line 149 of file GrowSystem.cs.

150 {
151 source = _row;
152 stages = new Stage[StageLength];
153 string[] growth = _row._growth;
154 string[] array = growth[1].Split('/');
155 baseTiles = new int[array.Length];
156 for (int i = 0; i < array.Length; i++)
157 {
158 baseTiles[i] = array[i].ToInt();
159 }
160 if (growth.Length > 2)
161 {
162 harvestTile = RenderHarvest.ConvertTile(growth[2].ToInt());
163 idHarvestThing = growth[3];
164 }
165 for (int j = 0; j < StageLength; j++)
166 {
167 Stage stage = CreateStage();
168 stages[j] = stage;
169 stage.idx = j;
170 if (j == 0 && UseGenericFirstStageTile)
171 {
173 }
174 else
175 {
177 }
178 if (harvestTile != 0 && IsHarvestStage(j))
179 {
180 stage.harvest = true;
181 }
182 }
183 }
virtual bool IsHarvestStage(int idx)
Definition: GrowSystem.cs:124
int[] baseTiles
Definition: GrowSystem.cs:49
string idHarvestThing
Definition: GrowSystem.cs:55
virtual RenderData RenderHarvest
Definition: GrowSystem.cs:75
virtual Stage CreateStage()
Definition: GrowSystem.cs:144
virtual void SetStageTile(Stage s)
Definition: GrowSystem.cs:191
virtual bool UseGenericFirstStageTile
Definition: GrowSystem.cs:91
Stage[] stages
Definition: GrowSystem.cs:47
virtual void SetGenericFirstStageTile(Stage s)
Definition: GrowSystem.cs:185
int harvestTile
Definition: GrowSystem.cs:51
int ConvertTile(int tile)
Definition: RenderData.cs:110
string[] _growth
Definition: SourceObj.cs:9

References baseTiles, RenderData.ConvertTile(), CreateStage(), harvestTile, idHarvestThing, IsHarvestStage(), RenderHarvest, SetGenericFirstStageTile(), SetStageTile(), source, stage, StageLength, stages, and UseGenericFirstStageTile.

Referenced by SourceObj.Row.OnInit().

◆ IsHarvestStage()

virtual bool GrowSystem.IsHarvestStage ( int  idx)
inlineprotectedvirtual

Definition at line 124 of file GrowSystem.cs.

125 {
126 return idx == HarvestStage;
127 }

References HarvestStage.

Referenced by Init(), and GrowSystemWheat.OnMineObj().

◆ IsLastStage()

bool GrowSystem.IsLastStage ( )
inline

Definition at line 119 of file GrowSystem.cs.

120 {
121 return stage.idx == StageLength - 1;
122 }

References StageLength.

Referenced by Cell.CanMakeStraw().

◆ IsWithered()

bool GrowSystem.IsWithered ( )
inline

Definition at line 511 of file GrowSystem.cs.

512 {
514 {
515 return true;
516 }
517 return false;
518 }
virtual bool WitherOnLastStage
Definition: GrowSystem.cs:93

References GrowSystem.Stage.idx, stage, StageLength, and WitherOnLastStage.

Referenced by OnMineObj(), GrowSystemPasture.OnMineObj(), GrowSystemSeaweed.OnMineObj(), GrowSystemWheat.OnMineObj(), and TryPopSeed().

◆ OnExceedLastStage()

virtual void GrowSystem.OnExceedLastStage ( )
inlinevirtual

Reimplemented in GrowSystemDeco, and GrowSystemKinoko.

Definition at line 424 of file GrowSystem.cs.

425 {
426 cell.objVal = (byte)(stages.Length * 30 - 1);
427 if (!CanRegrow || Rand.rnd(2) != 0)
428 {
429 return;
430 }
431 Point point = cell.GetPoint();
432 if (point.IsFarmField)
433 {
434 return;
435 }
436 if (Rand.rnd(2) == 0)
437 {
438 Point randomNeighbor = point.GetRandomNeighbor();
439 if (randomNeighbor.cell.CanGrowWeed)
440 {
441 randomNeighbor.SetObj(cell.obj);
442 point.SetObj();
443 return;
444 }
445 }
446 cell.objVal = 0;
447 cell.isHarvested = false;
448 cell.isWatered = cell.HasLiquid;
449 }
bool HasLiquid
Definition: Cell.cs:673
byte obj
Definition: Cell.cs:38
bool CanGrowWeed
Definition: Cell.cs:742
virtual bool CanRegrow
Definition: GrowSystem.cs:95
bool IsFarmField
Definition: Point.cs:127
Cell cell
Definition: Point.cs:51
Point GetRandomNeighbor()
Definition: Point.cs:759
Definition: Rand.cs:4
static int rnd(int max)
Definition: Rand.cs:59

References Cell.CanGrowWeed, CanRegrow, cell, Point.cell, Cell.GetPoint(), Point.GetRandomNeighbor(), Cell.HasLiquid, Point.IsFarmField, Cell.obj, Rand.rnd(), Point.SetObj(), and stages.

Referenced by Grow().

◆ OnHit()

virtual void GrowSystem.OnHit ( Chara  c)
inlinevirtual

Definition at line 534 of file GrowSystem.cs.

535 {
536 }

◆ OnHitFail()

virtual void GrowSystem.OnHitFail ( Chara  c)
inlinevirtual

Reimplemented in GrowSystemTree.

Definition at line 538 of file GrowSystem.cs.

539 {
540 }

Referenced by TaskHarvest.OnCreateProgress().

◆ OnMineObj()

virtual void GrowSystem.OnMineObj ( Chara  c = null)
inlinevirtual

Reimplemented in GrowSystemBerry, GrowSystemCactus, GrowSystemCrop, GrowSystemFlower, GrowSystemHerb, GrowSystemKinoko, GrowSystemPasture, GrowSystemPlant, GrowSystemSeaweed, GrowSystemTree, GrowSystemWeed, and GrowSystemWheat.

Definition at line 556 of file GrowSystem.cs.

557 {
558 if (!IsWithered())
559 {
560 int num = cell.sourceObj.components.Length - 1;
561 Thing t = ThingGen.Create(cell.sourceObj.components[num].Split('/')[0], cell.matObj_fixed.alias);
562 TryPick(cell, t, c);
563 }
564 }
SourceObj.Row sourceObj
Definition: Cell.cs:1072
SourceMaterial.Row matObj_fixed
Definition: Cell.cs:1039
void TryPick(Cell cell, Thing t, Chara c, bool applySeed=false)
Definition: GrowSystem.cs:566
bool IsWithered()
Definition: GrowSystem.cs:511
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53

References cell, ThingGen.Create(), IsWithered(), Cell.matObj_fixed, Cell.sourceObj, and TryPick().

Referenced by PopMineObj().

◆ OnProgressComplete()

void GrowSystem.OnProgressComplete ( Chara  c)
inline

Definition at line 542 of file GrowSystem.cs.

543 {
544 EClass._map.MineObj(cell.GetPoint(), null, c);
545 }
void MineObj(Point point, Task task=null, Chara c=null)
Definition: Map.cs:1840

References EClass._map, cell, Cell.GetPoint(), and Map.MineObj().

Referenced by TaskHarvest.OnCreateProgress().

◆ OnReachNextStage()

virtual void GrowSystem.OnReachNextStage ( )
inlinevirtual

Definition at line 419 of file GrowSystem.cs.

420 {
421 SetStage(cell.objVal / 30 + 1);
422 }
byte objVal
Definition: Cell.cs:40
void SetStage(int idx, bool renewHarvest=false)
Definition: GrowSystem.cs:451

References cell, Cell.objVal, and SetStage().

Referenced by Grow().

◆ OnRenderTileMap()

virtual void GrowSystem.OnRenderTileMap ( RenderParam  p,
bool  drawShadow = true 
)
inlinevirtual

Definition at line 207 of file GrowSystem.cs.

208 {
209 int num = cell.objVal / 30;
210 currentStage = stages[num];
211 SourceObj.Row row = source;
212 float y = p.y;
213 float z = p.z;
214 if (num != 0 || !UseGenericFirstStageTile)
215 {
216 p.y += row.pref.y;
217 p.z += row.pref.z;
218 }
220 {
221 if (cell.isHarvested || harvestTile == 0)
222 {
223 p.tile = ((afterHarvestTile != 0) ? afterHarvestTile : GetStageTile());
225 }
226 else
227 {
229 {
230 p.tile = GetStageTile();
232 p.liquidLv = 0;
233 }
234 p.tile = harvestTile;
236 }
237 }
238 else
239 {
240 p.tile = GetStageTile();
242 }
243 p.y = y;
244 p.z = z;
245 if (cell.obj == 118 && Core.fixedFrame % 10f == 0f && IsMature)
246 {
247 EClass.scene.psFey.transform.position = new Vector3(p.x, p.y, p.z - 2f);
248 EClass.scene.psFey.Emit(1);
249 }
250 if (drawShadow && num >= ShadowStage)
251 {
252 int shadow = GetShadow(num);
253 if (shadow == -1)
254 {
255 shadow = row.pref.shadow;
256 }
257 if (shadow > 1 && !cell.ignoreObjShadow)
258 {
260 }
261 }
262 }
BaseTileMap tileMap
MeshPass passShadow
Definition: BaseTileMap.cs:133
bool ignoreObjShadow
Definition: Cell.cs:378
Definition: Core.cs:14
static float fixedFrame
Definition: Core.cs:25
static Scene scene
Definition: EClass.cs:31
static BaseGameScreen screen
Definition: EClass.cs:33
RenderData renderData
Definition: GrowSystem.cs:13
virtual int GetStageTile()
Definition: GrowSystem.cs:197
int afterHarvestTile
Definition: GrowSystem.cs:53
virtual int GetShadow(int index)
Definition: GrowSystem.cs:202
virtual bool IsMature
Definition: GrowSystem.cs:117
virtual bool DrawHarvestOnTop
Definition: GrowSystem.cs:89
virtual int ShadowStage
Definition: GrowSystem.cs:99
void AddShadow(MeshPassParam p, ref Vector3 fix)
Definition: MeshPass.cs:195
void Draw(RenderParam p, int tile)
Definition: RenderData.cs:128
Vector3 offsetShadow
Definition: RenderData.cs:22
RenderData renderData
Definition: RenderRow.cs:71
SourcePref pref
Definition: RenderRow.cs:68
ParticleSystem psFey
Definition: Scene.cs:119
List< Item > items
Definition: ShadowData.cs:101
static ShadowData Instance
Definition: ShadowData.cs:99
int shadow
Definition: SourcePref.cs:39

References MeshPass.AddShadow(), afterHarvestTile, cell, currentStage, RenderData.Draw(), DrawHarvestOnTop, Core.fixedFrame, GetShadow(), GetStageTile(), GrowSystem.Stage.harvest, harvestTile, Cell.ignoreObjShadow, ShadowData.Instance, Cell.isHarvested, IsMature, ShadowData.items, Cell.obj, RenderData.offsetShadow, BaseTileMap.passShadow, RenderRow.pref, Scene.psFey, GrowSystem.Stage.renderData, RenderRow.renderData, RenderHarvest, EClass.scene, EClass.screen, SourcePref.shadow, ShadowStage, MeshPassParam.snow, source, stages, BaseGameScreen.tileMap, UseGenericFirstStageTile, MeshPassParam.x, MeshPassParam.y, SourcePref.y, MeshPassParam.z, and SourcePref.z.

Referenced by CardRenderer.Draw(), BaseTileMap.DrawTile(), and TileMapElona.DrawTile().

◆ OnSetObj()

virtual void GrowSystem.OnSetObj ( )
inlinevirtual

Reimplemented in GrowSystemTreeCoralwood.

Definition at line 283 of file GrowSystem.cs.

284 {
285 }

Referenced by Map.SetObj().

◆ OnSetStage()

virtual void GrowSystem.OnSetStage ( int  idx)
inlinevirtual

Definition at line 470 of file GrowSystem.cs.

471 {
472 }

Referenced by SetStage().

◆ Perish()

void GrowSystem.Perish ( )
inline

Definition at line 479 of file GrowSystem.cs.

480 {
482 {
483 if (CanHarvest())
484 {
485 PopHarvest(null);
486 }
487 Thing thing = TryPopSeed(null);
488 if (thing != null)
489 {
491 }
493 return;
494 }
496 {
498 return;
499 }
500 if (EClass.rnd(3) == 0)
501 {
502 Thing thing2 = TryPopSeed(null);
503 if (thing2 != null)
504 {
506 }
507 }
509 }
static int rnd(long a)
Definition: EClass.cs:59
void SetObj(int x, int z, int id=0, int value=1, int dir=0)
Definition: Map.cs:1535

References EClass._map, EClass._zone, Zone.AddCard(), CanHarvest(), cell, Cell.GetPoint(), GrowSystem.Stage.idx, Card.Install(), Player.isAutoFarming, EClass.player, PopHarvest(), EClass.rnd(), Map.SetObj(), SetStage(), stage, StageLength, TryPopSeed(), WitherOnLastStage, Cell.x, and Cell.z.

◆ PopHarvest() [1/2]

void GrowSystem.PopHarvest ( Chara  c,
string  idThing,
int  num = -1 
)
inline

◆ PopHarvest() [2/2]

void GrowSystem.PopHarvest ( Chara  c,
Thing  t = null,
int  num = -1 
)
inline

Definition at line 649 of file GrowSystem.cs.

650 {
651 if (t == null)
652 {
653 if (idHarvestThing.StartsWith('#'))
654 {
655 t = ThingGen.CreateFromCategory(idHarvestThing.Replace("#", ""));
656 }
657 else
658 {
659 string text = idHarvestThing;
660 if (text == "potato" && EClass.rnd(3) == 0)
661 {
662 text = "784";
663 }
664 t = ThingGen.Create(text.IsEmpty("apple"));
665 }
666 }
667 ApplySeed(t);
668 PlantData plantData = EClass._map.TryGetPlant(cell);
669 bool flag = false;
670 if (plantData != null && plantData.size > 0)
671 {
672 t.c_weight = t.SelfWeight * (80 + plantData.size * plantData.size * 100) / 100;
673 t.SetBool(115, enable: true);
674 t.isWeightChanged = true;
675 flag = true;
676 }
678 if (source._growth.Length > 4)
679 {
680 int num2 = EClass.rnd(source._growth[4].ToInt()) + 1;
681 int soilCost = EClass._zone.GetSoilCost();
682 int maxSoil = EClass._zone.MaxSoil;
683 if (soilCost > maxSoil && EClass.player.stats.days >= 5)
684 {
685 num2 -= EClass.rnd(2 + (soilCost - maxSoil) / 20);
686 }
687 if (num2 <= 0)
688 {
690 {
691 c?.Say("cropSpoiled", c, cell.GetObjName());
692 }
693 return;
694 }
695 t.SetNum(num2);
696 }
697 else if (Application.isEditor)
698 {
699 Debug.Log("harvest count not set:" + source.id + "/" + source.alias);
700 }
701 if (num > 0)
702 {
703 t.SetNum(num);
704 }
705 int num3 = t.Num;
706 TryPick(cell, t, c);
707 if (flag)
708 {
709 c.ModExpParty(207, Mathf.Min(t.c_weight * num3 / 125, 500));
710 }
711 }
BlessedState
Definition: BlessedState.cs:2
void SetBool(int id, bool enable)
Definition: BaseCard.cs:20
int c_weight
Definition: Card.cs:1403
Thing SetNum(int a)
Definition: Card.cs:3577
virtual void SetBlessedState(BlessedState s)
Definition: Card.cs:3977
void ModExpParty(int ele, int a)
Definition: Card.cs:2701
int Num
Definition: Card.cs:159
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:7052
string GetObjName()
Definition: Cell.cs:1604
void ApplySeed(Thing t)
Definition: GrowSystem.cs:713
int size
Definition: PlantData.cs:15
int days
Definition: Player.cs:75
Stats stats
Definition: Player.cs:1071
static Thing CreateFromCategory(string idCat, int lv=-1)
Definition: ThingGen.cs:75
virtual int MaxSoil
Definition: Zone.cs:518
int GetSoilCost()
Definition: Zone.cs:3813

References EClass._map, EClass._zone, ApplySeed(), cell, ThingGen.Create(), ThingGen.CreateFromCategory(), Player.Stats.days, Debug, Cell.GetObjName(), Zone.GetSoilCost(), idHarvestThing, Player.isAutoFarming, Zone.MaxSoil, Card.ModExpParty(), EClass.player, EClass.rnd(), Card.Say(), PlantData.size, source, Player.stats, Map.TryGetPlant(), and TryPick().

◆ PopMineObj()

void GrowSystem.PopMineObj ( Chara  c = null)
inline

Definition at line 547 of file GrowSystem.cs.

548 {
550 {
551 OnMineObj(c);
552 TryPopSeed(c);
553 }
554 }
static Game game
Definition: EClass.cs:9
bool disableUsermapBenefit
GamePrincipal principal
Definition: Game.cs:225
virtual void OnMineObj(Chara c=null)
Definition: GrowSystem.cs:556

References EClass._zone, GamePrincipal.disableUsermapBenefit, EClass.game, Zone.IsUserZone, OnMineObj(), Game.principal, and TryPopSeed().

Referenced by Grow(), and Map.MineObj().

◆ SetDefaultStage()

void GrowSystem.SetDefaultStage ( )
inline

Definition at line 278 of file GrowSystem.cs.

279 {
280 cell.objVal = (byte)(DefaultStage * 30);
281 }
virtual int DefaultStage
Definition: GrowSystem.cs:81

References DefaultStage.

Referenced by Recipe.Build().

◆ SetGenericFirstStageTile()

virtual void GrowSystem.SetGenericFirstStageTile ( Stage  s)
inlinevirtual

Reimplemented in GrowSystemTree.

Definition at line 185 of file GrowSystem.cs.

186 {
187 s.renderData = EClass.core.refs.renderers.objS_flat;
188 s.SetTile(0, 100, 101, 102);
189 }
RenderData objS_flat
Definition: CoreRef.cs:304
Renderers renderers
Definition: CoreRef.cs:357
CoreRef refs
Definition: Core.cs:51
static Core core
Definition: EClass.cs:7

References EClass.core, CoreRef.Renderers.objS_flat, Core.refs, CoreRef.renderers, and GrowSystem.Stage.SetTile().

Referenced by Init().

◆ SetRandomStage()

void GrowSystem.SetRandomStage ( )
inline

Definition at line 264 of file GrowSystem.cs.

265 {
266 int num = Rand.rnd(stages.Length);
267 if (num == 0 && EClass.rnd(5) != 0 && stages.Length >= 2)
268 {
269 num++;
270 }
271 else if (num == stages.Length - 1 && EClass.rnd(5) != 0 && stages.Length >= 2)
272 {
273 num--;
274 }
275 cell.objVal = (byte)(num * 30);
276 }

References Rand.rnd(), EClass.rnd(), and stages.

Referenced by BiomeProfile.ClusterObj.TryCreate().

◆ SetStage()

void GrowSystem.SetStage ( int  idx,
bool  renewHarvest = false 
)
inline

Definition at line 451 of file GrowSystem.cs.

452 {
453 cell.objVal = (byte)(idx * 30);
454 cell.gatherCount = 0;
455 if (cell.HasLiquid)
456 {
457 cell.isWatered = true;
458 }
459 if (renewHarvest)
460 {
461 cell.isHarvested = true;
462 }
463 if (cell.sourceObj.id == 118)
464 {
465 EClass._zone.dirtyElectricity = true;
466 }
467 OnSetStage(idx);
468 }
virtual void OnSetStage(int idx)
Definition: GrowSystem.cs:470

References cell, Cell.HasLiquid, OnSetStage(), and Cell.sourceObj.

Referenced by Zone.Generate(), GrowSystemDeco.OnExceedLastStage(), GrowSystemKinoko.OnExceedLastStage(), OnReachNextStage(), and Perish().

◆ SetStageTile()

virtual void GrowSystem.SetStageTile ( Stage  s)
inlinevirtual

Reimplemented in GrowSystemTree, and GrowSystemTreeSingle.

Definition at line 191 of file GrowSystem.cs.

192 {
193 s.renderData = source.renderData;
194 s.SetTile(s.idx + (UseGenericFirstStageTile ? (-1) : 0), baseTiles);
195 }

References baseTiles, GrowSystem.Stage.idx, GrowSystem.Stage.SetTile(), source, and UseGenericFirstStageTile.

Referenced by Init().

◆ TryGrow()

void GrowSystem.TryGrow ( VirtualDate  date)
inline

Definition at line 326 of file GrowSystem.cs.

327 {
328 if (CanGrow(date))
329 {
330 Grow();
331 }
332 }
void Grow(int mtp=1)
Definition: GrowSystem.cs:359
bool CanGrow(VirtualDate date)
Definition: GrowSystem.cs:287

References CanGrow(), and Grow().

Referenced by TraitFertilizer.OnSimulateHour(), and Cell.TryGrow().

◆ TryPick() [1/2]

void GrowSystem.TryPick ( Cell  cell,
string  idThing,
int  idMat = -1,
int  num = 1,
bool  applySeed = false 
)
inline

Definition at line 596 of file GrowSystem.cs.

597 {
598 if (num > 0)
599 {
600 TryPick(cell, ThingGen.Create(idThing, idMat).SetNum(num), EClass.pc, applySeed);
601 }
602 }
static Chara pc
Definition: EClass.cs:15

References cell, ThingGen.Create(), EClass.pc, Card.SetNum(), and TryPick().

◆ TryPick() [2/2]

void GrowSystem.TryPick ( Cell  cell,
Thing  t,
Chara  c,
bool  applySeed = false 
)
inline

Definition at line 566 of file GrowSystem.cs.

567 {
568 if (applySeed)
569 {
570 ApplySeed(t);
571 }
573 {
574 if (EClass.rnd(4) != 0)
575 {
576 if (t.Num > 1)
577 {
578 t.SetNum(t.Num / 2);
579 }
580 else if (EClass.rnd(2) == 0)
581 {
582 return;
583 }
585 {
587 }
588 }
589 }
590 else
591 {
593 }
594 }
Thing container_shipping
Definition: CardManager.cs:52
Card AddCard(Card c)
Definition: Card.cs:3166
CardManager cards
Definition: Game.cs:156
void TrySmoothPick(Cell cell, Thing t, Chara c)
Definition: Map.cs:1804
bool TryAddThingInSharedContainer(Thing t, List< Thing > containers=null, bool add=true, bool msg=false, Chara chara=null, bool sharedOnly=true)
Definition: Zone.cs:2160

References EClass._map, EClass._zone, Card.AddCard(), ApplySeed(), Game.cards, cell, CardManager.container_shipping, EClass.game, Player.isAutoFarming, Card.Num, EClass.player, EClass.rnd(), Card.SetNum(), Zone.TryAddThingInSharedContainer(), and Map.TrySmoothPick().

Referenced by OnMineObj(), GrowSystemBerry.OnMineObj(), GrowSystemCactus.OnMineObj(), GrowSystemCrop.OnMineObj(), GrowSystemFlower.OnMineObj(), GrowSystemHerb.OnMineObj(), GrowSystemPlant.OnMineObj(), GrowSystemTree.OnMineObj(), GrowSystemWheat.OnMineObj(), PopHarvest(), TryPick(), and TryPopSeed().

◆ TryPopSeed()

Thing GrowSystem.TryPopSeed ( Chara  c)
inline

Definition at line 604 of file GrowSystem.cs.

605 {
606 if (source.HasTag(CTAG.seed))
607 {
608 int num = (cell.IsFarmField ? 400 : 1000);
609 int soilCost = EClass._zone.GetSoilCost();
610 int maxSoil = EClass._zone.MaxSoil;
611 if (soilCost > maxSoil)
612 {
613 num += (soilCost - maxSoil) * 10;
614 }
615 if (IsWithered())
616 {
617 num /= 5;
618 }
620 {
621 return null;
622 }
623 if (EClass.player.isAutoFarming || EClass.rnd(num) < EClass.rnd(source.chance))
624 {
627 {
628 return thing;
629 }
630 TryPick(cell, thing, c);
631 return thing;
632 }
633 }
634 return null;
635 }
CTAG
Definition: CTAG.cs:2
static Thing MakeSeed(string id, PlantData plant=null)
Definition: TraitSeed.cs:88

References EClass._map, EClass._zone, cell, GamePrincipal.disableUsermapBenefit, EClass.game, Zone.GetSoilCost(), Player.isAutoFarming, Zone.IsUserZone, IsWithered(), TraitSeed.MakeSeed(), Zone.MaxSoil, EClass.player, Game.principal, EClass.rnd(), source, Map.TryGetPlant(), and TryPick().

Referenced by Grow(), Perish(), and PopMineObj().

Member Data Documentation

◆ _sourceSnowTree

SourceObj.Row [] GrowSystem._sourceSnowTree
staticprivate

Definition at line 37 of file GrowSystem.cs.

◆ afterHarvestTile

int GrowSystem.afterHarvestTile

Definition at line 53 of file GrowSystem.cs.

Referenced by OnRenderTileMap().

◆ baseTiles

int [] GrowSystem.baseTiles

◆ cell

◆ currentStage

Stage GrowSystem.currentStage
static

Definition at line 43 of file GrowSystem.cs.

Referenced by GetStageTile(), GrowSystemWheat.GetStageTile(), and OnRenderTileMap().

◆ DivStage

const int GrowSystem.DivStage = 30
static

Definition at line 39 of file GrowSystem.cs.

◆ harvestTile

int GrowSystem.harvestTile

Definition at line 51 of file GrowSystem.cs.

Referenced by GrowSystemWheat.GetStageTile(), Init(), and OnRenderTileMap().

◆ idHarvestThing

string GrowSystem.idHarvestThing

◆ source

◆ stages

Stage [] GrowSystem.stages

Definition at line 47 of file GrowSystem.cs.

Referenced by Init(), OnExceedLastStage(), OnRenderTileMap(), and SetRandomStage().

Property Documentation

◆ AnimeProgress

virtual AnimeID GrowSystem.AnimeProgress
get

Definition at line 113 of file GrowSystem.cs.

Referenced by TaskHarvest.OnCreateProgress().

◆ AutoMineStage

virtual int GrowSystem.AutoMineStage
get

Definition at line 85 of file GrowSystem.cs.

Referenced by Grow().

◆ CanLevelSeed

virtual bool GrowSystem.CanLevelSeed
get

Definition at line 97 of file GrowSystem.cs.

◆ CanRegrow

virtual bool GrowSystem.CanRegrow
getprotected

Definition at line 95 of file GrowSystem.cs.

Referenced by OnExceedLastStage().

◆ DefaultStage

virtual int GrowSystem.DefaultStage
get

Definition at line 81 of file GrowSystem.cs.

Referenced by SetDefaultStage().

◆ DrawHarvestOnTop

virtual bool GrowSystem.DrawHarvestOnTop
getprotected

Definition at line 89 of file GrowSystem.cs.

Referenced by OnRenderTileMap().

◆ GrowOnLand

virtual bool GrowSystem.GrowOnLand
get

Definition at line 109 of file GrowSystem.cs.

Referenced by CanGrow().

◆ GrowUndersea

virtual bool GrowSystem.GrowUndersea
get

Definition at line 111 of file GrowSystem.cs.

Referenced by CanGrow().

◆ HaltStage

virtual int GrowSystem.HaltStage
getprotected

Definition at line 87 of file GrowSystem.cs.

◆ HarvestStage

virtual int GrowSystem.HarvestStage
get

Definition at line 83 of file GrowSystem.cs.

Referenced by Grow(), HaltGrowth(), and IsHarvestStage().

◆ IsCrimeToHarvest

virtual bool GrowSystem.IsCrimeToHarvest
get

Definition at line 103 of file GrowSystem.cs.

◆ IsMature

virtual bool GrowSystem.IsMature
get

◆ IsTree

◆ MtpProgress

virtual float GrowSystem.MtpProgress
get

Definition at line 105 of file GrowSystem.cs.

◆ NeedSunlight

virtual bool GrowSystem.NeedSunlight
get

Definition at line 107 of file GrowSystem.cs.

Referenced by CanGrow(), and Zone.GrowPlants().

◆ RenderHarvest

virtual RenderData GrowSystem.RenderHarvest
get

Definition at line 75 of file GrowSystem.cs.

Referenced by Init(), and OnRenderTileMap().

◆ ShadowStage

virtual int GrowSystem.ShadowStage
get

Definition at line 99 of file GrowSystem.cs.

Referenced by OnRenderTileMap().

◆ SourceSnowTree

SourceObj.Row [] GrowSystem.SourceSnowTree
staticget

Definition at line 57 of file GrowSystem.cs.

58 {
59 get
60 {
61 object obj = _sourceSnowTree;
62 if (obj == null)
63 {
64 obj = new SourceObj.Row[2]
65 {
66 EClass.sources.objs.map[54],
67 EClass.sources.objs.map[55]
68 };
70 }
71 return (SourceObj.Row[])obj;
72 }
73 }
static SourceManager sources
Definition: EClass.cs:43
static SourceObj.Row[] _sourceSnowTree
Definition: GrowSystem.cs:37
SourceObj objs

◆ stage

Stage GrowSystem.stage
get

Definition at line 115 of file GrowSystem.cs.

Referenced by CanHarvest(), Zone.GrowPlants(), Init(), IsWithered(), and Perish().

◆ StageLength

virtual int GrowSystem.StageLength
get

◆ Step

virtual int GrowSystem.Step
get

Definition at line 77 of file GrowSystem.cs.

Referenced by Grow().

◆ UseGenericFirstStageTile

virtual bool GrowSystem.UseGenericFirstStageTile
getprotected

Definition at line 91 of file GrowSystem.cs.

Referenced by Init(), OnRenderTileMap(), and SetStageTile().

◆ WitherOnLastStage

virtual bool GrowSystem.WitherOnLastStage
getprotected

Definition at line 93 of file GrowSystem.cs.

Referenced by IsWithered(), and Perish().


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