Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
AM_Populate.cs
Go to the documentation of this file.
1using UnityEngine;
2
4{
5 public enum Mode
6 {
7 New,
10 }
11
12 public Mode mode;
13
14 public override int SubMenuModeIndex => (int)mode;
15
16 public override void OnClickSubMenu(int a)
17 {
18 mode = a.ToEnum<Mode>();
19 }
20
21 public override string OnSetSubMenuButton(int a, UIButton b)
22 {
23 if (a < 3)
24 {
25 return "populate" + a.ToEnum<Mode>();
26 }
27 return null;
28 }
29
30 public override void OnProcessTiles(Point point, int dir)
31 {
32 if (timer < 0.1f)
33 {
34 return;
35 }
36 timer = 0f;
37 _ = point.cell;
38 EClass._map.ForeachSphere(point.x, point.z, brushRadius, delegate(Point p)
39 {
40 if (mode == Mode.Delete || (mode == Mode.New && firstClick))
41 {
42 p.SetObj();
43 }
44 if (mode != Mode.Delete && !p.HasBlock && !p.HasObj)
45 {
46 for (int i = 0; i < 200; i++)
47 {
48 if (EClass.rnd(Mathf.Clamp(brushRadius * brushRadius - 3, 1, 10)) == 0)
49 {
50 if (EInput.isShiftDown)
51 {
52 bool flag = false;
53 for (int j = 0; j < 10000; j++)
54 {
55 p.cell.biome.Populate(p);
56 if (p.growth != null && p.growth.IsTree)
57 {
58 flag = true;
59 break;
60 }
61 }
62 if (!flag)
63 {
64 p.SetObj();
65 }
66 }
67 else
68 {
69 p.cell.biome.Populate(p);
70 }
71 }
72 if (brushRadius > 1 || p.HasObj)
73 {
74 break;
75 }
76 }
77 }
78 });
79 }
80}
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
Definition: UIBook.cs:627
override int SubMenuModeIndex
Definition: AM_Populate.cs:14
override void OnProcessTiles(Point point, int dir)
Definition: AM_Populate.cs:30
override string OnSetSubMenuButton(int a, UIButton b)
Definition: AM_Populate.cs:21
override void OnClickSubMenu(int a)
Definition: AM_Populate.cs:16
int brushRadius
Definition: ActionMode.cs:99
Definition: EClass.cs:5
static Map _map
Definition: EClass.cs:18
void ForeachSphere(int _x, int _z, float r, Action< Point > action)
Definition: Map.cs:2358
Definition: Point.cs:9
int x
Definition: Point.cs:36
int z
Definition: Point.cs:39
bool HasObj
Definition: Point.cs:137
bool HasBlock
Definition: Point.cs:141
Cell cell
Definition: Point.cs:51