Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
PointTarget.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using UnityEngine;
3
4public class PointTarget : EClass
5{
6 public Card card;
7
8 public Area area;
9
10 public ObjInfo obj;
11
13
15
17
19
20 public bool hasTargetChanged;
21
22 public bool hasValidTarget;
23
24 public bool drawHighlight;
25
26 public bool mouse = true;
27
28 public bool hasInteraction;
29
30 public bool isValid;
31
32 public Point pos = new Point();
33
34 public Point lastPos = new Point();
35
36 public int index;
37
38 public List<Card> cards = new List<Card>();
39
41 {
42 get
43 {
44 if (card != null)
45 {
46 return card.Chara;
47 }
48 return null;
49 }
50 }
51
52 public void Update(Point _pos)
53 {
54 pos.Set(_pos);
56 cards.Clear();
57 if (!isValid || pos.IsHidden || EClass.ui.BlockMouseOverUpdate || (mouse && (EClass.ui.isPointerOverUI || !EClass.scene.actionMode.ShowMouseoverTarget)))
58 {
59 Clear();
60 return;
61 }
62 card = null;
63 area = null;
64 task = null;
66 if (pos.sourceBlock.tileType.Invisible && !EClass.scene.actionMode.IsBuildMode)
67 {
68 block = null;
69 }
71 if (obj != null)
72 {
73 target = obj;
74 }
75 else if (block != null)
76 {
77 target = block;
78 }
79 else
80 {
81 target = null;
82 }
83 drawHighlight = target != null;
84 CellDetail detail = pos.detail;
85 if (detail != null)
86 {
87 area = detail.area;
88 task = detail.designation;
89 Thing thing = null;
90 Chara chara = null;
91 foreach (Chara chara2 in detail.charas)
92 {
93 if (!ShouldIgnore(chara2))
94 {
95 cards.Add(chara2);
96 if (chara == null || chara2.hostility < chara.hostility)
97 {
98 chara = chara2;
99 }
100 }
101 }
102 foreach (Thing thing2 in detail.things)
103 {
104 if (!ShouldIgnore(thing2))
105 {
106 cards.Add(thing2);
107 thing = thing2;
108 }
109 }
110 if (chara != null)
111 {
112 target = (card = chara);
113 drawHighlight = true;
114 }
115 else if (thing != null)
116 {
117 target = (card = thing);
118 drawHighlight = true;
119 }
120 else if (task != null)
121 {
122 target = task;
123 drawHighlight = true;
124 }
125 else if (area != null && EClass.scene.actionMode.AreaHihlight != 0)
126 {
127 target = area;
128 }
129 if (cards.Count > 0 && EClass.scene.actionMode.IsBuildMode)
130 {
131 target = (card = cards[Mathf.Abs(index) % cards.Count]);
132 drawHighlight = true;
133 }
134 }
135 if ((target == null || target is Chara) && EClass._zone.IsRegion)
136 {
138 if (zone != null)
139 {
140 target = zone;
141 }
142 }
143 hasInteraction = target != null;
145 }
146
147 public bool ShouldIgnore(Card c)
148 {
149 if (c.isChara)
150 {
151 if (c.Chara.host != null)
152 {
153 return true;
154 }
156 {
157 if (!EClass.debug.ignoreBuildRule && (c.IsPC || !c.IsPCFaction))
158 {
159 return true;
160 }
161 }
162 else
163 {
164 if ((!EClass.pc.hasTelepathy || !c.Chara.race.visibleWithTelepathy) && c.isHidden && !EClass.pc.canSeeInvisible)
165 {
166 return true;
167 }
168 if (c.IsPC)
169 {
170 return true;
171 }
172 if (!c.isSynced || !EClass.player.CanSee(c.Chara))
173 {
174 return true;
175 }
176 }
177 return false;
178 }
180 {
181 return true;
182 }
184 {
186 {
187 if (!c.isRoofItem)
188 {
189 return true;
190 }
191 }
192 else if (c.isRoofItem)
193 {
194 return true;
195 }
196 }
197 else if (c.isHidden || c.isRoofItem || c.isMasked)
198 {
199 return true;
200 }
201 return false;
202 }
203
204 public void CycleTarget(int a)
205 {
206 SE.Rotate();
207 index += a;
209 if ((bool)WidgetMouseover.Instance)
210 {
212 }
213 }
214
215 public bool CanCycle()
216 {
217 return cards.Count >= 2;
218 }
219
220 public void Clear()
221 {
222 card = null;
223 area = null;
224 target = null;
225 hasInteraction = false;
227 }
228
229 public void CheckLastTarget()
230 {
232 hasValidTarget = target != null;
234 lastPos.Set(pos);
235 }
236}
virtual bool IsRoofEditMode(Card c=null)
Definition: ActionMode.cs:311
virtual bool ShowMouseoverTarget
Definition: ActionMode.cs:167
virtual AreaHighlightMode AreaHihlight
Definition: ActionMode.cs:169
virtual bool IsBuildMode
Definition: ActionMode.cs:181
Definition: Area.cs:4
static bool _CanInspect(Point pos)
Definition: BlockInfo.cs:31
static BlockInfo GetTemp(Point _pos)
Definition: BlockInfo.cs:15
Definition: Card.cs:11
virtual Chara Chara
Definition: Card.cs:1946
bool isMasked
Definition: Card.cs:562
bool isRoofItem
Definition: Card.cs:550
Trait trait
Definition: Card.cs:49
virtual bool IsPC
Definition: Card.cs:2019
virtual bool isChara
Definition: Card.cs:1959
bool isHidden
Definition: Card.cs:502
virtual bool IsPCFaction
Definition: Card.cs:2129
Cell Cell
Definition: Card.cs:1931
virtual bool isSynced
Definition: Card.cs:1963
TaskDesignation designation
Definition: CellDetail.cs:19
List< Thing > things
Definition: CellDetail.cs:11
List< Chara > charas
Definition: CellDetail.cs:13
Area area
Definition: CellDetail.cs:15
bool IsFloorWater
Definition: Cell.cs:727
Definition: Chara.cs:10
bool canSeeInvisible
Definition: Chara.cs:133
Chara host
Definition: Chara.cs:33
Hostility hostility
Definition: Chara.cs:276
bool hasTelepathy
Definition: Chara.cs:135
SourceRace.Row race
Definition: Chara.cs:449
bool ignoreBuildRule
Definition: CoreDebug.cs:184
Definition: EClass.cs:5
static Scene scene
Definition: EClass.cs:30
static Zone _zone
Definition: EClass.cs:20
static Player player
Definition: EClass.cs:12
static Chara pc
Definition: EClass.cs:14
static CoreDebug debug
Definition: EClass.cs:48
static UI ui
Definition: EClass.cs:16
Zone GetZone(Point p)
Definition: EloMap.cs:420
static ObjInfo GetTemp(Point _pos)
Definition: ObjInfo.cs:47
static bool _CanInspect(Point pos)
Definition: ObjInfo.cs:67
bool CanSee(Chara c)
Definition: Player.cs:2221
void CycleTarget(int a)
Definition: PointTarget.cs:204
TaskPoint task
Definition: PointTarget.cs:14
bool hasInteraction
Definition: PointTarget.cs:28
bool hasTargetChanged
Definition: PointTarget.cs:20
IInspect lastTarget
Definition: PointTarget.cs:18
bool ShouldIgnore(Card c)
Definition: PointTarget.cs:147
void Clear()
Definition: PointTarget.cs:220
void Update(Point _pos)
Definition: PointTarget.cs:52
bool drawHighlight
Definition: PointTarget.cs:24
void CheckLastTarget()
Definition: PointTarget.cs:229
bool isValid
Definition: PointTarget.cs:30
bool hasValidTarget
Definition: PointTarget.cs:22
BlockInfo block
Definition: PointTarget.cs:12
bool CanCycle()
Definition: PointTarget.cs:215
Chara TargetChara
Definition: PointTarget.cs:41
IInspect target
Definition: PointTarget.cs:16
ObjInfo obj
Definition: PointTarget.cs:10
Point lastPos
Definition: PointTarget.cs:34
List< Card > cards
Definition: PointTarget.cs:38
Definition: Point.cs:9
SourceBlock.Row sourceBlock
Definition: Point.cs:63
Point Set(int _x, int _z)
Definition: Point.cs:479
CellDetail detail
Definition: Point.cs:71
bool Equals(int _x, int _z)
Definition: Point.cs:924
bool IsValid
Definition: Point.cs:88
bool IsHidden
Definition: Point.cs:323
Cell cell
Definition: Point.cs:51
Definition: Scene.cs:8
static Point HitPoint
Definition: Scene.cs:21
ActionMode actionMode
Definition: Scene.cs:77
EloMap elomap
Definition: Scene.cs:143
virtual bool IsRegion
Definition: Spatial.cs:501
Definition: Thing.cs:8
virtual bool IsGround
Definition: Trait.cs:64
static WidgetMouseover Instance
Definition: Zone.cs:12