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];
414 for (
int i = num; i < num + num3; i++)
416 for (
int j = num2; j < num2 + num4; j++)
419 array[num6] = cell.
objVal;
421 array2[num6] = cell.
_block;
423 array4[num6] = cell.
_floor;
424 array6[num6] = cell.
obj;
425 array7[num6] = cell.
objMat;
426 array8[num6] = cell.
decal;
427 array9[num6] = cell.
_dirs;
428 array12[num6] = cell.
height;
436 array10[num6] = array10[num6].SetBit(1, cell.
isSeen);
437 array10[num6] = array10[num6].SetBit(2, cell.
isHarvested);
438 array10[num6] = array10[num6].SetBit(3, cell.
impassable);
439 array10[num6] = array10[num6].SetBit(4, cell.
isModified);
440 array10[num6] = array10[num6].SetBit(5, cell.
isClearSnow);
441 array10[num6] = array10[num6].SetBit(6, cell.
isForceFloat);
443 array11[num6] = array11[num6].SetBit(0, cell.
isWatered);
444 array11[num6] = array11[num6].SetBit(1, cell.
isObjDyed);
445 array11[num6] = array11[num6].SetBit(2, cell.
crossWall);
454 IO.WriteLZ4(path +
"objVals", array);
455 IO.WriteLZ4(path +
"blocks", array2);
456 IO.WriteLZ4(path +
"blockMats", array3);
457 IO.WriteLZ4(path +
"floors", array4);
458 IO.WriteLZ4(path +
"floorMats", array5);
459 IO.WriteLZ4(path +
"objs", array6);
460 IO.WriteLZ4(path +
"objMats", array7);
461 IO.WriteLZ4(path +
"decal", array8);
462 IO.WriteLZ4(path +
"flags", array10);
463 IO.WriteLZ4(path +
"flags2", array11);
464 IO.WriteLZ4(path +
"dirs", array9);
465 IO.WriteLZ4(path +
"heights", array12);
466 IO.WriteLZ4(path +
"bridges", array13);
467 IO.WriteLZ4(path +
"bridgeMats", array14);
468 IO.WriteLZ4(path +
"bridgeHeights", array15);
469 IO.WriteLZ4(path +
"bridgePillars", array16);
470 IO.WriteLZ4(path +
"roofBlocks", array18);
471 IO.WriteLZ4(path +
"roofBlockMats", array19);
472 IO.WriteLZ4(path +
"roofBlockDirs", array17);
487 export.serializedCards.cards.Clear();
497 export.serializedCards.Add(chara2);
502 export.serializedCards.Add(chara2);
509 export.serializedCards.Add(thing);
519 export.serializedCards.Add(thing2);
523 List<Thing> list =
things;
524 things =
new List<Thing>();
533 byte[] array = IO.ReadLZ4(path + s, size,
compression);
536 Debug.Log(
"Couldn't load:" + s);
537 return new byte[size];
556 int size = num * num2;
563 byte[] bytes2 = TryLoad(
"objVals");
564 byte[] bytes3 = TryLoad(
"blockMats");
565 byte[] bytes4 = TryLoad(
"blocks");
566 byte[] bytes5 = TryLoad(
"floorMats");
567 byte[] bytes6 = TryLoad(
"floors");
568 byte[] bytes7 = TryLoad(
"objs");
569 byte[] bytes8 = TryLoad(
"objMats");
570 byte[] bytes9 = TryLoad(
"decal");
571 byte[] bytes10 = TryLoad(
"dirs");
572 byte[] bytes11 = TryLoad(
"flags");
573 byte[] bytes12 = TryLoad(
"flags2");
574 byte[] bytes13 = TryLoad(
"heights");
575 byte[] bytes14 = TryLoad(
"bridges");
576 byte[] bytes15 = TryLoad(
"bridgeMats");
577 byte[] bytes16 = TryLoad(
"bridgeHeights");
578 byte[] bytes17 = TryLoad(
"bridgePillars");
579 byte[] bytes18 = TryLoad(
"roofBlocks");
580 byte[] bytes19 = TryLoad(
"roofBlockMats");
581 byte[] bytes20 = TryLoad(
"roofBlockDirs");
582 if (bytes17.Length < size)
584 bytes17 =
new byte[size];
586 if (bytes2.Length < size)
588 bytes2 =
new byte[size];
590 if (bytes12.Length < size)
592 bytes12 =
new byte[size];
594 Validate(ref bytes2,
"objVals");
595 Validate(ref bytes3,
"blockMats");
596 Validate(ref bytes4,
"blocks");
597 Validate(ref bytes5,
"floorMats");
598 Validate(ref bytes6,
"floors");
599 Validate(ref bytes7,
"objs");
600 Validate(ref bytes8,
"objMats");
601 Validate(ref bytes9,
"decal");
602 Validate(ref bytes10,
"dirs");
603 Validate(ref bytes11,
"flags");
604 Validate(ref bytes12,
"flags2");
605 Validate(ref bytes13,
"heights");
606 Validate(ref bytes14,
"bridges");
607 Validate(ref bytes15,
"bridgeMats");
608 Validate(ref bytes16,
"bridgeHeights");
609 Validate(ref bytes17,
"bridgePillars");
610 Validate(ref bytes18,
"roofBlocks");
611 Validate(ref bytes19,
"roofBlockMats");
612 Validate(ref bytes20,
"roofBlockDirs");
616 for (
int i = 0; i < num; i++)
618 for (
int j = 0; j < num2; j++)
624 objVal = bytes2[num3],
625 _blockMat = bytes3[num3],
626 _block = bytes4[num3],
627 _floorMat = bytes5[num3],
628 _floor = bytes6[num3],
630 objMat = bytes8[num3],
631 decal = bytes9[num3],
632 _dirs = bytes10[num3],
633 height = bytes13[num3],
634 _bridge = bytes14[num3],
635 _bridgeMat = bytes15[num3],
636 bridgeHeight = bytes16[num3],
637 bridgePillar = bytes17[num3],
638 _roofBlock = bytes18[num3],
639 _roofBlockMat = bytes19[num3],
640 _roofBlockDir = bytes20[num3],
641 isSeen = bytes11[num3].GetBit(1),
642 isHarvested = bytes11[num3].GetBit(2),
643 impassable = bytes11[num3].GetBit(3),
644 isModified = bytes11[num3].GetBit(4),
645 isClearSnow = bytes11[num3].GetBit(5),
646 isForceFloat = bytes11[num3].GetBit(6),
647 isToggleWallPillar = bytes11[num3].GetBit(7),
648 isWatered = bytes12[num3].GetBit(0),
649 isObjDyed = bytes12[num3].GetBit(1),
650 crossWall = bytes12[num3].GetBit(2)
672 foreach (KeyValuePair<int, CellEffect> cellEffect
in cellEffects)
674 int key = cellEffect.Key;
675 int num4 = key %
Size;
676 int num5 = key /
Size;
678 if (cellEffect.Value.IsFire)
685 byte[] TryLoad(
string s)
689 void Validate(ref
byte[] bytes,
string id)
691 if (bytes.Length < size)
693 Debug.LogError(
"expection: size invalid:" +
id +
" " + bytes.Length +
"/" + size);
694 bytes =
new byte[size];
728 custom.id = (mapMetaData.id = id);
729 IO.SaveFile(_path +
"meta", mapMetaData);
736 using ZipFile zipFile = ZipFile.Read(pathZip);
737 ZipEntry zipEntry = zipFile[
"meta"];
738 if (zipEntry !=
null)
740 using (MemoryStream stream =
new MemoryStream())
742 zipEntry.Extract(stream);
744 mapMetaData.path = pathZip;
749 catch (Exception message)
751 if (Application.isEditor)
761 IO.CreateTempDirectory();
762 ZipFile zipFile = ZipFile.Read(pathZip);
763 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
764 zipFile.ExtractAll(IO.TempPath);
767 using (zipFile =
new ZipFile())
769 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
770 zipFile.AddDirectory(IO.TempPath);
771 zipFile.Save(pathZip);
774 IO.DeleteTempDirectory();
886 public void SetSeen(
int x,
int z,
bool seen =
true,
bool refresh =
true)
888 if (
cells[
x,
z].isSeen != seen)
901 for (
int i = 0; i <
Size; i++)
903 for (
int j = 0; j <
Size; j++)
918 EClass._map.SetSeen(p.x, p.z);
923 public void RefreshFOV(
int x,
int z,
int radius = 6,
bool recalculate =
false)
932 item.RecalculateFOV();
936 foreach (
Card item2
in list)
947 item.RecalculateFOV();
951 public void SetFloor(
int x,
int z,
int idMat = 0,
int idFloor = 0)
956 public void SetFloor(
int x,
int z,
int idMat,
int idFloor,
int dir)
959 cell._floorMat = (byte)idMat;
960 cell._floor = (byte)idFloor;
966 public void SetBridge(
int x,
int z,
int height = 0,
int idMat = 0,
int idBridge = 0,
int dir = 0)
969 cell.bridgeHeight = (byte)height;
970 cell._bridgeMat = (byte)idMat;
971 cell._bridge = (byte)idBridge;
972 cell.bridgePillar = 0;
974 if (cell.
room !=
null)
981 public void SetRoofBlock(
int x,
int z,
int idMat,
int idBlock,
int dir,
int height)
984 cell._roofBlockMat = (byte)idMat;
985 cell._roofBlock = (byte)idBlock;
986 cell._roofBlockDir = (byte)(dir + height * 4);
990 public void SetBlock(
int x,
int z,
int idMat = 0,
int idBlock = 0)
995 public void SetBlock(
int x,
int z,
int idMat,
int idBlock,
int dir)
999 cell._blockMat = (byte)idMat;
1000 cell._block = (byte)idBlock;
1001 cell.blockDir = dir;
1006 cell.isToggleWallPillar =
false;
1007 if (cell.
room !=
null)
1038 if (
x > 0 &&
z <
Size - 1)
1060 if (
x > 0 &&
z <
Size - 1)
1068 if (!
cells[
x,
z].HasFloodBlock)
1084 FloodSpiller floodSpiller =
flood;
1085 IFloodCell[,] array =
cells;
1086 FloodSpiller.Result result = floodSpiller.SpillFlood(array,
x,
z);
1087 if (!result.IsValid)
1092 foreach (IFloodCell
item in result.visited)
1108 foreach (IFloodCell item2
in result.visited)
1134 foreach (IFloodCell item3
in result.visited)
1139 room.AddPoint(
new Point(b, b2));
1143 room.AddPoint(
new Point(b, b2 - 1));
1148 room.AddPoint(
new Point(b + 1, b2));
1153 room.AddPoint(
new Point(b + 1, b2 - 1));
1171 if (cell.
effect ==
null && amount > 0)
1197 List<Card> list =
new List<Card>();
1198 bool fire = ele == 910;
1199 bool flag = ele == 911;
1214 Card rootCard =
item.GetRootCard();
1224 if (
item.isThing &&
item.things.Count == 0)
1230 if (ele == 911 &&
item.HasElement(1236))
1238 Card rootCard2 =
item.GetRootCard();
1241 Msg.
Say((
item.isChara ?
"blanketInv_" :
"blanketGround_") + element.source.alias, thing,
item);
1253 foreach (
Thing item2
in item.things.List((
Thing a) => a.things.Count == 0))
1265 foreach (
Card item3
in list)
1272 if (item3.IsEquipmentOrRangedOrAmmo && (
EClass.
rnd(4) != 0 || ((item3.IsRangedWeapon || item3.Thing.isEquipped) && rootCard3.
IsPCFaction &&
EClass.
rnd(4) != 0)))
1279 if (item3.isFireproof || (!item3.category.IsChildOf(
"book") &&
EClass.
rnd(2) == 0))
1285 if (!item3.category.IsChildOf(
"drink") &&
EClass.
rnd(5) == 0)
1295 bool flag2 = CanCook(item3);
1302 if (!(item4.
row is
SourceThing.
Row { isOrigin: false } row) || row.components.IsEmpty() || (row.components.Length >= 3 && !row.components[2].StartsWith(
'+')) || !row.Category.IsChildOf(
"meal"))
1306 if (!row.factory.IsEmpty())
1308 switch (row.factory[0])
1317 if (row.components[0] == item3.id || row.components[0] == item3.sourceCard._origin)
1322 if (list3.Count > 0)
1324 text = list3.RandomItem().
id;
1327 if (flag2 && !text.IsEmpty())
1331 List<Thing> list4 =
new List<Thing>();
1338 Msg.
Say((rootCard3 == item3) ?
"cook_groundItem" :
"cook_invItem", thing2, rootCard3, thing3.
Name);
1340 if (rootCard3 == item3)
1346 rootCard3.
Chara.
Pick(thing3, msg:
false);
1356 int num2 =
EClass.
rnd(item3.Num) / 2 + 1;
1357 if (item3.Num > num2)
1362 Msg.
Say((rootCard3 == item3) ?
"damage_groundItem" :
"damage_invItem", thing4, rootCard3);
1386 bool CanCook(
Card c)
1390 return c.
category.IsChildOf(
"foodstuff");
1396 public void Burn(
int x,
int z,
bool instant =
false)
1426 if (cell.
room !=
null)
1443 foreach (
Card item in sharedPoint.ListCards())
1454 item.DamageHP(30, 910);
1469 cell.effect = effect;
1505 cell.effect.amount += amount;
1522 public void SetObj(
int x,
int z,
int id = 0,
int value = 1,
int dir = 0)
1527 public void SetObj(
int x,
int z,
int idMat,
int idObj,
int value,
int dir,
bool ignoreRandomMat =
false)
1530 if (cell.
sourceObj.id == 118 || idObj == 118)
1532 EClass._zone.dirtyElectricity =
true;
1534 cell.obj = (byte)idObj;
1535 cell.objVal = (byte)value;
1536 cell.objMat = (byte)idMat;
1538 cell.isHarvested =
false;
1539 cell.isObjDyed =
false;
1541 if (!ignoreRandomMat && !sourceObj.
matCategory.IsEmpty())
1544 if (sourceObj.
tag.Contains(
"spot"))
1566 int num = ((!draw) ? 1 : 2);
1594 bool flag = p.sourceObj.id == 82;
1605 p.cell.objDir = row.
skin;
1633 if (recipeSource ==
null)
1638 if (iDIngredient ==
null)
1663 byte b = (flag ? point.cell._roofBlock : point.
cell.
_block);
1670 bool flag2 = c ==
null || c.IsAgent || c.IsPCFactionOrMinion;
1677 point.cell._roofBlock = 0;
1687 if (flag2 && point.
sourceObj.tileType.IsBlockMount && mineObj)
1718 point.cell.isModified =
true;
1835 if (c ==
null && task !=
null)
1839 bool num = c ==
null || c.IsAgent || c.IsPCFactionOrMinion;
1844 if (task is
TaskHarvest { IsReapSeed: not
false })
1849 if (soilCost > maxSoil)
1851 num2 -=
EClass.
rnd(2 + (soilCost - maxSoil) / 10);
1864 cell.isHarvested =
true;
1874 if (cell.
HasBlock && (sourceObj.
id == 18 || sourceObj.
id == 19))
1876 MineBlock(point, recoverBlock:
false, c, mineObj:
false);
1878 switch (sourceObj.
alias)
1888 string[] array = sourceObj.
components[num3].Split(
'/');
1890 if (array.Length > 1)
1898 cell.gatherCount = 0;
1969 if (!
item.isThing || !
item.trait.CanBeDestroyed || !
item.IsInstalled)
1973 HitResult hitResult =
item.TileType._HitTest(point,
item.Thing, canIgnore:
false);
1974 if (
item.Thing.stackOrder != detail.things.IndexOf(
item.Thing) || (hitResult !=
HitResult.Valid && hitResult !=
HitResult.Warning))
1990 for (
int i = 0; i < 4; i++)
1993 if (dependedRamp !=
null)
2007 public void AddDecal(
int x,
int z,
int id,
int amount = 1,
bool refresh =
true)
2009 if (
x < 0 || z < 0 || x >=
Size ||
z >=
Size)
2016 if (cell.
decal / 8 !=
id && cell.
decal % 8 == 0)
2020 int num = Mathf.Clamp(((cell.
decal / 8 ==
id) ? (cell.
decal % 8) : 0) + amount, 0, 7);
2021 cell.decal = (byte)(
id * 8 + num);
2029 public void SetDecal(
int x,
int z,
int id = 0,
int amount = 1,
bool refresh =
true)
2031 cells[
x,
z].
decal = (byte)((
id != 0 && amount != 0) ? ((uint)(
id * 8 + amount)) : 0u);
2088 for (
int i = 0; i <
Size; i++)
2090 for (
int j = 0; j <
Size; j++)
2100 for (
int i =
x - 2; i <
x + 3; i++)
2102 if (i < 0 || i >=
Size)
2106 for (
int j =
z - 2; j <
z + 3; j++)
2108 if (j >= 0 && j <
Size && (
x != i ||
z != j))
2127 cell.isSurrounded4d = cell2.HasFullBlock && cell3.HasFullBlock && cell4.HasFullBlock && cell5.
HasFullBlock;
2128 cell.isSurrounded = cell.isSurrounded4d && cell6.HasFullBlock && cell7.HasFullBlock && cell8.HasFullBlock && cell9.
HasFullBlock;
2136 if (blockType ==
null)
2160 if (!blockType.IsRamp)
2181 if (
left.HasRamp && !
left.HasStairs &&
left.blockDir == 3)
2186 if (
back.HasRamp && !
back.HasStairs &&
back.blockDir == 2)
2196 for (
int i = 0; i < tries; i++)
2198 point.x = center.x +
EClass.
rnd(radius * 2 + 1) - radius;
2199 point.z = center.z +
EClass.
rnd(radius * 2 + 1) - radius;
2206 Debug.Log(
"GetRandomPoint failed center:" + center?.ToString() +
" rad:" + radius);
2207 point.IsValid =
false;
2215 for (
int i = 0; i < 10000; i++)
2239 int num = ((
EClass.
rnd(2) == 0) ? 1 : (-1));
2240 int num2 = ((
EClass.
rnd(2) == 0) ? 1 : (-1));
2241 for (
int i = 0; i < 3; i++)
2243 point.x = center.x - num + i * num;
2244 for (
int j = 0; j < 3; j++)
2246 point.z = center.z - num2 + j * num2;
2258 List<Point> list =
new List<Point>();
2271 List<Chara> list =
new List<Chara>();
2275 if (detail ==
null || detail.
charas.Count <= 0)
2279 foreach (
Chara chara
in item.detail.charas)
2289 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));
2291 List<Point> list =
new List<Point>();
2296 if ((Mathf.Abs(diff - angle2) < angle || Mathf.Abs(diff - angle2 + 360f) < angle || Mathf.Abs(360f - diff + angle2) < angle) &&
Los.
IsVisible(center, p) && !p.
IsBlocked)
2311 if (size >
Size / 2 + 1)
2313 size =
Size / 2 - 1;
2321 bounds.Size = b.
Size;
2326 for (
int i = 0; i <
Size; i++)
2328 for (
int j = 0; j <
Size; j++)
2330 action(
cells[i, j]);
2338 for (
int i = 0; i <
Size; i++)
2340 for (
int j = 0; j <
Size; j++)
2342 action(point.
Set(i, j));
2349 for (
int i = 0; i <
Size; i++)
2351 for (
int j = 0; j <
Size; j++)
2361 int num = (int)Mathf.Ceil(r);
2362 for (
int i = _x - num; i < _x + num + 1; i++)
2364 if (i < 0 || i >=
Size)
2368 for (
int j = _z - num; j < _z + num + 1; j++)
2370 if (j >= 0 && j <
Size && (
float)((i - _x) * (i - _x) + (j - _z) * (j - _z)) < r * r)
2382 int num2 = center.
z;
2384 for (
int i = num - 1; i < num + 2; i++)
2386 if (i < 0 || i >=
Size)
2390 for (
int j = num2 - 1; j < num2 + 2; j++)
2392 if (j >= 0 && j <
Size)
2405 for (num = 0; num <
Size; num++)
2408 for (num2 = 0; num2 <
Size; num2++)
2486 List<Chara> list =
new List<Chara>();
2499 List<Thing> list =
new List<Thing>();
2526 if (thing.
parent !=
null)
2530 thing.isMasked =
false;
2531 thing.isRoofItem =
false;
2562 if (chara.
uid == uid)
2586 if (thing.
uid == uid)
2598 if (thing.
trait is T)
2600 return thing.trait as T;
2625 if (area1 ==
null && area2 ==
null)
2629 Thing thing = Find(area1);
2630 if (thing ==
null && area2 !=
null)
2632 thing = Find(area2);
2655 if (area1 ==
null && area2 ==
null)
2664 if (enumerable.Count() > 0)
2666 thing = enumerable.RandomItem() as
Thing;
2669 if (thing ==
null && area2 !=
null)
2672 if (enumerable2.Count() > 0)
2674 thing = enumerable2.RandomItem() as
Thing;
2682 Thing result =
null;
2684 where a.pos.IsPublicSpace()
2686 if (enumerable.Count() > 0)
2688 result = enumerable.RandomItem() as
Thing;
2696 where a.type.IsPublicArea
2697 select a).RandomItem();
override bool IsRoofEditMode(Card c=null)
void Add(Act a, string s="")
void SetPlaceState(PlaceState newState, bool byPlayer=false)
ElementContainerCard elements
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
Thing AddThing(string id, int lv=-1)
void ForeachPoint(Action< Point, bool > action)
virtual void Die(Element e=null, Card origin=null, AttackSource attackSource=AttackSource.None)
void ModCharge(int a, bool destroy=false)
bool HasEditorTag(EditorTag tag)
Thing TryMakeRandomItem(int lv=-1)
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
void Kick(Point p, bool ignoreSelf=false)
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
bool ignoreBackerDestoryFlag
Thing GetOrCreateDebugContainer()
static void MakeDish(Thing food, int lv, Chara crafter=null)
static void RebuildCritter(Cell cell)
static int curve(int 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)
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)
void SetBridge(int x, int z, int height=0, int idMat=0, int idBridge=0, int dir=0)
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 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 TryShatter(Point pos, int ele, int power)
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
List< Point > ListPointsInLine(Point center, Point to, int radius)
void ModFire(int x, int z, int amount)
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 SetBlock(int x, int z, int idMat=0, int idBlock=0)
PlantData AddPlant(Point pos, Thing seed)
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)
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
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 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)
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(SourceObj.Row obj, PlantData plant=null)
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
Card AddCard(Card t, Point point)
void Init(IPathfindGrid _grid, WeightCell[,] _weightMap, int size)