Elin Decompiled Documentation EA 23.270 Nightly Patch 1
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

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

693 {
696 {
697 thing = null;
698 }
699 if (thing == null)
700 {
701 return;
702 }
703 int encLv = thing.encLV / 10 + ((thing.encLV > 0) ? 1 : 0);
704 bool flag = t.IsFood || t.Evalue(10) > 0 || t.id == "grass";
705 foreach (Element value in thing.elements.dict.Values)
706 {
707 if ((!value.IsFoodTrait || flag) && (value.IsFoodTrait || value.id == 2))
708 {
709 t.elements.ModBase(value.id, value.Value / 10 * 10);
710 }
711 }
712 t.SetEncLv(encLv);
713 t.c_refText = thing.c_refText;
714 t.isCrafted = true;
715 }
ElementContainerCard elements
Definition: Card.cs:42
string c_refText
Definition: Card.cs:1630
void SetEncLv(int a)
Definition: Card.cs:3889
int Evalue(int ele)
Definition: Card.cs:2574
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:45
PlantData TryGetPlant(Point p)
Definition: Map.cs:1942
Thing seed
Definition: PlantData.cs:6
Definition: Thing.cs:8
virtual bool IsUserZone
Definition: Zone.cs:271

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

274 {
275 if (source.id == 0)
276 {
277 return false;
278 }
279 if (cell.HasBlock && !cell.sourceBlock.tileType.IsFence)
280 {
281 return false;
282 }
283 if (GrowUndersea)
284 {
285 if (EClass._zone.IsUnderwater || cell.sourceFloor.tileType.IsDeepWater)
286 {
287 return true;
288 }
289 }
290 else if (EClass._zone.IsUnderwater)
291 {
292 return false;
293 }
294 if (!GrowOnLand)
295 {
296 return false;
297 }
298 if (NeedSunlight)
299 {
300 if (date.sunMap == null)
301 {
302 date.BuildSunMap();
303 }
304 if ((cell.HasRoof || date.IsWinter || EClass._map.IsIndoor) && !date.sunMap.Contains(cell.index))
305 {
306 return false;
307 }
308 }
309 return true;
310 }
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:190
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:269

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

507 {
509 {
510 return false;
511 }
512 return true;
513 }
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 515 of file GrowSystem.cs.

516 {
517 return CanHarvest();
518 }
bool CanHarvest()
Definition: GrowSystem.cs:506

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

321 {
323 if (p1 == null || p1.seed == null)
324 {
325 return;
326 }
327 pos.ForeachNeighbor(delegate(Point pos2)
328 {
329 Thing thing = EClass._map.TryGetPlant(pos2)?.seed;
330 if (thing == null)
331 {
333 if (installed != null && installed.id == p1.seed.id)
334 {
335 thing = installed;
336 }
337 }
338 if (thing != null && p1.seed.refVal == thing.refVal && thing.encLV >= p1.seed.encLV)
339 {
340 p1.seed = thing;
341 }
342 }, diagonal: false);
343 }
@ 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 717 of file GrowSystem.cs.

718 {
719 return source.hp;
720 }

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

346 {
347 bool flag = cell.isWatered || (cell.IsTopWater && (source.tag.Contains("flood") || source.tag.Contains("undersea")));
348 PlantData plantData = EClass._map.TryGetPlant(cell);
349 if (plantData != null && flag)
350 {
351 plantData.water++;
352 }
353 int num = Step * mtp * ((!flag) ? 1 : 2);
354 int num2 = cell.objVal / 30;
355 int num3 = (cell.objVal + num) / 30;
356 if (num2 != num3)
357 {
359 {
360 PopHarvest(null);
361 }
363 {
364 Point point = cell.GetPoint();
365 EqualizePlants(point);
366 Thing thing = TryPopSeed(null);
367 PopMineObj();
368 if (thing != null)
369 {
370 point.SetObj();
371 EClass._zone.AddCard(thing, point).Install();
372 }
373 }
374 else if (num2 == StageLength - 1)
375 {
377 {
378 Point point2 = cell.GetPoint();
379 EqualizePlants(point2);
380 Thing thing2 = TryPopSeed(null);
381 if (thing2 != null)
382 {
383 point2.SetObj();
384 EClass._zone.AddCard(thing2, point2).Install();
385 }
386 }
387 else
388 {
390 }
391 }
392 else
393 {
395 }
396 }
397 else
398 {
399 cell.objVal += (byte)num;
400 }
401 cell.Refresh();
403 }
Card Install()
Definition: Card.cs:3766
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:65
virtual void OnReachNextStage()
Definition: GrowSystem.cs:405
virtual int AutoMineStage
Definition: GrowSystem.cs:71
virtual int HarvestStage
Definition: GrowSystem.cs:69
void PopMineObj(Chara c=null)
Definition: GrowSystem.cs:533
void EqualizePlants(Point pos)
Definition: GrowSystem.cs:320
virtual int Step
Definition: GrowSystem.cs:63
virtual void OnExceedLastStage()
Definition: GrowSystem.cs:410
void PopHarvest(Chara c, string idThing, int num=-1)
Definition: GrowSystem.cs:630
Thing TryPopSeed(Chara c)
Definition: GrowSystem.cs:590
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:1181
void SetObj(int id=0, int value=1, int dir=0)
Definition: Point.cs:928
Card AddCard(Card t, Point point)
Definition: Zone.cs:1992

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

461 {
462 return stage.idx == HarvestStage;
463 }

References HarvestStage.

◆ Harvest()

void GrowSystem.Harvest ( Chara  c)
inline

Definition at line 623 of file GrowSystem.cs.

624 {
625 cell.isHarvested = true;
626 cell.gatherCount = 0;
627 PopHarvest(c);
628 }

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

498 {
500 {
501 return true;
502 }
503 return false;
504 }
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 410 of file GrowSystem.cs.

411 {
412 cell.objVal = (byte)(stages.Length * 30 - 1);
413 if (!CanRegrow || Rand.rnd(2) != 0)
414 {
415 return;
416 }
417 Point point = cell.GetPoint();
418 if (point.IsFarmField)
419 {
420 return;
421 }
422 if (Rand.rnd(2) == 0)
423 {
424 Point randomNeighbor = point.GetRandomNeighbor();
425 if (randomNeighbor.cell.CanGrowWeed)
426 {
427 randomNeighbor.SetObj(cell.obj);
428 point.SetObj();
429 return;
430 }
431 }
432 cell.objVal = 0;
433 cell.isHarvested = false;
434 cell.isWatered = cell.HasLiquid;
435 }
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:759
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 520 of file GrowSystem.cs.

521 {
522 }

◆ OnHitFail()

virtual void GrowSystem.OnHitFail ( Chara  c)
inlinevirtual

Reimplemented in GrowSystemTree.

Definition at line 524 of file GrowSystem.cs.

525 {
526 }

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

543 {
544 if (!IsWithered())
545 {
546 int num = cell.sourceObj.components.Length - 1;
547 Thing t = ThingGen.Create(cell.sourceObj.components[num].Split('/')[0], cell.matObj_fixed.alias);
548 TryPick(cell, t, c);
549 }
550 }
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:552
bool IsWithered()
Definition: GrowSystem.cs:497
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 528 of file GrowSystem.cs.

529 {
530 EClass._map.MineObj(cell.GetPoint(), null, c);
531 }
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 405 of file GrowSystem.cs.

406 {
407 SetStage(cell.objVal / 30 + 1);
408 }
byte objVal
Definition: Cell.cs:40
void SetStage(int idx, bool renewHarvest=false)
Definition: GrowSystem.cs:437

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

Referenced by Grow().

◆ OnRenderTileMap()

virtual void GrowSystem.OnRenderTileMap ( RenderParam  p,
bool  drawShadow = true 
)
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 (cell.obj == 118 && Core.fixedFrame % 10f == 0f && IsMature)
232 {
233 EClass.scene.psFey.transform.position = new Vector3(p.x, p.y, p.z - 2f);
234 EClass.scene.psFey.Emit(1);
235 }
236 if (drawShadow && num >= ShadowStage)
237 {
238 int shadow = GetShadow(num);
239 if (shadow == -1)
240 {
241 shadow = row.pref.shadow;
242 }
243 if (shadow > 1 && !cell.ignoreObjShadow)
244 {
246 }
247 }
248 }
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:183
int afterHarvestTile
Definition: GrowSystem.cs:57
virtual int GetShadow(int index)
Definition: GrowSystem.cs:188
virtual bool IsMature
Definition: GrowSystem.cs:103
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
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 269 of file GrowSystem.cs.

270 {
271 }

Referenced by Map.SetObj().

◆ OnSetStage()

virtual void GrowSystem.OnSetStage ( int  idx)
inlinevirtual

Definition at line 456 of file GrowSystem.cs.

457 {
458 }

Referenced by SetStage().

◆ Perish()

void GrowSystem.Perish ( )
inline

Definition at line 465 of file GrowSystem.cs.

466 {
468 {
469 if (CanHarvest())
470 {
471 PopHarvest(null);
472 }
473 Thing thing = TryPopSeed(null);
474 if (thing != null)
475 {
477 }
479 return;
480 }
482 {
484 return;
485 }
486 if (EClass.rnd(3) == 0)
487 {
488 Thing thing2 = TryPopSeed(null);
489 if (thing2 != null)
490 {
492 }
493 }
495 }
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 635 of file GrowSystem.cs.

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

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

534 {
536 {
537 OnMineObj(c);
538 TryPopSeed(c);
539 }
540 }
static Game game
Definition: EClass.cs:9
bool disableUsermapBenefit
GamePrincipal principal
Definition: Game.cs:225
virtual void OnMineObj(Chara c=null)
Definition: GrowSystem.cs:542

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

265 {
266 cell.objVal = (byte)(DefaultStage * 30);
267 }
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: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 250 of file GrowSystem.cs.

251 {
252 int num = Rand.rnd(stages.Length);
253 if (num == 0 && EClass.rnd(5) != 0 && stages.Length >= 2)
254 {
255 num++;
256 }
257 else if (num == stages.Length - 1 && EClass.rnd(5) != 0 && stages.Length >= 2)
258 {
259 num--;
260 }
261 cell.objVal = (byte)(num * 30);
262 }

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

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

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

313 {
314 if (CanGrow(date))
315 {
316 Grow();
317 }
318 }
void Grow(int mtp=1)
Definition: GrowSystem.cs:345
bool CanGrow(VirtualDate date)
Definition: GrowSystem.cs:273

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

583 {
584 if (num > 0)
585 {
586 TryPick(cell, ThingGen.Create(idThing, idMat).SetNum(num), EClass.pc, applySeed);
587 }
588 }
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 552 of file GrowSystem.cs.

553 {
554 if (applySeed)
555 {
556 ApplySeed(t);
557 }
559 {
560 if (EClass.rnd(4) != 0)
561 {
562 if (t.Num > 1)
563 {
564 t.SetNum(t.Num / 2);
565 }
566 else if (EClass.rnd(2) == 0)
567 {
568 return;
569 }
571 {
573 }
574 }
575 }
576 else
577 {
579 }
580 }
Thing container_shipping
Definition: CardManager.cs:52
Card AddCard(Card c)
Definition: Card.cs:3109
int Num
Definition: Card.cs:159
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:2135

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

591 {
592 if (source.HasTag(CTAG.seed))
593 {
594 int num = (cell.IsFarmField ? 400 : 1000);
595 int soilCost = EClass._zone.GetSoilCost();
596 int maxSoil = EClass._zone.MaxSoil;
597 if (soilCost > maxSoil)
598 {
599 num += (soilCost - maxSoil) * 10;
600 }
601 if (IsWithered())
602 {
603 num /= 5;
604 }
606 {
607 return null;
608 }
609 if (EClass.player.isAutoFarming || EClass.rnd(num) < EClass.rnd(source.chance))
610 {
613 {
614 return thing;
615 }
616 TryPick(cell, thing, c);
617 return thing;
618 }
619 }
620 return null;
621 }
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

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

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