14 return this.trolley.owner.dir;
19 public override bool CanManualCancel()
26 public override bool CancelWhenDamaged
30 return this.owner !=
null && (!this.owner.IsPC || this.owner.hp < this.owner.MaxHP / 3);
36 public override bool CancelWhenMoved
46 public override bool ShowCursor
55 public override IEnumerable<
AIAct.Status> Run()
57 this.owner.Say(
"ride", this.owner, this.trolley.owner,
null,
null);
58 if (!this.trolley.HideChara)
60 this.owner.Talk(
"ride2",
null,
null,
false);
64 int nextDir = this.GetNextDir();
65 if (!this.trolley.owner.ExistsOnMap || nextDir == -1)
67 yield
return this.Stop(
null);
69 this.trolley.owner.dir = nextDir;
70 Point point = this.GetPoint(this.dir,
true);
71 this.owner.SetDir(nextDir);
72 this.owner.PlayAnime(AnimeID.Truck,
false);
73 string idSound = this.trolley.GetIdSound();
76 this.owner.PlaySound(idSound, 1f,
true);
80 this.owner.PlaySound(idSound, 1f,
true);
81 EClass.Sound.Stop(idSound, Mathf.Max(1f,
this.trolley.FadeDuration));
83 foreach (
Chara t
in point.ListCharas())
85 this.owner.Kick(t,
true,
false);
87 EClass._map.MoveCard(point, this.owner);
88 this.trolley.owner.MoveImmediate(point,
true,
true);
89 this.trolley.owner.PlayAnime(AnimeID.Truck,
false);
91 yield
return base.KeepRunning();
97 public Point GetPoint(
int d,
bool onlyValid =
true)
100 Point pos = this.trolley.owner.pos;
102 if (!point.IsValid || !point.IsInBounds || !point.HasRail || point.IsBlocked)
106 using (List<Thing>.Enumerator enumerator = point.Things.GetEnumerator())
108 while (enumerator.MoveNext())
110 if (!enumerator.Current.IsMultisize)
116 if (
EClass.pc.pos.Equals(point))
124 public int GetNextDir()
127 for (
int i = 0; i < 3 + (this.running ? 0 : 1); i++)
130 if (this.GetPoint(num,
true) !=
null)
139 public AIAct.Status Stop(Action action =
null)
141 EClass.Sound.Stop(this.trolley.GetIdSound(),
this.trolley.FadeDuration);
142 if (this.owner !=
null)
144 this.owner.Say(
"ride_unride", this.owner, this.trolley.owner,
null,
null);
146 return base.Success(
null);
150 public override void OnCancel()
156 public static int[][] DirList =
new int[][]
189 public static Vector2Int[] VecList =
new Vector2Int[]
191 new Vector2Int(0, -1),
192 new Vector2Int(1, 0),
193 new Vector2Int(0, 1),
194 new Vector2Int(-1, 0)