2using System.Collections.Generic;
5using System.Runtime.Serialization;
14 public static HashSet<int>
sunMap =
new HashSet<int>();
49 public List<Thing>
things =
new List<Thing>();
55 public List<int>
_plDay =
new List<int>();
61 public Dictionary<int, int>
gatherCounts =
new Dictionary<int, int>();
64 public Dictionary<int, CellEffect>
cellEffects =
new Dictionary<int, CellEffect>();
67 public Dictionary<int, int>
backerObjs =
new Dictionary<int, int>();
70 public Dictionary<int, PlantData>
plants =
new Dictionary<int, PlantData>();
81 public List<Chara>
charas =
new List<Chara>();
93 public FloodSpiller
flood =
new FloodSpiller();
99 public List<Footmark>
footmarks =
new List<Footmark>();
105 private HashSet<int>
roomHash =
new HashSet<int>();
107 private List<Thing>
_things =
new List<Thing>();
135 public IEnumerable<Card>
Cards => ((IEnumerable<Card>)
things).Concat((IEnumerable<Card>)
charas);
150 bits.Bits = (uint)
_bits;
153 public void CreateNew(
int size,
bool setReference =
true)
155 Debug.Log(
"Map CreateNew:");
197 Fov.map = (Cell.map = (Wall.map = (Point.map = (CellDetail.map =
this))));
202 pathfinder.
Init(
this, weightMap,
Size);
213 c.currentZone =
zone;
231 if (thing.
pos.
x >= newSize || thing.
pos.
z >= newSize)
238 if (chara.
pos.
x >= newSize || chara.
pos.
z >= newSize)
243 Size = (bounds.Size = newSize);
254 public void Shift(Vector2Int offset)
256 TweenUtil.Tween(0.1f,
null, delegate
260 item.pos.x += offset.x;
261 item.pos.z += offset.y;
265 for (
int i = 0; i <
Size; i++)
267 int num = i - offset.y;
268 for (
int j = 0; j <
Size; j++)
270 int num2 = j - offset.
x;
271 if (num2 >= 0 && num2 < Size && num >= 0 && num <
Size)
273 array[j, i] =
cells[num2, num];
277 array[j, i] =
new Cell
286 bounds.x += offset.
x;
287 bounds.z += offset.y;
288 bounds.maxX += offset.x;
289 bounds.maxZ += offset.y;
319 TweenUtil.Tween(0.1f,
null, delegate
327 List<Thing> list =
new List<Thing>();
347 for (
int i = 0; i <
Size; i++)
349 for (
int j = 0; j <
Size; j++)
379 Debug.Log(
"#io saving map:" + path);
380 IO.CreateDirectory(path);
387 num = partial.offsetX;
388 num2 = partial.offsetZ;
392 int num5 = num3 * num4;
393 byte[] array =
new byte[num5];
394 byte[] array2 =
new byte[num5];
395 byte[] array3 =
new byte[num5];
396 byte[] array4 =
new byte[num5];
397 byte[] array5 =
new byte[num5];
398 byte[] array6 =
new byte[num5];
399 byte[] array7 =
new byte[num5];
400 byte[] array8 =
new byte[num5];
401 byte[] array9 =
new byte[num5];
402 byte[] array10 =
new byte[num5];
403 byte[] array11 =
new byte[num5];
404 byte[] array12 =
new byte[num5];
405 byte[] array13 =
new byte[num5];
406 byte[] array14 =
new byte[num5];
407 byte[] array15 =
new byte[num5];
408 byte[] array16 =
new byte[num5];
409 byte[] array17 =
new byte[num5];
410 byte[] array18 =
new byte[num5];
411 byte[] array19 =
new byte[num5];
412 byte[] array20 =
new byte[num5];
413 byte[] array21 =
new byte[num5];
416 for (
int i = num; i < num + num3; i++)
418 for (
int j = num2; j < num2 + num4; j++)
421 array[num6] = cell.
objVal;
423 array2[num6] = cell.
_block;
425 array4[num6] = cell.
_floor;
426 array6[num6] = cell.
obj;
427 array20[num6] = cell.
_deco;
429 array7[num6] = cell.
objMat;
430 array8[num6] = cell.
decal;
431 array9[num6] = cell.
_dirs;
432 array12[num6] = cell.
height;
440 array10[num6] = array10[num6].SetBit(1, cell.
isSeen);
441 array10[num6] = array10[num6].SetBit(2, cell.
isHarvested);
442 array10[num6] = array10[num6].SetBit(3, cell.
impassable);
443 array10[num6] = array10[num6].SetBit(4, cell.
isModified);
444 array10[num6] = array10[num6].SetBit(5, cell.
isClearSnow);
445 array10[num6] = array10[num6].SetBit(6, cell.
isForceFloat);
447 array11[num6] = array11[num6].SetBit(0, cell.
isWatered);
448 array11[num6] = array11[num6].SetBit(1, cell.
isObjDyed);
449 array11[num6] = array11[num6].SetBit(2, cell.
crossWall);
458 Write(path +
"objVals", array);
459 Write(path +
"blocks", array2);
460 Write(path +
"blockMats", array3);
461 Write(path +
"floors", array4);
462 Write(path +
"floorMats", array5);
463 Write(path +
"objs", array6);
464 Write(path +
"objMats", array7);
465 Write(path +
"decal", array8);
466 Write(path +
"flags", array10);
467 Write(path +
"flags2", array11);
468 Write(path +
"dirs", array9);
469 Write(path +
"heights", array12);
470 Write(path +
"bridges", array13);
471 Write(path +
"bridgeMats", array14);
472 Write(path +
"bridgeHeights", array15);
473 Write(path +
"bridgePillars", array16);
474 Write(path +
"roofBlocks", array18);
475 Write(path +
"roofBlockMats", array19);
476 Write(path +
"roofBlockDirs", array17);
477 Write(path +
"decos", array20);
478 Write(path +
"decoMats", array21);
493 export.serializedCards.cards.Clear();
503 export.serializedCards.Add(chara2);
508 export.serializedCards.Add(chara2);
515 export.serializedCards.Add(thing);
525 export.serializedCards.Add(thing2);
529 List<Thing> list =
things;
530 things =
new List<Thing>();
535 void Write(
string _path,
byte[] bytes)
543 byte[] array = IO.ReadLZ4(path + s, size,
compression);
546 Debug.Log(
"Couldn't load:" + s);
547 return new byte[size];
566 int size = num * num2;
573 byte[] bytes2 = TryLoad(
"objVals");
574 byte[] bytes3 = TryLoad(
"blockMats");
575 byte[] bytes4 = TryLoad(
"blocks");
576 byte[] bytes5 = TryLoad(
"floorMats");
577 byte[] bytes6 = TryLoad(
"floors");
578 byte[] bytes7 = TryLoad(
"objs");
579 byte[] bytes8 = TryLoad(
"objMats");
580 byte[] bytes9 = TryLoad(
"decal");
581 byte[] bytes10 = TryLoad(
"decos");
582 byte[] bytes11 = TryLoad(
"decoMats");
583 byte[] bytes12 = TryLoad(
"dirs");
584 byte[] bytes13 = TryLoad(
"flags");
585 byte[] bytes14 = TryLoad(
"flags2");
586 byte[] bytes15 = TryLoad(
"heights");
587 byte[] bytes16 = TryLoad(
"bridges");
588 byte[] bytes17 = TryLoad(
"bridgeMats");
589 byte[] bytes18 = TryLoad(
"bridgeHeights");
590 byte[] bytes19 = TryLoad(
"bridgePillars");
591 byte[] bytes20 = TryLoad(
"roofBlocks");
592 byte[] bytes21 = TryLoad(
"roofBlockMats");
593 byte[] bytes22 = TryLoad(
"roofBlockDirs");
594 if (bytes19.Length < size)
596 bytes19 =
new byte[size];
598 if (bytes2.Length < size)
600 bytes2 =
new byte[size];
602 if (bytes14.Length < size)
604 bytes14 =
new byte[size];
606 Validate(ref bytes2,
"objVals");
607 Validate(ref bytes3,
"blockMats");
608 Validate(ref bytes4,
"blocks");
609 Validate(ref bytes5,
"floorMats");
610 Validate(ref bytes6,
"floors");
611 Validate(ref bytes7,
"objs");
612 Validate(ref bytes8,
"objMats");
613 Validate(ref bytes9,
"decal");
614 Validate(ref bytes10,
"decos");
615 Validate(ref bytes11,
"decoMats");
616 Validate(ref bytes12,
"dirs");
617 Validate(ref bytes13,
"flags");
618 Validate(ref bytes14,
"flags2");
619 Validate(ref bytes15,
"heights");
620 Validate(ref bytes16,
"bridges");
621 Validate(ref bytes17,
"bridgeMats");
622 Validate(ref bytes18,
"bridgeHeights");
623 Validate(ref bytes19,
"bridgePillars");
624 Validate(ref bytes20,
"roofBlocks");
625 Validate(ref bytes21,
"roofBlockMats");
626 Validate(ref bytes22,
"roofBlockDirs");
630 for (
int i = 0; i < num; i++)
632 for (
int j = 0; j < num2; j++)
638 objVal = bytes2[num3],
639 _blockMat = bytes3[num3],
640 _block = bytes4[num3],
641 _floorMat = bytes5[num3],
642 _floor = bytes6[num3],
644 objMat = bytes8[num3],
645 decal = bytes9[num3],
646 _deco = bytes10[num3],
647 _decoMat = bytes11[num3],
648 _dirs = bytes12[num3],
649 height = bytes15[num3],
650 _bridge = bytes16[num3],
651 _bridgeMat = bytes17[num3],
652 bridgeHeight = bytes18[num3],
653 bridgePillar = bytes19[num3],
654 _roofBlock = bytes20[num3],
655 _roofBlockMat = bytes21[num3],
656 _roofBlockDir = bytes22[num3],
657 isSeen = bytes13[num3].GetBit(1),
658 isHarvested = bytes13[num3].GetBit(2),
659 impassable = bytes13[num3].GetBit(3),
660 isModified = bytes13[num3].GetBit(4),
661 isClearSnow = bytes13[num3].GetBit(5),
662 isForceFloat = bytes13[num3].GetBit(6),
663 isToggleWallPillar = bytes13[num3].GetBit(7),
664 isWatered = bytes14[num3].GetBit(0),
665 isObjDyed = bytes14[num3].GetBit(1),
666 crossWall = bytes14[num3].GetBit(2)
688 foreach (KeyValuePair<int, CellEffect> cellEffect
in cellEffects)
690 int key = cellEffect.Key;
691 int num4 = key %
Size;
692 int num5 = key /
Size;
694 if (cellEffect.Value.IsFire)
701 byte[] TryLoad(
string s)
705 void Validate(ref
byte[] bytes,
string id)
707 if (bytes.Length < size)
709 Debug.LogError(
"expection: size invalid:" +
id +
" " + bytes.Length +
"/" + size);
710 bytes =
new byte[size];
746 custom.id = (mapMetaData.id = id);
747 IO.SaveFile(_path +
"meta", mapMetaData);
754 using ZipFile zipFile = ZipFile.Read(pathZip);
755 ZipEntry zipEntry = zipFile[
"meta"];
756 if (zipEntry !=
null)
758 using (MemoryStream stream =
new MemoryStream())
760 zipEntry.Extract(stream);
762 mapMetaData.path = pathZip;
767 catch (Exception message)
769 if (Application.isEditor)
779 IO.CreateTempDirectory();
780 ZipFile zipFile = ZipFile.Read(pathZip);
781 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
782 zipFile.ExtractAll(IO.TempPath);
785 using (zipFile =
new ZipFile())
787 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
788 zipFile.AddDirectory(IO.TempPath);
789 zipFile.Save(pathZip);
792 IO.DeleteTempDirectory();
905 public void SetSeen(
int x,
int z,
bool seen =
true,
bool refresh =
true)
907 if (
cells[
x,
z].isSeen != seen)
920 for (
int i = 0; i <
Size; i++)
922 for (
int j = 0; j <
Size; j++)
937 EClass._map.SetSeen(p.x, p.z);
942 public void RefreshFOV(
int x,
int z,
int radius = 6,
bool recalculate =
false)
951 item.RecalculateFOV();
955 foreach (
Card item2
in list)
966 item.RecalculateFOV();
970 public void SetFloor(
int x,
int z,
int idMat = 0,
int idFloor = 0)
975 public void SetFloor(
int x,
int z,
int idMat,
int idFloor,
int dir)
978 cell._floorMat = (byte)idMat;
979 cell._floor = (byte)idFloor;
981 cell.isWatered =
false;
986 public void SetDeco(
int x,
int z,
int idMat,
int idDeco)
989 cell._decoMat = (byte)idMat;
990 cell._deco = (byte)idDeco;
994 public void SetBridge(
int x,
int z,
int height = 0,
int idMat = 0,
int idBridge = 0,
int dir = 0,
byte idPillar = 0)
997 cell.bridgeHeight = (byte)height;
998 cell._bridgeMat = (byte)idMat;
999 cell._bridge = (byte)idBridge;
1000 cell.bridgePillar = idPillar;
1001 cell.floorDir = dir;
1002 if (cell.
room !=
null)
1012 cell._roofBlockMat = (byte)idMat;
1013 cell._roofBlock = (byte)idBlock;
1014 cell._roofBlockDir = (byte)(dir + height * 4);
1018 public void SetBlock(
int x,
int z,
int idMat = 0,
int idBlock = 0)
1023 public void SetBlock(
int x,
int z,
int idMat,
int idBlock,
int dir)
1027 cell._blockMat = (byte)idMat;
1028 cell._block = (byte)idBlock;
1029 cell.blockDir = dir;
1034 cell.isToggleWallPillar =
false;
1035 if (cell.
room !=
null)
1066 if (
x > 0 &&
z <
Size - 1)
1088 if (
x > 0 &&
z <
Size - 1)
1096 if (!
cells[
x,
z].HasFloodBlock)
1112 FloodSpiller floodSpiller =
flood;
1113 IFloodCell[,] array =
cells;
1114 FloodSpiller.Result result = floodSpiller.SpillFlood(array,
x,
z);
1115 if (!result.IsValid)
1120 foreach (IFloodCell
item in result.visited)
1136 foreach (IFloodCell item2
in result.visited)
1162 foreach (IFloodCell item3
in result.visited)
1167 room.AddPoint(
new Point(b, b2));
1171 room.AddPoint(
new Point(b, b2 - 1));
1176 room.AddPoint(
new Point(b + 1, b2));
1181 room.AddPoint(
new Point(b + 1, b2 - 1));
1199 if (cell.
effect ==
null && amount > 0)
1225 if (CC !=
null && CC.IsPCFactionOrMinion && (CC.HasElement(1651) ||
EClass.
pc.
Evalue(1651) >= 2))
1230 List<Card> list =
new List<Card>();
1231 bool fire = ele == 910;
1232 bool cold = ele == 911;
1249 if (
item.IsPCFactionOrMinion)
1254 else if (!CanCook(
item))
1261 Card rootCard =
item.GetRootCard();
1271 if (
item.isThing &&
item.things.Count == 0)
1277 if (ele == 911 &&
item.HasElement(1236))
1285 Card rootCard2 =
item.GetRootCard();
1288 Msg.
Say((
item.isChara ?
"blanketInv_" :
"blanketGround_") + element.source.alias, thing,
item);
1300 foreach (
Thing item2
in item.things.List((
Thing a) => a.things.Count == 0))
1313 foreach (
Card item3
in list)
1320 if (item3.IsEquipmentOrRangedOrAmmo && (
EClass.
rnd(4) != 0 || ((item3.IsRangedWeapon || item3.Thing.isEquipped) && rootCard3.
IsPCFaction &&
EClass.
rnd(4) != 0)))
1327 if (item3.isFireproof || (!item3.category.IsChildOf(
"book") &&
EClass.
rnd(2) == 0))
1333 if (!item3.category.IsChildOf(
"drink") &&
EClass.
rnd(5) == 0)
1343 bool flag3 = CanCook(item3);
1352 if (!(item4.
row is
SourceThing.
Row { isOrigin: false, chance: not 0 } row) || row.components.IsEmpty() || (row.components.Length >= 3 && !row.components[2].StartsWith(
'+')) || !row.Category.IsChildOf(
"meal") || (row.HasTag(
CTAG.dish_fail) && power >
EClass.
rnd(500)))
1356 if (!row.factory.IsEmpty())
1358 switch (row.factory[0])
1367 if (row.components[0].Split(
'|').Contains(item3.id) || row.components[0].Split(
'|').Contains(item3.sourceCard._origin))
1372 if (list3.Count > 0)
1374 text = list3.RandomItemWeighted((
SourceThing.
Row r) => r.chance)?.
id;
1382 if (flag3 && !text.IsEmpty())
1385 List<Thing> list4 =
new List<Thing>();
1392 Msg.
Say(((rootCard3 == item3) ?
"cook_groundItem" :
"cook_invItem") + (fire ?
"" :
"_cold"), thing2, rootCard3, thing3.
Name);
1394 if (rootCard3 == item3)
1400 rootCard3.
Chara.
Pick(thing3, msg:
false);
1410 int num2 =
EClass.
rnd(item3.Num) / 2 + 1;
1411 if (item3.Num > num2)
1416 Msg.
Say((rootCard3 == item3) ?
"damage_groundItem" :
"damage_invItem", thing4, rootCard3);
1439 pos.PlayEffect(fire ?
"Element/eleFire" :
"Element/eleCold");
1445 bool CanCook(
Card c)
1447 if ((fire || cold) && c.
IsFood)
1449 return c.
category.IsChildOf(
"foodstuff");
1455 public void Burn(
int x,
int z,
bool instant =
false)
1485 if (cell.
room !=
null)
1502 foreach (
Card item in sharedPoint.ListCards())
1513 item.DamageHP(30L, 910);
1528 cell.effect = effect;
1564 cell.effect.amount += amount;
1581 public void SetObj(
int x,
int z,
int id = 0,
int value = 1,
int dir = 0)
1586 public void SetObj(
int x,
int z,
int idMat,
int idObj,
int value,
int dir,
bool ignoreRandomMat =
false)
1589 if (cell.
sourceObj.id == 118 || idObj == 118)
1591 EClass._zone.dirtyElectricity =
true;
1593 cell.obj = (byte)idObj;
1594 cell.objVal = (byte)value;
1595 cell.objMat = (byte)idMat;
1597 cell.isHarvested =
false;
1598 cell.isObjDyed =
false;
1600 if (!ignoreRandomMat && !sourceObj.
matCategory.IsEmpty())
1603 if (sourceObj.
tag.Contains(
"spot"))
1625 int num = ((!draw) ? 1 : 2);
1653 bool flag = p.sourceObj.id == 82;
1664 p.cell.objDir = row.
skin;
1692 if (recipeSource ==
null)
1697 if (iDIngredient ==
null)
1722 byte b = (flag ? point.cell._roofBlock : point.
cell.
_block);
1729 bool flag2 = c ==
null || c.IsAgent || c.IsPCFactionOrMinion;
1736 point.cell._roofBlock = 0;
1746 if (flag2 && point.
sourceObj.tileType.IsBlockMount && mineObj)
1777 point.cell.isModified =
true;
1894 if (c ==
null && task !=
null)
1898 bool num = c ==
null || c.IsAgent || c.IsPCFactionOrMinion;
1908 if (soilCost > maxSoil)
1910 num2 -=
EClass.
rnd(2 + (soilCost - maxSoil) / 10);
1923 cell.isHarvested =
true;
1933 if (cell.
HasBlock && (sourceObj.
id == 18 || sourceObj.
id == 19))
1935 MineBlock(point, recoverBlock:
false, c, mineObj:
false);
1946 switch (sourceObj.
alias)
1956 string[] array = sourceObj.
components[num3].Split(
'/');
1958 if (array.Length > 1)
1966 cell.gatherCount = 0;
2037 if (!
item.isThing || !
item.trait.CanBeDestroyed || !
item.IsInstalled)
2041 HitResult hitResult =
item.TileType._HitTest(point,
item.Thing, canIgnore:
false);
2042 if (
item.Thing.stackOrder != detail.things.IndexOf(
item.Thing) || (hitResult !=
HitResult.Valid && hitResult !=
HitResult.Warning))
2058 for (
int i = 0; i < 4; i++)
2061 if (dependedRamp !=
null)
2075 public void AddDecal(
int x,
int z,
int id,
int amount = 1,
bool refresh =
true)
2077 if (
x < 0 || z < 0 || x >=
Size ||
z >=
Size)
2084 if (cell.
decal / 8 !=
id && cell.
decal % 8 == 0)
2088 int num = Mathf.Clamp(((cell.
decal / 8 ==
id) ? (cell.
decal % 8) : 0) + amount, 0, 7);
2089 cell.decal = (byte)(
id * 8 + num);
2097 public void SetDecal(
int x,
int z,
int id = 0,
int amount = 1,
bool refresh =
true)
2099 cells[
x,
z].
decal = (byte)((
id != 0 && amount != 0) ? ((uint)(
id * 8 + amount)) : 0u);
2156 for (
int i = 0; i <
Size; i++)
2158 for (
int j = 0; j <
Size; j++)
2168 for (
int i =
x - 2; i <
x + 3; i++)
2170 if (i < 0 || i >=
Size)
2174 for (
int j =
z - 2; j <
z + 3; j++)
2176 if (j >= 0 && j <
Size && (
x != i ||
z != j))
2195 cell.isSurrounded4d = cell2.HasFullBlock && cell3.HasFullBlock && cell4.HasFullBlock && cell5.
HasFullBlock;
2196 cell.isSurrounded = cell.isSurrounded4d && cell6.HasFullBlock && cell7.HasFullBlock && cell8.HasFullBlock && cell9.
HasFullBlock;
2204 if (blockType ==
null)
2228 if (!blockType.IsRamp)
2249 if (
left.HasRamp && !
left.HasStairs &&
left.blockDir == 3)
2254 if (
back.HasRamp && !
back.HasStairs &&
back.blockDir == 2)
2264 for (
int i = 0; i < tries; i++)
2266 point.x = center.x +
EClass.
rnd(radius * 2 + 1) - radius;
2267 point.z = center.z +
EClass.
rnd(radius * 2 + 1) - radius;
2274 Debug.Log(
"GetRandomPoint failed center:" + center?.ToString() +
" rad:" + radius);
2275 point.IsValid =
false;
2283 for (
int i = 0; i < 10000; i++)
2307 int num = ((
EClass.
rnd(2) == 0) ? 1 : (-1));
2308 int num2 = ((
EClass.
rnd(2) == 0) ? 1 : (-1));
2309 for (
int i = 0; i < 3; i++)
2311 point.x = center.x - num + i * num;
2312 for (
int j = 0; j < 3; j++)
2314 point.z = center.z - num2 + j * num2;
2326 List<Point> list =
new List<Point>();
2339 List<Point> list =
new List<Point>();
2352 List<Chara> list =
new List<Chara>();
2356 if (detail ==
null || detail.
charas.Count <= 0)
2360 foreach (
Chara chara
in item.detail.charas)
2370 Point to2 =
new Point((to.
x > center.
x) ? 1 : ((to.
x < center.
x) ? (-1) : 0), (to.
z > center.
z) ? 1 : ((to.
z < center.
z) ? (-1) : 0));
2372 List<Point> list =
new List<Point>();
2377 if ((Mathf.Abs(diff - angle2) < angle || Mathf.Abs(diff - angle2 + 360f) < angle || Mathf.Abs(360f - diff + angle2) < angle) &&
Los.
IsVisible(center, p) && !p.
IsBlocked)
2387 return Los.
ListVisible(center, to, radius,
null, returnOnBlocked);
2392 if (size >
Size / 2 + 1)
2394 size =
Size / 2 - 1;
2402 bounds.Size = b.
Size;
2407 for (
int i = 0; i <
Size; i++)
2409 for (
int j = 0; j <
Size; j++)
2411 action(
cells[i, j]);
2419 for (
int i = 0; i <
Size; i++)
2421 for (
int j = 0; j <
Size; j++)
2423 action(point.
Set(i, j));
2430 for (
int i = 0; i <
Size; i++)
2432 for (
int j = 0; j <
Size; j++)
2442 int num = (int)Mathf.Ceil(r);
2443 for (
int i = _x - num; i < _x + num + 1; i++)
2445 if (i < 0 || i >=
Size)
2449 for (
int j = _z - num; j < _z + num + 1; j++)
2451 if (j >= 0 && j <
Size && (
float)((i - _x) * (i - _x) + (j - _z) * (j - _z)) < r * r)
2463 for (
int i = _x - r; i < _x + r + 1; i++)
2465 if (i < 0 || i >=
Size)
2469 for (
int j = _z - r; j < _z + r + 1; j++)
2471 if (j >= 0 && j <
Size)
2483 int num2 = center.
z;
2485 for (
int i = num - 1; i < num + 2; i++)
2487 if (i < 0 || i >=
Size)
2491 for (
int j = num2 - 1; j < num2 + 2; j++)
2493 if (j >= 0 && j <
Size)
2506 for (num = 0; num <
Size; num++)
2509 for (num2 = 0; num2 <
Size; num2++)
2587 List<Chara> list =
new List<Chara>();
2600 List<Thing> list =
new List<Thing>();
2627 if (thing.
parent !=
null)
2631 thing.isMasked =
false;
2632 thing.isRoofItem =
false;
2663 if (chara.
uid == uid)
2687 if (thing.
uid == uid)
2699 if (thing.
trait is T)
2701 return thing.trait as T;
2726 if (area1 ==
null && area2 ==
null)
2730 Thing thing = Find(area1);
2731 if (thing ==
null && area2 !=
null)
2733 thing = Find(area2);
2756 if (area1 ==
null && area2 ==
null)
2765 if (enumerable.Count() > 0)
2767 thing = enumerable.RandomItem() as
Thing;
2770 if (thing ==
null && area2 !=
null)
2773 if (enumerable2.Count() > 0)
2775 thing = enumerable2.RandomItem() as
Thing;
2783 Thing result =
null;
2785 where a.pos.IsPublicSpace()
2787 if (enumerable.Count() > 0)
2789 result = enumerable.RandomItem() as
Thing;
2797 where a.type.IsPublicArea
2798 select a).RandomItem();
static bool not(DramaManager dm, Dictionary< string, string > line, params string[] parameters)
override bool IsRoofEditMode(Card c=null)
void Add(Act a, string s="")
Thing TryMakeRandomItem(int lv=-1, TryMakeRandomItemSource itemSource=TryMakeRandomItemSource.Default, Chara crafter=null)
void SetPlaceState(PlaceState newState, bool byPlayer=false)
ElementContainerCard elements
virtual void Die(Element e=null, Card origin=null, AttackSource attackSource=AttackSource.None, Chara originalTarget=null)
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
Thing AddThing(string id, int lv=-1)
void Kick(Point p, bool ignoreSelf=false, bool checkWall=true)
void ForeachPoint(Action< Point, bool > action)
void ModCharge(int a, bool destroy=false)
bool HasEditorTag(EditorTag tag)
Thing Add(string id, int num=1, int lv=1)
SourceCategory.Row category
SourceBlock.Row sourceBlock
bool CanBuildRamp(int dir)
SourceFloor.Row sourceFloor
SourceMaterial.Row matObj
CellDetail GetOrCreateDetail()
SourceMaterial.Row matObj_fixed
void PickOrDrop(Point p, string idThing, int idMat=-1, int num=1, bool msg=true)
override bool IsPCFaction
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
bool ignoreBackerDestoryFlag
Thing GetOrCreateDebugContainer()
static void MakeDish(Thing food, int lv, Chara crafter=null, int seed=-1)
static void RebuildCritter(Cell cell)
static int curve(long _a, int start, int step, int rate=75)
static SourceManager sources
static FactionBranch Branch
static Effect Get(Effect original)
void Play(float delay, Point from, float fixY=0f, Point to=null, Sprite sprite=null)
Element ModBase(int ele, int v)
static Element Create(int id, int v=0)
static FowProfile Load(string id)
static void SaveFile(string path, object obj)
bool disableUsermapBenefit
static void Load(string id, bool cloud)
bool Save(bool isAutoSave=false, bool silent=false)
void PopMineObj(Chara c=null)
LogicalPoint GetOrCreate(Point point)
static List< Point > ListVisible(Point p1, Point p2, int radius, Action< Point, bool > _onVisit=null, bool returnOnBlocked=true)
static bool IsVisible(Point p1, Point p2, Action< Point, bool > _onVisit=null)
static SourceMaterial.Row GetRandomMaterialFromCategory(int lv, string cat, SourceMaterial.Row fallback)
void SetBounds(int _x, int _z, int _maxX, int _maxZ)
Point GetSurface(int x, int z, bool walkable=true)
void ForeachCell(Action< Cell > action)
new void ForeachXYZ(Action< int, int > action)
new void ForeachCell(Action< Cell > action)
void TrySmoothPick(Point p, Thing t, Chara c)
Thing FindThing(Type type, BaseArea area1, BaseArea area2=null)
void RefreshNeighborTiles(int x, int z)
Thing FindThing(Func< Thing, bool > func)
PlantData TryGetPlant(Point p)
void ForeachSphere(int _x, int _z, float r, Action< Point > action)
Dictionary< int, int > gatherCounts
void Shift(Vector2Int offset)
Thing FindThing(Type type, Chara c=null)
void ExportMetaData(string _path, string id, PartialMap partial=null)
Chara FindChara(string id)
IEnumerable< Card > Cards
void RefreshSingleTile(int x, int z)
Point GetRandomPoint(Point center, int radius, int tries=100, bool mustBeWalkable=true, bool requireLos=true)
void RemovePlant(Point pos)
BaseArea FindPublicArea()
static void UpdateMetaData(string pathZip, PartialMap partial=null)
void DestroyObj(Point point)
void SetBridge(int x, int z, int height=0, int idMat=0, int idBridge=0, int dir=0, byte idPillar=0)
void Save(string path, ZoneExportData export=null, PartialMap partial=null)
void TrySmoothPick(Cell cell, Thing t, Chara c)
void AddCardOnActivate(Card c)
Dictionary< int, CellEffect > cellEffects
void RefreshFOV(int x, int z, int radius=6, bool recalculate=false)
List< Point > ListPointsInArc(Point center, Point to, int radius, float angle)
void MoveCard(Point p, Card t)
Thing FindThing(string workTag, Chara c)
void AddBackerTree(bool draw)
void Reveal(Point center, int power=100)
void SetBlockDir(int x, int z, int dir)
void MineObj(Point point, Task task=null, Chara c=null)
void SetLiquid(int x, int z, CellEffect effect=null)
void OnCardRemovedFromZone(Card t)
Point GetNearbyResourcePoint(Point center)
void SetDecal(int x, int z, int id=0, int amount=1, bool refresh=true)
PlantData TryGetPlant(Cell c)
int CountChara(Faction faction)
void MineBlock(Point point, bool recoverBlock=false, Chara c=null, bool mineObj=true)
List< Chara > ListCharasInCircle(Point center, float radius, bool los=true)
void SetFloor(int x, int z, int idMat, int idFloor, int dir)
void OnDeserialized(StreamingContext context)
void SetFoormark(Point pos, int id, int angle, int offset=0)
byte[] TryLoadFile(string path, string s, int size)
void _ValidateInstalled(int x, int y)
int GetRampDir(int x, int z, TileType blockType=null)
List< Thing > ListThing< T >()
Dictionary< int, int > backerObjs
void ModFire(int x, int z, int amount)
void SetDeco(int x, int z, int idMat, int idDeco)
void _AddCard(int x, int z, Card t, bool onAddToZone)
void Burn(int x, int z, bool instant=false)
void MineObjSound(Point point)
void OnSerializing(StreamingContext context)
void SetSeen(int x, int z, bool seen=true, bool refresh=true)
void ModLiquid(int x, int z, int amount)
void MineFloor(Point point, Chara c=null, bool recoverBlock=false, bool removePlatform=true)
void SetFloor(int x, int z, int idMat=0, int idFloor=0)
void SetBounds(MapBounds b)
void TryShatter(Point pos, int ele, int power, Card CC=null)
void SetBlock(int x, int z, int idMat=0, int idBlock=0)
PlantData AddPlant(Point pos, Thing seed)
void ForeachSquare(int _x, int _z, int r, Action< Point > action)
void TryRemoveRoom(int x, int z)
List< Footmark > footmarks
void SetRoofBlock(int x, int z, int idMat, int idBlock, int dir, int height)
new Point GetRandomEdge(int r=3)
void OnImport(ZoneExportData data)
List< Point > ListPointsInSquare(Point center, int radius, bool mustBeWalkable=true, bool los=true)
new void ForeachPoint(Action< Point > action)
void TryAddRoom(int x, int z)
void DestroyBlock(int x, int z)
void QuickRefreshTile(int x, int z)
List< Chara > serializedCharas
static bool isDirtySunMap
static MapMetaData GetMetaData(string pathZip)
virtual void OnSerializing()
void RemoveLonelyRamps(Cell cell)
void SetBlock(int x, int z, int idMat, int idBlock, int dir)
void SetLiquid(int x, int z, int id, int value=1)
void ValidateInstalled(Point p)
void DropBlockComponent(Point point, TileRow r, SourceMaterial.Row mat, bool recoverBlock, bool isPlatform=false, Chara c=null)
MapExportSetting exportSetting
void SetEffect(int x, int z, CellEffect effect=null)
void OnCardAddedToZone(Card t, int x, int z)
Thing FindThing(string workTag, BaseArea area1=null, BaseArea area2=null)
void ForeachNeighbor(Point center, Action< Point > action)
void OnSetBlockOrDoor(int x, int z)
void Load(string path, bool import=false, PartialMap partial=null)
CellEffectManager effectManager
List< Point > ListPointsInLine(Point center, Point to, int radius, bool returnOnBlocked=true)
Cell GetDependedRamp(Cell cell)
void MineRamp(Point point, int ramp, bool recoverBlock=false)
List< Point > ListPointsInCircle(Point center, float radius, bool mustBeWalkable=true, bool los=true)
void CreateNew(int size, bool setReference=true)
void AddDecal(int x, int z, int id, int amount=1, bool refresh=true)
void RevealAll(bool reveal=true)
IO.Compression compression
void SetObj(int x, int z, int idMat, int idObj, int value, int dir, bool ignoreRandomMat=false)
Dictionary< int, PlantData > plants
List< Chara > ListChara(Faction faction)
List< TransAnime > pointAnimes
void RefreshShadow(int x, int z)
void ApplyBackerObj(Point p, int id=-1)
void SetObj(int x, int z, int id=0, int value=1, int dir=0)
SourceBacker.Row GetBackerObj(Point p)
static HashSet< int > sunMap
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
static PathManager Instance
HashSet< int > doneBackers
void ClearMapHighlights()
SourceMaterial.Row matBlock
SourceMaterial.Row matFloor
List< Card > ListCards(bool includeMasked=false)
Point Set(int _x, int _z)
SourceMaterial.Row matBridge
void SetFloor(int idMat=0, int idFloor=0)
SoundSource PlaySound(string id, bool synced=true, float v=1f, bool spatial=true)
bool Equals(int _x, int _z)
SourceFloor.Row sourceFloor
void SetBlock(int idMat=0, int idBlock=0)
bool HasRoomOrArea(BaseArea a)
Point Clamp(bool useBounds=false)
float GetAngle2(Point to)
void Animate(AnimeID id, bool animeBlock=false)
SourceFloor.Row sourceBridge
void OnCardAddedToZone(Card c)
Dictionary< string, PropSet > workMap
static void SetSeed(int a=-1)
static List< RecipeSource > list
static RecipeSource Get(string id)
static SceneProfile Load(string id)
void AddActorEx(Card c, Action< ActorEx > onBeforeSetOwner=null)
void Restore(Map map, Map orgMap, bool addToZone, PartialMap partial=null)
void AddBlood(Point p, int a=1)
string GetSoundDead(RenderRow c=null)
bool OnMineWreck(Point point)
static Thing CreateRawMaterial(SourceMaterial.Row m)
static Thing CreateBlock(int id, int idMat)
static Thing CreateFloor(int id, int idMat, bool platform=false)
static Thing Create(string id, int idMat=-1, int lv=-1)
static Thing MakeSeed(string idSource)
virtual List< Point > ListPoints(Point center=null, bool onlyPassable=true)
virtual void OnAddedToZone()
virtual bool CanCopyInBlueprint
virtual void OnRemovedFromZone()
virtual bool CanOnlyCarry
static void Say(string text, FontColor fontColor=FontColor.Default, Sprite sprite=null)
SerializedCards serializedCards
virtual bool DisableRooms
virtual bool IsUnderwater
Card AddCard(Card t, Point point)
void Init(IPathfindGrid _grid, WeightCell[,] _weightMap, int size)