Elin Decompiled Documentation EA 23.153 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 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)
 
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

static SourceObj.Row[] sourceSnowTree
 
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

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]
 

Additional Inherited Members

- Static Public Member Functions inherited from EClass
static int rndSeed (int a, int seed)
 
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)
 

Detailed Description

Definition at line 3 of file GrowSystem.cs.

Member Function Documentation

◆ ApplySeed()

void GrowSystem.ApplySeed ( Thing  t)
inline

Definition at line 694 of file GrowSystem.cs.

695 {
698 {
699 thing = null;
700 }
701 if (thing == null)
702 {
703 return;
704 }
705 int encLv = thing.encLV / 10 + ((thing.encLV > 0) ? 1 : 0);
706 bool flag = t.IsFood || t.Evalue(10) > 0 || t.id == "grass";
707 foreach (Element value in thing.elements.dict.Values)
708 {
709 if ((!value.IsFoodTrait || flag) && (value.IsFoodTrait || value.id == 2))
710 {
711 t.elements.ModBase(value.id, value.Value / 10 * 10);
712 }
713 }
714 t.SetEncLv(encLv);
715 t.c_refText = thing.c_refText;
716 t.isCrafted = true;
717 }
ElementContainerCard elements
Definition: Card.cs:37
string c_refText
Definition: Card.cs:1589
void SetEncLv(int a)
Definition: Card.cs:3709
int Evalue(int ele)
Definition: Card.cs:2507
Definition: EClass.cs:5
static Zone _zone
Definition: EClass.cs:20
static Map _map
Definition: EClass.cs:18
Dictionary< int, Element > dict
Element ModBase(int ele, int v)
int id
Definition: ELEMENT.cs:248
int Value
Definition: ELEMENT.cs:290
bool IsFoodTrait
Definition: ELEMENT.cs:362
static Cell cell
Definition: GrowSystem.cs:45
PlantData TryGetPlant(Point p)
Definition: Map.cs:1920
Thing seed
Definition: PlantData.cs:6
Definition: Thing.cs:8
virtual bool IsUserZone
Definition: Zone.cs:266

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 120 of file GrowSystem.cs.

121 {
122 return false;
123 }

◆ BlockSight()

virtual bool GrowSystem.BlockSight ( Cell  cell)
inlinevirtual

Reimplemented in GrowSystemTree, and GrowSystemTreeCoralwood.

Definition at line 115 of file GrowSystem.cs.

116 {
117 return false;
118 }

Referenced by Cell.Refresh().

◆ CanGrow()

bool GrowSystem.CanGrow ( VirtualDate  date)
inline

Definition at line 268 of file GrowSystem.cs.

269 {
270 if (source.id == 0)
271 {
272 return false;
273 }
274 if (cell.HasBlock && !cell.sourceBlock.tileType.IsFence)
275 {
276 return false;
277 }
278 if (GrowUndersea)
279 {
280 if (EClass._zone.IsUnderwater || cell.sourceFloor.tileType.IsDeepWater)
281 {
282 return true;
283 }
284 }
285 else if (EClass._zone.IsUnderwater)
286 {
287 return false;
288 }
289 if (!GrowOnLand)
290 {
291 return false;
292 }
293 if (NeedSunlight)
294 {
295 if (date.sunMap == null)
296 {
297 date.BuildSunMap();
298 }
299 if ((cell.HasRoof || date.IsWinter || EClass._map.IsIndoor) && !date.sunMap.Contains(cell.index))
300 {
301 return false;
302 }
303 }
304 return true;
305 }
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:186
SourceObj.Row source
Definition: GrowSystem.cs:49
virtual bool GrowOnLand
Definition: GrowSystem.cs:95
virtual bool NeedSunlight
Definition: GrowSystem.cs:93
virtual bool GrowUndersea
Definition: GrowSystem.cs:97
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:264

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 501 of file GrowSystem.cs.

502 {
504 {
505 return false;
506 }
507 return true;
508 }
bool isHarvested
Definition: Cell.cs:330
Stage stage
Definition: GrowSystem.cs:101

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 510 of file GrowSystem.cs.

511 {
512 return CanHarvest();
513 }
bool CanHarvest()
Definition: GrowSystem.cs:501

References CanHarvest().

Referenced by Cell.CanReapSeed().

◆ CreateStage()

virtual Stage GrowSystem.CreateStage ( )
inlinevirtual

Definition at line 130 of file GrowSystem.cs.

131 {
132 return new Stage();
133 }

Referenced by Init().

◆ EqualizePlants()

void GrowSystem.EqualizePlants ( Point  pos)
inline

Definition at line 315 of file GrowSystem.cs.

316 {
318 if (p1 == null || p1.seed == null)
319 {
320 return;
321 }
322 pos.ForeachNeighbor(delegate(Point pos2)
323 {
324 Thing thing = EClass._map.TryGetPlant(pos2)?.seed;
325 if (thing == null)
326 {
328 if (installed != null && installed.id == p1.seed.id)
329 {
330 thing = installed;
331 }
332 }
333 if (thing != null && p1.seed.refVal == thing.refVal && thing.encLV >= p1.seed.encLV)
334 {
335 p1.seed = thing;
336 }
337 }, diagonal: false);
338 }
@ seed
string id
Definition: Card.cs:31
int refVal
Definition: Card.cs:190
int encLV
Definition: Card.cs:310
Definition: Point.cs:9
Thing Installed
Definition: Point.cs:315
void ForeachNeighbor(Action< Point > action, bool diagonal=true)
Definition: Point.cs:1377

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 719 of file GrowSystem.cs.

720 {
721 return source.hp;
722 }

References source.

◆ GetShadow()

virtual int GrowSystem.GetShadow ( int  index)
inlinevirtual

Reimplemented in GrowSystemTree, GrowSystemTreeCoralwood, and GrowSystemTreeSingle.

Definition at line 188 of file GrowSystem.cs.

189 {
190 return -1;
191 }

Referenced by OnRenderTileMap().

◆ GetSoundProgress()

virtual string GrowSystem.GetSoundProgress ( )
inlinevirtual

Reimplemented in GrowSystemWheat.

Definition at line 125 of file GrowSystem.cs.

126 {
127 return "Material/grass";
128 }

Referenced by TaskHarvest.OnCreateProgress().

◆ GetStageTile()

virtual int GrowSystem.GetStageTile ( )
inlinevirtual

Reimplemented in GrowSystemDeco, GrowSystemTreeCoralwood, and GrowSystemWheat.

Definition at line 183 of file GrowSystem.cs.

184 {
185 return currentStage.tiles[cell.objDir % currentStage.tiles.Length];
186 }
static Stage currentStage
Definition: GrowSystem.cs:47

References currentStage, and GrowSystem.Stage.tiles.

Referenced by OnRenderTileMap().

◆ Grow()

void GrowSystem.Grow ( int  mtp = 1)
inline

Definition at line 340 of file GrowSystem.cs.

341 {
342 bool flag = cell.isWatered || (cell.IsTopWater && (source.tag.Contains("flood") || source.tag.Contains("undersea")));
343 PlantData plantData = EClass._map.TryGetPlant(cell);
344 if (plantData != null && flag)
345 {
346 plantData.water++;
347 }
348 int num = Step * mtp * ((!flag) ? 1 : 2);
349 int num2 = cell.objVal / 30;
350 int num3 = (cell.objVal + num) / 30;
351 if (num2 != num3)
352 {
354 {
355 PopHarvest(null);
356 }
358 {
359 Point point = cell.GetPoint();
360 EqualizePlants(point);
361 Thing thing = TryPopSeed(null);
362 PopMineObj();
363 if (thing != null)
364 {
365 point.SetObj();
366 EClass._zone.AddCard(thing, point).Install();
367 }
368 }
369 else if (num2 == StageLength - 1)
370 {
372 {
373 Point point2 = cell.GetPoint();
374 EqualizePlants(point2);
375 Thing thing2 = TryPopSeed(null);
376 if (thing2 != null)
377 {
378 point2.SetObj();
379 EClass._zone.AddCard(thing2, point2).Install();
380 }
381 }
382 else
383 {
385 }
386 }
387 else
388 {
390 }
391 }
392 else
393 {
394 cell.objVal += (byte)num;
395 }
396 cell.Refresh();
398 }
Card Install()
Definition: Card.cs:3590
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:12
virtual int StageLength
Definition: GrowSystem.cs:65
virtual void OnReachNextStage()
Definition: GrowSystem.cs:400
virtual int AutoMineStage
Definition: GrowSystem.cs:71
virtual int HarvestStage
Definition: GrowSystem.cs:69
void PopMineObj(Chara c=null)
Definition: GrowSystem.cs:528
void EqualizePlants(Point pos)
Definition: GrowSystem.cs:315
virtual int Step
Definition: GrowSystem.cs:63
virtual void OnExceedLastStage()
Definition: GrowSystem.cs:405
void PopHarvest(Chara c, string idThing, int num=-1)
Definition: GrowSystem.cs:625
Thing TryPopSeed(Chara c)
Definition: GrowSystem.cs:585
void RefreshFOV(int x, int z, int radius=6, bool recalculate=false)
Definition: Map.cs:923
int water
Definition: PlantData.cs:9
bool isAutoFarming
Definition: Player.cs:997
void SetObj(int id=0, int value=1, int dir=0)
Definition: Point.cs:908
Card AddCard(Card t, Point point)
Definition: Zone.cs:1910

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 455 of file GrowSystem.cs.

456 {
457 return stage.idx == HarvestStage;
458 }

References HarvestStage.

◆ Harvest()

void GrowSystem.Harvest ( Chara  c)
inline

Definition at line 618 of file GrowSystem.cs.

619 {
620 cell.isHarvested = true;
621 cell.gatherCount = 0;
622 PopHarvest(c);
623 }

References PopHarvest().

Referenced by TaskHarvest.OnCreateProgress().

◆ Init()

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

Definition at line 135 of file GrowSystem.cs.

136 {
137 source = _row;
138 stages = new Stage[StageLength];
139 string[] growth = _row._growth;
140 string[] array = growth[1].Split('/');
141 baseTiles = new int[array.Length];
142 for (int i = 0; i < array.Length; i++)
143 {
144 baseTiles[i] = array[i].ToInt();
145 }
146 if (growth.Length > 2)
147 {
148 harvestTile = RenderHarvest.ConvertTile(growth[2].ToInt());
149 idHarvestThing = growth[3];
150 }
151 for (int j = 0; j < StageLength; j++)
152 {
153 Stage stage = CreateStage();
154 stages[j] = stage;
155 stage.idx = j;
156 if (j == 0 && UseGenericFirstStageTile)
157 {
159 }
160 else
161 {
163 }
164 if (harvestTile != 0 && IsHarvestStage(j))
165 {
166 stage.harvest = true;
167 }
168 }
169 }
virtual bool IsHarvestStage(int idx)
Definition: GrowSystem.cs:110
int[] baseTiles
Definition: GrowSystem.cs:53
string idHarvestThing
Definition: GrowSystem.cs:59
virtual RenderData RenderHarvest
Definition: GrowSystem.cs:61
virtual Stage CreateStage()
Definition: GrowSystem.cs:130
virtual void SetStageTile(Stage s)
Definition: GrowSystem.cs:177
virtual bool UseGenericFirstStageTile
Definition: GrowSystem.cs:77
Stage[] stages
Definition: GrowSystem.cs:51
virtual void SetGenericFirstStageTile(Stage s)
Definition: GrowSystem.cs:171
int harvestTile
Definition: GrowSystem.cs:55
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 110 of file GrowSystem.cs.

111 {
112 return idx == HarvestStage;
113 }

References HarvestStage.

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

◆ IsLastStage()

bool GrowSystem.IsLastStage ( )
inline

Definition at line 105 of file GrowSystem.cs.

106 {
107 return stage.idx == StageLength - 1;
108 }

References StageLength.

Referenced by Cell.CanMakeStraw().

◆ IsWithered()

bool GrowSystem.IsWithered ( )
inline

Definition at line 492 of file GrowSystem.cs.

493 {
495 {
496 return true;
497 }
498 return false;
499 }
virtual bool WitherOnLastStage
Definition: GrowSystem.cs:79

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 405 of file GrowSystem.cs.

406 {
407 cell.objVal = (byte)(stages.Length * 30 - 1);
408 if (!CanRegrow || Rand.rnd(2) != 0)
409 {
410 return;
411 }
412 Point point = cell.GetPoint();
413 if (point.IsFarmField)
414 {
415 return;
416 }
417 if (Rand.rnd(2) == 0)
418 {
419 Point randomNeighbor = point.GetRandomNeighbor();
420 if (randomNeighbor.cell.CanGrowWeed)
421 {
422 randomNeighbor.SetObj(cell.obj);
423 point.SetObj();
424 return;
425 }
426 }
427 cell.objVal = 0;
428 cell.isHarvested = false;
429 cell.isWatered = cell.HasLiquid;
430 }
bool HasLiquid
Definition: Cell.cs:673
byte obj
Definition: Cell.cs:38
bool CanGrowWeed
Definition: Cell.cs:742
virtual bool CanRegrow
Definition: GrowSystem.cs:81
bool IsFarmField
Definition: Point.cs:127
Cell cell
Definition: Point.cs:51
Point GetRandomNeighbor()
Definition: Point.cs:743
Definition: Rand.cs:4
static int rnd(int max)
Definition: Rand.cs:52

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 515 of file GrowSystem.cs.

516 {
517 }

◆ OnHitFail()

virtual void GrowSystem.OnHitFail ( Chara  c)
inlinevirtual

Reimplemented in GrowSystemTree.

Definition at line 519 of file GrowSystem.cs.

520 {
521 }

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 537 of file GrowSystem.cs.

538 {
539 if (!IsWithered())
540 {
541 int num = cell.sourceObj.components.Length - 1;
542 Thing t = ThingGen.Create(cell.sourceObj.components[num].Split('/')[0], cell.matObj_fixed.alias);
543 TryPick(cell, t, c);
544 }
545 }
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:547
bool IsWithered()
Definition: GrowSystem.cs:492
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 523 of file GrowSystem.cs.

524 {
525 EClass._map.MineObj(cell.GetPoint(), null, c);
526 }
void MineObj(Point point, Task task=null, Chara c=null)
Definition: Map.cs:1827

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

Referenced by TaskHarvest.OnCreateProgress().

◆ OnReachNextStage()

virtual void GrowSystem.OnReachNextStage ( )
inlinevirtual

Definition at line 400 of file GrowSystem.cs.

401 {
402 SetStage(cell.objVal / 30 + 1);
403 }
byte objVal
Definition: Cell.cs:40
void SetStage(int idx, bool renewHarvest=false)
Definition: GrowSystem.cs:432

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

Referenced by Grow().

◆ OnRenderTileMap()

virtual void GrowSystem.OnRenderTileMap ( RenderParam  p)
inlinevirtual

Definition at line 193 of file GrowSystem.cs.

194 {
195 int num = cell.objVal / 30;
196 currentStage = stages[num];
197 SourceObj.Row row = source;
198 float y = p.y;
199 float z = p.z;
200 if (num != 0 || !UseGenericFirstStageTile)
201 {
202 p.y += row.pref.y;
203 p.z += row.pref.z;
204 }
206 {
207 if (cell.isHarvested || harvestTile == 0)
208 {
209 p.tile = ((afterHarvestTile != 0) ? afterHarvestTile : GetStageTile());
211 }
212 else
213 {
215 {
216 p.tile = GetStageTile();
218 p.liquidLv = 0;
219 }
220 p.tile = harvestTile;
222 }
223 }
224 else
225 {
226 p.tile = GetStageTile();
228 }
229 p.y = y;
230 p.z = z;
231 if (num >= ShadowStage)
232 {
233 int shadow = GetShadow(num);
234 if (shadow == -1)
235 {
236 shadow = row.pref.shadow;
237 }
238 if (shadow > 1 && !cell.ignoreObjShadow)
239 {
241 }
242 }
243 }
BaseTileMap tileMap
MeshPass passShadow
Definition: BaseTileMap.cs:133
bool ignoreObjShadow
Definition: Cell.cs:378
static BaseGameScreen screen
Definition: EClass.cs:32
RenderData renderData
Definition: GrowSystem.cs:13
virtual int GetStageTile()
Definition: GrowSystem.cs:183
int afterHarvestTile
Definition: GrowSystem.cs:57
virtual int GetShadow(int index)
Definition: GrowSystem.cs:188
virtual bool DrawHarvestOnTop
Definition: GrowSystem.cs:75
virtual int ShadowStage
Definition: GrowSystem.cs:85
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
List< Item > items
Definition: ShadowData.cs:101
static ShadowData Instance
Definition: ShadowData.cs:99
int shadow
Definition: SourcePref.cs:35

References MeshPass.AddShadow(), afterHarvestTile, cell, currentStage, RenderData.Draw(), DrawHarvestOnTop, GetShadow(), GetStageTile(), GrowSystem.Stage.harvest, harvestTile, Cell.ignoreObjShadow, ShadowData.Instance, Cell.isHarvested, ShadowData.items, RenderData.offsetShadow, BaseTileMap.passShadow, RenderRow.pref, GrowSystem.Stage.renderData, RenderRow.renderData, RenderHarvest, 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 BaseTileMap.DrawTile(), and TileMapElona.DrawTile().

◆ OnSetObj()

virtual void GrowSystem.OnSetObj ( )
inlinevirtual

Reimplemented in GrowSystemTreeCoralwood.

Definition at line 264 of file GrowSystem.cs.

265 {
266 }

Referenced by Map.SetObj().

◆ OnSetStage()

virtual void GrowSystem.OnSetStage ( int  idx)
inlinevirtual

Definition at line 451 of file GrowSystem.cs.

452 {
453 }

Referenced by SetStage().

◆ Perish()

void GrowSystem.Perish ( )
inline

Definition at line 460 of file GrowSystem.cs.

461 {
463 {
464 if (CanHarvest())
465 {
466 PopHarvest(null);
467 }
468 Thing thing = TryPopSeed(null);
469 if (thing != null)
470 {
472 }
474 return;
475 }
477 {
479 return;
480 }
481 if (EClass.rnd(3) == 0)
482 {
483 Thing thing2 = TryPopSeed(null);
484 if (thing2 != null)
485 {
487 }
488 }
490 }
static int rnd(int a)
Definition: EClass.cs:58
void SetObj(int x, int z, int id=0, int value=1, int dir=0)
Definition: Map.cs:1522

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 630 of file GrowSystem.cs.

631 {
632 if (t == null)
633 {
634 if (idHarvestThing.StartsWith('#'))
635 {
636 t = ThingGen.CreateFromCategory(idHarvestThing.Replace("#", ""));
637 }
638 else
639 {
640 string text = idHarvestThing;
641 if (text == "potato" && EClass.rnd(3) == 0)
642 {
643 text = "784";
644 }
645 t = ThingGen.Create(text.IsEmpty("apple"));
646 }
647 }
648 ApplySeed(t);
649 PlantData plantData = EClass._map.TryGetPlant(cell);
650 if (plantData != null && plantData.size > 0)
651 {
652 t.c_weight = t.SelfWeight * (80 + plantData.size * plantData.size * 100) / 100;
653 t.SetBool(115, enable: true);
654 t.isWeightChanged = true;
655 }
657 if (source._growth.Length > 4)
658 {
659 int num2 = EClass.rnd(source._growth[4].ToInt()) + 1;
660 int soilCost = EClass._zone.GetSoilCost();
661 int maxSoil = EClass._zone.MaxSoil;
662 if (soilCost > maxSoil && EClass.player.stats.days >= 5)
663 {
664 num2 -= EClass.rnd(2 + (soilCost - maxSoil) / 20);
665 }
666 if (num2 <= 0)
667 {
669 {
670 c?.Say("cropSpoiled", c, cell.GetObjName());
671 }
672 return;
673 }
674 t.SetNum(num2);
675 }
676 else if (Application.isEditor)
677 {
678 Debug.Log("harvest count not set:" + source.id + "/" + source.alias);
679 }
680 if (num > 0)
681 {
682 t.SetNum(num);
683 }
684 if (c == null || EClass.player.isAutoFarming)
685 {
686 TryPick(cell, t, c);
687 }
688 else
689 {
690 c.Pick(t);
691 }
692 }
BlessedState
Definition: BlessedState.cs:2
void SetBool(int id, bool enable)
Definition: BaseCard.cs:20
Thing SetNum(int a)
Definition: Card.cs:3356
virtual void SetBlessedState(BlessedState s)
Definition: Card.cs:3740
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6423
string GetObjName()
Definition: Cell.cs:1604
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:4017
void ApplySeed(Thing t)
Definition: GrowSystem.cs:694
int size
Definition: PlantData.cs:15
int days
Definition: Player.cs:68
Stats stats
Definition: Player.cs:832
static Thing CreateFromCategory(string idCat, int lv=-1)
Definition: ThingGen.cs:75
virtual int MaxSoil
Definition: Zone.cs:509
int GetSoilCost()
Definition: Zone.cs:3537

References EClass._map, EClass._zone, ApplySeed(), cell, ThingGen.Create(), ThingGen.CreateFromCategory(), Player.Stats.days, Debug, Cell.GetObjName(), Zone.GetSoilCost(), idHarvestThing, Player.isAutoFarming, Zone.MaxSoil, Chara.Pick(), 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 528 of file GrowSystem.cs.

529 {
531 {
532 OnMineObj(c);
533 TryPopSeed(c);
534 }
535 }
static Game game
Definition: EClass.cs:8
bool disableUsermapBenefit
GamePrincipal principal
Definition: Game.cs:221
virtual void OnMineObj(Chara c=null)
Definition: GrowSystem.cs:537

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 259 of file GrowSystem.cs.

260 {
261 cell.objVal = (byte)(DefaultStage * 30);
262 }
virtual int DefaultStage
Definition: GrowSystem.cs:67

References DefaultStage.

Referenced by Recipe.Build().

◆ SetGenericFirstStageTile()

virtual void GrowSystem.SetGenericFirstStageTile ( Stage  s)
inlinevirtual

Reimplemented in GrowSystemTree.

Definition at line 171 of file GrowSystem.cs.

172 {
173 s.renderData = EClass.core.refs.renderers.objS_flat;
174 s.SetTile(0, 100, 101, 102);
175 }
RenderData objS_flat
Definition: CoreRef.cs:302
Renderers renderers
Definition: CoreRef.cs:347
CoreRef refs
Definition: Core.cs:51
static Core core
Definition: EClass.cs:6

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 245 of file GrowSystem.cs.

246 {
247 int num = Rand.rnd(stages.Length);
248 if (num == 0 && EClass.rnd(5) != 0 && stages.Length >= 2)
249 {
250 num++;
251 }
252 else if (num == stages.Length - 1 && EClass.rnd(5) != 0 && stages.Length >= 2)
253 {
254 num--;
255 }
256 cell.objVal = (byte)(num * 30);
257 }

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

Referenced by BiomeProfile.ClusterObj.TryCreate().

◆ SetStage()

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

Definition at line 432 of file GrowSystem.cs.

433 {
434 cell.objVal = (byte)(idx * 30);
435 cell.gatherCount = 0;
436 if (cell.HasLiquid)
437 {
438 cell.isWatered = true;
439 }
440 if (renewHarvest)
441 {
442 cell.isHarvested = true;
443 }
444 if (cell.sourceObj.id == 118)
445 {
446 EClass._zone.dirtyElectricity = true;
447 }
448 OnSetStage(idx);
449 }
virtual void OnSetStage(int idx)
Definition: GrowSystem.cs:451

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 177 of file GrowSystem.cs.

178 {
179 s.renderData = source.renderData;
180 s.SetTile(s.idx + (UseGenericFirstStageTile ? (-1) : 0), baseTiles);
181 }

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

Referenced by Init().

◆ TryGrow()

void GrowSystem.TryGrow ( VirtualDate  date)
inline

Definition at line 307 of file GrowSystem.cs.

308 {
309 if (CanGrow(date))
310 {
311 Grow();
312 }
313 }
void Grow(int mtp=1)
Definition: GrowSystem.cs:340
bool CanGrow(VirtualDate date)
Definition: GrowSystem.cs:268

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 577 of file GrowSystem.cs.

578 {
579 if (num > 0)
580 {
581 TryPick(cell, ThingGen.Create(idThing, idMat).SetNum(num), EClass.pc, applySeed);
582 }
583 }
static Chara pc
Definition: EClass.cs:14

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 547 of file GrowSystem.cs.

548 {
549 if (applySeed)
550 {
551 ApplySeed(t);
552 }
554 {
555 if (EClass.rnd(4) != 0)
556 {
557 if (t.Num > 1)
558 {
559 t.SetNum(t.Num / 2);
560 }
561 else if (EClass.rnd(2) == 0)
562 {
563 return;
564 }
566 {
568 }
569 }
570 }
571 else
572 {
574 }
575 }
Thing container_shipping
Definition: CardManager.cs:52
Card AddCard(Card c)
Definition: Card.cs:3006
int Num
Definition: Card.cs:154
CardManager cards
Definition: Game.cs:155
void TrySmoothPick(Cell cell, Thing t, Chara c)
Definition: Map.cs:1791
bool TryAddThingInSharedContainer(Thing t, List< Thing > containers=null, bool add=true, bool msg=false, Chara chara=null, bool sharedOnly=true)
Definition: Zone.cs:2053

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 585 of file GrowSystem.cs.

586 {
587 if (source.HasTag(CTAG.seed))
588 {
589 int num = (cell.IsFarmField ? 400 : 1000);
590 int soilCost = EClass._zone.GetSoilCost();
591 int maxSoil = EClass._zone.MaxSoil;
592 if (soilCost > maxSoil)
593 {
594 num += (soilCost - maxSoil) * 10;
595 }
596 if (IsWithered())
597 {
598 num /= 5;
599 }
601 {
602 return null;
603 }
604 if (EClass.player.isAutoFarming || EClass.rnd(num) < EClass.rnd(source.chance))
605 {
608 {
609 return thing;
610 }
611 TryPick(cell, thing, c);
612 return thing;
613 }
614 }
615 return null;
616 }
CTAG
Definition: CTAG.cs:2
static Thing MakeSeed(SourceObj.Row obj, 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

◆ afterHarvestTile

int GrowSystem.afterHarvestTile

Definition at line 57 of file GrowSystem.cs.

Referenced by OnRenderTileMap().

◆ baseTiles

int [] GrowSystem.baseTiles

◆ cell

◆ currentStage

Stage GrowSystem.currentStage
static

Definition at line 47 of file GrowSystem.cs.

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

◆ DivStage

const int GrowSystem.DivStage = 30
static

Definition at line 43 of file GrowSystem.cs.

◆ harvestTile

int GrowSystem.harvestTile

Definition at line 55 of file GrowSystem.cs.

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

◆ idHarvestThing

string GrowSystem.idHarvestThing

◆ source

◆ sourceSnowTree

SourceObj.Row [] GrowSystem.sourceSnowTree
static
Initial value:
= new SourceObj.Row[2]
{
EClass.sources.objs.map[54],
}
static SourceManager sources
Definition: EClass.cs:42
SourceObj objs

Definition at line 37 of file GrowSystem.cs.

◆ stages

Stage [] GrowSystem.stages

Definition at line 51 of file GrowSystem.cs.

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

Property Documentation

◆ AnimeProgress

virtual AnimeID GrowSystem.AnimeProgress
get

Definition at line 99 of file GrowSystem.cs.

Referenced by TaskHarvest.OnCreateProgress().

◆ AutoMineStage

virtual int GrowSystem.AutoMineStage
get

Definition at line 71 of file GrowSystem.cs.

Referenced by Grow().

◆ CanLevelSeed

virtual bool GrowSystem.CanLevelSeed
get

Definition at line 83 of file GrowSystem.cs.

◆ CanRegrow

virtual bool GrowSystem.CanRegrow
getprotected

Definition at line 81 of file GrowSystem.cs.

Referenced by OnExceedLastStage().

◆ DefaultStage

virtual int GrowSystem.DefaultStage
get

Definition at line 67 of file GrowSystem.cs.

Referenced by SetDefaultStage().

◆ DrawHarvestOnTop

virtual bool GrowSystem.DrawHarvestOnTop
getprotected

Definition at line 75 of file GrowSystem.cs.

Referenced by OnRenderTileMap().

◆ GrowOnLand

virtual bool GrowSystem.GrowOnLand
get

Definition at line 95 of file GrowSystem.cs.

Referenced by CanGrow().

◆ GrowUndersea

virtual bool GrowSystem.GrowUndersea
get

Definition at line 97 of file GrowSystem.cs.

Referenced by CanGrow().

◆ HaltStage

virtual int GrowSystem.HaltStage
getprotected

Definition at line 73 of file GrowSystem.cs.

◆ HarvestStage

virtual int GrowSystem.HarvestStage
get

Definition at line 69 of file GrowSystem.cs.

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

◆ IsCrimeToHarvest

virtual bool GrowSystem.IsCrimeToHarvest
get

Definition at line 89 of file GrowSystem.cs.

◆ IsMature

virtual bool GrowSystem.IsMature
get

◆ IsTree

◆ MtpProgress

virtual float GrowSystem.MtpProgress
get

Definition at line 91 of file GrowSystem.cs.

◆ NeedSunlight

virtual bool GrowSystem.NeedSunlight
get

Definition at line 93 of file GrowSystem.cs.

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

◆ RenderHarvest

virtual RenderData GrowSystem.RenderHarvest
get

Definition at line 61 of file GrowSystem.cs.

Referenced by Init(), and OnRenderTileMap().

◆ ShadowStage

virtual int GrowSystem.ShadowStage
get

Definition at line 85 of file GrowSystem.cs.

Referenced by OnRenderTileMap().

◆ stage

Stage GrowSystem.stage
get

Definition at line 101 of file GrowSystem.cs.

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

◆ StageLength

virtual int GrowSystem.StageLength
get

Definition at line 65 of file GrowSystem.cs.

Referenced by GrowSystemWheat.GetStageTile(), Grow(), Init(), IsLastStage(), IsWithered(), and Perish().

◆ Step

virtual int GrowSystem.Step
get

Definition at line 63 of file GrowSystem.cs.

Referenced by Grow().

◆ UseGenericFirstStageTile

virtual bool GrowSystem.UseGenericFirstStageTile
getprotected

Definition at line 77 of file GrowSystem.cs.

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

◆ WitherOnLastStage

virtual bool GrowSystem.WitherOnLastStage
getprotected

Definition at line 79 of file GrowSystem.cs.

Referenced by IsWithered(), and Perish().


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