Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
AreaTypeFarm.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using Newtonsoft.Json;
3
4public class AreaTypeFarm : AreaType
5{
6 [JsonProperty]
7 public int refSeed;
8
9 public override bool IsWork => true;
10
11 public override AIAct GetAI()
12 {
13 Point plowPos = GetPlowPos();
14 if (plowPos != null)
15 {
16 if (plowPos.HasObj)
17 {
18 return new TaskCut
19 {
20 pos = plowPos.Copy()
21 };
22 }
23 return new AI_Farm
24 {
25 pos = plowPos.Copy()
26 };
27 }
28 if (EClass.rnd(3) == 0)
29 {
30 return new AI_Farm
31 {
33 };
34 }
35 if (EClass.rnd(3) == 0)
36 {
37 return new AI_Water
38 {
40 };
41 }
42 return base.GetAI();
43 }
44
46 {
47 List<Point> list = new List<Point>();
48 foreach (Point point in owner.points)
49 {
50 if ((point.sourceFloor.ContainsTag("grass") || point.sourceFloor.tag.Contains("soil")) && (!point.IsFarmField || point.HasObj))
51 {
52 list.Add(point);
53 }
54 }
55 if (list.Count > 0)
56 {
57 return list.RandomItem();
58 }
59 return null;
60 }
61}
Definition: AIAct.cs:6
Point GetPlowPos()
Definition: AreaTypeFarm.cs:45
override bool IsWork
Definition: AreaTypeFarm.cs:9
override AIAct GetAI()
Definition: AreaTypeFarm.cs:11
BaseArea owner
Definition: AreaType.cs:12
PointList points
Definition: BaseArea.cs:26
Point GetRandomFreePos()
Definition: BaseArea.cs:60
Definition: EClass.cs:5
static int rnd(int a)
Definition: EClass.cs:50
Definition: Point.cs:9
Point Copy()
Definition: Point.cs:467
bool IsFarmField
Definition: Point.cs:127
SourceFloor.Row sourceFloor
Definition: Point.cs:65
bool HasObj
Definition: Point.cs:137