Elin Decompiled Documentation EA 23.306 Nightly
Loading...
Searching...
No Matches
Map Class Reference
Inheritance diagram for Map:
MapBounds IPathfindGrid EClass

Public Member Functions

void CreateNew (int size, bool setReference=true)
 
void SetZone (Zone _zone)
 
void SetReference ()
 
void OnDeactivate ()
 
void Resize (int newSize)
 
void Shift (Vector2Int offset)
 
void Reload ()
 
void ReloadRoom ()
 
void Reset ()
 
void ResetEditorPos ()
 
void Save (string path, ZoneExportData export=null, PartialMap partial=null)
 
byte[] TryLoadFile (string path, string s, int size)
 
void Load (string path, bool import=false, PartialMap partial=null)
 
void ValidateVersion ()
 
void OnLoad ()
 
void OnImport (ZoneExportData data)
 
void ExportMetaData (string _path, string id, PartialMap partial=null)
 
void AddCardOnActivate (Card c)
 
void OnCardAddedToZone (Card t, int x, int z)
 
void OnCardRemovedFromZone (Card t)
 
void MoveCard (Point p, Card t)
 
void _AddCard (int x, int z, Card t, bool onAddToZone)
 
void _RemoveCard (Card t)
 
Cell GetCell (int index)
 
void SetSeen (int x, int z, bool seen=true, bool refresh=true)
 
void RevealAll (bool reveal=true)
 
void Reveal (Point center, int power=100)
 
void RefreshFOV (int x, int z, int radius=6, bool recalculate=false)
 
void RefreshFOVAll ()
 
void SetFloor (int x, int z, int idMat=0, int idFloor=0)
 
void SetFloor (int x, int z, int idMat, int idFloor, int dir)
 
void SetDeco (int x, int z, int idMat, int idDeco)
 
void SetBridge (int x, int z, int height=0, int idMat=0, int idBridge=0, int dir=0, byte idPillar=0)
 
void SetRoofBlock (int x, int z, int idMat, int idBlock, int dir, int height)
 
void SetBlock (int x, int z, int idMat=0, int idBlock=0)
 
void SetBlock (int x, int z, int idMat, int idBlock, int dir)
 
void OnSetBlockOrDoor (int x, int z)
 
void TryRemoveRoom (int x, int z)
 
void TryAddRoom (int x, int z)
 
void SetBlockDir (int x, int z, int dir)
 
void ModFire (int x, int z, int amount)
 
void TryShatter (Point pos, int ele, int power)
 
void Burn (int x, int z, bool instant=false)
 
void SetLiquid (int x, int z, CellEffect effect=null)
 
void SetLiquid (int x, int z, int id, int value=1)
 
void SetEffect (int x, int z, CellEffect effect=null)
 
void ModLiquid (int x, int z, int amount)
 
void ClearRainAndDecal ()
 
void SetObj (int x, int z, int id=0, int value=1, int dir=0)
 
void SetObj (int x, int z, int idMat, int idObj, int value, int dir, bool ignoreRandomMat=false)
 
void AddBackerTree (bool draw)
 
SourceBacker.Row GetBackerObj (Point p)
 
void ApplyBackerObj (Point p, int id=-1)
 
void DropBlockComponent (Point point, TileRow r, SourceMaterial.Row mat, bool recoverBlock, bool isPlatform=false, Chara c=null)
 
void MineBlock (Point point, bool recoverBlock=false, Chara c=null, bool mineObj=true)
 
void MineRamp (Point point, int ramp, bool recoverBlock=false)
 
void MineFloor (Point point, Chara c=null, bool recoverBlock=false, bool removePlatform=true)
 
void RefreshShadow (int x, int z)
 
void TrySmoothPick (Cell cell, Thing t, Chara c)
 
void TrySmoothPick (Point p, Thing t, Chara c)
 
void DestroyObj (Point point)
 
void MineObj (Point point, Task task=null, Chara c=null)
 
void MineObjSound (Point point)
 
PlantData TryGetPlant (Point p)
 
PlantData TryGetPlant (Cell c)
 
PlantData AddPlant (Point pos, Thing seed)
 
void RemovePlant (Point pos)
 
void ValidateInstalled (Point p)
 
void _ValidateInstalled (int x, int y)
 
void RemoveLonelyRamps (Cell cell)
 
void DestroyBlock (int x, int z)
 
void AddDecal (int x, int z, int id, int amount=1, bool refresh=true)
 
void SetDecal (int x, int z, int id=0, int amount=1, bool refresh=true)
 
void SetFoormark (Point pos, int id, int angle, int offset=0)
 
int AngleToIndex (int a)
 
void RefreshSingleTile (int x, int z)
 
void RefreshAllTiles ()
 
void RefreshNeighborTiles (int x, int z)
 
void QuickRefreshTile (int x, int z)
 
int GetRampDir (int x, int z, TileType blockType=null)
 
Cell GetDependedRamp (Cell cell)
 
Point GetRandomPoint (Point center, int radius, int tries=100, bool mustBeWalkable=true, bool requireLos=true)
 
new Point GetRandomEdge (int r=3)
 
Point GetNearbyResourcePoint (Point center)
 
List< PointListPointsInCircle (Point center, float radius, bool mustBeWalkable=true, bool los=true)
 
List< CharaListCharasInCircle (Point center, float radius, bool los=true)
 
List< PointListPointsInArc (Point center, Point to, int radius, float angle)
 
List< PointListPointsInLine (Point center, Point to, int radius, bool returnOnBlocked=true)
 
void SetBounds (int size)
 
void SetBounds (MapBounds b)
 
new void ForeachCell (Action< Cell > action)
 
new void ForeachPoint (Action< Point > action)
 
new void ForeachXYZ (Action< int, int > action)
 
void ForeachSphere (int _x, int _z, float r, Action< Point > action)
 
void ForeachNeighbor (Point center, Action< Point > action)
 
void Quake ()
 
int CountChara (Faction faction)
 
int CountGuest ()
 
int CountHostile ()
 
int CountWildAnimal ()
 
int CountNonHostile ()
 
List< CharaListChara (Faction faction)
 
List< ThingListThing< T > ()
 
bool PutAway (Card c)
 
Chara FindChara (string id)
 
Chara FindChara (int uid)
 
Thing FindThing (Func< Thing, bool > func)
 
Thing FindThing (int uid)
 
FindThing< T > ()
 
Thing FindThing (Type type, Chara c=null)
 
Thing FindThing (Type type, BaseArea area1, BaseArea area2=null)
 
Thing FindThing (string workTag, BaseArea area1=null, BaseArea area2=null)
 
Thing FindThing (string workTag, Chara c)
 
BaseArea FindPublicArea ()
 
void RefreshSunMap ()
 
- Public Member Functions inherited from MapBounds
void SetBounds (int _x, int _z, int _maxX, int _maxZ)
 
bool Contains (int dx, int dz)
 
bool Contains (Point p)
 
Point GetCenterPos ()
 
Point GetRandomTopPos ()
 
Point GetRandomRightPos ()
 
Point GetRandomBottomPos ()
 
Point GetRandomLeftPos ()
 
Point GetTopPos (float rate=-1f)
 
Point GetRightPos (float rate=-1f)
 
Point GetBottomPos (float rate=-1f)
 
Point GetLeftPos (float rate=-1f)
 
Point GetRandomPoint ()
 
Point GetSpawnPos (int x, int z, int maxX, int maxZ)
 
bool CanExpand (int a)
 
void Expand (int a)
 
Point GetSurface (int x, int z, bool walkable=true)
 
Point GetRandomSurface (int x, int z, int radius, bool walkable=true, bool allowWater=false)
 
Point GetRandomSurface (bool centered=false, bool walkable=true, bool allowWater=false)
 
Point GetRandomSpawnPos ()
 
Point GetRandomEdge (int r=3)
 
Point GetRandomSpace (int width, int height, int tries=100)
 
void ForeachCell (Action< Cell > action)
 
void ForeachPoint (Action< Point > action)
 
void ForeachXYZ (Action< int, int > action)
 

Static Public Member Functions

static MapMetaData GetMetaData (string pathZip)
 
static void UpdateMetaData (string pathZip, PartialMap partial=null)
 
- Static Public Member Functions inherited from EClass
static int rndSeed (int a, int seed)
 
static int rnd (long a)
 
static int rnd (int a)
 
static int curve (long _a, int start, int step, int rate=75)
 
static int sqrt (int a)
 
static int rndHalf (int a)
 
static float rndf (float a)
 
static int rndSqrt (int a)
 
static void Wait (float a, Card c)
 
static void Wait (float a, Point p)
 
static int Bigger (int a, int b)
 
static int Smaller (int a, int b)
 

Public Attributes

int seed
 
int _bits
 
IO.Compression compression
 
Version version
 
RoomManager rooms = new RoomManager()
 
TaskManager tasks = new TaskManager()
 
MapConfig config = new MapConfig()
 
CustomData custom
 
List< CharaserializedCharas = new List<Chara>()
 
List< CharadeadCharas = new List<Chara>()
 
List< Thingthings = new List<Thing>()
 
MapBounds bounds = new MapBounds()
 
List< int > _plDay = new List<int>()
 
List< int > _plNight = new List<int>()
 
Dictionary< int, int > gatherCounts = new Dictionary<int, int>()
 
Dictionary< int, CellEffectcellEffects = new Dictionary<int, CellEffect>()
 
Dictionary< int, int > backerObjs = new Dictionary<int, int>()
 
Dictionary< int, PlantDataplants = new Dictionary<int, PlantData>()
 
MapExportSetting exportSetting
 
BitArray32 bits
 
Playlist plDay
 
Playlist plNight
 
List< Characharas = new List<Chara>()
 
List< TransAnimepointAnimes = new List<TransAnime>()
 
Cell[,] cells
 
Zone zone
 
CellEffectManager effectManager = new CellEffectManager()
 
PropsManager props = new PropsManager()
 
FloodSpiller flood = new FloodSpiller()
 
BiomeProfile[,] biomes
 
POIMap poiMap
 
List< Footmarkfootmarks = new List<Footmark>()
 
FowProfile fowProfile
 
bool revealed
 
- Public Attributes inherited from MapBounds
int x
 
int z
 
int maxX
 
int maxZ
 
int Size
 

Static Public Attributes

static HashSet< int > sunMap = new HashSet<int>()
 
static bool isDirtySunMap
 
- Static Public Attributes inherited from EClass
static Core core
 

Protected Member Functions

virtual void OnSerializing ()
 

Properties

bool isBreakerDown [get, set]
 
PropsStocked Stocked [get]
 
PropsInstalled Installed [get]
 
PropsRoaming Roaming [get]
 
float sizeModifier [get]
 
bool isGenerated [get]
 
bool IsIndoor [get]
 
int SizeXZ [get]
 
IEnumerable< CardCards [get]
 
- Properties inherited from MapBounds
int CenterX [get]
 
int CenterZ [get]
 
int Width [get]
 
int Height [get]
 
- Properties inherited from EClass
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Faction Wilds [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static SoundManager Sound [get]
 
static CoreDebug debug [get]
 

Private Member Functions

void OnSerializing (StreamingContext context)
 
void OnDeserialized (StreamingContext context)
 

Private Attributes

HashSet< int > roomHash = new HashSet<int>()
 
List< Thing_things = new List<Thing>()
 

Detailed Description

Definition at line 12 of file Map.cs.

Member Function Documentation

◆ _AddCard()

void Map._AddCard ( int  x,
int  z,
Card  t,
bool  onAddToZone 
)
inline

Definition at line 858 of file Map.cs.

859 {
860 if (!onAddToZone)
861 {
862 _RemoveCard(t);
863 }
864 t.lastPos.Set(t.pos);
865 t.pos.Set(x, z);
866 if (t.IsMultisize)
867 {
868 t.ForeachPoint(delegate(Point p, bool main)
869 {
870 p.cell.AddCard(t);
871 });
872 }
873 else
874 {
875 t.Cell.AddCard(t);
876 }
877 t.CalculateFOV();
878 if (t.isThing && !t.trait.IDActorEx.IsEmpty())
879 {
881 }
882 }
virtual bool IsMultisize
Definition: Card.cs:2200
virtual bool isThing
Definition: Card.cs:2121
void CalculateFOV()
Definition: Card.cs:6805
void ForeachPoint(Action< Point, bool > action)
Definition: Card.cs:8190
Point pos
Definition: Card.cs:60
Trait trait
Definition: Card.cs:54
Cell Cell
Definition: Card.cs:2095
Point lastPos
Definition: Card.cs:62
void AddCard(Card c)
Definition: Cell.cs:1586
Definition: EClass.cs:6
static Scene scene
Definition: EClass.cs:31
int x
Definition: MapBounds.cs:8
void _RemoveCard(Card t)
Definition: Map.cs:884
Definition: Point.cs:9
Point Set(int _x, int _z)
Definition: Point.cs:503
Cell cell
Definition: Point.cs:51
void AddActorEx(Card c, Action< ActorEx > onBeforeSetOwner=null)
Definition: Scene.cs:1022
virtual string IDActorEx
Definition: Trait.cs:187

References _RemoveCard(), Scene.AddActorEx(), Cell.AddCard(), Card.CalculateFOV(), Card.Cell, Point.cell, Card.ForeachPoint(), Trait.IDActorEx, Card.IsMultisize, Card.isThing, Card.lastPos, Card.pos, EClass.scene, Point.Set(), Card.trait, MapBounds.x, and MapBounds.z.

Referenced by AddCardOnActivate(), MoveCard(), and OnCardAddedToZone().

◆ _RemoveCard()

void Map._RemoveCard ( Card  t)
inline

Definition at line 884 of file Map.cs.

885 {
886 if (t.IsMultisize)
887 {
888 t.ForeachPoint(delegate(Point p, bool main)
889 {
890 p.cell.RemoveCard(t);
891 });
892 }
893 else
894 {
895 t.Cell.RemoveCard(t);
896 }
897 t.ClearFOV();
898 }
void ClearFOV()
Definition: Card.cs:6895
void RemoveCard(Card c)
Definition: Cell.cs:1602

References Card.Cell, Point.cell, Card.ClearFOV(), Card.ForeachPoint(), Card.IsMultisize, and Cell.RemoveCard().

Referenced by _AddCard(), and OnCardRemovedFromZone().

◆ _ValidateInstalled()

void Map._ValidateInstalled ( int  x,
int  y 
)
inline

Definition at line 1997 of file Map.cs.

1998 {
1999 Point point = Point.shared.Set(x, y);
2000 if (!point.IsValid)
2001 {
2002 return;
2003 }
2004 List<Card> list = point.ListCards();
2005 CellDetail detail = point.cell.detail;
2006 if (detail == null)
2007 {
2008 return;
2009 }
2010 foreach (Card item in list)
2011 {
2012 if (!item.isThing || !item.trait.CanBeDestroyed || !item.IsInstalled)
2013 {
2014 continue;
2015 }
2016 HitResult hitResult = item.TileType._HitTest(point, item.Thing, canIgnore: false);
2017 if (item.Thing.stackOrder != detail.things.IndexOf(item.Thing) || (hitResult != HitResult.Valid && hitResult != HitResult.Warning))
2018 {
2019 if (EClass._zone.IsPCFaction || (!item.isNPCProperty && !(item.trait is TraitHarvest)))
2020 {
2021 item.SetPlaceState(PlaceState.roaming);
2022 }
2023 else if (item.rarity < Rarity.Legendary)
2024 {
2025 item.Die();
2026 }
2027 }
2028 }
2029 }
HitResult
Definition: HitResult.cs:2
PlaceState
Definition: PlaceState.cs:2
Rarity
Definition: Rarity.cs:2
Definition: Card.cs:11
List< Thing > things
Definition: CellDetail.cs:11
CellDetail detail
Definition: Cell.cs:100
static Zone _zone
Definition: EClass.cs:21
static Point shared
Definition: Point.cs:20
List< Card > ListCards(bool includeMasked=false)
Definition: Point.cs:1052
bool IsValid
Definition: Point.cs:88
bool IsPCFaction
Definition: Zone.cs:475

References EClass._zone, Point.cell, Cell.detail, Zone.IsPCFaction, Point.IsValid, item, Point.ListCards(), Point.Set(), Point.shared, and MapBounds.x.

Referenced by TryShatter(), and ValidateInstalled().

◆ AddBackerTree()

void Map.AddBackerTree ( bool  draw)
inline

Definition at line 1597 of file Map.cs.

1598 {
1600 int num = ((!draw) ? 1 : 2);
1601 EClass._map.bounds.ForeachCell(delegate(Cell c)
1602 {
1603 if (num > 0 && c.growth != null && c.growth.IsTree && c.growth.IsMature && (!EClass.player.doneBackers.Contains(item.id) || EClass.core.config.test.ignoreBackerDestoryFlag) && (c.sourceObj.alias == item.tree || item.tree == "random"))
1604 {
1605 backerObjs[c.index] = item.id;
1606 Debug.Log(c.index + "/" + c.x + "/" + c.z + "/" + item.id + "/" + item.Name + "/" + item.tree);
1607 num--;
1609 }
1610 });
1611 }
static int indexTree
Definition: BackerContent.cs:3
Definition: Cell.cs:7
GrowSystem growth
Definition: Cell.cs:233
byte z
Definition: Cell.cs:64
byte x
Definition: Cell.cs:62
int index
Definition: Cell.cs:122
bool ignoreBackerDestoryFlag
Definition: CoreConfig.cs:566
CoreConfig config
Definition: Core.cs:70
static Core core
Definition: EClass.cs:7
static Map _map
Definition: EClass.cs:19
static SourceManager sources
Definition: EClass.cs:43
static Player player
Definition: EClass.cs:13
virtual bool IsMature
Definition: GrowSystem.cs:117
virtual bool IsTree
Definition: GrowSystem.cs:101
void ForeachCell(Action< Cell > action)
Definition: MapBounds.cs:279
Dictionary< int, int > backerObjs
Definition: Map.cs:67
MapBounds bounds
Definition: Map.cs:52
HashSet< int > doneBackers
Definition: Player.cs:1140
List< Row > listTree
Definition: SourceBacker.cs:93
SourceBacker backers

References EClass._map, backerObjs, SourceManager.backers, bounds, Core.config, EClass.core, Debug, Player.doneBackers, MapBounds.ForeachCell(), Cell.growth, CoreConfig.Test.ignoreBackerDestoryFlag, Cell.index, BackerContent.indexTree, GrowSystem.IsMature, GrowSystem.IsTree, item, SourceBacker.listTree, EClass.player, EClass.sources, CoreConfig.test, Cell.x, and Cell.z.

Referenced by Zone_Field.OnGenerateMap().

◆ AddCardOnActivate()

void Map.AddCardOnActivate ( Card  c)
inline

Definition at line 795 of file Map.cs.

796 {
797 c.parent = zone;
799 Chara chara = c.Chara;
800 if (chara != null)
801 {
802 chara.currentZone = EClass._zone;
803 }
804 if (c.isChara)
805 {
806 if (!c.pos.IsInBounds)
807 {
809 }
810 }
811 else if (!c.pos.IsValid)
812 {
814 }
815 _AddCard(c.pos.x, c.pos.z, c, onAddToZone: true);
816 }
virtual Chara Chara
Definition: Card.cs:2110
virtual bool isChara
Definition: Card.cs:2123
Definition: Chara.cs:10
Point GetCenterPos()
Definition: MapBounds.cs:52
void _AddCard(int x, int z, Card t, bool onAddToZone)
Definition: Map.cs:858
PropsManager props
Definition: Map.cs:91
Zone zone
Definition: Map.cs:87
int x
Definition: Point.cs:36
int z
Definition: Point.cs:39
bool IsInBounds
Definition: Point.cs:104
void OnCardAddedToZone(Card c)
Definition: PropsManager.cs:25

References _AddCard(), EClass._map, EClass._zone, Card.Chara, MapBounds.GetCenterPos(), Card.isChara, Point.IsInBounds, Point.IsValid, PropsManager.OnCardAddedToZone(), Card.pos, props, Point.Set(), Point.x, Point.z, and zone.

Referenced by Zone.AddGlobalCharasOnActivate().

◆ AddDecal()

void Map.AddDecal ( int  x,
int  z,
int  id,
int  amount = 1,
bool  refresh = true 
)
inline

Definition at line 2050 of file Map.cs.

2051 {
2052 if (x < 0 || z < 0 || x >= Size || z >= Size)
2053 {
2054 return;
2055 }
2056 Cell cell = cells[x, z];
2057 if (cell.sourceFloor.tileType.AllowBlood && (cell.decal / 8 == id || cell.decal % 8 <= amount))
2058 {
2059 if (cell.decal / 8 != id && cell.decal % 8 == 0)
2060 {
2061 amount--;
2062 }
2063 int num = Mathf.Clamp(((cell.decal / 8 == id) ? (cell.decal % 8) : 0) + amount, 0, 7);
2064 cell.decal = (byte)(id * 8 + num);
2065 if (refresh)
2066 {
2068 }
2069 }
2070 }
SourceFloor.Row sourceFloor
Definition: Cell.cs:1064
byte decal
Definition: Cell.cs:46
int Size
Definition: MapBounds.cs:20
void RefreshNeighborTiles(int x, int z)
Definition: Map.cs:2140
Cell[,] cells
Definition: Map.cs:85

References cells, Cell.decal, RefreshNeighborTiles(), MapBounds.Size, Cell.sourceFloor, MapBounds.x, and MapBounds.z.

Referenced by Card.AddBlood(), SourceMaterial.Row.AddBlood(), AM_MoveInstalled.HitTest(), and CoreDebug.UpdateInput().

◆ AddPlant()

PlantData Map.AddPlant ( Point  pos,
Thing  seed 
)
inline

Definition at line 1973 of file Map.cs.

1974 {
1975 PlantData plantData = new PlantData
1976 {
1977 seed = seed
1978 };
1979 plants[pos.index] = plantData;
1980 return plantData;
1981 }
int seed
Definition: Map.cs:19
Dictionary< int, PlantData > plants
Definition: Map.cs:70
int index
Definition: Point.cs:49

References Point.index, plants, and seed.

Referenced by Zone.Generate(), TraitFertilizer.OnSimulateHour(), ZoneEventHarvest.OnVisit(), and TraitSeed.TrySprout().

◆ AngleToIndex()

int Map.AngleToIndex ( int  a)
inline

Definition at line 2095 of file Map.cs.

2096 {
2097 if (EClass._zone.IsRegion)
2098 {
2099 return a switch
2100 {
2101 135 => 7,
2102 180 => 0,
2103 225 => 1,
2104 -90 => 2,
2105 -45 => 3,
2106 0 => 4,
2107 45 => 5,
2108 _ => 6,
2109 };
2110 }
2111 return a switch
2112 {
2113 135 => 0,
2114 180 => 1,
2115 225 => 2,
2116 -90 => 3,
2117 -45 => 4,
2118 0 => 5,
2119 45 => 6,
2120 _ => 7,
2121 };
2122 }
virtual bool IsRegion
Definition: Spatial.cs:515

References EClass._zone, and Spatial.IsRegion.

Referenced by SetFoormark().

◆ ApplyBackerObj()

void Map.ApplyBackerObj ( Point  p,
int  id = -1 
)
inline

Definition at line 1622 of file Map.cs.

1623 {
1624 if (!p.HasObj)
1625 {
1626 return;
1627 }
1628 bool flag = p.sourceObj.id == 82;
1629 SourceBacker.Row row = ((id != -1) ? EClass.sources.backers.map.TryGetValue(id) : (flag ? EClass.sources.backers.listRemain.NextItem(ref BackerContent.indexRemain) : EClass.sources.backers.listTree.NextItem(ref BackerContent.indexTree)));
1630 if (row == null)
1631 {
1632 return;
1633 }
1635 {
1636 backerObjs[p.index] = row.id;
1637 if (flag)
1638 {
1639 p.cell.objDir = row.skin;
1640 }
1641 }
1642 else
1643 {
1644 backerObjs.Remove(p.index);
1645 }
1646 }
static int indexRemain
Definition: BackerContent.cs:5
bool HasObj
Definition: Point.cs:137
List< Row > listRemain
Definition: SourceBacker.cs:87

References backerObjs, SourceManager.backers, Core.config, EClass.core, Player.doneBackers, Point.HasObj, SourceBacker.Row.id, CoreConfig.Test.ignoreBackerDestoryFlag, Point.index, BackerContent.indexRemain, BackerContent.indexTree, SourceBacker.listRemain, SourceBacker.listTree, EClass.player, SourceBacker.Row.skin, EClass.sources, and CoreConfig.test.

Referenced by BackerContentInspector.ContentObj.Apply().

◆ Burn()

void Map.Burn ( int  x,
int  z,
bool  instant = false 
)
inline

Definition at line 1430 of file Map.cs.

1431 {
1432 Cell cell = cells[x, z];
1433 Point sharedPoint = cell.GetSharedPoint();
1434 if ((instant || EClass.rnd(10) == 0) && cell.HasObj)
1435 {
1436 if (cell.sourceObj.tileType is TileTypeTree)
1437 {
1438 SetObj(x, z, cell.matObj_fixed.id, 59, 0, EClass.rnd(4));
1439 }
1440 else
1441 {
1442 SetObj(x, z);
1443 if (EClass.rnd(2) == 0)
1444 {
1445 EClass._zone.AddCard(ThingGen.Create((EClass.rnd(2) == 0) ? "ash" : "ash2"), sharedPoint);
1446 }
1447 }
1448 }
1449 if ((instant || EClass.rnd(5) == 0) && cell._block != 0 && cell._block != 96)
1450 {
1451 if (EClass.rnd(10) == 0 || !cell.sourceBlock.tileType.IsWall)
1452 {
1453 cell._block = 0;
1454 }
1455 else
1456 {
1457 cell._block = 96;
1458 }
1459 SetObj(x, z);
1460 if (cell.room != null)
1461 {
1462 cell.room.SetDirty();
1463 }
1465 }
1466 if (instant || EClass.rnd(10) == 0)
1467 {
1468 if (EClass.rnd(4) != 0)
1469 {
1470 cell._floor = 49;
1471 }
1472 if (cell._bridge != 0 && EClass.rnd(5) != 0)
1473 {
1474 cell._bridge = 49;
1475 }
1476 }
1477 foreach (Card item in sharedPoint.ListCards())
1478 {
1479 if (item.trait.CanBeDestroyed && !item.trait.IsDoor && !item.isFireproof && !item.category.IsChildOf("currency") && item.rarity < Rarity.Legendary && !(item.trait is TraitFigure) && item.isThing)
1480 {
1481 if (instant)
1482 {
1483 item.Destroy();
1484 EClass._zone.AddCard(ThingGen.Create((EClass.rnd(2) == 0) ? "ash" : "ash2"), sharedPoint);
1485 }
1486 else
1487 {
1488 item.DamageHP(30L, 910);
1489 }
1490 }
1491 }
1492 if (instant)
1493 {
1494 cell.effect = null;
1495 }
1496 }
byte _block
Definition: Cell.cs:32
Room room
Definition: Cell.cs:110
SourceBlock.Row sourceBlock
Definition: Cell.cs:1062
byte _bridge
Definition: Cell.cs:48
Point GetSharedPoint()
Definition: Cell.cs:1118
SourceObj.Row sourceObj
Definition: Cell.cs:1084
bool HasObj
Definition: Cell.cs:649
SourceMaterial.Row matObj_fixed
Definition: Cell.cs:1049
static int rnd(long a)
Definition: EClass.cs:59
void SetObj(int x, int z, int id=0, int value=1, int dir=0)
Definition: Map.cs:1556
void SetDirty()
Definition: Room.cs:213
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53
Card AddCard(Card t, Point point)
Definition: Zone.cs:2017

References Cell._block, Cell._bridge, EClass._zone, Zone.AddCard(), cells, ThingGen.Create(), Cell.GetSharedPoint(), Cell.HasObj, item, Cell.matObj_fixed, RefreshNeighborTiles(), EClass.rnd(), Cell.room, Room.SetDirty(), SetObj(), Cell.sourceBlock, Cell.sourceObj, MapBounds.x, and MapBounds.z.

Referenced by LogicalFire.Update().

◆ ClearRainAndDecal()

void Map.ClearRainAndDecal ( )
inline

Definition at line 1547 of file Map.cs.

1548 {
1549 ForeachCell(delegate(Cell c)
1550 {
1551 c.effect = null;
1552 c.decal = 0;
1553 });
1554 }
new void ForeachCell(Action< Cell > action)
Definition: Map.cs:2367

References ForeachCell().

Referenced by Zone.Export().

◆ CountChara()

int Map.CountChara ( Faction  faction)
inline

Definition at line 2462 of file Map.cs.

2463 {
2464 int num = 0;
2465 foreach (Chara chara in charas)
2466 {
2467 if (chara.faction == faction)
2468 {
2469 num++;
2470 }
2471 }
2472 return num;
2473 }
Faction faction
Definition: Chara.cs:429
List< Chara > charas
Definition: Map.cs:81

References charas, and Chara.faction.

◆ CountGuest()

int Map.CountGuest ( )
inline

Definition at line 2475 of file Map.cs.

2476 {
2477 int num = 0;
2478 foreach (Chara chara in charas)
2479 {
2480 if (chara.IsGuest())
2481 {
2482 num++;
2483 }
2484 }
2485 return num;
2486 }
bool IsGuest()
Definition: Chara.cs:6781

References charas, and Chara.IsGuest().

◆ CountHostile()

int Map.CountHostile ( )
inline

Definition at line 2488 of file Map.cs.

2489 {
2490 int num = 0;
2491 foreach (Chara chara in charas)
2492 {
2493 if (!chara.IsPCFaction && chara.IsHostile())
2494 {
2495 num++;
2496 }
2497 }
2498 return num;
2499 }
override bool IsPCFaction
Definition: Chara.cs:685
bool IsHostile()
Definition: Chara.cs:6690

References charas, Chara.IsHostile(), and Chara.IsPCFaction.

◆ CountNonHostile()

int Map.CountNonHostile ( )
inline

Definition at line 2514 of file Map.cs.

2515 {
2516 int num = 0;
2517 foreach (Chara chara in charas)
2518 {
2519 if (!chara.IsPCFaction && !chara.IsHostile())
2520 {
2521 num++;
2522 }
2523 }
2524 return num;
2525 }

References charas, Chara.IsHostile(), and Chara.IsPCFaction.

◆ CountWildAnimal()

int Map.CountWildAnimal ( )
inline

Definition at line 2501 of file Map.cs.

2502 {
2503 int num = 0;
2504 foreach (Chara chara in charas)
2505 {
2506 if (!chara.IsPCFaction && chara.IsAnimal)
2507 {
2508 num++;
2509 }
2510 }
2511 return num;
2512 }
bool IsAnimal
Definition: Chara.cs:881

References charas, Chara.IsAnimal, and Chara.IsPCFaction.

◆ CreateNew()

void Map.CreateNew ( int  size,
bool  setReference = true 
)
inline

Definition at line 153 of file Map.cs.

154 {
155 Debug.Log("Map CreateNew:");
156 Size = size;
157 cells = new Cell[Size, Size];
158 bounds = new MapBounds
159 {
160 x = 0,
161 z = 0,
162 maxX = Size - 1,
163 maxZ = Size - 1,
164 Size = Size
165 };
166 SetBounds(0, 0, Size - 1, Size - 1);
167 ForeachXYZ(delegate(int x, int z)
168 {
169 cells[x, z] = new Cell
170 {
171 x = (byte)x,
172 z = (byte)z
173 };
174 });
175 if (setReference)
176 {
177 SetReference();
178 }
179 }
int maxZ
Definition: MapBounds.cs:17
int maxX
Definition: MapBounds.cs:14
new void ForeachXYZ(Action< int, int > action)
Definition: Map.cs:2390
void SetBounds(int size)
Definition: Map.cs:2352
void SetReference()
Definition: Map.cs:195

References bounds, cells, Debug, ForeachXYZ(), MapBounds.maxX, MapBounds.maxZ, SetBounds(), SetReference(), MapBounds.Size, MapBounds.x, and MapBounds.z.

Referenced by MapGen.OnGenerateTerrain(), MapGenDungen.OnGenerateTerrain(), and MapGenRegion.OnGenerateTerrain().

◆ DestroyBlock()

void Map.DestroyBlock ( int  x,
int  z 
)
inline

Definition at line 2045 of file Map.cs.

2046 {
2047 SetBlock(x, z);
2048 }
void SetBlock(int x, int z, int idMat=0, int idBlock=0)
Definition: Map.cs:1017

References SetBlock(), MapBounds.x, and MapBounds.z.

Referenced by OnCardAddedToZone().

◆ DestroyObj()

void Map.DestroyObj ( Point  point)
inline

Definition at line 1846 of file Map.cs.

1847 {
1848 Cell cell = point.cell;
1849 SourceObj.Row sourceObj = cell.sourceObj;
1850 SourceMaterial.Row matObj = cell.matObj;
1851 if (sourceObj.tileType.IsBlockPass)
1852 {
1853 Effect.Get("smoke").Play(point);
1854 }
1855 Effect.Get("mine").Play(point).SetParticleColor(cell.matObj.GetColor())
1856 .Emit(10 + EClass.rnd(10));
1857 point.PlaySound(matObj.GetSoundDead());
1858 matObj.AddBlood(point, 3);
1859 }
SourceMaterial.Row matObj
Definition: Cell.cs:1046
Definition: Effect.cs:7
static Effect Get(Effect original)
Definition: Effect.cs:85
void Play(float delay, Point from, float fixY=0f, Point to=null, Sprite sprite=null)
Definition: Effect.cs:100
SoundSource PlaySound(string id, bool synced=true, float v=1f, bool spatial=true)
Definition: Point.cs:1254
TileType tileType
Definition: RenderRow.cs:77
void AddBlood(Point p, int a=1)
string GetSoundDead(RenderRow c=null)
virtual bool IsBlockPass
Definition: TileType.cs:159

References SourceMaterial.Row.AddBlood(), Point.cell, Effect.Get(), SourceMaterial.Row.GetSoundDead(), TileType.IsBlockPass, Cell.matObj, Effect.Play(), Point.PlaySound(), EClass.rnd(), Cell.sourceObj, and RenderRow.tileType.

Referenced by MineObj(), and TaskHarvest.OnCreateProgress().

◆ DropBlockComponent()

void Map.DropBlockComponent ( Point  point,
TileRow  r,
SourceMaterial::Row  mat,
bool  recoverBlock,
bool  isPlatform = false,
Chara  c = null 
)
inline

Definition at line 1648 of file Map.cs.

1649 {
1651 {
1652 return;
1653 }
1654 Thing thing = null;
1655 if (r.components.Length == 0)
1656 {
1657 return;
1658 }
1660 if (recoverBlock)
1661 {
1662 thing = ((!(r is SourceFloor.Row)) ? ThingGen.CreateBlock(r.id, mat.id) : ThingGen.CreateFloor(r.id, mat.id, isPlatform));
1663 }
1664 else
1665 {
1666 RecipeSource recipeSource = RecipeManager.Get(r.RecipeID + (isPlatform ? "-b" : ""));
1667 if (recipeSource == null)
1668 {
1669 return;
1670 }
1671 string iDIngredient = recipeSource.GetIDIngredient();
1672 if (iDIngredient == null)
1673 {
1674 return;
1675 }
1676 thing = ThingGen.Create(iDIngredient);
1677 thing.ChangeMaterial(mat.alias);
1678 }
1680 {
1681 PutAway(thing);
1682 }
1683 else
1684 {
1685 TrySmoothPick(point, thing, c);
1686 }
1687 }
virtual bool IsBuildMode
Definition: ActionMode.cs:181
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
Definition: Card.cs:3119
bool godBuild
Definition: CoreDebug.cs:319
static Game game
Definition: EClass.cs:9
static CoreDebug debug
Definition: EClass.cs:49
bool disableUsermapBenefit
GamePrincipal principal
Definition: Game.cs:225
void TrySmoothPick(Cell cell, Thing t, Chara c)
Definition: Map.cs:1825
bool PutAway(Card c)
Definition: Map.cs:2553
static void BuildList()
static RecipeSource Get(string id)
string GetIDIngredient()
virtual string RecipeID
Definition: RenderRow.cs:105
string[] components
Definition: RenderRow.cs:52
ActionMode actionMode
Definition: Scene.cs:79
static Thing CreateBlock(int id, int idMat)
Definition: ThingGen.cs:101
static Thing CreateFloor(int id, int idMat, bool platform=false)
Definition: ThingGen.cs:108
Definition: Thing.cs:8
int id
Definition: TileRow.cs:8
virtual bool IsUserZone
Definition: Zone.cs:273

References EClass._zone, Scene.actionMode, RecipeManager.BuildList(), Card.ChangeMaterial(), RenderRow.components, ThingGen.Create(), ThingGen.CreateBlock(), ThingGen.CreateFloor(), EClass.debug, GamePrincipal.disableUsermapBenefit, EClass.game, RecipeManager.Get(), RecipeSource.GetIDIngredient(), CoreDebug.godBuild, TileRow.id, ActionMode.IsBuildMode, Zone.IsUserZone, Game.principal, PutAway(), RenderRow.RecipeID, EClass.scene, and TrySmoothPick().

Referenced by MineBlock(), MineFloor(), and MineRamp().

◆ ExportMetaData()

void Map.ExportMetaData ( string  _path,
string  id,
PartialMap  partial = null 
)
inline

Definition at line 732 of file Map.cs.

733 {
734 if (custom == null)
735 {
736 custom = new CustomData();
737 }
738 MapMetaData mapMetaData = new MapMetaData
739 {
740 name = EClass._zone.Name,
742 tag = (EClass._map.exportSetting?.tag ?? ""),
743 partial = partial,
744 underwater = EClass._zone.IsUnderwater
745 };
746 custom.id = (mapMetaData.id = id);
747 IO.SaveFile(_path + "meta", mapMetaData);
748 }
Version version
Definition: BaseCore.cs:17
static BaseCore Instance
Definition: BaseCore.cs:11
Definition: IO.cs:11
static void SaveFile(string path, object obj, bool compress=false, JsonSerializerSettings setting=null)
Definition: IO.cs:89
CustomData custom
Definition: Map.cs:40
MapExportSetting exportSetting
Definition: Map.cs:73
Version version
Definition: Map.cs:28
virtual string Name
Definition: Spatial.cs:509
virtual bool IsUnderwater
Definition: Zone.cs:271
int GetInt()
Definition: Version.cs:21

References EClass._map, EClass._zone, custom, exportSetting, Version.GetInt(), BaseCore.Instance, Zone.IsUnderwater, Spatial.Name, MapExportSetting.tag, version, and BaseCore.version.

Referenced by Zone.Export(), and UpdateMetaData().

◆ FindChara() [1/2]

Chara Map.FindChara ( int  uid)
inline

Definition at line 2601 of file Map.cs.

2602 {
2603 foreach (Chara chara in charas)
2604 {
2605 if (chara.uid == uid)
2606 {
2607 return chara;
2608 }
2609 }
2610 return null;
2611 }
int uid
Definition: Card.cs:125

References charas, and Card.uid.

◆ FindChara() [2/2]

◆ FindPublicArea()

BaseArea Map.FindPublicArea ( )
inline

Definition at line 2736 of file Map.cs.

2737 {
2738 return (from a in ((IEnumerable<BaseArea>)rooms.listArea).Concat((IEnumerable<BaseArea>)rooms.listRoom)
2739 where a.type.IsPublicArea
2740 select a).RandomItem();
2741 }
RoomManager rooms
Definition: Map.cs:31
List< Room > listRoom
Definition: RoomManager.cs:13
List< Area > listArea
Definition: RoomManager.cs:10

References RoomManager.listArea, RoomManager.listRoom, and rooms.

Referenced by GoalSleep.OnSimulatePosition(), and GoalSleep.Run().

◆ FindThing() [1/6]

Thing Map.FindThing ( Func< Thing, bool >  func)
inline

◆ FindThing() [2/6]

Thing Map.FindThing ( int  uid)
inline

Definition at line 2625 of file Map.cs.

2626 {
2627 foreach (Thing thing in things)
2628 {
2629 if (thing.uid == uid)
2630 {
2631 return thing;
2632 }
2633 }
2634 return null;
2635 }

References things, and Card.uid.

◆ FindThing() [3/6]

Thing Map.FindThing ( string  workTag,
BaseArea  area1 = null,
BaseArea  area2 = null 
)
inline

Definition at line 2696 of file Map.cs.

2697 {
2698 if (area1 == null && area2 == null)
2699 {
2700 return null;
2701 }
2702 Thing thing = null;
2703 PropSet orCreate = EClass._map.Installed.workMap.GetOrCreate(workTag);
2704 if (area1 != null)
2705 {
2706 IEnumerable<Card> enumerable = orCreate.Where((Card a) => a.pos.HasRoomOrArea(area1));
2707 if (enumerable.Count() > 0)
2708 {
2709 thing = enumerable.RandomItem() as Thing;
2710 }
2711 }
2712 if (thing == null && area2 != null)
2713 {
2714 IEnumerable<Card> enumerable2 = orCreate.Where((Card a) => a.pos.HasRoomOrArea(area2));
2715 if (enumerable2.Count() > 0)
2716 {
2717 thing = enumerable2.RandomItem() as Thing;
2718 }
2719 }
2720 return thing;
2721 }
PropsInstalled Installed
Definition: Map.cs:123
bool HasRoomOrArea(BaseArea a)
Definition: Point.cs:421
Dictionary< string, PropSet > workMap
Definition: Props.cs:16

References EClass._map, Point.HasRoomOrArea(), Installed, Card.pos, and Props.workMap.

◆ FindThing() [4/6]

Thing Map.FindThing ( string  workTag,
Chara  c 
)
inline

Definition at line 2723 of file Map.cs.

2724 {
2725 Thing result = null;
2726 IEnumerable<Card> enumerable = from a in EClass._map.Installed.workMap.GetOrCreate(workTag)
2727 where a.pos.IsPublicSpace()
2728 select a;
2729 if (enumerable.Count() > 0)
2730 {
2731 result = enumerable.RandomItem() as Thing;
2732 }
2733 return result;
2734 }

References EClass._map, Installed, and Props.workMap.

◆ FindThing() [5/6]

Thing Map.FindThing ( Type  type,
BaseArea  area1,
BaseArea  area2 = null 
)
inline

Definition at line 2666 of file Map.cs.

2667 {
2668 if (area1 == null && area2 == null)
2669 {
2670 return null;
2671 }
2672 Thing thing = Find(area1);
2673 if (thing == null && area2 != null)
2674 {
2675 thing = Find(area2);
2676 }
2677 return thing;
2678 Thing Find(BaseArea area)
2679 {
2680 _things.Clear();
2681 foreach (Thing thing2 in EClass._map.props.installed.things)
2682 {
2683 if (type.IsAssignableFrom(thing2.trait.GetType()) && thing2.pos.HasRoomOrArea(area))
2684 {
2685 _things.Add(thing2);
2686 }
2687 }
2688 if (_things.Count <= 0)
2689 {
2690 return null;
2691 }
2692 return _things.RandomItem();
2693 }
2694 }
void Add(Act a, string s="")
Definition: ActPlan.cs:11
List< Thing > _things
Definition: Map.cs:107
PropsInstalled installed
Definition: PropsManager.cs:8
List< Thing > things
Definition: Props.cs:20

References EClass._map, _things, ActPlan.List.Add(), Point.HasRoomOrArea(), PropsManager.installed, Card.pos, props, Props.things, and Card.trait.

◆ FindThing() [6/6]

Thing Map.FindThing ( Type  type,
Chara  c = null 
)
inline

Definition at line 2649 of file Map.cs.

2650 {
2651 _things.Clear();
2652 foreach (Thing thing in EClass._map.props.installed.things)
2653 {
2654 if (type.IsAssignableFrom(thing.trait.GetType()) && thing.pos.IsPublicSpace())
2655 {
2656 _things.Add(thing);
2657 }
2658 }
2659 if (_things.Count <= 0)
2660 {
2661 return null;
2662 }
2663 return _things.RandomItem();
2664 }
bool IsPublicSpace()
Definition: Point.cs:449

References EClass._map, _things, ActPlan.List.Add(), PropsManager.installed, Point.IsPublicSpace(), Card.pos, props, Props.things, and Card.trait.

◆ FindThing< T >()

T Map.FindThing< T > ( )
inline
Type Constraints
T :Trait 

Definition at line 2637 of file Map.cs.

2637 : Trait
2638 {
2639 foreach (Thing thing in things)
2640 {
2641 if (thing.trait is T)
2642 {
2643 return thing.trait as T;
2644 }
2645 }
2646 return null;
2647 }
Definition: Trait.cs:7

References things, and Card.trait.

◆ ForeachCell()

◆ ForeachNeighbor()

void Map.ForeachNeighbor ( Point  center,
Action< Point action 
)
inline

Definition at line 2422 of file Map.cs.

2423 {
2424 int num = center.x;
2425 int num2 = center.z;
2426 Point point = new Point();
2427 for (int i = num - 1; i < num + 2; i++)
2428 {
2429 if (i < 0 || i >= Size)
2430 {
2431 continue;
2432 }
2433 for (int j = num2 - 1; j < num2 + 2; j++)
2434 {
2435 if (j >= 0 && j < Size)
2436 {
2437 point.Set(i, j);
2438 action(point);
2439 }
2440 }
2441 }
2442 }

References Point.Set(), MapBounds.Size, Point.x, and Point.z.

◆ ForeachPoint()

new void Map.ForeachPoint ( Action< Point action)
inline

Definition at line 2378 of file Map.cs.

2379 {
2380 Point point = new Point();
2381 for (int i = 0; i < Size; i++)
2382 {
2383 for (int j = 0; j < Size; j++)
2384 {
2385 action(point.Set(i, j));
2386 }
2387 }
2388 }

References Point.Set(), and MapBounds.Size.

Referenced by BaseTileSelector.ProcessFillTiles().

◆ ForeachSphere()

void Map.ForeachSphere ( int  _x,
int  _z,
float  r,
Action< Point action 
)
inline

Definition at line 2401 of file Map.cs.

2402 {
2403 Point point = new Point();
2404 int num = (int)Mathf.Ceil(r);
2405 for (int i = _x - num; i < _x + num + 1; i++)
2406 {
2407 if (i < 0 || i >= Size)
2408 {
2409 continue;
2410 }
2411 for (int j = _z - num; j < _z + num + 1; j++)
2412 {
2413 if (j >= 0 && j < Size && (float)((i - _x) * (i - _x) + (j - _z) * (j - _z)) < r * r)
2414 {
2415 point.Set(i, j);
2416 action(point);
2417 }
2418 }
2419 }
2420 }

References Point.Set(), and MapBounds.Size.

Referenced by SurvivalManager.GetRandomPoint(), Trait.ListPoints(), TraitLightSun.ListPoints(), ListPointsInArc(), ListPointsInCircle(), Act.OnMarkMapHighlights(), AM_Populate.OnProcessTiles(), AM_Terrain.OnProcessTiles(), AM_BaseTerrain.OnRenderTile(), RefreshFOV(), Reveal(), ActWait.Search(), GameUpdater.Update(), and VirtualRoom.VirtualRoom().

◆ ForeachXYZ()

new void Map.ForeachXYZ ( Action< int, int >  action)
inline

Definition at line 2390 of file Map.cs.

2391 {
2392 for (int i = 0; i < Size; i++)
2393 {
2394 for (int j = 0; j < Size; j++)
2395 {
2396 action(i, j);
2397 }
2398 }
2399 }

References MapBounds.Size.

Referenced by CreateNew().

◆ GetBackerObj()

SourceBacker.Row Map.GetBackerObj ( Point  p)
inline

Definition at line 1613 of file Map.cs.

1614 {
1615 if (!backerObjs.ContainsKey(p.index))
1616 {
1617 return null;
1618 }
1619 return EClass.sources.backers.map.TryGetValue(backerObjs[p.index]);
1620 }

References backerObjs, SourceManager.backers, Point.index, and EClass.sources.

Referenced by TaskHarvest.OnCreateProgress().

◆ GetCell()

Cell Map.GetCell ( int  index)
inline

Definition at line 900 of file Map.cs.

901 {
902 return cells[index % Size, index % SizeXZ / Size];
903 }
int SizeXZ
Definition: Map.cs:133

References cells, MapBounds.Size, and SizeXZ.

Referenced by Zone.Activate(), MapSubset.Apply(), Fov.ClearVisible(), Fov.Perform(), and ActionMode.RefreshTexts().

◆ GetDependedRamp()

Cell Map.GetDependedRamp ( Cell  cell)
inline

Definition at line 2211 of file Map.cs.

2212 {
2213 Cell right = cell.Right;
2214 if (right.HasRamp && !right.HasStairs && right.blockDir == 1)
2215 {
2216 return right;
2217 }
2218 Cell front = cell.Front;
2219 if (front.HasRamp && !front.HasStairs && front.blockDir == 0)
2220 {
2221 return front;
2222 }
2223 Cell left = cell.Left;
2224 if (left.HasRamp && !left.HasStairs && left.blockDir == 3)
2225 {
2226 return left;
2227 }
2228 Cell back = cell.Back;
2229 if (back.HasRamp && !back.HasStairs && back.blockDir == 2)
2230 {
2231 return back;
2232 }
2233 return null;
2234 }
Cell Back
Definition: Cell.cs:161
bool HasStairs
Definition: Cell.cs:863
Cell Front
Definition: Cell.cs:137
Cell Left
Definition: Cell.cs:173
Cell Right
Definition: Cell.cs:149
bool HasRamp
Definition: Cell.cs:845
int blockDir
Definition: Cell.cs:906

References Cell.Back, back, Cell.blockDir, Cell.Front, Cell.HasRamp, Cell.HasStairs, Cell.Left, left, Cell.Right, and right.

Referenced by RemoveLonelyRamps().

◆ GetMetaData()

static MapMetaData Map.GetMetaData ( string  pathZip)
inlinestatic

Definition at line 750 of file Map.cs.

751 {
752 try
753 {
754 using ZipFile zipFile = ZipFile.Read(pathZip);
755 ZipEntry zipEntry = zipFile["meta"];
756 if (zipEntry != null)
757 {
758 using (MemoryStream stream = new MemoryStream())
759 {
760 zipEntry.Extract(stream);
761 MapMetaData mapMetaData = IO.LoadStreamJson<MapMetaData>(stream);
762 mapMetaData.path = pathZip;
763 return mapMetaData;
764 }
765 }
766 }
767 catch (Exception message)
768 {
769 if (Application.isEditor)
770 {
771 Debug.Log(message);
772 }
773 }
774 return null;
775 }

References Debug.

Referenced by Zone.IsImportValid(), TraitMoongate.ListSavedUserMap(), PartialMap.Load(), PartialMapMenu.Refresh(), and TraitMoongate.UseMoongate().

◆ GetNearbyResourcePoint()

Point Map.GetNearbyResourcePoint ( Point  center)
inline

Definition at line 2279 of file Map.cs.

2280 {
2281 Point point = new Point();
2282 int num = ((EClass.rnd(2) == 0) ? 1 : (-1));
2283 int num2 = ((EClass.rnd(2) == 0) ? 1 : (-1));
2284 for (int i = 0; i < 3; i++)
2285 {
2286 point.x = center.x - num + i * num;
2287 for (int j = 0; j < 3; j++)
2288 {
2289 point.z = center.z - num2 + j * num2;
2290 if (point.IsValid && point.area == null && point.cell.CanHarvest())
2291 {
2292 return point;
2293 }
2294 }
2295 }
2296 return Point.Invalid;
2297 }
bool CanHarvest()
Definition: Cell.cs:1700
static Point Invalid
Definition: Point.cs:28
Area area
Definition: Point.cs:73

References Point.area, Cell.CanHarvest(), Point.cell, Point.Invalid, Point.IsValid, and EClass.rnd().

◆ GetRampDir()

int Map.GetRampDir ( int  x,
int  z,
TileType  blockType = null 
)
inline

Definition at line 2174 of file Map.cs.

2175 {
2176 Cell cell = cells[x, z];
2177 if (cell.HasFullBlock)
2178 {
2179 if (blockType == null)
2180 {
2181 blockType = cell.sourceBlock.tileType;
2182 }
2183 Cell right = cell.Right;
2184 Cell front = cell.Front;
2185 Cell left = cell.Left;
2186 Cell back = cell.Back;
2187 if (!right.HasBlock && !right.IsVoid && left.HasFullBlock && front.CanBuildRamp(1) && back.CanBuildRamp(1))
2188 {
2189 return 1;
2190 }
2191 if (!front.HasBlock && !front.IsVoid && back.HasFullBlock && left.CanBuildRamp(0) && right.CanBuildRamp(0))
2192 {
2193 return 0;
2194 }
2195 if (!left.HasBlock && !left.IsVoid && right.HasFullBlock && front.CanBuildRamp(3) && back.CanBuildRamp(3))
2196 {
2197 return 3;
2198 }
2199 if (!back.HasBlock && !back.IsVoid && front.HasFullBlock && left.CanBuildRamp(2) && right.CanBuildRamp(2))
2200 {
2201 return 2;
2202 }
2203 if (!blockType.IsRamp)
2204 {
2205 return 0;
2206 }
2207 }
2208 return -1;
2209 }
bool HasBlock
Definition: Cell.cs:651
bool CanBuildRamp(int dir)
Definition: Cell.cs:1155
bool HasFullBlock
Definition: Cell.cs:825
bool IsVoid
Definition: Cell.cs:967
bool IsRamp
Definition: TileType.cs:153

References Cell.Back, back, Cell.CanBuildRamp(), cells, Cell.Front, Cell.HasBlock, Cell.HasFullBlock, Cell.IsVoid, Cell.Left, left, Cell.Right, right, Cell.sourceBlock, MapBounds.x, and MapBounds.z.

Referenced by TaskMine.GetHitResult(), and MineRamp().

◆ GetRandomEdge()

new Point Map.GetRandomEdge ( int  r = 3)
inline

Definition at line 2254 of file Map.cs.

2255 {
2256 int num = 0;
2257 int num2 = 0;
2258 for (int i = 0; i < 10000; i++)
2259 {
2260 if (EClass.rnd(2) == 0)
2261 {
2262 num = ((EClass.rnd(2) == 0) ? EClass.rnd(r) : (Size - 1 - EClass.rnd(r)));
2263 num2 = EClass.rnd(Size);
2264 }
2265 else
2266 {
2267 num2 = ((EClass.rnd(2) == 0) ? EClass.rnd(r) : (Size - 1 - EClass.rnd(r)));
2268 num = EClass.rnd(Size);
2269 }
2270 Point surface = GetSurface(num, num2, walkable: false);
2271 if (surface.IsValid)
2272 {
2273 return surface;
2274 }
2275 }
2276 return GetSurface(Size / 2, Size / 2, walkable: false);
2277 }
Point GetSurface(int x, int z, bool walkable=true)
Definition: MapBounds.cs:171

References MapBounds.GetSurface(), Point.IsValid, EClass.rnd(), and MapBounds.Size.

Referenced by ZoneEventSiege.GetSpawnPos(), and MapGen.MakeRiver().

◆ GetRandomPoint()

Point Map.GetRandomPoint ( Point  center,
int  radius,
int  tries = 100,
bool  mustBeWalkable = true,
bool  requireLos = true 
)
inline

Definition at line 2236 of file Map.cs.

2237 {
2238 Point point = new Point();
2239 for (int i = 0; i < tries; i++)
2240 {
2241 point.x = center.x + EClass.rnd(radius * 2 + 1) - radius;
2242 point.z = center.z + EClass.rnd(radius * 2 + 1) - radius;
2243 point.Clamp();
2244 if ((!mustBeWalkable || !point.cell.blocked) && (!requireLos || Los.IsVisible(center, point)))
2245 {
2246 return point;
2247 }
2248 }
2249 Debug.Log("GetRandomPoint failed center:" + center?.ToString() + " rad:" + radius);
2250 point.IsValid = false;
2251 return point;
2252 }
Definition: Los.cs:5
static bool IsVisible(Point p1, Point p2, Action< Point, bool > _onVisit=null)
Definition: Los.cs:167
Point Clamp(bool useBounds=false)
Definition: Point.cs:1009

References Algorithms.WeightCell.blocked, Point.cell, Point.Clamp(), Debug, Los.IsVisible(), and EClass.rnd().

Referenced by Zone.Generate(), MapBounds.GetRandomSpawnPos(), MapGenDungen.OnGenerateTerrain(), MapGen.Populate(), and TraitSpotSpawn.Update().

◆ ListChara()

List< Chara > Map.ListChara ( Faction  faction)
inline

Definition at line 2527 of file Map.cs.

2528 {
2529 List<Chara> list = new List<Chara>();
2530 foreach (Chara chara in charas)
2531 {
2532 if (chara.faction == faction)
2533 {
2534 list.Add(chara);
2535 }
2536 }
2537 return list;
2538 }

References charas, and Chara.faction.

Referenced by ContentPopulation.Refresh().

◆ ListCharasInCircle()

List< Chara > Map.ListCharasInCircle ( Point  center,
float  radius,
bool  los = true 
)
inline

Definition at line 2312 of file Map.cs.

2313 {
2314 List<Chara> list = new List<Chara>();
2315 foreach (Point item in ListPointsInCircle(center, radius, mustBeWalkable: false, los))
2316 {
2317 CellDetail detail = item.detail;
2318 if (detail == null || detail.charas.Count <= 0)
2319 {
2320 continue;
2321 }
2322 foreach (Chara chara in item.detail.charas)
2323 {
2324 list.Add(chara);
2325 }
2326 }
2327 return list;
2328 }
List< Chara > charas
Definition: CellDetail.cs:13
List< Point > ListPointsInCircle(Point center, float radius, bool mustBeWalkable=true, bool los=true)
Definition: Map.cs:2299

References CellDetail.charas, item, and ListPointsInCircle().

Referenced by AI_PlayMusic.Run().

◆ ListPointsInArc()

List< Point > Map.ListPointsInArc ( Point  center,
Point  to,
int  radius,
float  angle 
)
inline

Definition at line 2330 of file Map.cs.

2331 {
2332 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));
2333 Point point = new Point(0, 0);
2334 List<Point> list = new List<Point>();
2335 float diff = point.GetAngle2(to2);
2336 ForeachSphere(center.x, center.z, radius, delegate(Point p)
2337 {
2338 float angle2 = center.GetAngle2(p);
2339 if ((Mathf.Abs(diff - angle2) < angle || Mathf.Abs(diff - angle2 + 360f) < angle || Mathf.Abs(360f - diff + angle2) < angle) && Los.IsVisible(center, p) && !p.IsBlocked)
2340 {
2341 list.Add(p.Copy());
2342 }
2343 });
2344 return list;
2345 }
void ForeachSphere(int _x, int _z, float r, Action< Point > action)
Definition: Map.cs:2401
bool IsBlocked
Definition: Point.cs:363
float GetAngle2(Point to)
Definition: Point.cs:613

References ForeachSphere(), Point.GetAngle2(), Point.IsBlocked, Los.IsVisible(), Point.x, and Point.z.

Referenced by ActEffect.ProcAt().

◆ ListPointsInCircle()

List< Point > Map.ListPointsInCircle ( Point  center,
float  radius,
bool  mustBeWalkable = true,
bool  los = true 
)
inline

Definition at line 2299 of file Map.cs.

2300 {
2301 List<Point> list = new List<Point>();
2302 ForeachSphere(center.x, center.z, radius, delegate(Point p)
2303 {
2304 if ((!mustBeWalkable || !p.cell.blocked) && (!los || Los.IsVisible(center, p)))
2305 {
2306 list.Add(p.Copy());
2307 }
2308 });
2309 return list;
2310 }

References Algorithms.WeightCell.blocked, Point.cell, ForeachSphere(), Los.IsVisible(), Point.x, and Point.z.

Referenced by TaskClean.GetTarget(), ListCharasInCircle(), Point.ListWitnesses(), and ActEffect.ProcAt().

◆ ListPointsInLine()

List< Point > Map.ListPointsInLine ( Point  center,
Point  to,
int  radius,
bool  returnOnBlocked = true 
)
inline

Definition at line 2347 of file Map.cs.

2348 {
2349 return Los.ListVisible(center, to, radius, null, returnOnBlocked);
2350 }
static List< Point > ListVisible(Point p1, Point p2, int radius, Action< Point, bool > _onVisit=null, bool returnOnBlocked=true)
Definition: Los.cs:90

References Los.ListVisible().

Referenced by ActMelee.Attack(), ActTelekinesis.ListPath(), ActBolt.OnMarkMapHighlights(), ActRanged.Perform(), and ActEffect.ProcAt().

◆ ListThing< T >()

List< Thing > Map.ListThing< T > ( )
inline
Type Constraints
T :Trait 

Definition at line 2540 of file Map.cs.

2540 : Trait
2541 {
2542 List<Thing> list = new List<Thing>();
2543 foreach (Thing thing in things)
2544 {
2545 if (thing.IsInstalled && thing.trait is T)
2546 {
2547 list.Add(thing);
2548 }
2549 }
2550 return list;
2551 }
bool IsInstalled
Definition: Card.cs:2423

References Card.IsInstalled, things, and Card.trait.

◆ Load()

void Map.Load ( string  path,
bool  import = false,
PartialMap  partial = null 
)
inline

Definition at line 552 of file Map.cs.

553 {
554 if (partial == null)
555 {
556 Debug.Log("Map Load:" + compression.ToString() + ": " + path);
557 }
558 int num = Size;
559 int num2 = Size;
560 if (partial != null)
561 {
562 num = partial.w;
563 num2 = partial.h;
564 Debug.Log(compression.ToString() + ": " + num + "/" + num2);
565 }
566 int size = num * num2;
567 cells = new Cell[num, num2];
568 if (bounds.maxX == 0)
569 {
570 bounds.SetBounds(0, 0, num - 1, num2 - 1);
571 }
572 SetBounds(0, 0, num - 1, num2 - 1);
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)
595 {
596 bytes19 = new byte[size];
597 }
598 if (bytes2.Length < size)
599 {
600 bytes2 = new byte[size];
601 }
602 if (bytes14.Length < size)
603 {
604 bytes14 = new byte[size];
605 }
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");
627 int count = EClass.sources.floors.rows.Count;
628 int count2 = EClass.sources.materials.rows.Count;
629 int num3 = 0;
630 for (int i = 0; i < num; i++)
631 {
632 for (int j = 0; j < num2; j++)
633 {
634 Cell cell = (cells[i, j] = new Cell
635 {
636 x = (byte)i,
637 z = (byte)j,
638 objVal = bytes2[num3],
639 _blockMat = bytes3[num3],
640 _block = bytes4[num3],
641 _floorMat = bytes5[num3],
642 _floor = bytes6[num3],
643 obj = bytes7[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)
667 });
668 if (cell._bridge >= count)
669 {
670 cell._bridge = 0;
671 }
672 if (cell._bridgeMat >= count2)
673 {
674 cell._bridgeMat = 1;
675 }
677 num3++;
678 }
679 }
680 things.ForeachReverse(delegate(Thing t)
681 {
682 if (t.Num <= 0 || t.isDestroyed)
683 {
684 Debug.Log("[bug] Removing bugged thing:" + t.Num + "/" + t.isDestroyed + "/" + t);
685 things.Remove(t);
686 }
687 });
688 foreach (KeyValuePair<int, CellEffect> cellEffect in cellEffects)
689 {
690 int key = cellEffect.Key;
691 int num4 = key % Size;
692 int num5 = key / Size;
693 cells[num4, num5].effect = cellEffect.Value;
694 if (cellEffect.Value.IsFire)
695 {
696 effectManager.GetOrCreate(new Point(num4, num5));
697 }
698 }
699 cellEffects.Clear();
701 byte[] TryLoad(string s)
702 {
703 return TryLoadFile(path, s, size);
704 }
705 void Validate(ref byte[] bytes, string id)
706 {
707 if (bytes.Length < size)
708 {
709 Debug.LogError("expection: size invalid:" + id + " " + bytes.Length + "/" + size);
710 bytes = new byte[size];
711 }
712 }
713 }
bool isDestroyed
Definition: Card.cs:78
int Num
Definition: Card.cs:161
CellEffect effect
Definition: Cell.cs:102
byte _bridgeMat
Definition: Cell.cs:50
static void RebuildCritter(Cell cell)
Definition: Critter.cs:93
LogicalPoint GetOrCreate(Point point)
void SetBounds(int _x, int _z, int _maxX, int _maxZ)
Definition: MapBounds.cs:30
Dictionary< int, CellEffect > cellEffects
Definition: Map.cs:64
byte[] TryLoadFile(string path, string s, int size)
Definition: Map.cs:541
CellEffectManager effectManager
Definition: Map.cs:89
void ValidateVersion()
Definition: Map.cs:715
IO.Compression compression
Definition: Map.cs:25
SourceMaterial materials
SourceFloor floors

References Cell._bridge, Cell._bridgeMat, bounds, cellEffects, cells, compression, Debug, Cell.effect, effectManager, SourceManager.floors, LogicalPointManager.GetOrCreate(), Card.isDestroyed, SourceManager.materials, MapBounds.maxX, Card.Num, Critter.RebuildCritter(), MapBounds.SetBounds(), SetBounds(), MapBounds.Size, EClass.sources, things, TryLoadFile(), ValidateVersion(), MapBounds.x, and MapBounds.z.

Referenced by PartialMap._Load(), and Zone.Activate().

◆ MineBlock()

void Map.MineBlock ( Point  point,
bool  recoverBlock = false,
Chara  c = null,
bool  mineObj = true 
)
inline

Definition at line 1689 of file Map.cs.

1690 {
1691 bool flag = ActionMode.Mine.IsRoofEditMode() && point.cell._roofBlock != 0;
1692 if (!point.IsValid || (!flag && !point.cell.HasBlock))
1693 {
1694 return;
1695 }
1696 SourceMaterial.Row row = (flag ? point.matRoofBlock : point.matBlock);
1697 byte b = (flag ? point.cell._roofBlock : point.cell._block);
1698 SourceBlock.Row row2 = EClass.sources.blocks.rows[b];
1699 Effect.Get("smoke").Play(point);
1700 Effect.Get("mine").Play(point).SetParticleColor(row.GetColor())
1701 .Emit(10 + EClass.rnd(10));
1702 point.PlaySound(row.GetSoundDead(row2));
1703 row.AddBlood(point, 8);
1704 bool flag2 = c == null || c.IsAgent || c.IsPCFactionOrMinion;
1706 {
1707 flag2 = false;
1708 }
1709 if (flag)
1710 {
1711 point.cell._roofBlock = 0;
1712 RefreshSingleTile(point.x, point.z);
1713 }
1714 else
1715 {
1716 if (point.cell.HasFullBlock)
1717 {
1718 RemoveLonelyRamps(point.cell);
1719 }
1720 point.SetBlock();
1721 if (flag2 && point.sourceObj.tileType.IsBlockMount && mineObj)
1722 {
1723 MineObj(point, null, c);
1724 }
1725 }
1726 if (flag2)
1727 {
1728 DropBlockComponent(point, row2, row, recoverBlock, isPlatform: false, c);
1729 }
1730 RefreshShadow(point.x, point.z);
1731 RefreshShadow(point.x, point.z - 1);
1732 ValidateInstalled(point);
1733 RefreshFOV(point.x, point.z);
1734 if (flag2 && !point.cell.isModified && !flag)
1735 {
1736 if (b == 17 || EClass.rnd(100) == 0)
1737 {
1738 zone.AddCard(ThingGen.Create("money2"), point);
1739 }
1740 if (EClass._zone.DangerLv >= 10 && EClass.rnd(200) == 0)
1741 {
1742 zone.AddCard(ThingGen.Create("crystal_earth"), point);
1743 }
1744 if (EClass._zone.DangerLv >= 25 && EClass.rnd(200) == 0)
1745 {
1746 zone.AddCard(ThingGen.Create("crystal_sun"), point);
1747 }
1748 if (EClass._zone.DangerLv >= 40 && EClass.rnd(200) == 0)
1749 {
1750 zone.AddCard(ThingGen.Create("crystal_mana"), point);
1751 }
1752 point.cell.isModified = true;
1753 }
1754 }
override bool IsRoofEditMode(Card c=null)
Definition: AM_Mine.cs:19
static AM_Mine Mine
Definition: ActionMode.cs:33
bool IsPCFactionOrMinion
Definition: Card.cs:2314
bool isModified
Definition: Cell.cs:446
void RefreshSingleTile(int x, int z)
Definition: Map.cs:2124
void RefreshFOV(int x, int z, int radius=6, bool recalculate=false)
Definition: Map.cs:942
void MineObj(Point point, Task task=null, Chara c=null)
Definition: Map.cs:1861
void RemoveLonelyRamps(Cell cell)
Definition: Map.cs:2031
void ValidateInstalled(Point p)
Definition: Map.cs:1988
void DropBlockComponent(Point point, TileRow r, SourceMaterial.Row mat, bool recoverBlock, bool isPlatform=false, Chara c=null)
Definition: Map.cs:1648
void RefreshShadow(int x, int z)
Definition: Map.cs:1821
SourceMaterial.Row matBlock
Definition: Point.cs:55
SourceObj.Row sourceObj
Definition: Point.cs:69
void SetBlock(int idMat=0, int idBlock=0)
Definition: Point.cs:919
SourceBlock blocks
override int DangerLv
Definition: Zone.cs:110

References Cell._block, EClass._zone, SourceMaterial.Row.AddBlood(), Zone.AddCard(), SourceManager.blocks, Point.cell, ThingGen.Create(), Zone.DangerLv, GamePrincipal.disableUsermapBenefit, DropBlockComponent(), EClass.game, Effect.Get(), SourceMaterial.Row.GetColor(), SourceMaterial.Row.GetSoundDead(), Cell.HasBlock, Cell.HasFullBlock, Cell.isModified, AM_Mine.IsRoofEditMode(), Zone.IsUserZone, Point.IsValid, Point.matBlock, ActionMode.Mine, MineObj(), Effect.Play(), Point.PlaySound(), Game.principal, RefreshFOV(), RefreshShadow(), RefreshSingleTile(), RemoveLonelyRamps(), EClass.rnd(), Point.SetBlock(), Point.sourceObj, EClass.sources, ValidateInstalled(), Point.x, Point.z, and zone.

Referenced by ActEffect.DamageEle(), MineObj(), TaskMine.OnProgressComplete(), and RemoveLonelyRamps().

◆ MineFloor()

void Map.MineFloor ( Point  point,
Chara  c = null,
bool  recoverBlock = false,
bool  removePlatform = true 
)
inline

Definition at line 1773 of file Map.cs.

1774 {
1775 if (!point.IsValid || (!point.HasFloor && !point.HasBridge))
1776 {
1777 return;
1778 }
1779 SourceMaterial.Row row = (point.cell.HasBridge ? point.matBridge : point.matFloor);
1780 SourceFloor.Row c2 = (point.cell.HasBridge ? point.sourceBridge : point.sourceFloor);
1781 Effect.Get("mine").Play(point).SetParticleColor(row.GetColor())
1782 .Emit(10 + EClass.rnd(10));
1783 point.PlaySound(row.GetSoundDead(c2));
1784 MineObj(point, null, c);
1785 if (point.cell.HasBridge && removePlatform)
1786 {
1787 DropBlockComponent(EClass.pc.pos, point.sourceBridge, point.matBridge, recoverBlock, isPlatform: true, c);
1788 EClass._map.SetBridge(point.x, point.z, 0, 0, 0, 0, 0);
1789 if (point.IsSky)
1790 {
1791 EClass.pc.Kick(point, ignoreSelf: true);
1792 }
1793 return;
1794 }
1796 {
1797 DropBlockComponent(EClass.pc.pos, point.sourceFloor, row, recoverBlock, isPlatform: false, c);
1798 SetFloor(point.x, point.z, 0, 90);
1799 if (point.IsSky)
1800 {
1801 EClass.pc.Kick(point, ignoreSelf: true);
1802 }
1803 return;
1804 }
1805 if (zone.IsRegion || point.cell._floor == 40)
1806 {
1807 Thing thing = ThingGen.CreateRawMaterial(row);
1808 thing.ChangeMaterial(row.alias);
1809 TrySmoothPick(point, thing, c);
1810 }
1811 else
1812 {
1813 DropBlockComponent(point, point.sourceFloor, row, recoverBlock, isPlatform: false, c);
1814 }
1815 if (!EClass._zone.IsRegion && !point.sourceFloor.components[0].Contains("chunk@soil"))
1816 {
1817 point.SetFloor(EClass.sources.floors.rows[1].DefaultMaterial.id, 40);
1818 }
1819 }
void Kick(Point p, bool ignoreSelf=false, bool checkWall=true)
Definition: Card.cs:6146
byte _floor
Definition: Cell.cs:36
bool HasBridge
Definition: Cell.cs:679
static Chara pc
Definition: EClass.cs:15
void SetBridge(int x, int z, int height=0, int idMat=0, int idBridge=0, int dir=0, byte idPillar=0)
Definition: Map.cs:993
void SetFloor(int x, int z, int idMat=0, int idFloor=0)
Definition: Map.cs:970
SourceMaterial.Row matFloor
Definition: Point.cs:57
bool HasBridge
Definition: Point.cs:221
bool IsSky
Definition: Point.cs:224
SourceMaterial.Row matBridge
Definition: Point.cs:59
void SetFloor(int idMat=0, int idFloor=0)
Definition: Point.cs:924
SourceFloor.Row sourceFloor
Definition: Point.cs:65
bool HasFloor
Definition: Point.cs:219
SourceFloor.Row sourceBridge
Definition: Point.cs:67
static Thing CreateRawMaterial(SourceMaterial.Row m)
Definition: ThingGen.cs:68
virtual bool IsSkyLevel
Definition: Zone.cs:269

References Cell._floor, EClass._map, EClass._zone, SourceMaterial.Row.alias, Point.cell, Card.ChangeMaterial(), ThingGen.CreateRawMaterial(), DropBlockComponent(), SourceManager.floors, Effect.Get(), SourceMaterial.Row.GetColor(), SourceMaterial.Row.GetSoundDead(), Cell.HasBridge, Point.HasBridge, Point.HasFloor, Spatial.IsRegion, Point.IsSky, Zone.IsSkyLevel, Point.IsValid, Card.Kick(), Point.matBridge, Point.matFloor, MineObj(), EClass.pc, Effect.Play(), Point.PlaySound(), Card.pos, EClass.rnd(), SetBridge(), Point.SetFloor(), SetFloor(), Point.sourceBridge, Point.sourceFloor, EClass.sources, TrySmoothPick(), Point.x, Point.z, and zone.

Referenced by TaskDig.OnProgressComplete().

◆ MineObj()

void Map.MineObj ( Point  point,
Task  task = null,
Chara  c = null 
)
inline

Definition at line 1861 of file Map.cs.

1862 {
1863 if (!point.IsValid || !point.HasObj)
1864 {
1865 return;
1866 }
1867 Cell cell = point.cell;
1868 SourceObj.Row sourceObj = cell.sourceObj;
1869 if (c == null && task != null)
1870 {
1871 c = task.owner;
1872 }
1873 bool num = c == null || c.IsAgent || c.IsPCFactionOrMinion;
1874 DestroyObj(point);
1875 if (num)
1876 {
1877 SourceMaterial.Row matObj_fixed = cell.matObj_fixed;
1878 if (task is TaskHarvest { IsReapSeed: not false })
1879 {
1880 int num2 = 1 + EClass.rnd(2) + ((EClass.rnd(3) == 0) ? 1 : 0);
1881 int soilCost = EClass._zone.GetSoilCost();
1882 int maxSoil = EClass._zone.MaxSoil;
1883 if (soilCost > maxSoil)
1884 {
1885 num2 -= EClass.rnd(2 + (soilCost - maxSoil) / 10);
1886 }
1887 if (num2 <= 0)
1888 {
1889 Msg.Say("seedSpoiled", cell.GetObjName());
1890 }
1891 else if (!EClass._zone.IsUserZone)
1892 {
1893 Thing t2 = TraitSeed.MakeSeed(sourceObj, TryGetPlant(cell)).SetNum(num2);
1894 EClass.pc.PickOrDrop(point, t2);
1895 }
1896 if (cell.growth.IsTree)
1897 {
1898 cell.isHarvested = true;
1899 return;
1900 }
1901 }
1902 else if (sourceObj.HasGrowth)
1903 {
1904 cell.growth.PopMineObj(c);
1905 }
1906 else
1907 {
1908 if (cell.HasBlock && (sourceObj.id == 18 || sourceObj.id == 19))
1909 {
1910 MineBlock(point, recoverBlock: false, c, mineObj: false);
1911 }
1913 {
1914 if (EClass.game.survival.OnMineWreck(point))
1915 {
1916 Rand.SetSeed();
1917 return;
1918 }
1919 Rand.SetSeed();
1920 }
1921 switch (sourceObj.alias)
1922 {
1923 case "nest_bird":
1924 if (EClass.rnd(5) <= 1)
1925 {
1926 Pop(ThingGen.Create((EClass.rnd(10) == 0) ? "egg_fertilized" : "_egg").TryMakeRandomItem());
1927 }
1928 break;
1929 }
1930 int num3 = EClass.rnd(EClass.rnd(sourceObj.components.Length) + 1);
1931 string[] array = sourceObj.components[num3].Split('/');
1932 Thing thing = ThingGen.Create(array[0].Split('|')[0], matObj_fixed.alias);
1933 if (array.Length > 1)
1934 {
1935 thing.SetNum(EClass.rnd(array[1].ToInt()) + 1);
1936 }
1937 Pop(thing);
1938 }
1939 }
1940 SetObj(point.x, point.z);
1941 cell.gatherCount = 0;
1942 void Pop(Thing t)
1943 {
1945 {
1947 {
1948 EClass._map.PutAway(t);
1949 }
1950 else
1951 {
1952 TrySmoothPick(point, t, c);
1953 }
1954 }
1955 }
1956 }
new Chara owner
Definition: AIAct.cs:14
Thing TryMakeRandomItem(int lv=-1, TryMakeRandomItemSource itemSource=TryMakeRandomItemSource.Default, Chara crafter=null)
Definition: Card.cs:5606
Thing SetNum(int a)
Definition: Card.cs:3579
string GetObjName()
Definition: Cell.cs:1640
void PickOrDrop(Point p, string idThing, int idMat=-1, int num=1, bool msg=true)
Definition: Chara.cs:4372
SurvivalManager survival
Definition: Game.cs:228
bool IsSurvival
Definition: Game.cs:276
void PopMineObj(Chara c=null)
Definition: GrowSystem.cs:547
PlantData TryGetPlant(Point p)
Definition: Map.cs:1963
void DestroyObj(Point point)
Definition: Map.cs:1846
void MineBlock(Point point, bool recoverBlock=false, Chara c=null, bool mineObj=true)
Definition: Map.cs:1689
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
Definition: Rand.cs:4
static void SetSeed(int a=-1)
Definition: Rand.cs:44
bool HasGrowth
Definition: SourceObj.cs:28
bool OnMineWreck(Point point)
string alias
Definition: TileRow.cs:12
static Thing MakeSeed(string id, PlantData plant=null)
Definition: TraitSeed.cs:88
virtual int MaxSoil
Definition: Zone.cs:518
int GetSoilCost()
Definition: Zone.cs:3814

References EClass._map, EClass._zone, Scene.actionMode, SourceMaterial.Row.alias, TileRow.alias, Point.cell, RenderRow.components, ThingGen.Create(), EClass.debug, DestroyObj(), GamePrincipal.disableUsermapBenefit, EClass.game, Cell.GetObjName(), Zone.GetSoilCost(), CoreDebug.godBuild, Cell.growth, Cell.HasBlock, SourceObj.Row.HasGrowth, Point.HasObj, TileRow.id, ActionMode.IsBuildMode, Game.IsSurvival, GrowSystem.IsTree, Zone.IsUserZone, Point.IsValid, TraitSeed.MakeSeed(), Cell.matObj_fixed, Zone.MaxSoil, MineBlock(), SurvivalManager.OnMineWreck(), EClass.pc, Chara.PickOrDrop(), GrowSystem.PopMineObj(), Game.principal, PutAway(), EClass.rnd(), Msg.Say(), EClass.scene, Card.SetNum(), SetObj(), Rand.SetSeed(), Cell.sourceObj, Game.survival, TryGetPlant(), Card.TryMakeRandomItem(), TrySmoothPick(), Point.x, and Point.z.

Referenced by ActEffect.DamageEle(), MineBlock(), MineFloor(), MineRamp(), TaskHarvest.OnCreateProgress(), TaskCut.OnProgressComplete(), and GrowSystem.OnProgressComplete().

◆ MineObjSound()

void Map.MineObjSound ( Point  point)
inline

Definition at line 1958 of file Map.cs.

1959 {
1960 point.PlaySound(point.cell.matObj.GetSoundDead(point.cell.sourceObj));
1961 }

References Point.cell, Cell.matObj, Point.PlaySound(), and Cell.sourceObj.

Referenced by Recipe.Build().

◆ MineRamp()

void Map.MineRamp ( Point  point,
int  ramp,
bool  recoverBlock = false 
)
inline

Definition at line 1756 of file Map.cs.

1757 {
1758 if (point.IsValid && point.cell.HasFullBlock)
1759 {
1760 SourceMaterial.Row matBlock = point.matBlock;
1761 byte block = point.cell._block;
1762 Effect.Get("smoke").Play(point);
1763 Effect.Get("mine").Play(point).SetParticleColor(point.matBlock.GetColor())
1764 .Emit(10 + EClass.rnd(10));
1765 MineObj(point);
1766 int rampDir = EClass._map.GetRampDir(point.x, point.z, EClass.sources.blocks.rows[ramp].tileType);
1767 RemoveLonelyRamps(point.cell);
1768 SetBlock(point.x, point.z, point.cell._blockMat, ramp, rampDir);
1769 DropBlockComponent(point, EClass.sources.blocks.rows[block], matBlock, recoverBlock);
1770 }
1771 }
byte _blockMat
Definition: Cell.cs:34
int GetRampDir(int x, int z, TileType blockType=null)
Definition: Map.cs:2174

References Cell._block, Cell._blockMat, EClass._map, block, SourceManager.blocks, Point.cell, DropBlockComponent(), Effect.Get(), GetRampDir(), Cell.HasFullBlock, Point.IsValid, Point.matBlock, MineObj(), Effect.Play(), RemoveLonelyRamps(), EClass.rnd(), SetBlock(), EClass.sources, Point.x, and Point.z.

Referenced by TaskMine.OnProgressComplete().

◆ ModFire()

void Map.ModFire ( int  x,
int  z,
int  amount 
)
inline

Definition at line 1193 of file Map.cs.

1194 {
1195 Cell cell = cells[x, z];
1196 if (amount <= 0 || (!cell.IsTopWaterAndNoSnow && !cell.IsSnowTile && !EClass._zone.IsUnderwater))
1197 {
1198 if (cell.effect == null && amount > 0)
1199 {
1200 SE.Play("fire");
1201 }
1202 int num = amount + (cell.effect?.FireAmount ?? 0);
1203 if (num > 20)
1204 {
1205 num = 20;
1206 }
1207 if (num <= 0)
1208 {
1209 cell.effect = null;
1210 return;
1211 }
1212 cell.effect = new CellEffect
1213 {
1214 id = 3,
1215 amount = num
1216 };
1218 }
1219 }
int FireAmount
Definition: CellEffect.cs:162
bool IsSnowTile
Definition: Cell.cs:790
bool IsTopWaterAndNoSnow
Definition: Cell.cs:720

References EClass._zone, cells, Cell.effect, effectManager, CellEffect.FireAmount, LogicalPointManager.GetOrCreate(), Cell.IsSnowTile, Cell.IsTopWaterAndNoSnow, Zone.IsUnderwater, MapBounds.x, and MapBounds.z.

Referenced by RecipeCard.Craft(), and Point.ModFire().

◆ ModLiquid()

void Map.ModLiquid ( int  x,
int  z,
int  amount 
)
inline

Definition at line 1534 of file Map.cs.

1535 {
1536 Cell cell = cells[x, z];
1537 if (!cell.IsTopWaterAndNoSnow && cell.effect != null)
1538 {
1539 cell.effect.amount += amount;
1540 if (cell.effect.amount <= 0)
1541 {
1542 cell.effect = null;
1543 }
1544 }
1545 }
int amount
Definition: CellEffect.cs:26

References CellEffect.amount, cells, Cell.effect, Cell.IsTopWaterAndNoSnow, MapBounds.x, and MapBounds.z.

Referenced by GameUpdater.SurfaceUpdater.FixedUpdate().

◆ MoveCard()

void Map.MoveCard ( Point  p,
Card  t 
)
inline

Definition at line 853 of file Map.cs.

854 {
855 _AddCard(p.x, p.z, t, onAddToZone: false);
856 }

References _AddCard(), Point.x, and Point.z.

Referenced by Chara._Move(), Card._Move(), Card.MoveImmediate(), ResetEditorPos(), Resize(), AI_Trolley.Run(), and Chara.SyncRide().

◆ OnCardAddedToZone()

void Map.OnCardAddedToZone ( Card  t,
int  x,
int  z 
)
inline

Definition at line 818 of file Map.cs.

819 {
820 if (t.isChara)
821 {
822 charas.Add(t.Chara);
823 }
824 else
825 {
826 things.Add(t.Thing);
827 }
829 if (t.isChara && new Point(x, z).cell.HasFullBlock)
830 {
831 DestroyBlock(x, z);
832 }
833 _AddCard(x, z, t, onAddToZone: true);
835 }
virtual Thing Thing
Definition: Card.cs:2098
void DestroyBlock(int x, int z)
Definition: Map.cs:2045
virtual void OnAddedToZone()
Definition: Trait.cs:706

References _AddCard(), ActPlan.List.Add(), Card.Chara, charas, DestroyBlock(), Card.isChara, Trait.OnAddedToZone(), PropsManager.OnCardAddedToZone(), props, Card.Thing, things, Card.trait, MapBounds.x, and MapBounds.z.

Referenced by Zone.AddCard().

◆ OnCardRemovedFromZone()

void Map.OnCardRemovedFromZone ( Card  t)
inline

Definition at line 837 of file Map.cs.

838 {
841 _RemoveCard(t);
842 t.parent = null;
843 if (t.isChara)
844 {
845 charas.Remove(t.Chara);
846 }
847 else
848 {
849 things.Remove(t.Thing);
850 }
851 }
void SetPlaceState(PlaceState newState, bool byPlayer=false)
Definition: Card.cs:3831
virtual void OnRemovedFromZone()
Definition: Trait.cs:710

References _RemoveCard(), Card.Chara, charas, Card.isChara, Trait.OnRemovedFromZone(), Card.SetPlaceState(), Card.Thing, things, and Card.trait.

Referenced by Zone.RemoveCard().

◆ OnDeactivate()

void Map.OnDeactivate ( )
inline

Definition at line 205 of file Map.cs.

206 {
207 charas.ForeachReverse(delegate(Chara c)
208 {
209 c.ai = new NoGoal();
210 if (c.IsGlobal)
211 {
212 zone.RemoveCard(c);
213 c.currentZone = zone;
214 }
215 });
216 foreach (Thing thing in things)
217 {
218 if (thing.renderer.hasActor)
219 {
220 thing.renderer.KillActor();
221 }
222 }
224 }
void KillActor()
CardRenderer renderer
Definition: Card.cs:64
override bool IsGlobal
Definition: Chara.cs:624
Definition: NoGoal.cs:4
void ClearMapHighlights()
Definition: Player.cs:2518
void RemoveCard(Card t)
Definition: Zone.cs:2057

References charas, Player.ClearMapHighlights(), CardRenderer.hasActor, Chara.IsGlobal, CardRenderer.KillActor(), EClass.player, Zone.RemoveCard(), Card.renderer, things, and zone.

Referenced by Zone.Deactivate().

◆ OnDeserialized()

void Map.OnDeserialized ( StreamingContext  context)
inlineprivate

Definition at line 148 of file Map.cs.

149 {
150 bits.Bits = (uint)_bits;
151 }
int _bits
Definition: Map.cs:22

References _bits.

◆ OnImport()

void Map.OnImport ( ZoneExportData  data)
inline

Definition at line 726 of file Map.cs.

727 {
728 tasks = new TaskManager();
729 data.serializedCards.Restore(this, data.orgMap, addToZone: false);
730 }
TaskManager tasks
Definition: Map.cs:34
void Restore(Map map, Map orgMap, bool addToZone, PartialMap partial=null)
SerializedCards serializedCards

References ZoneExportData.orgMap, SerializedCards.Restore(), ZoneExportData.serializedCards, and tasks.

Referenced by Zone.Activate().

◆ OnLoad()

void Map.OnLoad ( )
inline

Definition at line 720 of file Map.cs.

721 {
722 rooms.OnLoad();
723 tasks.OnLoad();
724 }
void OnLoad()
Definition: RoomManager.cs:26
void OnLoad()
Definition: TaskManager.cs:66

References RoomManager.OnLoad(), TaskManager.OnLoad(), rooms, and tasks.

◆ OnSerializing() [1/2]

virtual void Map.OnSerializing ( )
inlineprotectedvirtual

Definition at line 143 of file Map.cs.

144 {
145 }

◆ OnSerializing() [2/2]

void Map.OnSerializing ( StreamingContext  context)
inlineprivate

Definition at line 138 of file Map.cs.

139 {
140 _bits = (int)bits.Bits;
141 }
BitArray32 bits
Definition: Map.cs:75
uint Bits
Definition: BitArray32.cs:6

References _bits, bits, and BitArray32.Bits.

◆ OnSetBlockOrDoor()

void Map.OnSetBlockOrDoor ( int  x,
int  z 
)
inline

Definition at line 1045 of file Map.cs.

1046 {
1047 new Point(x, z);
1048 TryRemoveRoom(x, z);
1049 if (x > 0)
1050 {
1051 TryRemoveRoom(x - 1, z);
1052 }
1053 if (x < Size - 1)
1054 {
1055 TryRemoveRoom(x + 1, z);
1056 }
1057 if (z > 0)
1058 {
1059 TryRemoveRoom(x, z - 1);
1060 }
1061 if (z < Size - 1)
1062 {
1063 TryRemoveRoom(x, z + 1);
1064 }
1065 if (x > 0 && z < Size - 1)
1066 {
1067 TryRemoveRoom(x - 1, z + 1);
1068 }
1069 roomHash.Clear();
1070 TryAddRoom(x, z);
1071 if (x > 0)
1072 {
1073 TryAddRoom(x - 1, z);
1074 }
1075 if (x < Size - 1)
1076 {
1077 TryAddRoom(x + 1, z);
1078 }
1079 if (z > 0)
1080 {
1081 TryAddRoom(x, z - 1);
1082 }
1083 if (z < Size - 1)
1084 {
1085 TryAddRoom(x, z + 1);
1086 }
1087 if (x > 0 && z < Size - 1)
1088 {
1089 TryAddRoom(x - 1, z + 1);
1090 }
1091 }
HashSet< int > roomHash
Definition: Map.cs:105
void TryRemoveRoom(int x, int z)
Definition: Map.cs:1093
void TryAddRoom(int x, int z)
Definition: Map.cs:1105

References roomHash, MapBounds.Size, TryAddRoom(), TryRemoveRoom(), MapBounds.x, and MapBounds.z.

Referenced by SerializedCards.Restore(), SetBlock(), and Card.SetPlaceState().

◆ PutAway()

bool Map.PutAway ( Card  c)
inline

Definition at line 2553 of file Map.cs.

2554 {
2556 {
2557 return false;
2558 }
2559 if (c.isChara)
2560 {
2562 {
2563 return false;
2564 }
2565 c.Destroy();
2566 return true;
2567 }
2568 Thing thing = c.Thing;
2569 if (thing.parent != null)
2570 {
2571 thing.parent.RemoveCard(thing);
2572 }
2573 thing.isMasked = false;
2574 thing.isRoofItem = false;
2575 if (EClass._zone.IsPCFaction && EClass._map.props.installed.traits.GetRandomThing<TraitSpotStockpile>() != null)
2576 {
2577 EClass._zone.TryAddThingInSpot<TraitSpotStockpile>(thing);
2578 return true;
2579 }
2580 if (EClass.debug.enable)
2581 {
2583 return true;
2584 }
2585 EClass.pc.Pick(thing, msg: false);
2586 return true;
2587 }
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:3182
ICardParent parent
Definition: Card.cs:56
void Destroy()
Definition: Card.cs:5198
virtual bool IsPC
Definition: Card.cs:2185
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:4392
bool enable
Definition: CoreDebug.cs:301
Thing GetOrCreateDebugContainer()
Definition: CoreDebug.cs:775
bool ignoreBuildRule
Definition: CoreDebug.cs:200
TraitManager traits
Definition: Props.cs:18
virtual bool CanOnlyCarry
Definition: Trait.cs:305
void RemoveCard(Card c)

References EClass._map, EClass._zone, Card.AddThing(), Trait.CanOnlyCarry, EClass.debug, Card.Destroy(), CoreDebug.enable, CoreDebug.GetOrCreateDebugContainer(), CoreDebug.ignoreBuildRule, PropsManager.installed, Card.isChara, Card.IsPC, Zone.IsPCFaction, Card.parent, EClass.pc, Chara.Pick(), props, ICardParent.RemoveCard(), Card.Thing, Card.trait, and Props.traits.

Referenced by DropBlockComponent(), MineObj(), AM_Deconstruct.Perform(), and AM_MoveInstalled.TryPutAway().

◆ Quake()

void Map.Quake ( )
inline

Definition at line 2444 of file Map.cs.

2445 {
2446 Point point = new Point();
2447 int num;
2448 for (num = 0; num < Size; num++)
2449 {
2450 int num2;
2451 for (num2 = 0; num2 < Size; num2++)
2452 {
2453 point.x = num;
2454 point.z = num2;
2455 point.Copy().Animate(AnimeID.Quake, animeBlock: true);
2456 num2 += EClass.rnd(2);
2457 }
2458 num += EClass.rnd(2);
2459 }
2460 }
AnimeID
Definition: AnimeID.cs:2
Point Copy()
Definition: Point.cs:491
void Animate(AnimeID id, bool animeBlock=false)
Definition: Point.cs:1303

References Point.Animate(), Point.Copy(), EClass.rnd(), and MapBounds.Size.

◆ QuickRefreshTile()

void Map.QuickRefreshTile ( int  x,
int  z 
)
inline

Definition at line 2159 of file Map.cs.

2160 {
2161 Cell cell = cells[x, z];
2162 Cell cell2 = ((x > 0) ? cells[x - 1, z] : Cell.Void);
2163 Cell cell3 = ((x + 1 < Size) ? cells[x + 1, z] : Cell.Void);
2164 Cell cell4 = ((z > 0) ? cells[x, z - 1] : Cell.Void);
2165 Cell cell5 = ((z + 1 < Size) ? cells[x, z + 1] : Cell.Void);
2166 Cell cell6 = ((x > 0 && z > 0) ? cells[x - 1, z - 1] : Cell.Void);
2167 Cell cell7 = ((x + 1 < Size && z > 0) ? cells[x + 1, z - 1] : Cell.Void);
2168 Cell cell8 = ((x > 0 && z + 1 < Size) ? cells[x - 1, z + 1] : Cell.Void);
2169 Cell cell9 = ((x + 1 < Size && z + 1 < Size) ? cells[x + 1, z + 1] : Cell.Void);
2170 cell.isSurrounded4d = cell2.HasFullBlock && cell3.HasFullBlock && cell4.HasFullBlock && cell5.HasFullBlock;
2171 cell.isSurrounded = cell.isSurrounded4d && cell6.HasFullBlock && cell7.HasFullBlock && cell8.HasFullBlock && cell9.HasFullBlock;
2172 }
static Cell Void
Definition: Cell.cs:10

References cells, Cell.HasFullBlock, MapBounds.Size, Cell.Void, MapBounds.x, and MapBounds.z.

Referenced by MapGen.GenerateTerrain().

◆ RefreshAllTiles()

void Map.RefreshAllTiles ( )
inline

Definition at line 2129 of file Map.cs.

2130 {
2131 for (int i = 0; i < Size; i++)
2132 {
2133 for (int j = 0; j < Size; j++)
2134 {
2135 cells[i, j].Refresh();
2136 }
2137 }
2138 }
void Refresh()
Definition: Cell.cs:1164

References cells, Cell.Refresh(), and MapBounds.Size.

Referenced by GameDate.AdvanceMonth(), PartialMap.Apply(), ZoneInspector.FillUtil.FlattenHeight(), MapGenDungen.OnGenerateTerrain(), MapGenRegion.OnGenerateTerrain(), Zone.OnSimulateMonth(), MapGen.Populate(), ZoneInspector.RefreshAll(), and HotItemContext.Show().

◆ RefreshFOV()

void Map.RefreshFOV ( int  x,
int  z,
int  radius = 6,
bool  recalculate = false 
)
inline

Definition at line 942 of file Map.cs.

943 {
944 ForeachSphere(x, z, radius, delegate(Point p)
945 {
946 List<Card> list = p.ListCards();
947 if (recalculate)
948 {
949 foreach (Card item in list)
950 {
951 item.RecalculateFOV();
952 }
953 return;
954 }
955 foreach (Card item2 in list)
956 {
957 item2.CalculateFOV();
958 }
959 });
960 }

References Card.CalculateFOV(), ForeachSphere(), item, Point.ListCards(), MapBounds.x, and MapBounds.z.

Referenced by GrowSystem.Grow(), MineBlock(), WidgetArtTool.OnActivate(), TaskMoveInstalled.OnProgressComplete(), TraitDoor.ToggleDoor(), and TraitDoorSwing.ToggleDoor().

◆ RefreshFOVAll()

void Map.RefreshFOVAll ( )
inline

Definition at line 962 of file Map.cs.

963 {
964 foreach (Card item in ((IEnumerable<Card>)EClass._map.things).Concat((IEnumerable<Card>)EClass._map.charas))
965 {
966 item.RecalculateFOV();
967 }
968 }

References EClass._map, charas, item, and things.

Referenced by ColorProfile.OnValidate().

◆ RefreshNeighborTiles()

void Map.RefreshNeighborTiles ( int  x,
int  z 
)
inline

Definition at line 2140 of file Map.cs.

2141 {
2142 cells[x, z].Refresh();
2143 for (int i = x - 2; i < x + 3; i++)
2144 {
2145 if (i < 0 || i >= Size)
2146 {
2147 continue;
2148 }
2149 for (int j = z - 2; j < z + 3; j++)
2150 {
2151 if (j >= 0 && j < Size && (x != i || z != j))
2152 {
2153 cells[i, j].Refresh();
2154 }
2155 }
2156 }
2157 }

References cells, Cell.Refresh(), MapBounds.Size, MapBounds.x, and MapBounds.z.

Referenced by AddDecal(), Burn(), SetBlock(), SetBridge(), SetDecal(), SetDeco(), SetFloor(), SetObj(), and SetSeen().

◆ RefreshShadow()

void Map.RefreshShadow ( int  x,
int  z 
)
inline

Definition at line 1821 of file Map.cs.

1822 {
1823 }

Referenced by MineBlock().

◆ RefreshSingleTile()

void Map.RefreshSingleTile ( int  x,
int  z 
)
inline

◆ RefreshSunMap()

void Map.RefreshSunMap ( )
inline

Definition at line 2743 of file Map.cs.

2744 {
2745 if (!isDirtySunMap)
2746 {
2747 return;
2748 }
2749 sunMap.Clear();
2750 foreach (Card sun in EClass._map.props.installed.traits.suns)
2751 {
2752 foreach (Point item in sun.trait.ListPoints(null, onlyPassable: false))
2753 {
2754 sunMap.Add(item.index);
2755 }
2756 }
2757 isDirtySunMap = false;
2758 }
static bool isDirtySunMap
Definition: Map.cs:16
static HashSet< int > sunMap
Definition: Map.cs:14
TraitMap suns
Definition: TraitManager.cs:14
virtual List< Point > ListPoints(Point center=null, bool onlyPassable=true)
Definition: Trait.cs:779

References EClass._map, PropsManager.installed, isDirtySunMap, item, Trait.ListPoints(), props, sunMap, TraitManager.suns, Card.trait, and Props.traits.

Referenced by GameUpdater.Update().

◆ Reload()

void Map.Reload ( )
inline

Definition at line 310 of file Map.cs.

311 {
312 rooms = new RoomManager();
313 SetReference();
314 string id = Game.id;
315 EClass.game.Save();
316 EClass.scene.Init(Scene.Mode.None);
317 Game.Load(id, cloud: false);
318 RevealAll();
319 TweenUtil.Tween(0.1f, null, delegate
320 {
321 ReloadRoom();
322 });
323 }
Definition: Game.cs:9
static void Load(string id, bool cloud)
Definition: Game.cs:322
static string id
Definition: Game.cs:148
bool Save(bool isAutoSave=false, bool silent=false)
Definition: Game.cs:1040
void ReloadRoom()
Definition: Map.cs:325
void RevealAll(bool reveal=true)
Definition: Map.cs:918
Definition: Scene.cs:8
void Init(Mode newMode)
Definition: Scene.cs:178
Mode
Definition: Scene.cs:10

References EClass.game, Game.id, Scene.Init(), Game.Load(), ReloadRoom(), RevealAll(), rooms, Game.Save(), EClass.scene, and SetReference().

Referenced by Resize(), and Shift().

◆ ReloadRoom()

void Map.ReloadRoom ( )
inline

Definition at line 325 of file Map.cs.

326 {
327 List<Thing> list = new List<Thing>();
328 foreach (Thing thing in things)
329 {
330 if (thing.trait.IsDoor)
331 {
332 list.Add(thing);
333 }
334 }
335 foreach (Thing item in list)
336 {
337 Point pos = item.pos;
339 EClass._zone.AddCard(item, pos);
340 item.Install();
341 }
343 }
void RefreshAll()
Definition: RoomManager.cs:43
virtual bool IsDoor
Definition: Trait.cs:58

References EClass._zone, Zone.AddCard(), Trait.IsDoor, item, RoomManager.RefreshAll(), Zone.RemoveCard(), rooms, things, and Card.trait.

Referenced by MapGenDungen.OnGenerateTerrain(), and Reload().

◆ RemoveLonelyRamps()

void Map.RemoveLonelyRamps ( Cell  cell)
inline

Definition at line 2031 of file Map.cs.

2032 {
2033 for (int i = 0; i < 4; i++)
2034 {
2035 Cell dependedRamp = GetDependedRamp(cell);
2036 if (dependedRamp != null)
2037 {
2038 MineBlock(dependedRamp.GetPoint());
2039 continue;
2040 }
2041 break;
2042 }
2043 }
Point GetPoint()
Definition: Cell.cs:1113
Cell GetDependedRamp(Cell cell)
Definition: Map.cs:2211

References GetDependedRamp(), Cell.GetPoint(), and MineBlock().

Referenced by MineBlock(), and MineRamp().

◆ RemovePlant()

void Map.RemovePlant ( Point  pos)
inline

Definition at line 1983 of file Map.cs.

1984 {
1985 plants.Remove(pos.index);
1986 }

References Point.index, and plants.

◆ Reset()

void Map.Reset ( )
inline

Definition at line 345 of file Map.cs.

346 {
347 for (int i = 0; i < Size; i++)
348 {
349 for (int j = 0; j < Size; j++)
350 {
351 cells[i, j].Reset();
352 }
353 }
354 SetReference();
355 }
void Reset()
Definition: Cell.cs:1562

References cells, Cell.Reset(), SetReference(), and MapBounds.Size.

Referenced by MapGen.OnGenerateTerrain().

◆ ResetEditorPos()

void Map.ResetEditorPos ( )
inline

Definition at line 357 of file Map.cs.

358 {
360 foreach (Chara chara in charas)
361 {
362 if (chara.isPlayerCreation && chara.orgPos != null)
363 {
364 MoveCard(chara.orgPos, chara);
365 }
366 }
367 foreach (Thing thing in things)
368 {
369 if (thing.trait is TraitDoor)
370 {
371 (thing.trait as TraitDoor).ForceClose();
372 }
373 }
374 }
bool isPlayerCreation
Definition: Card.cs:497
Point orgPos
Definition: Chara.cs:21
void MoveCard(Point p, Card t)
Definition: Map.cs:853
void Revive()
Definition: Zone.cs:1126

References EClass._zone, charas, Card.isPlayerCreation, MoveCard(), Chara.orgPos, Zone.Revive(), things, and Card.trait.

Referenced by Zone.Export(), and BuildMenu.OnActivate().

◆ Resize()

void Map.Resize ( int  newSize)
inline

Definition at line 226 of file Map.cs.

227 {
228 Point p = new Point(0, 0);
229 foreach (Thing thing in EClass._map.things)
230 {
231 if (thing.pos.x >= newSize || thing.pos.z >= newSize)
232 {
233 MoveCard(p, thing);
234 }
235 }
236 foreach (Chara chara in EClass._map.charas)
237 {
238 if (chara.pos.x >= newSize || chara.pos.z >= newSize)
239 {
240 MoveCard(p, chara);
241 }
242 }
243 Size = (bounds.Size = newSize);
244 maxX = (maxZ = Size);
245 cells = Util.ResizeArray(EClass._map.cells, newSize, newSize, (int x, int y) => new Cell
246 {
247 x = (byte)x,
248 z = (byte)y,
249 isSeen = true
250 });
251 Reload();
252 }
void Reload()
Definition: Map.cs:310
Definition: Util.cs:10

References EClass._map, cells, charas, MapBounds.maxX, MapBounds.maxZ, MoveCard(), Card.pos, Reload(), MapBounds.Size, things, Util, MapBounds.x, Point.x, MapBounds.z, and Point.z.

Referenced by ZoneInspector.ResizeUtil.Apply(), and MapGen.OnGenerateTerrain().

◆ Reveal()

void Map.Reveal ( Point  center,
int  power = 100 
)
inline

Definition at line 931 of file Map.cs.

932 {
933 ForeachSphere(center.x, center.z, 10 + power / 5, delegate(Point p)
934 {
935 if (EClass.rnd(power) >= Mathf.Min(p.Distance(center) * 10, power - 10))
936 {
937 EClass._map.SetSeen(p.x, p.z);
938 }
939 });
940 }
int Distance(Point p)
Definition: Point.cs:990

References Point.Distance(), ForeachSphere(), EClass.rnd(), Point.x, and Point.z.

Referenced by ActEffect.Proc().

◆ RevealAll()

void Map.RevealAll ( bool  reveal = true)
inline

Definition at line 918 of file Map.cs.

919 {
920 for (int i = 0; i < Size; i++)
921 {
922 for (int j = 0; j < Size; j++)
923 {
924 EClass._map.SetSeen(i, j, reveal, refresh: false);
925 }
926 }
929 }
bool revealed
Definition: Map.cs:103
void SetSeen(int x, int z, bool seen=true, bool refresh=true)
Definition: Map.cs:905
static void UpdateMap(List< Cell > newPoints)

References EClass._map, revealed, SetSeen(), MapBounds.Size, and WidgetMinimap.UpdateMap().

Referenced by BuildMenu.Activate(), Zone.ClaimZone(), ZoneProfile.Generate(), ActEffect.Proc(), Reload(), and CoreDebug.ToggleRevealMap().

◆ Save()

void Map.Save ( string  path,
ZoneExportData  export = null,
PartialMap  partial = null 
)
inline

Definition at line 376 of file Map.cs.

377 {
379 Debug.Log("#io saving map:" + path);
380 IO.CreateDirectory(path);
381 int num = 0;
382 int num2 = 0;
383 int num3 = Size;
384 int num4 = Size;
385 if (partial != null)
386 {
387 num = partial.offsetX;
388 num2 = partial.offsetZ;
389 num3 = partial.w;
390 num4 = partial.h;
391 }
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];
414 cellEffects.Clear();
415 int num6 = 0;
416 for (int i = num; i < num + num3; i++)
417 {
418 for (int j = num2; j < num2 + num4; j++)
419 {
420 Cell cell = cells[i, j];
421 array[num6] = cell.objVal;
422 array3[num6] = cell._blockMat;
423 array2[num6] = cell._block;
424 array5[num6] = cell._floorMat;
425 array4[num6] = cell._floor;
426 array6[num6] = cell.obj;
427 array20[num6] = cell._deco;
428 array21[num6] = cell._decoMat;
429 array7[num6] = cell.objMat;
430 array8[num6] = cell.decal;
431 array9[num6] = cell._dirs;
432 array12[num6] = cell.height;
433 array13[num6] = cell._bridge;
434 array14[num6] = cell._bridgeMat;
435 array15[num6] = cell.bridgeHeight;
436 array17[num6] = cell._roofBlockDir;
437 array18[num6] = cell._roofBlock;
438 array19[num6] = cell._roofBlockMat;
439 array16[num6] = cell.bridgePillar;
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);
446 array10[num6] = array10[num6].SetBit(7, cell.isToggleWallPillar);
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);
450 if (cell.effect != null)
451 {
452 cellEffects[j * num4 + i] = cell.effect;
453 }
454 num6++;
455 }
456 }
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);
479 things.Sort((Thing a, Thing b) => a.stackOrder - b.stackOrder);
480 if (export == null)
481 {
482 foreach (Chara chara in charas)
483 {
484 if (!chara.IsGlobal)
485 {
486 serializedCharas.Add(chara);
487 }
488 }
489 GameIO.SaveFile(path + "map", this);
490 }
491 else
492 {
493 export.serializedCards.cards.Clear();
494 if (partial == null)
495 {
496 MapExportSetting mapExportSetting = exportSetting ?? new MapExportSetting();
497 foreach (Chara chara2 in charas)
498 {
499 if (export.usermap)
500 {
501 if ((!mapExportSetting.clearLocalCharas || chara2.IsPCFactionOrMinion) && !chara2.trait.IsUnique && !chara2.IsPC)
502 {
503 export.serializedCards.Add(chara2);
504 }
505 }
506 else if (!chara2.IsGlobal && chara2.isPlayerCreation)
507 {
508 export.serializedCards.Add(chara2);
509 }
510 }
511 foreach (Thing thing in things)
512 {
513 if (thing.isPlayerCreation && thing.c_altName != "DebugContainer")
514 {
515 export.serializedCards.Add(thing);
516 }
517 }
518 }
519 else
520 {
521 foreach (Thing thing2 in things)
522 {
523 if ((ActionMode.Copy.IsActive || thing2.trait.CanCopyInBlueprint) && thing2.pos.x >= num && thing2.pos.z >= num2 && thing2.pos.x < num + num3 && thing2.pos.z < num2 + num4)
524 {
525 export.serializedCards.Add(thing2);
526 }
527 }
528 }
529 List<Thing> list = things;
530 things = new List<Thing>();
531 GameIO.SaveFile(path + "map", this);
532 things = list;
533 }
534 serializedCharas.Clear();
535 void Write(string _path, byte[] bytes)
536 {
537 IO.WriteLZ4(_path, bytes, compression);
538 }
539 }
static AM_Copy Copy
Definition: ActionMode.cs:45
bool IsActive
Definition: ActionMode.cs:121
string c_altName
Definition: Card.cs:1621
byte objMat
Definition: Cell.cs:44
bool isHarvested
Definition: Cell.cs:338
bool isClearSnow
Definition: Cell.cs:458
byte _deco
Definition: Cell.cs:58
byte _decoMat
Definition: Cell.cs:60
byte objVal
Definition: Cell.cs:42
byte _floorMat
Definition: Cell.cs:38
byte _roofBlock
Definition: Cell.cs:52
byte height
Definition: Cell.cs:80
bool isWatered
Definition: Cell.cs:350
byte _roofBlockDir
Definition: Cell.cs:56
bool isToggleWallPillar
Definition: Cell.cs:566
byte _roofBlockMat
Definition: Cell.cs:54
bool isSeen
Definition: Cell.cs:290
byte obj
Definition: Cell.cs:40
bool isForceFloat
Definition: Cell.cs:314
bool impassable
Definition: Cell.cs:410
bool crossWall
Definition: Cell.cs:638
bool isObjDyed
Definition: Cell.cs:626
byte bridgeHeight
Definition: Cell.cs:82
byte _dirs
Definition: Cell.cs:30
byte bridgePillar
Definition: Cell.cs:90
new TraitChara trait
Definition: Chara.cs:505
override bool IsPC
Definition: Chara.cs:626
Definition: GameIO.cs:11
static void SaveFile(string path, object obj)
Definition: GameIO.cs:257
Compression
Definition: IO.cs:13
static void CreateDirectory(string path)
Definition: IO.cs:377
static void WriteLZ4(string _path, byte[] _bytes, Compression compression=Compression.None)
Definition: IO.cs:141
List< Chara > serializedCharas
Definition: Map.cs:43
int offsetX
Definition: PartialMap.cs:31
int offsetZ
Definition: PartialMap.cs:34
void Add(Card c)
List< Data > cards
int stackOrder
Definition: Thing.cs:13
virtual bool IsUnique
Definition: TraitChara.cs:33
virtual bool CanCopyInBlueprint
Definition: Trait.cs:166

References Cell._block, Cell._blockMat, Cell._bridge, Cell._bridgeMat, Cell._deco, Cell._decoMat, Cell._dirs, Cell._floor, Cell._floorMat, Cell._roofBlock, Cell._roofBlockDir, Cell._roofBlockMat, Cell.bridgeHeight, Cell.bridgePillar, Card.c_altName, Trait.CanCopyInBlueprint, cellEffects, cells, charas, compression, CoreConfig.Test.compressSave, Core.config, ActionMode.Copy, EClass.core, Cell.crossWall, Debug, Cell.decal, Cell.effect, exportSetting, Cell.height, Cell.impassable, ActionMode.IsActive, Cell.isClearSnow, Cell.isForceFloat, Chara.IsGlobal, Cell.isHarvested, Cell.isModified, Cell.isObjDyed, Chara.IsPC, Card.IsPCFactionOrMinion, Card.isPlayerCreation, Cell.isSeen, Cell.isToggleWallPillar, TraitChara.IsUnique, Cell.isWatered, Cell.obj, Cell.objMat, Cell.objVal, Card.pos, GameIO.SaveFile(), serializedCharas, MapBounds.Size, Thing.stackOrder, CoreConfig.test, things, Card.trait, Chara.trait, version, BaseCore.version, Point.x, and Point.z.

Referenced by Zone._OnBeforeSave(), and Zone.Export().

◆ SetBlock() [1/2]

void Map.SetBlock ( int  x,
int  z,
int  idMat,
int  idBlock,
int  dir 
)
inline

Definition at line 1022 of file Map.cs.

1023 {
1024 Cell cell = cells[x, z];
1025 bool hasFloodBlock = cell.HasFloodBlock;
1026 cell._blockMat = (byte)idMat;
1027 cell._block = (byte)idBlock;
1028 cell.blockDir = dir;
1029 if (cell.effect == null || !cell.effect.IsFire)
1030 {
1031 cell.effect = null;
1032 }
1033 cell.isToggleWallPillar = false;
1034 if (cell.room != null)
1035 {
1036 cell.room.SetDirty();
1037 }
1038 if (hasFloodBlock || cell.HasFloodBlock)
1039 {
1041 }
1043 }
bool IsFire
Definition: CellEffect.cs:147
bool HasFloodBlock
Definition: Cell.cs:1025
void OnSetBlockOrDoor(int x, int z)
Definition: Map.cs:1045

References cells, Cell.effect, Cell.HasFloodBlock, CellEffect.IsFire, OnSetBlockOrDoor(), RefreshNeighborTiles(), Cell.room, Room.SetDirty(), MapBounds.x, and MapBounds.z.

◆ SetBlock() [2/2]

void Map.SetBlock ( int  x,
int  z,
int  idMat = 0,
int  idBlock = 0 
)
inline

Definition at line 1017 of file Map.cs.

1018 {
1019 SetBlock(x, z, idMat, idBlock, 0);
1020 }

References SetBlock(), MapBounds.x, and MapBounds.z.

Referenced by Recipe.Build(), ZoneInspector.FillUtil.ClearBlock(), DestroyBlock(), ZoneInspector.FillUtil.FillBlock(), MineRamp(), Point.SetBlock(), and SetBlock().

◆ SetBlockDir()

void Map.SetBlockDir ( int  x,
int  z,
int  dir 
)
inline

Definition at line 1186 of file Map.cs.

1187 {
1188 Cell cell = cells[x, z];
1189 cell._block = (byte)cell.sourceBlock.id;
1190 cell.blockDir = dir;
1191 }

References Cell.blockDir, cells, Cell.sourceBlock, MapBounds.x, and MapBounds.z.

Referenced by Recipe.Build().

◆ SetBounds() [1/2]

void Map.SetBounds ( int  size)
inline

Definition at line 2352 of file Map.cs.

2353 {
2354 if (size > Size / 2 + 1)
2355 {
2356 size = Size / 2 - 1;
2357 }
2358 bounds.SetBounds(Size / 2 - size, Size / 2 - size, Size / 2 + size, Size / 2 + size);
2359 }

References bounds, MapBounds.SetBounds(), and MapBounds.Size.

Referenced by CreateNew(), Load(), and MapGen.OnGenerateTerrain().

◆ SetBounds() [2/2]

void Map.SetBounds ( MapBounds  b)
inline

Definition at line 2361 of file Map.cs.

2362 {
2363 bounds.SetBounds(b.x, b.z, b.maxX, b.maxZ);
2364 bounds.Size = b.Size;
2365 }

References bounds, MapBounds.maxX, MapBounds.maxZ, MapBounds.SetBounds(), MapBounds.Size, MapBounds.x, and MapBounds.z.

◆ SetBridge()

void Map.SetBridge ( int  x,
int  z,
int  height = 0,
int  idMat = 0,
int  idBridge = 0,
int  dir = 0,
byte  idPillar = 0 
)
inline

Definition at line 993 of file Map.cs.

994 {
995 Cell cell = cells[x, z];
996 cell.bridgeHeight = (byte)height;
997 cell._bridgeMat = (byte)idMat;
998 cell._bridge = (byte)idBridge;
999 cell.bridgePillar = idPillar;
1000 cell.floorDir = dir;
1001 if (cell.room != null)
1002 {
1003 cell.room.SetDirty();
1004 }
1006 }

References cells, RefreshNeighborTiles(), Cell.room, Room.SetDirty(), MapBounds.x, and MapBounds.z.

Referenced by Recipe.Build(), MineFloor(), and TaskDig.OnProgressComplete().

◆ SetDecal()

void Map.SetDecal ( int  x,
int  z,
int  id = 0,
int  amount = 1,
bool  refresh = true 
)
inline

Definition at line 2072 of file Map.cs.

2073 {
2074 cells[x, z].decal = (byte)((id != 0 && amount != 0) ? ((uint)(id * 8 + amount)) : 0u);
2075 if (refresh)
2076 {
2078 }
2079 }

References cells, Cell.decal, RefreshNeighborTiles(), MapBounds.x, and MapBounds.z.

Referenced by FactionBranch.DailyOutcome(), AM_MoveInstalled.HitTest(), AIWork_Clean.OnPerformWork(), TaskCut.OnProgressComplete(), AI_Clean.Run(), and TaskClean.Run().

◆ SetDeco()

void Map.SetDeco ( int  x,
int  z,
int  idMat,
int  idDeco 
)
inline

Definition at line 985 of file Map.cs.

986 {
987 Cell cell = cells[x, z];
988 cell._decoMat = (byte)idMat;
989 cell._deco = (byte)idDeco;
991 }

References cells, RefreshNeighborTiles(), MapBounds.x, and MapBounds.z.

Referenced by Recipe.Build().

◆ SetEffect()

void Map.SetEffect ( int  x,
int  z,
CellEffect  effect = null 
)
inline

Definition at line 1529 of file Map.cs.

1530 {
1531 cells[x, z].effect = effect;
1532 }

References cells, Cell.effect, MapBounds.x, and MapBounds.z.

Referenced by Chara._Move(), GameUpdater.FastSurfaceUpdater.FixedUpdate(), and ActEffect.ProcAt().

◆ SetFloor() [1/2]

void Map.SetFloor ( int  x,
int  z,
int  idMat,
int  idFloor,
int  dir 
)
inline

Definition at line 975 of file Map.cs.

976 {
977 Cell cell = cells[x, z];
978 cell._floorMat = (byte)idMat;
979 cell._floor = (byte)idFloor;
980 cell.floorDir = dir;
983 }

References cells, Critter.RebuildCritter(), RefreshNeighborTiles(), MapBounds.x, and MapBounds.z.

◆ SetFloor() [2/2]

void Map.SetFloor ( int  x,
int  z,
int  idMat = 0,
int  idFloor = 0 
)
inline

Definition at line 970 of file Map.cs.

971 {
972 SetFloor(x, z, idMat, idFloor, 0);
973 }

References SetFloor(), MapBounds.x, and MapBounds.z.

Referenced by Recipe.Build(), ZonePreEnterDigStairs.Execute(), ZoneInspector.FillUtil.FillFloor(), Zone.Generate(), MineFloor(), Point.SetFloor(), and SetFloor().

◆ SetFoormark()

void Map.SetFoormark ( Point  pos,
int  id,
int  angle,
int  offset = 0 
)
inline

Definition at line 2081 of file Map.cs.

2082 {
2083 Cell cell = pos.cell;
2084 int tile = AngleToIndex(angle) + offset;
2085 Footmark footmark = new Footmark
2086 {
2087 tile = tile,
2088 remaining = 10
2089 };
2090 footmark.pos.Set(pos);
2091 footmarks.Add(footmark);
2092 cell.GetOrCreateDetail().footmark = footmark;
2093 }
Footmark footmark
Definition: CellDetail.cs:17
CellDetail GetOrCreateDetail()
Definition: Cell.cs:1569
Point pos
Definition: Footmark.cs:3
int AngleToIndex(int a)
Definition: Map.cs:2095
List< Footmark > footmarks
Definition: Map.cs:99

References AngleToIndex(), Point.cell, CellDetail.footmark, footmarks, Cell.GetOrCreateDetail(), Footmark.pos, and Point.Set().

Referenced by Chara._Move().

◆ SetLiquid() [1/2]

void Map.SetLiquid ( int  x,
int  z,
CellEffect  effect = null 
)
inline

◆ SetLiquid() [2/2]

void Map.SetLiquid ( int  x,
int  z,
int  id,
int  value = 1 
)
inline

Definition at line 1507 of file Map.cs.

1508 {
1509 Cell cell = cells[x, z];
1510 if (!cell.IsTopWaterAndNoSnow || value == 0)
1511 {
1512 if (value > 3)
1513 {
1514 value = 3;
1515 }
1516 if (value <= 0)
1517 {
1518 cell.effect = null;
1519 return;
1520 }
1521 cell.effect = new CellEffect
1522 {
1523 id = id,
1524 amount = value
1525 };
1526 }
1527 }

References cells, Cell.IsTopWaterAndNoSnow, MapBounds.x, and MapBounds.z.

◆ SetObj() [1/2]

void Map.SetObj ( int  x,
int  z,
int  id = 0,
int  value = 1,
int  dir = 0 
)
inline

◆ SetObj() [2/2]

void Map.SetObj ( int  x,
int  z,
int  idMat,
int  idObj,
int  value,
int  dir,
bool  ignoreRandomMat = false 
)
inline

Definition at line 1561 of file Map.cs.

1562 {
1563 Cell cell = cells[x, z];
1564 if (cell.sourceObj.id == 118 || idObj == 118)
1565 {
1566 EClass._zone.dirtyElectricity = true;
1567 }
1568 cell.obj = (byte)idObj;
1569 cell.objVal = (byte)value;
1570 cell.objMat = (byte)idMat;
1571 cell.objDir = dir;
1572 cell.isHarvested = false;
1573 cell.isObjDyed = false;
1574 SourceObj.Row sourceObj = cell.sourceObj;
1575 if (!ignoreRandomMat && !sourceObj.matCategory.IsEmpty())
1576 {
1577 int num = EClass._zone.DangerLv;
1578 if (sourceObj.tag.Contains("spot"))
1579 {
1580 num += EClass.pc.Evalue(1656) * 5;
1581 }
1582 cell.objMat = (byte)MATERIAL.GetRandomMaterialFromCategory(num, sourceObj.matCategory.Split(','), cell.matObj).id;
1583 }
1584 if (backerObjs.ContainsKey(cell.index))
1585 {
1586 backerObjs.Remove(cell.index);
1587 }
1588 if (plants.ContainsKey(cell.index))
1589 {
1590 plants.Remove(cell.index);
1591 }
1592 cell.growth?.OnSetObj();
1593 Critter.RebuildCritter(cell);
1595 }
int Evalue(int ele)
Definition: Card.cs:2613
virtual void OnSetObj()
Definition: GrowSystem.cs:283
static SourceMaterial.Row GetRandomMaterialFromCategory(int lv, string cat, SourceMaterial.Row fallback)
Definition: MATERIAL.cs:93
string[] tag
Definition: RenderRow.cs:58
string matCategory
Definition: SourceObj.cs:23

References EClass._zone, backerObjs, cells, Zone.DangerLv, Card.Evalue(), MATERIAL.GetRandomMaterialFromCategory(), Cell.growth, Cell.index, SourceObj.Row.matCategory, Cell.matObj, GrowSystem.OnSetObj(), EClass.pc, plants, Critter.RebuildCritter(), RefreshNeighborTiles(), Cell.sourceObj, RenderRow.tag, MapBounds.x, and MapBounds.z.

◆ SetReference()

void Map.SetReference ( )
inline

Definition at line 195 of file Map.cs.

196 {
197 Fov.map = (Cell.map = (Wall.map = (Point.map = (CellDetail.map = this))));
198 Cell.Size = Size;
199 Cell.cells = cells;
201 WeightCell[,] weightMap = cells;
202 pathfinder.Init(this, weightMap, Size);
203 }
IPathfinder pathfinder
Definition: PathManager.cs:24
static PathManager Instance
Definition: PathManager.cs:16
void Init(IPathfindGrid _grid, WeightCell[,] _weightMap, int size)

References cells, IPathfinder.Init(), PathManager.Instance, PathManager.pathfinder, and MapBounds.Size.

Referenced by PartialMap._Load(), Zone.Activate(), PartialMap.Apply(), CreateNew(), Reload(), Reset(), and SetZone().

◆ SetRoofBlock()

void Map.SetRoofBlock ( int  x,
int  z,
int  idMat,
int  idBlock,
int  dir,
int  height 
)
inline

Definition at line 1008 of file Map.cs.

1009 {
1010 Cell cell = cells[x, z];
1011 cell._roofBlockMat = (byte)idMat;
1012 cell._roofBlock = (byte)idBlock;
1013 cell._roofBlockDir = (byte)(dir + height * 4);
1015 }

References cells, RefreshSingleTile(), MapBounds.x, and MapBounds.z.

Referenced by Recipe.Build().

◆ SetSeen()

void Map.SetSeen ( int  x,
int  z,
bool  seen = true,
bool  refresh = true 
)
inline

Definition at line 905 of file Map.cs.

906 {
907 if (cells[x, z].isSeen != seen)
908 {
909 cells[x, z].isSeen = seen;
910 if (refresh)
911 {
913 }
915 }
916 }

References EClass._map, cells, Cell.isSeen, RefreshNeighborTiles(), WidgetMinimap.UpdateMap(), MapBounds.x, and MapBounds.z.

Referenced by Fov.Perform(), and RevealAll().

◆ SetZone()

void Map.SetZone ( Zone  _zone)
inline

Definition at line 181 of file Map.cs.

182 {
183 zone = _zone;
184 zone.bounds = bounds;
185 bounds.Size = Size;
186 SetReference();
187 props.Init();
188 EClass.scene.profile = SceneProfile.Load(config.idSceneProfile.IsEmpty("default"));
189 if (!config.idFowProfile.IsEmpty())
190 {
192 }
193 }
static FowProfile Load(string id)
Definition: FowProfile.cs:9
string idSceneProfile
Definition: MapConfig.cs:8
string idFowProfile
Definition: MapConfig.cs:11
FowProfile fowProfile
Definition: Map.cs:101
MapConfig config
Definition: Map.cs:37
static SceneProfile Load(string id)
Definition: SceneProfile.cs:18

References EClass._zone, bounds, config, fowProfile, MapConfig.idFowProfile, MapConfig.idSceneProfile, PropsManager.Init(), FowProfile.Load(), SceneProfile.Load(), props, SetReference(), MapBounds.Size, and zone.

Referenced by Zone.Activate(), Zone.Generate(), ZoneBlueprint.GenerateMap(), MapGen.GenerateTerrain(), MapGenDungen.OnGenerateTerrain(), and MapGenRegion.OnGenerateTerrain().

◆ Shift()

void Map.Shift ( Vector2Int  offset)
inline

Definition at line 254 of file Map.cs.

255 {
256 TweenUtil.Tween(0.1f, null, delegate
257 {
258 foreach (Card item in ((IEnumerable<Card>)EClass._map.things).Concat((IEnumerable<Card>)EClass._map.charas))
259 {
260 item.pos.x += offset.x;
261 item.pos.z += offset.y;
262 item.pos.Clamp();
263 }
264 Cell[,] array = new Cell[Size, Size];
265 for (int i = 0; i < Size; i++)
266 {
267 int num = i - offset.y;
268 for (int j = 0; j < Size; j++)
269 {
270 int num2 = j - offset.x;
271 if (num2 >= 0 && num2 < Size && num >= 0 && num < Size)
272 {
273 array[j, i] = cells[num2, num];
274 }
275 else
276 {
277 array[j, i] = new Cell
278 {
279 x = (byte)j,
280 z = (byte)i
281 };
282 }
283 }
284 }
285 cells = array;
286 bounds.x += offset.x;
287 bounds.z += offset.y;
288 bounds.maxX += offset.x;
289 bounds.maxZ += offset.y;
290 if (bounds.x < 0)
291 {
292 bounds.x = 0;
293 }
294 if (bounds.z < 0)
295 {
296 bounds.z = 0;
297 }
298 if (bounds.maxX > Size)
299 {
300 bounds.maxX = Size;
301 }
302 if (bounds.maxZ > Size)
303 {
304 bounds.maxZ = Size;
305 }
306 Reload();
307 });
308 }

References EClass._map, bounds, cells, charas, item, MapBounds.maxX, MapBounds.maxZ, Reload(), MapBounds.Size, things, Cell.x, MapBounds.x, and MapBounds.z.

Referenced by ZoneInspector.ResizeUtil.Apply().

◆ TryAddRoom()

void Map.TryAddRoom ( int  x,
int  z 
)
inline

Definition at line 1105 of file Map.cs.

1106 {
1107 if (EClass._zone.DisableRooms || roomHash.Contains(x + z * Size) || cells[x, z].HasFloodBlock)
1108 {
1109 return;
1110 }
1111 FloodSpiller floodSpiller = flood;
1112 IFloodCell[,] array = cells;
1113 FloodSpiller.Result result = floodSpiller.SpillFlood(array, x, z);
1114 if (!result.IsValid)
1115 {
1116 return;
1117 }
1118 bool flag = false;
1119 foreach (IFloodCell item in result.visited)
1120 {
1121 if (item.hasDoor)
1122 {
1123 flag = true;
1124 break;
1125 }
1126 Cell cell = item as Cell;
1127 if (cell.sourceBlock.tileType.IsFloodDoor || cell.Front.hasDoor || cell.Right.hasDoor || cell.FrontRight.hasDoor || cell.Back.hasDoor || cell.Left.hasDoor || cell.BackLeft.hasDoor)
1128 {
1129 flag = true;
1130 break;
1131 }
1132 }
1133 if (!flag && IsIndoor)
1134 {
1135 foreach (IFloodCell item2 in result.visited)
1136 {
1137 Cell cell2 = item2 as Cell;
1138 if (cell2.detail == null || cell2.detail.things.Count == 0)
1139 {
1140 continue;
1141 }
1142 foreach (Thing thing in cell2.detail.things)
1143 {
1144 if (thing.trait is TraitRoomPlate || thing.trait is TraitHouseBoard)
1145 {
1146 flag = true;
1147 break;
1148 }
1149 }
1150 if (flag)
1151 {
1152 break;
1153 }
1154 }
1155 }
1156 if (!flag)
1157 {
1158 return;
1159 }
1160 Room room = rooms.AddRoom(new Room());
1161 foreach (IFloodCell item3 in result.visited)
1162 {
1163 Cell cell3 = item3 as Cell;
1164 byte b = cell3.x;
1165 byte b2 = cell3.z;
1166 room.AddPoint(new Point(b, b2));
1167 roomHash.Add(b + b2 * Size);
1168 if (b2 > 0 && cell3.Front.HasFloodBlock && cell3.Front.room == null)
1169 {
1170 room.AddPoint(new Point(b, b2 - 1));
1171 roomHash.Add(b + (b2 - 1) * Size);
1172 }
1173 if (b < Size - 1 && cell3.Right.HasFloodBlock && cell3.Right.room == null)
1174 {
1175 room.AddPoint(new Point(b + 1, b2));
1176 roomHash.Add(b + 1 + b2 * Size);
1177 }
1178 if (b2 > 0 && b < Size - 1 && cell3.FrontRight.HasFloodBlock && cell3.FrontRight.room == null)
1179 {
1180 room.AddPoint(new Point(b + 1, b2 - 1));
1181 roomHash.Add(b + 1 + (b2 - 1) * Size);
1182 }
1183 }
1184 }
Cell BackLeft
Definition: Cell.cs:221
bool hasDoor
Definition: Cell.cs:266
Cell FrontRight
Definition: Cell.cs:185
bool IsIndoor
Definition: Map.cs:131
FloodSpiller flood
Definition: Map.cs:93
Room AddRoom(Room r)
Definition: RoomManager.cs:110
Definition: Room.cs:4
void AddPoint(Point p)
Definition: Room.cs:46
virtual bool DisableRooms
Definition: Zone.cs:121

References EClass._zone, RoomManager.AddRoom(), Cell.Back, Cell.BackLeft, cells, Cell.detail, Zone.DisableRooms, flood, Cell.Front, Cell.FrontRight, Cell.hasDoor, Cell.HasFloodBlock, IsIndoor, item, Cell.Left, Cell.Right, Cell.room, roomHash, rooms, MapBounds.Size, Cell.sourceBlock, Card.things, CellDetail.things, Card.trait, Cell.x, MapBounds.x, Cell.z, and MapBounds.z.

Referenced by OnSetBlockOrDoor().

◆ TryGetPlant() [1/2]

PlantData Map.TryGetPlant ( Cell  c)
inline

Definition at line 1968 of file Map.cs.

1969 {
1970 return plants.TryGetValue(c.index);
1971 }

References Cell.index, and plants.

◆ TryGetPlant() [2/2]

◆ TryLoadFile()

byte[] Map.TryLoadFile ( string  path,
string  s,
int  size 
)
inline

Definition at line 541 of file Map.cs.

542 {
543 byte[] array = IO.ReadLZ4(path + s, size, compression);
544 if (array == null)
545 {
546 Debug.Log("Couldn't load:" + s);
547 return new byte[size];
548 }
549 return array;
550 }
static byte[] ReadLZ4(string _path, int size, Compression compression)
Definition: IO.cs:159

References compression, and Debug.

Referenced by Zone.Activate(), and Load().

◆ TryRemoveRoom()

void Map.TryRemoveRoom ( int  x,
int  z 
)
inline

Definition at line 1093 of file Map.cs.

1094 {
1095 if (!cells[x, z].HasFloodBlock)
1096 {
1097 Room room = cells[x, z].room;
1098 if (room != null)
1099 {
1100 rooms.RemoveRoom(room);
1101 }
1102 }
1103 }
void RemoveRoom(Room r)
Definition: RoomManager.cs:119

References cells, RoomManager.RemoveRoom(), Cell.room, rooms, MapBounds.x, and MapBounds.z.

Referenced by OnSetBlockOrDoor().

◆ TryShatter()

void Map.TryShatter ( Point  pos,
int  ele,
int  power 
)
inline

Definition at line 1221 of file Map.cs.

1222 {
1223 Element element = Element.Create(ele);
1224 List<Card> list = new List<Card>();
1225 bool fire = ele == 910;
1226 bool cold = ele == 911;
1227 _ = fire;
1228 List<Card> list2 = pos.ListCards();
1229 if (fire && (pos.cell.IsSnowTile || pos.cell.IsTopWater))
1230 {
1231 return;
1232 }
1233 foreach (Card item in list2)
1234 {
1235 if (item.ResistLvFrom(ele) >= 3 || item.trait is TraitBlanket || (EClass.rnd(3) == 0 && !CanCook(item)) || (item.IsPCFaction && EClass.rnd(3) == 0) || (fire && item.HasCondition<ConWet>()) || (cold && item.HasCondition<ConBurning>()))
1236 {
1237 continue;
1238 }
1240 {
1241 Card rootCard = item.GetRootCard();
1242 if (!rootCard.isChara || rootCard.Chara.IsPCFaction)
1243 {
1244 if (pos.IsSync)
1245 {
1246 Msg.Say("damage_protectCore", item);
1247 }
1248 continue;
1249 }
1250 }
1251 if (item.isThing && item.things.Count == 0)
1252 {
1253 list.Add(item);
1254 }
1255 else
1256 {
1257 if (ele == 911 && item.HasElement(1236))
1258 {
1259 continue;
1260 }
1261 Thing thing = ((ele == 910) ? item.things.FindBest<TraitBlanketFireproof>((Thing t) => -t.c_charges) : item.things.FindBest<TraitBlanketColdproof>((Thing t) => -t.c_charges));
1262 if (thing != null)
1263 {
1264 thing.ModCharge(-1);
1265 Card rootCard2 = item.GetRootCard();
1266 if (pos.IsSync)
1267 {
1268 Msg.Say((item.isChara ? "blanketInv_" : "blanketGround_") + element.source.alias, thing, item);
1269 }
1270 if (thing.c_charges <= 0)
1271 {
1272 thing.Die(element);
1273 if (rootCard2.IsPCParty)
1274 {
1276 }
1277 }
1278 continue;
1279 }
1280 foreach (Thing item2 in item.things.List((Thing a) => a.things.Count == 0))
1281 {
1282 Card parentCard = item2.parentCard;
1283 if (parentCard == null || (!(parentCard.trait is TraitChestMerchant) && !parentCard.HasEditorTag(EditorTag.PreciousContainer)))
1284 {
1285 list.Add(item2);
1286 }
1287 }
1288 }
1289 }
1290 list.Shuffle();
1291 int num = 0;
1292 foreach (Card item3 in list)
1293 {
1294 if (!item3.trait.CanBeDestroyed || item3.category.IsChildOf("currency") || item3.trait is TraitDoor || item3.trait is TraitFigure || item3.trait is TraitTrainingDummy || item3.rarity >= Rarity.Legendary)
1295 {
1296 continue;
1297 }
1298 Card rootCard3 = item3.GetRootCard();
1299 if (item3.IsEquipmentOrRangedOrAmmo && (EClass.rnd(4) != 0 || ((item3.IsRangedWeapon || item3.Thing.isEquipped) && rootCard3.IsPCFaction && EClass.rnd(4) != 0)))
1300 {
1301 continue;
1302 }
1303 switch (ele)
1304 {
1305 case 910:
1306 if (item3.isFireproof || (!item3.category.IsChildOf("book") && EClass.rnd(2) == 0))
1307 {
1308 continue;
1309 }
1310 break;
1311 case 911:
1312 if (!item3.category.IsChildOf("drink") && EClass.rnd(5) == 0)
1313 {
1314 continue;
1315 }
1316 break;
1317 }
1318 if (EClass.rnd(num * num) != 0)
1319 {
1320 continue;
1321 }
1322 bool flag = CanCook(item3);
1323 string text = "";
1324 if (flag)
1325 {
1326 if (fire)
1327 {
1328 List<SourceThing.Row> list3 = new List<SourceThing.Row>();
1329 foreach (RecipeSource item4 in RecipeManager.list)
1330 {
1331 if (!(item4.row is SourceThing.Row { isOrigin: false } 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)))
1332 {
1333 continue;
1334 }
1335 if (!row.factory.IsEmpty())
1336 {
1337 switch (row.factory[0])
1338 {
1339 case "chopper":
1340 case "mixer":
1341 case "camppot":
1342 case "cauldron":
1343 continue;
1344 }
1345 }
1346 if (row.components[0].Split('|').Contains(item3.id) || row.components[0].Split('|').Contains(item3.sourceCard._origin))
1347 {
1348 list3.Add(row);
1349 }
1350 }
1351 if (list3.Count > 0)
1352 {
1353 text = list3.RandomItemWeighted((SourceThing.Row r) => r.chance)?.id;
1354 }
1355 }
1356 else
1357 {
1358 text = "711";
1359 }
1360 }
1361 if (flag && !text.IsEmpty())
1362 {
1363 item3.GetRoot();
1364 Thing thing2 = item3.Split(1);
1365 List<Thing> list4 = new List<Thing>();
1366 list4.Add(thing2);
1367 Thing thing3 = ThingGen.Create(text);
1368 CraftUtil.MakeDish(thing3, list4, 999);
1369 thing3.elements.ModBase(2, EClass.curve(power / 10, 50, 10));
1370 if (pos.IsSync)
1371 {
1372 Msg.Say(((rootCard3 == item3) ? "cook_groundItem" : "cook_invItem") + (fire ? "" : "_cold"), thing2, rootCard3, thing3.Name);
1373 }
1374 if (rootCard3 == item3)
1375 {
1376 EClass._zone.AddCard(thing3, item3.pos);
1377 }
1378 else if (rootCard3.isChara)
1379 {
1380 rootCard3.Chara.Pick(thing3, msg: false);
1381 }
1382 else
1383 {
1384 rootCard3.AddThing(thing3);
1385 }
1386 thing2.Destroy();
1387 }
1388 else
1389 {
1390 int num2 = EClass.rnd(item3.Num) / 2 + 1;
1391 if (item3.Num > num2)
1392 {
1393 Thing thing4 = item3.Split(num2);
1394 if (pos.IsSync)
1395 {
1396 Msg.Say((rootCard3 == item3) ? "damage_groundItem" : "damage_invItem", thing4, rootCard3);
1397 }
1398 thing4.Destroy();
1399 if (rootCard3.IsPCFaction)
1400 {
1401 WidgetPopText.Say("popDestroy".lang(thing4.Name, rootCard3.Name));
1402 }
1403 }
1404 else
1405 {
1406 item3.Die(element);
1407 if (rootCard3.IsPCFaction)
1408 {
1409 WidgetPopText.Say("popDestroy".lang(item3.Name, rootCard3.Name));
1410 }
1411 }
1412 }
1413 if (rootCard3.IsPCParty)
1414 {
1416 }
1417 num++;
1418 }
1419 _ValidateInstalled(pos.x, pos.z);
1420 bool CanCook(Card c)
1421 {
1422 if ((fire || cold) && c.IsFood)
1423 {
1424 return c.category.IsChildOf("foodstuff");
1425 }
1426 return false;
1427 }
1428 }
CTAG
Definition: CTAG.cs:2
EditorTag
Definition: EditorTag.cs:2
int itemLost
Definition: AM_Adv.cs:110
static AM_Adv Adv
Definition: ActionMode.cs:15
string _origin
Definition: CardRow.cs:15
Thing Split(int a)
Definition: Card.cs:3568
ElementContainerCard elements
Definition: Card.cs:42
virtual void Die(Element e=null, Card origin=null, AttackSource attackSource=AttackSource.None, Chara originalTarget=null)
Definition: Card.cs:5130
ICardParent GetRoot()
Definition: Card.cs:3501
virtual bool IsPCParty
Definition: Card.cs:2191
bool IsEquipmentOrRangedOrAmmo
Definition: Card.cs:2272
string Name
Definition: Card.cs:2179
bool IsFood
Definition: Card.cs:2217
void ModCharge(int a, bool destroy=false)
Definition: Card.cs:4034
bool HasEditorTag(EditorTag tag)
Definition: Card.cs:2642
bool isFireproof
Definition: Card.cs:677
Card GetRootCard()
Definition: Card.cs:3510
virtual bool IsPCFaction
Definition: Card.cs:2311
Card parentCard
Definition: Card.cs:106
virtual CardRow sourceCard
Definition: Card.cs:2171
Thing Add(string id, int num=1, int lv=1)
Definition: Card.cs:3159
SourceCategory.Row category
Definition: Card.cs:2089
int c_charges
Definition: Card.cs:1297
bool IsTopWater
Definition: Cell.cs:708
Definition: ConWet.cs:2
static void MakeDish(Thing food, int lv, Chara crafter=null, int seed=-1)
Definition: CraftUtil.cs:61
static int curve(long _a, int start, int step, int rate=75)
Definition: EClass.cs:69
static FactionBranch Branch
Definition: EClass.cs:23
Element ModBase(int ele, int v)
SourceElement.Row source
Definition: ELEMENT.cs:278
static Element Create(int id, int v=0)
Definition: ELEMENT.cs:1119
bool HasItemProtection
void _ValidateInstalled(int x, int y)
Definition: Map.cs:1997
bool IsSync
Definition: Point.cs:344
static List< RecipeSource > list
RenderRow row
Definition: RecipeSource.cs:5
bool isEquipped
Definition: Thing.cs:17
virtual bool CanBeDestroyed
Definition: Trait.cs:307
static void Say(string text, FontColor fontColor=FontColor.Default, Sprite sprite=null)

References _ValidateInstalled(), EClass._zone, Card.Add(), Zone.AddCard(), Card.AddThing(), ActionMode.Adv, EClass.Branch, Card.c_charges, Card.category, Point.cell, Card.Chara, Element.Create(), ThingGen.Create(), EClass.curve(), Card.Destroy(), Card.Die(), Card.elements, Card.GetRootCard(), Card.HasEditorTag(), FactionBranch.HasItemProtection, Card.isChara, Card.IsFood, Card.IsPCFaction, Chara.IsPCFaction, Zone.IsPCFaction, Card.IsPCParty, Cell.IsSnowTile, Cell.IsTopWater, item, AM_Adv.itemLost, RecipeManager.list, Point.ListCards(), CraftUtil.MakeDish(), ElementContainer.ModBase(), Card.ModCharge(), Card.Name, Card.parentCard, Chara.Pick(), Card.pos, EClass.rnd(), RecipeSource.row, Msg.Say(), WidgetPopText.Say(), Card.Split(), and Card.trait.

Referenced by ActEffect.DamageEle().

◆ TrySmoothPick() [1/2]

◆ TrySmoothPick() [2/2]

void Map.TrySmoothPick ( Point  p,
Thing  t,
Chara  c 
)
inline

Definition at line 1830 of file Map.cs.

1831 {
1832 if (c != null && c.IsAgent)
1833 {
1834 EClass.pc.PickOrDrop(p, t);
1835 }
1836 else if (c != null && c.IsPC && (c.pos.Equals(p) || (EClass.core.config.game.smoothPick && c.Dist(p) <= 1) || EClass._zone.IsRegion))
1837 {
1838 c.PickOrDrop(p, t);
1839 }
1840 else
1841 {
1842 EClass._zone.AddCard(t, p);
1843 }
1844 }
bool IsAgent
Definition: Card.cs:2291
int Dist(Card c)
Definition: Card.cs:8025
new GameConfig game
Definition: CoreConfig.cs:613
bool Equals(int _x, int _z)
Definition: Point.cs:961

References EClass._zone, Zone.AddCard(), Core.config, EClass.core, Card.Dist(), Point.Equals(), CoreConfig.game, Card.IsAgent, Chara.IsPC, Spatial.IsRegion, EClass.pc, Chara.PickOrDrop(), Card.pos, and CoreConfig.GameConfig.smoothPick.

◆ UpdateMetaData()

static void Map.UpdateMetaData ( string  pathZip,
PartialMap  partial = null 
)
inlinestatic

Definition at line 777 of file Map.cs.

778 {
780 ZipFile zipFile = ZipFile.Read(pathZip);
781 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
782 zipFile.ExtractAll(IO.TempPath);
783 zipFile.Dispose();
784 EClass._map.ExportMetaData(IO.TempPath + "/", Path.GetFileNameWithoutExtension(pathZip), partial);
785 using (zipFile = new ZipFile())
786 {
787 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
788 zipFile.AddDirectory(IO.TempPath);
789 zipFile.Save(pathZip);
790 zipFile.Dispose();
791 }
793 }
static void CreateTempDirectory(string path=null)
Definition: IO.cs:411
static string TempPath
Definition: IO.cs:64
static void DeleteTempDirectory(string path=null)
Definition: IO.cs:416
void ExportMetaData(string _path, string id, PartialMap partial=null)
Definition: Map.cs:732

References EClass._map, and ExportMetaData().

Referenced by PartialMap.Update().

◆ ValidateInstalled()

void Map.ValidateInstalled ( Point  p)
inline

Definition at line 1988 of file Map.cs.

1989 {
1990 _ValidateInstalled(p.x, p.z);
1991 _ValidateInstalled(p.x + 1, p.z);
1992 _ValidateInstalled(p.x - 1, p.z);
1993 _ValidateInstalled(p.x, p.z + 1);
1994 _ValidateInstalled(p.x, p.z - 1);
1995 }

References _ValidateInstalled(), Point.x, and Point.z.

Referenced by MineBlock().

◆ ValidateVersion()

void Map.ValidateVersion ( )
inline

Definition at line 715 of file Map.cs.

716 {
718 }

References EClass.core, version, and BaseCore.version.

Referenced by Load().

Member Data Documentation

◆ _bits

int Map._bits

Definition at line 22 of file Map.cs.

Referenced by OnDeserialized(), and OnSerializing().

◆ _plDay

List<int> Map._plDay = new List<int>()

◆ _plNight

List<int> Map._plNight = new List<int>()

Definition at line 58 of file Map.cs.

Referenced by LayerEditPlaylist.Activate(), and LayerEditPlaylist.OnKill().

◆ _things

List<Thing> Map._things = new List<Thing>()
private

Definition at line 107 of file Map.cs.

Referenced by FindThing().

◆ backerObjs

Dictionary<int, int> Map.backerObjs = new Dictionary<int, int>()

◆ biomes

BiomeProfile [,] Map.biomes

Definition at line 95 of file Map.cs.

◆ bits

BitArray32 Map.bits

Definition at line 75 of file Map.cs.

Referenced by OnSerializing().

◆ bounds

◆ cellEffects

Dictionary<int, CellEffect> Map.cellEffects = new Dictionary<int, CellEffect>()

Definition at line 64 of file Map.cs.

Referenced by Load(), and Save().

◆ cells

◆ charas

List<Chara> Map.charas = new List<Chara>()

Definition at line 81 of file Map.cs.

Referenced by ReligionManager.ジュアさまの薄い本をください(), ActPlan._Update(), Zone.Activate(), ActionMode.Activate(), SerializedCards.Add(), Zone.AddGlobalCharasOnActivate(), LayerSleep.Advance(), ZoneEventQuest.AggroEnemy(), Chara.BanishAllMinions(), Point.CallGuard(), Chara.CallHelp(), TraitTrolley.CanActivate(), QuestDefense.CanUpdateOnTalk(), ElementContainerFaction.CheckDirty(), AM_MoveInstalled.CheckEnemyNearBy(), CountChara(), CountGuest(), FactionBranch.CountGuests(), CountHostile(), Zone.CountMinions(), CountNonHostile(), FactionBranch.CountWealthyGuests(), CountWildAnimal(), AI_Torture.CreateProgress(), LayerPeople.CreateSelectEmbarkMembers(), Card.DamageHP(), Chara.Die(), FindChara(), Zone.FindChara(), Chara.FindNearestNewEnemy(), Chara.FindNewEnemy(), GameUpdater.SensorUpdater.FixedUpdate(), GameUpdater.CharaUpdater.FixedUpdate(), GameUpdater.ConditionUpdater.FixedUpdate(), RefChara.GetAndCache(), GoalSiege.GetDestCard(), DramaCustomSequence.GetListGuide(), AI_Mofu.GetMofu(), Zone.GetRandomVisitPos(), TaskCullLife.GetTarget(), QuestManager.HasFarAwayEscort(), Chara.HasMinion(), TraitShackle.IsRestraining(), ListChara(), Point.ListCharasInRadius(), Zone.ListMinions(), Region.ListMobs(), CraftUtil.MakeDarkSoup(), DramaOutcome.marry(), Chara.MoveZone(), Zone.OnActivate(), Zone_Casino.OnActivate(), Zone_LittleGarden.OnActivate(), TraitTrap.OnActivateTrap(), FactionBranch.OnAfterSimulate(), Zone_WindRest.OnAfterSimulate(), AI_Torture.OnCancelOrSuccess(), OnCardAddedToZone(), OnCardRemovedFromZone(), NotificationBattle.OnClick(), NotificationGuest.OnClick(), AM_EditMarker.OnDeactivate(), OnDeactivate(), QuestDeliver.OnEnterZone(), Zone.OnGenerateMap(), Zone_CursedManor.OnGenerateMap(), Zone_RandomDungeon.OnGenerateMap(), Zone_Void.OnGenerateMap(), Zone_SubTown.OnGenerateRooms(), ZoneInstanceRandomQuest.OnLeaveZone(), BaseListPeople.OnList(), ListPeopleBed.OnList(), WidgetNotice.OnRefresh(), AM_Adv.OnRenderTile(), Zone.OnSimulateHour(), ConInvisibility.OnStart(), Zone.OnVisit(), ZoneEventSiege.OnVisit(), DramaManager.ParseLine(), ActCryRage.Perform(), ActCrySad.Perform(), ActSummonGuard.Perform(), ActEffect.Proc(), ActEffect.ProcAt(), Card.PurgeDuplicateArtifact(), Card.PurgeEythArtifact(), Zone.RefreshCriminal(), Zone.RefreshDeathSentense(), RefreshFOVAll(), Zone.RefreshListCitizen(), WidgetMinimap.RefreshMarkers(), LayerQuestBoard.RefreshQuest(), ActionMode.RefreshTexts(), CoreDebug.RegenerateNames(), Chara.RequestProtection(), ResetEditorPos(), Zone.ResetHostility(), Resize(), AI_Fuck.Run(), AI_Idle.Run(), AI_Offer.Run(), GoalCombat.Run(), Save(), WidgetSearch.Search(), Zone.SetAlarm(), ZoneInspector.SetAllPlayerCreation(), Shift(), Zone.Simulate(), Card.SpawnLoot(), ConSleep.SuccubusSleep(), ConSleep.SuccubusVisit(), ContentRanking.SwitchRanking(), Msg.TalkMaid(), Player.TargetRanged(), Card.Teleport(), CoreDebug.TestSpawn(), Chara.Tick(), ConChampagne.Tick(), ConSleep.Tick(), Chara.TryClearInventory(), ThingGen.TryLickChest(), GoalCombat.TryUseAbility(), Chara.UnmakeMinion(), GameUpdater.Update(), CoreDebug.UpdateInput(), Player.UpdateNyan(), Zone.UpdateQuests(), Chara.UseAbility(), and ElementContainerCard.ValueBonus().

◆ compression

IO.Compression Map.compression

Definition at line 25 of file Map.cs.

Referenced by Load(), Save(), and TryLoadFile().

◆ config

◆ custom

CustomData Map.custom

Definition at line 40 of file Map.cs.

Referenced by ExportMetaData(), LayerUploader.OnInit(), and LayerUploader.SaveID().

◆ deadCharas

◆ effectManager

CellEffectManager Map.effectManager = new CellEffectManager()

Definition at line 89 of file Map.cs.

Referenced by Load(), and ModFire().

◆ exportSetting

MapExportSetting Map.exportSetting

◆ flood

FloodSpiller Map.flood = new FloodSpiller()

Definition at line 93 of file Map.cs.

Referenced by TryAddRoom().

◆ footmarks

List<Footmark> Map.footmarks = new List<Footmark>()

Definition at line 99 of file Map.cs.

Referenced by GameDate.AdvanceMin(), and SetFoormark().

◆ fowProfile

FowProfile Map.fowProfile

Definition at line 101 of file Map.cs.

Referenced by SetZone(), and BaseGameScreen.UpdateShaders().

◆ gatherCounts

Dictionary<int, int> Map.gatherCounts = new Dictionary<int, int>()

Definition at line 61 of file Map.cs.

◆ isDirtySunMap

bool Map.isDirtySunMap
static

Definition at line 16 of file Map.cs.

Referenced by RefreshSunMap().

◆ plants

Dictionary<int, PlantData> Map.plants = new Dictionary<int, PlantData>()

Definition at line 70 of file Map.cs.

Referenced by AddPlant(), RemovePlant(), SetObj(), and TryGetPlant().

◆ plDay

◆ plNight

Playlist Map.plNight

Definition at line 79 of file Map.cs.

◆ poiMap

◆ pointAnimes

List<TransAnime> Map.pointAnimes = new List<TransAnime>()

Definition at line 83 of file Map.cs.

Referenced by Point.Animate(), BaseGameScreen.Draw(), and WidgetDebug.UpdateText().

◆ props

◆ revealed

bool Map.revealed

Definition at line 103 of file Map.cs.

Referenced by RevealAll().

◆ roomHash

HashSet<int> Map.roomHash = new HashSet<int>()
private

Definition at line 105 of file Map.cs.

Referenced by OnSetBlockOrDoor(), and TryAddRoom().

◆ rooms

◆ seed

int Map.seed

Definition at line 19 of file Map.cs.

Referenced by AddPlant(), MapGen.Output(), and WidgetDebug.UpdateText().

◆ serializedCharas

List<Chara> Map.serializedCharas = new List<Chara>()

Definition at line 43 of file Map.cs.

Referenced by Zone.Activate(), SerializedCards.Restore(), and Save().

◆ sunMap

HashSet<int> Map.sunMap = new HashSet<int>()
static

Definition at line 14 of file Map.cs.

Referenced by BaseTileMap.DrawTile(), and RefreshSunMap().

◆ tasks

◆ things

List<Thing> Map.things = new List<Thing>()

Definition at line 49 of file Map.cs.

Referenced by Zone.Activate(), ActionMode.Activate(), GameDate.AdvanceMonth(), PartialMap.Apply(), FactionBranch.CalcInnIncome(), QuestSharedContainer.CanUpdateOnTalk(), QuestShippingChest.CanUpdateOnTalk(), Zone.ClaimZone(), Zone.Deactivate(), FindThing(), FindThing< T >(), CoreDebug.Fix_LostCore(), GameUpdater.ThingUpdater.FixedUpdate(), CoreDebug.GetDebugContainer(), Zone.GetElectricity(), DramaCustomSequence.GetListGuide(), CoreDebug.GetOrCreateDebugContainer(), Zone.GetSpawnPos(), AI_Haul.GetThingToClean(), Zone.GrowPlants(), Scene.Init(), Point.IsInSpot< T >(), HomeResourceWorth.ListHeirloom(), ListThing< T >(), Load(), Zone_Tent.OnBeforeDeactivate(), OnCardAddedToZone(), OnCardRemovedFromZone(), AM_EditMarker.OnDeactivate(), OnDeactivate(), Zone_CursedManorDungeon.OnGenerateMap(), Zone_WindRest.OnGenerateMap(), Zone.OnKillGame(), Zone.OnSimulateHour(), ZoneEventHarvest.OnVisit(), ZoneEventMusic.OnVisit(), ZoneEventWedding.OnVisit(), Scene.RebuildActorEx(), BranchMap.Refresh(), Zone.RefreshElectricity(), RefreshFOVAll(), ActionMode.RefreshTexts(), ReloadRoom(), TraitDaggerGrave.RemainingSword(), ResetEditorPos(), Resize(), SerializedCards.Restore(), TaskDump.Run(), PartialMap.Save(), Save(), TraitDetector.Search(), WidgetSearch.Search(), Zone_CurryRuinDungeon.SetAlarm(), ZoneInspector.SetAllPlayerCreation(), Shift(), Zone.Simulate(), CoreDebug.Test_Grow(), Zone.TryGetRestock< T >(), Zone.TryListThingsInSpot< T >(), AI_Shopping.TryRestock(), TraitFactionBoard.TrySetAct(), and TraitTeleporter.TryTeleport().

◆ version

Version Map.version

Definition at line 28 of file Map.cs.

Referenced by ExportMetaData(), Zone.OnActivate(), Zone_Nefu.OnActivate(), Save(), and ValidateVersion().

◆ zone

Zone Map.zone

Property Documentation

◆ Cards

IEnumerable<Card> Map.Cards
get

Definition at line 135 of file Map.cs.

Referenced by MapSubset.OnSave(), ActSwarm.Perform(), and ActionMode.RefreshTexts().

◆ Installed

◆ isBreakerDown

bool Map.isBreakerDown
getset

Definition at line 109 of file Map.cs.

110 {
111 get
112 {
113 return bits[0];
114 }
115 set
116 {
117 bits[0] = value;
118 }
119 }

Referenced by TraitLeverBreaker.OnToggle().

◆ isGenerated

bool Map.isGenerated
get

Definition at line 129 of file Map.cs.

Referenced by MapGen.OnGenerateTerrain().

◆ IsIndoor

◆ Roaming

◆ sizeModifier

float Map.sizeModifier
get

Definition at line 127 of file Map.cs.

Referenced by Crawler.Crawl().

◆ SizeXZ

int Map.SizeXZ
get

◆ Stocked


The documentation for this class was generated from the following file: