8 public override bool HaveUpdate
18 public override bool Waterproof
28 public override ToggleType ToggleType
32 return ToggleType.Custom;
38 public override bool IsOn
42 return this.owner.isOn || !
EClass._zone.IsPCFaction;
47 public override bool CanUse(
Chara c)
49 return this.owner.IsInstalled && EClass._zone.IsPCFaction && !this.owner.pos.HasChara;
53 public override bool OnUse(
Chara c)
59 if (chara.IsAliveInCurrentZone && !chara.IsPCParty && chara.memberType == FactionMemberType.Default)
66 c.Teleport(this.owner.pos,
false,
true);
69 c.orgPos =
new Point(this.owner.pos);
70 c.PlaySound(
"ride", 1f,
true);
76 public override void OnStepped(
Chara c)
82 if (this.ShouldWork())
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);
93 public override void OnSteppedOut(
Chara c)
99 public override void Update()
101 if (!this.owner.isOn || !
EClass._zone.IsPCFaction)
105 if (!this.ShouldWork())
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);
115 public void Refresh(
Chara c)
117 if (c.IsPCFaction && c.homeBranch ==
EClass._zone.branch)
119 c.RefreshWorkElements(
EClass._zone.elements);
124 public bool ShouldWork()
126 if (!this.owner.pos.HasChara)
131 foreach (
Thing thing
in this.owner.pos.Things)
142 if (!
EClass._zone.IsPCFaction)
146 foreach (
Chara chara
in this.owner.pos.Charas)
148 if (chara.IsPCFaction && chara.memberType == FactionMemberType.Default)