Elin Modding Docs Doc
Loading...
Searching...
No Matches
AI_Haul.cs
1using System;
2using System.Collections.Generic;
3
4// Token: 0x020001EE RID: 494
5public class AI_Haul : AIAct
6{
7 // Token: 0x06000E2C RID: 3628 RVA: 0x0006B57B File Offset: 0x0006977B
8 public override IEnumerable<AIAct.Status> Run()
9 {
10 if (this.dest.ExistsOnMap)
11 {
12 yield return base.DoGoto(this.dest.pos, 1, false, null);
13 }
14 if (!this.dest.ExistsOnMap)
15 {
16 yield return base.Success(null);
17 }
18 if (EClass._zone.TryAddThingInSharedContainer(this.dest, null, true, false, null, true))
19 {
20 this.owner.Say("haul", this.owner, this.dest, null, null);
21 if (this.dest.id == "731")
22 {
23 this.owner.Talk("clean", null, null, false);
24 }
25 else
26 {
27 this.owner.Talk("haul", null, null, false);
28 }
29 }
30 yield return base.Success(null);
31 yield break;
32 }
33
34 // Token: 0x06000E2D RID: 3629 RVA: 0x0006B58C File Offset: 0x0006978C
35 public static Thing GetThingToClean(Chara c = null)
36 {
37 AI_Haul._list.Clear();
38 foreach (Thing thing in EClass._map.things)
39 {
40 if (thing.placeState == PlaceState.roaming && !thing.isMasked && (thing.id == "731" || thing.id == "_egg" || thing.id == "egg_fertilized" || thing.id == "milk"))
41 {
42 AI_Haul._list.Add(thing);
43 }
44 }
45 if (AI_Haul._list.Count == 0)
46 {
47 return null;
48 }
49 if (c != null)
50 {
51 Thing result = null;
52 int num = 9999;
53 foreach (Thing thing2 in AI_Haul._list)
54 {
55 int num2 = c.pos.Distance(thing2.pos);
56 if (num2 < num && EClass._zone.TryAddThingInSharedContainer(thing2, null, false, false, null, true))
57 {
58 num = num2;
59 result = thing2;
60 }
61 }
62 return result;
63 }
64 AI_Haul._list.Shuffle<Thing>();
65 foreach (Thing thing3 in AI_Haul._list)
66 {
67 if (EClass._zone.TryAddThingInSharedContainer(thing3, null, false, false, null, true))
68 {
69 return thing3;
70 }
71 }
72 return null;
73 }
74
75 // Token: 0x06000E2E RID: 3630 RVA: 0x0006B734 File Offset: 0x00069934
76 public static AI_Haul TryGetAI(Chara c)
77 {
78 Thing thingToClean = AI_Haul.GetThingToClean(c);
79 if (thingToClean != null)
80 {
81 return new AI_Haul
82 {
83 dest = thingToClean
84 };
85 }
86 return null;
87 }
88
89 // Token: 0x04000D3C RID: 3388
90 public Thing dest;
91
92 // Token: 0x04000D3D RID: 3389
93 public static List<Thing> _list = new List<Thing>();
94}
Definition AIAct.cs:7
Definition Chara.cs:12
Definition Thing.cs:10