Elin Decompiled Documentation EA 23.102 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 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 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 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 663 of file GrowSystem.cs.

664 {
667 {
668 thing = null;
669 }
670 if (thing == null)
671 {
672 return;
673 }
674 int encLv = thing.encLV / 10 + ((thing.encLV > 0) ? 1 : 0);
675 bool flag = t.IsFood || t.Evalue(10) > 0 || t.id == "grass";
676 foreach (Element value in thing.elements.dict.Values)
677 {
678 if ((!value.IsFoodTrait || flag) && (value.IsFoodTrait || value.id == 2))
679 {
680 t.elements.ModBase(value.id, value.Value / 10 * 10);
681 }
682 }
683 t.SetEncLv(encLv);
684 t.c_refText = thing.c_refText;
685 t.isCrafted = true;
686 }
ElementContainerCard elements
Definition: Card.cs:37
string c_refText
Definition: Card.cs:1529
void SetEncLv(int a)
Definition: Card.cs:3567
int Evalue(int ele)
Definition: Card.cs:2431
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:240
int Value
Definition: ELEMENT.cs:282
bool IsFoodTrait
Definition: ELEMENT.cs:354
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:264

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

117 {
118 return false;
119 }

◆ BlockSight()

virtual bool GrowSystem.BlockSight ( Cell  cell)
inlinevirtual

Reimplemented in GrowSystemTree, and GrowSystemTreeCoralwood.

Definition at line 111 of file GrowSystem.cs.

112 {
113 return false;
114 }

Referenced by Cell.Refresh().

◆ CanGrow()

bool GrowSystem.CanGrow ( VirtualDate  date)
inline

Definition at line 264 of file GrowSystem.cs.

265 {
266 if (source.id == 0)
267 {
268 return false;
269 }
270 if (cell.HasBlock && !cell.sourceBlock.tileType.IsFence)
271 {
272 return false;
273 }
274 if (NeedSunlight)
275 {
276 if (date.sunMap == null)
277 {
278 date.BuildSunMap();
279 }
280 if ((cell.HasRoof || date.IsWinter || EClass._map.IsIndoor) && !date.sunMap.Contains(cell.index))
281 {
282 return false;
283 }
284 }
285 return true;
286 }
SourceBlock.Row sourceBlock
Definition: Cell.cs:1052
bool HasBlock
Definition: Cell.cs:643
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 NeedSunlight
Definition: GrowSystem.cs:93
bool IsIndoor
Definition: Map.cs:131
void BuildSunMap()
Definition: VirtualDate.cs:54
HashSet< int > sunMap
Definition: VirtualDate.cs:9

References EClass._map, VirtualDate.BuildSunMap(), cell, Cell.HasBlock, Cell.HasRoof, Cell.index, Map.IsIndoor, Date.IsWinter, NeedSunlight, source, Cell.sourceBlock, and VirtualDate.sunMap.

Referenced by TryGrow().

◆ CanHarvest()

bool GrowSystem.CanHarvest ( )
inline

Definition at line 482 of file GrowSystem.cs.

483 {
485 {
486 return false;
487 }
488 return true;
489 }
bool isHarvested
Definition: Cell.cs:330
Stage stage
Definition: GrowSystem.cs:97

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 GrowSystemFlower, GrowSystemHerb, GrowSystemKinoko, GrowSystemPasture, and GrowSystemWeed.

Definition at line 491 of file GrowSystem.cs.

492 {
493 return CanHarvest();
494 }
bool CanHarvest()
Definition: GrowSystem.cs:482

References CanHarvest().

Referenced by Cell.CanReapSeed().

◆ CreateStage()

virtual Stage GrowSystem.CreateStage ( )
inlinevirtual

Definition at line 126 of file GrowSystem.cs.

127 {
128 return new Stage();
129 }

Referenced by Init().

◆ EqualizePlants()

void GrowSystem.EqualizePlants ( Point  pos)
inline

Definition at line 296 of file GrowSystem.cs.

297 {
299 if (p1 == null || p1.seed == null)
300 {
301 return;
302 }
303 pos.ForeachNeighbor(delegate(Point pos2)
304 {
305 Thing thing = EClass._map.TryGetPlant(pos2)?.seed;
306 if (thing == null)
307 {
309 if (installed != null && installed.id == p1.seed.id)
310 {
311 thing = installed;
312 }
313 }
314 if (thing != null && p1.seed.refVal == thing.refVal && thing.encLV >= p1.seed.encLV)
315 {
316 p1.seed = thing;
317 }
318 }, diagonal: false);
319 }
@ 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:303
void ForeachNeighbor(Action< Point > action, bool diagonal=true)
Definition: Point.cs:1361

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

689 {
690 return source.hp;
691 }

References source.

◆ GetShadow()

virtual int GrowSystem.GetShadow ( int  index)
inlinevirtual

Reimplemented in GrowSystemTree, GrowSystemTreeCoralwood, and GrowSystemTreeSingle.

Definition at line 184 of file GrowSystem.cs.

185 {
186 return -1;
187 }

Referenced by OnRenderTileMap().

◆ GetSoundProgress()

virtual string GrowSystem.GetSoundProgress ( )
inlinevirtual

Reimplemented in GrowSystemWheat.

Definition at line 121 of file GrowSystem.cs.

122 {
123 return "Material/grass";
124 }

Referenced by TaskHarvest.OnCreateProgress().

◆ GetStageTile()

virtual int GrowSystem.GetStageTile ( )
inlinevirtual

Reimplemented in GrowSystemDeco, GrowSystemTreeCoralwood, and GrowSystemWheat.

Definition at line 179 of file GrowSystem.cs.

180 {
181 return currentStage.tiles[cell.objDir % currentStage.tiles.Length];
182 }
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 321 of file GrowSystem.cs.

322 {
323 bool flag = cell.isWatered || (cell.IsTopWater && source.tag.Contains("flood"));
324 PlantData plantData = EClass._map.TryGetPlant(cell);
325 if (plantData != null && flag)
326 {
327 plantData.water++;
328 }
329 int num = Step * mtp * ((!flag) ? 1 : 2);
330 int num2 = cell.objVal / 30;
331 int num3 = (cell.objVal + num) / 30;
332 if (num2 != num3)
333 {
335 {
336 PopHarvest(null);
337 }
339 {
340 Point point = cell.GetPoint();
341 EqualizePlants(point);
342 Thing thing = TryPopSeed(null);
343 PopMineObj();
344 if (thing != null)
345 {
346 point.SetObj();
347 EClass._zone.AddCard(thing, point).Install();
348 }
349 }
350 else if (num2 == StageLength - 1)
351 {
353 {
354 Point point2 = cell.GetPoint();
355 EqualizePlants(point2);
356 Thing thing2 = TryPopSeed(null);
357 if (thing2 != null)
358 {
359 point2.SetObj();
360 EClass._zone.AddCard(thing2, point2).Install();
361 }
362 }
363 else
364 {
366 }
367 }
368 else
369 {
371 }
372 }
373 else
374 {
375 cell.objVal += (byte)num;
376 }
377 cell.Refresh();
379 }
Card Install()
Definition: Card.cs:3448
void Refresh()
Definition: Cell.cs:1148
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:381
virtual int AutoMineStage
Definition: GrowSystem.cs:71
virtual int HarvestStage
Definition: GrowSystem.cs:69
void PopMineObj(Chara c=null)
Definition: GrowSystem.cs:509
void EqualizePlants(Point pos)
Definition: GrowSystem.cs:296
virtual int Step
Definition: GrowSystem.cs:63
virtual void OnExceedLastStage()
Definition: GrowSystem.cs:386
void PopHarvest(Chara c, string idThing, int num=-1)
Definition: GrowSystem.cs:606
Thing TryPopSeed(Chara c)
Definition: GrowSystem.cs:566
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:982
void SetObj(int id=0, int value=1, int dir=0)
Definition: Point.cs:892
Card AddCard(Card t, Point point)
Definition: Zone.cs:1893

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

437 {
438 return stage.idx == HarvestStage;
439 }

References HarvestStage.

◆ Harvest()

void GrowSystem.Harvest ( Chara  c)
inline

Definition at line 599 of file GrowSystem.cs.

600 {
601 cell.isHarvested = true;
602 cell.gatherCount = 0;
603 PopHarvest(c);
604 }

References PopHarvest().

Referenced by TaskHarvest.OnCreateProgress().

◆ Init()

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

Definition at line 131 of file GrowSystem.cs.

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

107 {
108 return idx == HarvestStage;
109 }

References HarvestStage.

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

◆ IsLastStage()

bool GrowSystem.IsLastStage ( )
inline

Definition at line 101 of file GrowSystem.cs.

102 {
103 return stage.idx == StageLength - 1;
104 }

References StageLength.

Referenced by Cell.CanMakeStraw().

◆ IsWithered()

bool GrowSystem.IsWithered ( )
inline

Definition at line 473 of file GrowSystem.cs.

474 {
476 {
477 return true;
478 }
479 return false;
480 }
virtual bool WitherOnLastStage
Definition: GrowSystem.cs:79

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

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

◆ OnExceedLastStage()

virtual void GrowSystem.OnExceedLastStage ( )
inlinevirtual

Reimplemented in GrowSystemDeco, and GrowSystemKinoko.

Definition at line 386 of file GrowSystem.cs.

387 {
388 cell.objVal = (byte)(stages.Length * 30 - 1);
389 if (!CanRegrow || Rand.rnd(2) != 0)
390 {
391 return;
392 }
393 Point point = cell.GetPoint();
394 if (point.IsFarmField)
395 {
396 return;
397 }
398 if (Rand.rnd(2) == 0)
399 {
400 Point randomNeighbor = point.GetRandomNeighbor();
401 if (randomNeighbor.cell.CanGrowWeed)
402 {
403 randomNeighbor.SetObj(cell.obj);
404 point.SetObj();
405 return;
406 }
407 }
408 cell.objVal = 0;
409 cell.isHarvested = false;
410 cell.isWatered = cell.HasLiquid;
411 }
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:731
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 496 of file GrowSystem.cs.

497 {
498 }

◆ OnHitFail()

virtual void GrowSystem.OnHitFail ( Chara  c)
inlinevirtual

Reimplemented in GrowSystemTree.

Definition at line 500 of file GrowSystem.cs.

501 {
502 }

Referenced by TaskHarvest.OnCreateProgress().

◆ OnMineObj()

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

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

Definition at line 518 of file GrowSystem.cs.

519 {
520 if (!IsWithered())
521 {
522 int num = cell.sourceObj.components.Length - 1;
523 Thing t = ThingGen.Create(cell.sourceObj.components[num].Split('/')[0], cell.matObj_fixed.alias);
524 TryPick(cell, t, c);
525 }
526 }
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:528
bool IsWithered()
Definition: GrowSystem.cs:473
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 504 of file GrowSystem.cs.

505 {
506 EClass._map.MineObj(cell.GetPoint(), null, c);
507 }
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 381 of file GrowSystem.cs.

382 {
383 SetStage(cell.objVal / 30 + 1);
384 }
byte objVal
Definition: Cell.cs:40
void SetStage(int idx, bool renewHarvest=false)
Definition: GrowSystem.cs:413

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

Referenced by Grow().

◆ OnRenderTileMap()

virtual void GrowSystem.OnRenderTileMap ( RenderParam  p)
inlinevirtual

Definition at line 189 of file GrowSystem.cs.

190 {
191 int num = cell.objVal / 30;
192 currentStage = stages[num];
193 SourceObj.Row row = source;
194 float y = p.y;
195 float z = p.z;
196 if (num != 0 || !UseGenericFirstStageTile)
197 {
198 p.y += row.pref.y;
199 p.z += row.pref.z;
200 }
202 {
203 if (cell.isHarvested || harvestTile == 0)
204 {
205 p.tile = ((afterHarvestTile != 0) ? afterHarvestTile : GetStageTile());
207 }
208 else
209 {
211 {
212 p.tile = GetStageTile();
214 p.liquidLv = 0;
215 }
216 p.tile = harvestTile;
218 }
219 }
220 else
221 {
222 p.tile = GetStageTile();
224 }
225 p.y = y;
226 p.z = z;
227 if (num >= ShadowStage)
228 {
229 int shadow = GetShadow(num);
230 if (shadow == -1)
231 {
232 shadow = row.pref.shadow;
233 }
234 if (shadow > 1 && !cell.ignoreObjShadow)
235 {
237 }
238 }
239 }
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:179
int afterHarvestTile
Definition: GrowSystem.cs:57
virtual int GetShadow(int index)
Definition: GrowSystem.cs:184
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 260 of file GrowSystem.cs.

261 {
262 }

Referenced by Map.SetObj().

◆ OnSetStage()

virtual void GrowSystem.OnSetStage ( int  idx)
inlinevirtual

Definition at line 432 of file GrowSystem.cs.

433 {
434 }

Referenced by SetStage().

◆ Perish()

void GrowSystem.Perish ( )
inline

Definition at line 441 of file GrowSystem.cs.

442 {
444 {
445 if (CanHarvest())
446 {
447 PopHarvest(null);
448 }
449 Thing thing = TryPopSeed(null);
450 if (thing != null)
451 {
453 }
455 return;
456 }
458 {
460 return;
461 }
462 if (EClass.rnd(3) == 0)
463 {
464 Thing thing2 = TryPopSeed(null);
465 if (thing2 != null)
466 {
468 }
469 }
471 }
static int rnd(int a)
Definition: EClass.cs:50
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 611 of file GrowSystem.cs.

612 {
613 if (t == null)
614 {
615 t = ((!idHarvestThing.StartsWith('#')) ? ThingGen.Create(idHarvestThing.IsEmpty("apple")) : ThingGen.CreateFromCategory(idHarvestThing.Replace("#", "")));
616 }
617 ApplySeed(t);
618 PlantData plantData = EClass._map.TryGetPlant(cell);
619 if (plantData != null && plantData.size > 0)
620 {
621 t.c_weight = t.SelfWeight * (80 + plantData.size * plantData.size * 100) / 100;
622 t.SetBool(115, enable: true);
623 t.isWeightChanged = true;
624 }
626 if (source._growth.Length > 4)
627 {
628 int num2 = EClass.rnd(source._growth[4].ToInt()) + 1;
629 int soilCost = EClass._zone.GetSoilCost();
630 int maxSoil = EClass._zone.MaxSoil;
631 if (soilCost > maxSoil && EClass.player.stats.days >= 5)
632 {
633 num2 -= EClass.rnd(2 + (soilCost - maxSoil) / 20);
634 }
635 if (num2 <= 0)
636 {
638 {
639 c?.Say("cropSpoiled", c, cell.GetObjName());
640 }
641 return;
642 }
643 t.SetNum(num2);
644 }
645 else
646 {
647 Debug.Log("harvest count not set:" + source.id + "/" + source.alias);
648 }
649 if (num > 0)
650 {
651 t.SetNum(num);
652 }
653 if (c == null || EClass.player.isAutoFarming)
654 {
655 TryPick(cell, t, c);
656 }
657 else
658 {
659 c.Pick(t);
660 }
661 }
BlessedState
Definition: BlessedState.cs:2
void SetBool(int id, bool enable)
Definition: BaseCard.cs:20
Thing SetNum(int a)
Definition: Card.cs:3242
virtual void SetBlessedState(BlessedState s)
Definition: Card.cs:3572
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6046
string GetObjName()
Definition: Cell.cs:1600
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:3920
void ApplySeed(Thing t)
Definition: GrowSystem.cs:663
int size
Definition: PlantData.cs:15
int days
Definition: Player.cs:68
Stats stats
Definition: Player.cs:817
static Thing CreateFromCategory(string idCat, int lv=-1)
Definition: ThingGen.cs:75
virtual int MaxSoil
Definition: Zone.cs:507
int GetSoilCost()
Definition: Zone.cs:3433

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

510 {
512 {
513 OnMineObj(c);
514 TryPopSeed(c);
515 }
516 }
static Game game
Definition: EClass.cs:8
bool disableUsermapBenefit
GamePrincipal principal
Definition: Game.cs:221
virtual void OnMineObj(Chara c=null)
Definition: GrowSystem.cs:518

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

256 {
257 cell.objVal = (byte)(DefaultStage * 30);
258 }
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 167 of file GrowSystem.cs.

168 {
169 s.renderData = EClass.core.refs.renderers.objS_flat;
170 s.SetTile(0, 100, 101, 102);
171 }
RenderData objS_flat
Definition: CoreRef.cs:298
Renderers renderers
Definition: CoreRef.cs:341
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 241 of file GrowSystem.cs.

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

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

414 {
415 cell.objVal = (byte)(idx * 30);
416 cell.gatherCount = 0;
417 if (cell.HasLiquid)
418 {
419 cell.isWatered = true;
420 }
421 if (renewHarvest)
422 {
423 cell.isHarvested = true;
424 }
425 if (cell.sourceObj.id == 118)
426 {
427 EClass._zone.dirtyElectricity = true;
428 }
429 OnSetStage(idx);
430 }
virtual void OnSetStage(int idx)
Definition: GrowSystem.cs:432

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

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

◆ SetStageTile()

virtual void GrowSystem.SetStageTile ( Stage  s)
inlinevirtual

Reimplemented in GrowSystemTree, and GrowSystemTreeSingle.

Definition at line 173 of file GrowSystem.cs.

174 {
175 s.renderData = source.renderData;
176 s.SetTile(s.idx + (UseGenericFirstStageTile ? (-1) : 0), baseTiles);
177 }

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

Referenced by Init().

◆ TryGrow()

void GrowSystem.TryGrow ( VirtualDate  date)
inline

Definition at line 288 of file GrowSystem.cs.

289 {
290 if (CanGrow(date))
291 {
292 Grow();
293 }
294 }
void Grow(int mtp=1)
Definition: GrowSystem.cs:321
bool CanGrow(VirtualDate date)
Definition: GrowSystem.cs:264

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

559 {
560 if (num > 0)
561 {
562 TryPick(cell, ThingGen.Create(idThing, idMat).SetNum(num), EClass.pc, applySeed);
563 }
564 }
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 528 of file GrowSystem.cs.

529 {
530 if (applySeed)
531 {
532 ApplySeed(t);
533 }
535 {
536 if (EClass.rnd(4) != 0)
537 {
538 if (t.Num > 1)
539 {
540 t.SetNum(t.Num / 2);
541 }
542 else if (EClass.rnd(2) == 0)
543 {
544 return;
545 }
547 {
549 }
550 }
551 }
552 else
553 {
555 }
556 }
Thing container_shipping
Definition: CardManager.cs:52
Card AddCard(Card c)
Definition: Card.cs:2887
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:2036

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

567 {
568 if (source.HasTag(CTAG.seed))
569 {
570 int num = (cell.IsFarmField ? 400 : 1000);
571 int soilCost = EClass._zone.GetSoilCost();
572 int maxSoil = EClass._zone.MaxSoil;
573 if (soilCost > maxSoil)
574 {
575 num += (soilCost - maxSoil) * 10;
576 }
577 if (IsWithered())
578 {
579 num /= 5;
580 }
582 {
583 return null;
584 }
585 if (EClass.player.isAutoFarming || EClass.rnd(num) < EClass.rnd(source.chance))
586 {
589 {
590 return thing;
591 }
592 TryPick(cell, thing, c);
593 return thing;
594 }
595 }
596 return null;
597 }
CTAG
Definition: CTAG.cs:2
static Thing MakeSeed(SourceObj.Row obj, PlantData plant=null)
Definition: TraitSeed.cs:77

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 95 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().

◆ 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 97 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: