2using System.Collections.Generic;
75 public int eloX => EClass.scene.elomap.minX +
x;
77 public int eloY => EClass.scene.elomap.minY +
z;
95 x = ((!value) ? (-999) : 0);
117 return z <= map.Size - 1;
207 return cell.detail.designation is
TaskBuild;
238 if (cellDetail ==
null)
242 return cellDetail.charas.Count > 0;
251 if (cellDetail ==
null)
255 return cellDetail.things.Count > 0;
265 return detail.charas.Count > 1;
288 if (cellDetail ==
null || cellDetail.
charas.Count <= 0)
301 if (cellDetail ==
null || cellDetail.
things.Count <= 0)
314 if (cellDetail ==
null || cellDetail.
things.Count <= 0)
378 return IsInSpot<TraitGeyser>();
393 public bool Within(
int _x,
int _z,
int _w,
int _h)
395 if (
x >= _x &&
z >= _z &&
x < _x + _w)
421 return cell.room == a;
494 T val = Activator.CreateInstance<T>();
522 return "(" +
x +
" / " +
z +
")";
527 return new Point(lhs.
x + rhs.
x, lhs.
z + rhs.
z);
530 public void Set(Vector3 v)
536 x = (num2 - num) / 2 * -1;
566 vCache.z = 1000f + vCache.x * _screen.tileWeight.x + vCache.y * _screen.tileWeight.z + (float)(
int)b *
_screen.
tileMap.
_heightMod.z;
575 vCache.z = 1000f + vCache.x * _screen.tileWeight.x + vCache.y * _screen.tileWeight.z + (float)(
int)b *
_screen.
tileMap.
_heightMod.z;
598 vCache.x += EClass.screen.tileWorldSize.x * 0.5f;
599 vCache.y += EClass.screen.tileWorldSize.y * 0.75f;
605 return Quaternion.Euler(0f, 0f,
GetAngle(to));
611 return Mathf.Atan2(vector.y, vector.x) * 57.29578f;
617 return Mathf.Atan2(to.
z -
z, num) * 57.29578f;
620 public Point GetNearestPoint(
bool allowBlock =
false,
bool allowChara =
true,
bool allowInstalled =
true,
bool ignoreCenter =
false,
int minRadius = 0)
634 for (
int i = 0; i < 30; i++)
636 for (
int j = 0; j < r; j++)
644 for (
int k = 0; k < r; k++)
653 for (
int l = 0; l < r; l++)
661 for (
int m = 0; m < r; m++)
676 if (minRadius > r / 2)
692 public bool ForeachNearestPoint(Func<Point, bool> endFunc,
bool allowBlock =
false,
bool allowChara =
true,
bool allowInstalled =
true,
bool ignoreCenter =
false,
int maxRange = 30)
698 if (
IsValid(num2, num3) && endFunc(p))
702 if (
IsValid(num2, num3 + 1) && endFunc(p))
706 for (
int i = 0; i < maxRange; i++)
708 for (
int j = 0; j < num; j++)
711 if (
IsValid(num2, num3) && endFunc(p))
716 for (
int k = 0; k < num; k++)
719 if (
IsValid(num2, num3) && endFunc(p))
725 for (
int l = 0; l < num; l++)
728 if (
IsValid(num2, num3) && endFunc(p))
733 for (
int m = 0; m < num; m++)
736 if (
IsValid(num2, num3) && endFunc(p))
743 Debug.Log(
"ForeachNearestPoint Fail:" +
this);
762 int num = ((
EClass.
rnd(2) == 0) ? 1 : (-1));
770 public Point GetRandomPoint(
int radius,
bool requireLos =
true,
bool allowChara =
true,
bool allowBlocked =
false,
int tries = 100)
773 for (
int i = 0; i < tries; i++)
784 public Point GetRandomPointInRadius(
int minRadius,
int maxRadius,
bool requireLos =
true,
bool allowChara =
true,
bool allowBlocked =
false,
int tries = 2000)
787 for (
int i = 0; i < tries; i++)
793 if (num >= minRadius && num <= maxRadius && (!requireLos ||
Los.
IsVisible(
this, point)))
805 int num = dest.x - point.
x;
806 int num2 = dest.z - point.
z;
807 if (Mathf.Abs(num) > 1 || Mathf.Abs(num2) > 1)
809 int num3 = Mathf.Max(Mathf.Abs(num), Mathf.Abs(num2));
810 point.x += num / num3;
811 point.z += num2 / num3;
824 if (talkIf(
item) && !
item.renderer.IsTalking())
833 List<Chara> list =
new List<Chara>();
836 List<Chara> list2 =
item.detail?.charas;
837 if (list2 ==
null || list2.Count == 0)
841 foreach (
Chara item2
in list2)
878 if (funcWitness ==
null)
884 if (funcWitness(
item))
888 target?.DoHostileAction(criminal);
891 item.DoHostileAction(criminal);
905 caller.
Talk(
"callGuards");
910 Chara chara = list.First();
911 caller.
Say(
"calledGuard", caller);
920 public void SetBlock(
int idMat = 0,
int idBlock = 0)
925 public void SetFloor(
int idMat = 0,
int idFloor = 0)
930 public void SetObj(
int id = 0,
int value = 1,
int dir = 0)
935 public void ModFire(
int value,
bool extinguish =
false)
1055 List<Card> list =
new List<Card>();
1079 List<Card> list =
new List<Card>();
1104 if (
item.isChara ||
item.trait.CanBeAttacked)
1133 if (thing.
trait is T)
1135 return thing.trait as T;
1159 List<Card> list =
new List<Card>();
1175 List<Chara> list =
new List<Chara>();
1188 List<Chara> list =
new List<Chara>();
1204 List<Chara> list =
new List<Chara>();
1224 List<Chara> list =
new List<Chara>();
1227 if (func(chara) && chara.
Dist(cc) < dist && (!onlyVisible ||
Los.
IsVisible(chara, cc)))
1235 public T GetInstalled<T>() where T :
Trait
1243 return thing.trait as T;
1255 public SoundSource
PlaySound(
string id,
bool synced =
true,
float v = 1f,
bool spatial =
true)
1257 Vector3 vector =
default(Vector3);
1264 vector = (EClass._zone.IsRegion ? PositionTopdown() : Position());
1280 map.RefreshNeighborTiles(x, z);
1285 map.RefreshSingleTile(x, z);
1290 if (FirstThing ==
null)
1310 CellDetail orCreateDetail = cell.GetOrCreateDetail();
1311 if (orCreateDetail.
anime ==
null)
1317 animeBlock = animeBlock
1322 transAnime.drawBlock =
true;
1329 if (detail ==
null || detail.anime ==
null)
1333 p.x += detail.anime.
v.x;
1334 p.y += detail.anime.v.y;
1335 p.z += detail.anime.v.z;
1336 p.v.x += detail.anime.v.x;
1337 p.v.y += detail.anime.v.y;
1338 p.v.z += detail.anime.v.z;
1344 if (detail ==
null || detail.anime ==
null)
1348 p.x += detail.anime.v.x;
1349 p.y += detail.anime.v.y;
1350 p.z += detail.anime.v.z;
1356 List<IInspect> list =
new List<IInspect>();
1358 if (cellDetail !=
null)
1389 for (
int i = 0; i < h; i++)
1391 for (
int j = 0; j < w; j++)
1393 shared3.Set(x - j, z + i);
1394 action(shared3, j == 0 && i == 0);
1402 for (
int i = x - 1; i <= x + 1; i++)
1404 for (
int j = z - 1; j <= z + 1; j++)
1406 if (diagonal || i == x || j == z)
1428 cell.highlight = (byte)
id;
virtual bool IsRoofEditMode(Card c=null)
virtual bool IsPublicArea
static bool _CanInspect(Point pos)
static BlockInfo GetTempList(Point _pos)
void Talk(string idTopic, string ref1=null, string ref2=null, bool forceSync=false)
void Say(string lang, string ref1=null, string ref2=null)
TaskDesignation designation
SourceBlock.Row sourceBlock
SourceMaterial.Row matBlock
SourceFloor.Row sourceFloor
SourceMaterial.Row matRoofBlock
SourceMaterial.Row matBridge
SourceFloor.Row sourceBridge
SourceMaterial.Row matFloor
SourceBlock.Row sourceRoofBlock
Hostility OriginalHostility
bool HasCondition(string alias)
override bool IsPCFaction
override bool IsPCFactionMinion
void DoHostileAction(Card _tg, bool immediate=false)
static BaseGameScreen screen
static SoundManager Sound
static Effect Get(Effect original)
void Play(float delay, Point from, float fixY=0f, Point to=null, Sprite sprite=null)
static int Distance(int x1, int y1, int x2, int y2)
static bool IsVisible(Point p1, Point p2, Action< Point, bool > _onVisit=null)
bool Contains(int dx, int dz)
void ModFire(int x, int z, int amount)
void SetFloor(int x, int z, int idMat=0, int idFloor=0)
void SetBlock(int x, int z, int idMat=0, int idBlock=0)
List< Point > ListPointsInCircle(Point center, float radius, bool mustBeWalkable=true, bool los=true)
List< TransAnime > pointAnimes
void SetObj(int x, int z, int id=0, int value=1, int dir=0)
static HashSet< int > sunMap
static bool _CanInspect(Point pos)
static ObjInfo GetTempList(Point _pos)
List< Cell > lastMarkedHighlights
SourceMaterial.Row matBlock
SourceMaterial.Row matFloor
static Point GetShared(int x, int z)
int Distance(int tx, int tz)
SourceMaterial.Row matRoofBlock
bool IsBlockByHeight(Point p)
List< Chara > ListWitnesses(Chara criminal, int radius=4, WitnessType type=WitnessType.crime, Chara target=null)
SourceBlock.Row sourceBlock
void ForeachMultiSize(int w, int h, Action< Point, bool > action)
void SetObj(int id=0, int value=1, int dir=0)
List< Card > ListThings< T >(bool onlyInstalled=true)
List< Card > ListVisibleCards()
ref Vector3 Position(int height)
void SetHighlight(int id)
List< Card > ListCards(bool includeMasked=false)
Vector3 ApplyAnime(ref Vector3 p)
RenderParam ApplyAnime(RenderParam p)
ref Vector3 PositionTopdownTreasure()
override string ToString()
Point Set(int _x, int _z)
List< IInspect > ListInspectorTargets()
ref Vector3 PositionTopdown()
ref Vector3 PositionAuto()
void ForeachNeighbor(Action< Point > action, bool diagonal=true)
Quaternion GetRotation(Point to)
Point GetNearestPoint(bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false, int minRadius=0)
bool HasNonHomeProperty(Thing exclude=null)
void ModFire(int value, bool extinguish=false)
SourceMaterial.Row matBridge
void SetFloor(int idMat=0, int idFloor=0)
void CallGuard(Chara criminal, Chara caller)
SoundSource PlaySound(string id, bool synced=true, float v=1f, bool spatial=true)
override bool Equals(object obj)
List< Chara > ListCharasInNeighbor(Func< Chara, bool > func)
ref Vector3 PositionCenter()
Point GetPointTowards(Point dest)
List< Chara > ListCharasInRadius(Chara cc, int dist, Func< Chara, bool > func, bool onlyVisible=true)
Chara FindChara(Func< Chara, bool > func)
bool Equals(int _x, int _z)
static BaseGameScreen _screen
List< Chara > ListCharas()
bool TryWitnessCrime(Chara criminal, Chara target=null, int radius=4, Func< Chara, bool > funcWitness=null)
SourceFloor.Row sourceFloor
void TalkWitnesses(Chara criminal, string idTalk, int radius=4, WitnessType type=WitnessType.everyone, Func< Chara, bool > talkIf=null, int chance=3)
void SetBlock(int idMat=0, int idBlock=0)
Chara FirstVisibleChara()
bool Within(int _x, int _z, int _w, int _h)
override int GetHashCode()
static Point operator+(Point lhs, Point rhs)
Effect PlayEffect(string id)
void RefreshNeighborTiles()
bool HasRoomOrArea(BaseArea a)
static readonly XY[] Surrounds
bool ForeachNearestPoint(Func< Point, bool > endFunc, bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false, int maxRange=30)
Point GetRandomPointInRadius(int minRadius, int maxRadius, bool requireLos=true, bool allowChara=true, bool allowBlocked=false, int tries=2000)
Point Clamp(bool useBounds=false)
float GetAngle2(Point to)
Thing FindThing(Func< Thing, bool > func)
Point GetRandomNeighbor()
void Animate(AnimeID id, bool animeBlock=false)
SourceFloor.Row sourceBridge
List< Chara > ListVisibleCharas()
SourceBlock.Row sourceRoofBlock
Point GetRandomPoint(int radius, bool requireLos=true, bool allowChara=true, bool allowBlocked=false, int tries=100)
GameScreenElona screenElona
virtual List< Point > ListPoints(Point center=null, bool onlyPassable=true, bool allowChara=true)
virtual bool SetAlarmOnBreakLaw
ElementContainerZone elements
virtual bool IsUnderwater
virtual void SetAlarm(bool enable)