Elin Decompiled Documentation
EA 23.102 Nightly
Loading...
Searching...
No Matches
AreaTypeFarm.cs
Go to the documentation of this file.
1
using
System.Collections.Generic;
2
using
Newtonsoft.Json;
3
4
public
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
{
32
pos =
owner
.
GetRandomFreePos
()
33
};
34
}
35
if
(
EClass
.
rnd
(3) == 0)
36
{
37
return
new
AI_Water
38
{
39
pos =
owner
.
GetRandomFreePos
()
40
};
41
}
42
return
base.GetAI();
43
}
44
45
public
Point
GetPlowPos
()
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
}
AIAct
Definition:
AIAct.cs:6
AI_Farm
Definition:
AI_Farm.cs:2
AI_Water
Definition:
AI_Water.cs:2
AreaTypeFarm
Definition:
AreaTypeFarm.cs:5
AreaTypeFarm.GetPlowPos
Point GetPlowPos()
Definition:
AreaTypeFarm.cs:45
AreaTypeFarm.IsWork
override bool IsWork
Definition:
AreaTypeFarm.cs:9
AreaTypeFarm.refSeed
int refSeed
Definition:
AreaTypeFarm.cs:7
AreaTypeFarm.GetAI
override AIAct GetAI()
Definition:
AreaTypeFarm.cs:11
AreaType
Definition:
AreaType.cs:5
AreaType.owner
BaseArea owner
Definition:
AreaType.cs:12
BaseArea.points
PointList points
Definition:
BaseArea.cs:26
BaseArea.GetRandomFreePos
Point GetRandomFreePos()
Definition:
BaseArea.cs:60
EClass
Definition:
EClass.cs:5
EClass.rnd
static int rnd(int a)
Definition:
EClass.cs:50
Point
Definition:
Point.cs:9
Point.Copy
Point Copy()
Definition:
Point.cs:467
Point.IsFarmField
bool IsFarmField
Definition:
Point.cs:127
Point.sourceFloor
SourceFloor.Row sourceFloor
Definition:
Point.cs:65
Point.HasObj
bool HasObj
Definition:
Point.cs:137
TaskCut
Definition:
TaskCut.cs:2
Elin
AreaTypeFarm.cs
Generated by
1.9.6