Elin Modding Docs Doc
Loading...
Searching...
No Matches
TraitGeneratorWheel.cs
1using System;
2
3// Token: 0x020003E5 RID: 997
5{
6 // Token: 0x17000906 RID: 2310
7 // (get) Token: 0x06001D1A RID: 7450 RVA: 0x000AAE6A File Offset: 0x000A906A
8 public override bool HaveUpdate
9 {
10 get
11 {
12 return true;
13 }
14 }
15
16 // Token: 0x17000907 RID: 2311
17 // (get) Token: 0x06001D1B RID: 7451 RVA: 0x000AAE6D File Offset: 0x000A906D
18 public override bool Waterproof
19 {
20 get
21 {
22 return true;
23 }
24 }
25
26 // Token: 0x17000908 RID: 2312
27 // (get) Token: 0x06001D1C RID: 7452 RVA: 0x000AAE70 File Offset: 0x000A9070
28 public override ToggleType ToggleType
29 {
30 get
31 {
32 return ToggleType.Custom;
33 }
34 }
35
36 // Token: 0x17000909 RID: 2313
37 // (get) Token: 0x06001D1D RID: 7453 RVA: 0x000AAE73 File Offset: 0x000A9073
38 public override bool IsOn
39 {
40 get
41 {
42 return this.owner.isOn || !EClass._zone.IsPCFaction;
43 }
44 }
45
46 // Token: 0x06001D1E RID: 7454 RVA: 0x000AAE91 File Offset: 0x000A9091
47 public override bool CanUse(Chara c)
48 {
49 return this.owner.IsInstalled && EClass._zone.IsPCFaction && !this.owner.pos.HasChara;
50 }
51
52 // Token: 0x06001D1F RID: 7455 RVA: 0x000AAEC1 File Offset: 0x000A90C1
53 public override bool OnUse(Chara c)
54 {
55 LayerPeople.CreateSelect("", "", delegate(UIList l)
56 {
57 foreach (Chara chara in EClass.Branch.members)
58 {
59 if (chara.IsAliveInCurrentZone && !chara.IsPCParty && chara.memberType == FactionMemberType.Default)
60 {
61 l.Add(chara);
62 }
63 }
64 }, delegate(Chara c)
65 {
66 c.Teleport(this.owner.pos, false, true);
67 c.RemoveCondition<ConSleep>();
68 c.noMove = true;
69 c.orgPos = new Point(this.owner.pos);
70 c.PlaySound("ride", 1f, true);
71 }, null);
72 return true;
73 }
74
75 // Token: 0x06001D20 RID: 7456 RVA: 0x000AAF00 File Offset: 0x000A9100
76 public override void OnStepped(Chara c)
77 {
78 if (this.IsOn)
79 {
80 return;
81 }
82 if (this.ShouldWork())
83 {
84 this.owner.isOn = true;
85 EClass._zone.dirtyElectricity = true;
86 this.owner.Say("generator_start", this.owner, null, null);
87 this.owner.PlaySound("electricity_on", 1f, true);
88 this.Refresh(c);
89 }
90 }
91
92 // Token: 0x06001D21 RID: 7457 RVA: 0x000AAF6B File Offset: 0x000A916B
93 public override void OnSteppedOut(Chara c)
94 {
95 this.Refresh(c);
96 }
97
98 // Token: 0x06001D22 RID: 7458 RVA: 0x000AAF74 File Offset: 0x000A9174
99 public override void Update()
100 {
101 if (!this.owner.isOn || !EClass._zone.IsPCFaction)
102 {
103 return;
104 }
105 if (!this.ShouldWork())
106 {
107 this.owner.isOn = false;
108 EClass._zone.dirtyElectricity = true;
109 this.owner.Say("generator_stop", this.owner, null, null);
110 this.owner.PlaySound("electricity_off", 1f, true);
111 }
112 }
113
114 // Token: 0x06001D23 RID: 7459 RVA: 0x000AAFE9 File Offset: 0x000A91E9
115 public void Refresh(Chara c)
116 {
117 if (c.IsPCFaction && c.homeBranch == EClass._zone.branch)
118 {
119 c.RefreshWorkElements(EClass._zone.elements);
120 }
121 }
122
123 // Token: 0x06001D24 RID: 7460 RVA: 0x000AB018 File Offset: 0x000A9218
124 public bool ShouldWork()
125 {
126 if (!this.owner.pos.HasChara)
127 {
128 return false;
129 }
130 int num = 0;
131 foreach (Thing thing in this.owner.pos.Things)
132 {
133 if (thing.IsInstalled && thing.trait is TraitGeneratorWheel)
134 {
135 num++;
136 }
137 }
138 if (num != 1)
139 {
140 return false;
141 }
142 if (!EClass._zone.IsPCFaction)
143 {
144 return true;
145 }
146 foreach (Chara chara in this.owner.pos.Charas)
147 {
148 if (chara.IsPCFaction && chara.memberType == FactionMemberType.Default)
149 {
150 return true;
151 }
152 }
153 return false;
154 }
155}
Definition Chara.cs:12
Definition Point.cs:11
Definition Thing.cs:10