Elin Decompiled Documentation EA 23.183 Nightly Patch 1
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 SetBridge (int x, int z, int height=0, int idMat=0, int idBridge=0, int dir=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)
 
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 (int a, int start, int step, int rate=75)
 
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 842 of file Map.cs.

843 {
844 if (!onAddToZone)
845 {
846 _RemoveCard(t);
847 }
848 t.pos.Set(x, z);
849 if (t.IsMultisize)
850 {
851 t.ForeachPoint(delegate(Point p, bool main)
852 {
853 p.cell.AddCard(t);
854 });
855 }
856 else
857 {
858 t.Cell.AddCard(t);
859 }
860 t.CalculateFOV();
861 if (t.isThing && !t.trait.IDActorEx.IsEmpty())
862 {
864 }
865 }
virtual bool IsMultisize
Definition: Card.cs:2120
virtual bool isThing
Definition: Card.cs:2043
void CalculateFOV()
Definition: Card.cs:6176
void ForeachPoint(Action< Point, bool > action)
Definition: Card.cs:7480
Point pos
Definition: Card.cs:57
Trait trait
Definition: Card.cs:51
Cell Cell
Definition: Card.cs:2017
void AddCard(Card c)
Definition: Cell.cs:1550
Definition: EClass.cs:5
static Scene scene
Definition: EClass.cs:30
int x
Definition: MapBounds.cs:8
void _RemoveCard(Card t)
Definition: Map.cs:867
Definition: Point.cs:9
Point Set(int _x, int _z)
Definition: Point.cs:491
Cell cell
Definition: Point.cs:51
void AddActorEx(Card c, Action< ActorEx > onBeforeSetOwner=null)
Definition: Scene.cs:1015
virtual string IDActorEx
Definition: Trait.cs:174

References _RemoveCard(), Scene.AddActorEx(), Cell.AddCard(), Card.CalculateFOV(), Card.Cell, Point.cell, Card.ForeachPoint(), Trait.IDActorEx, Card.IsMultisize, Card.isThing, 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 867 of file Map.cs.

868 {
869 if (t.IsMultisize)
870 {
871 t.ForeachPoint(delegate(Point p, bool main)
872 {
873 p.cell.RemoveCard(t);
874 });
875 }
876 else
877 {
878 t.Cell.RemoveCard(t);
879 }
880 t.ClearFOV();
881 }
void ClearFOV()
Definition: Card.cs:6265
void RemoveCard(Card c)
Definition: Cell.cs:1566

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 1963 of file Map.cs.

1964 {
1965 Point point = Point.shared.Set(x, y);
1966 if (!point.IsValid)
1967 {
1968 return;
1969 }
1970 List<Card> list = point.ListCards();
1971 CellDetail detail = point.cell.detail;
1972 if (detail == null)
1973 {
1974 return;
1975 }
1976 foreach (Card item in list)
1977 {
1978 if (!item.isThing || !item.trait.CanBeDestroyed || !item.IsInstalled)
1979 {
1980 continue;
1981 }
1982 HitResult hitResult = item.TileType._HitTest(point, item.Thing, canIgnore: false);
1983 if (item.Thing.stackOrder != detail.things.IndexOf(item.Thing) || (hitResult != HitResult.Valid && hitResult != HitResult.Warning))
1984 {
1985 if (EClass._zone.IsPCFaction || (!item.isNPCProperty && !(item.trait is TraitHarvest)))
1986 {
1987 item.SetPlaceState(PlaceState.roaming);
1988 }
1989 else if (item.rarity < Rarity.Legendary)
1990 {
1991 item.Die();
1992 }
1993 }
1994 }
1995 }
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:92
static Zone _zone
Definition: EClass.cs:20
static Point shared
Definition: Point.cs:20
List< Card > ListCards(bool includeMasked=false)
Definition: Point.cs:1031
bool IsValid
Definition: Point.cs:88
bool IsPCFaction
Definition: Zone.cs:466

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 1572 of file Map.cs.

1573 {
1575 int num = ((!draw) ? 1 : 2);
1576 EClass._map.bounds.ForeachCell(delegate(Cell c)
1577 {
1578 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"))
1579 {
1580 backerObjs[c.index] = item.id;
1581 Debug.Log(c.index + "/" + c.x + "/" + c.z + "/" + item.id + "/" + item.Name + "/" + item.tree);
1582 num--;
1584 }
1585 });
1586 }
static int indexTree
Definition: BackerContent.cs:3
Definition: Cell.cs:7
GrowSystem growth
Definition: Cell.cs:225
byte z
Definition: Cell.cs:58
byte x
Definition: Cell.cs:56
int index
Definition: Cell.cs:114
bool ignoreBackerDestoryFlag
Definition: CoreConfig.cs:555
CoreConfig config
Definition: Core.cs:70
static Core core
Definition: EClass.cs:6
static Map _map
Definition: EClass.cs:18
static SourceManager sources
Definition: EClass.cs:42
static Player player
Definition: EClass.cs:12
virtual bool IsMature
Definition: GrowSystem.cs:103
virtual bool IsTree
Definition: GrowSystem.cs:87
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:993
List< Row > listTree
Definition: SourceBacker.cs:73
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 779 of file Map.cs.

780 {
781 c.parent = zone;
783 Chara chara = c.Chara;
784 if (chara != null)
785 {
786 chara.currentZone = EClass._zone;
787 }
788 if (c.isChara)
789 {
790 if (!c.pos.IsInBounds)
791 {
793 }
794 }
795 else if (!c.pos.IsValid)
796 {
798 }
799 _AddCard(c.pos.x, c.pos.z, c, onAddToZone: true);
800 }
virtual Chara Chara
Definition: Card.cs:2032
virtual bool isChara
Definition: Card.cs:2045
Definition: Chara.cs:10
Point GetCenterPos()
Definition: MapBounds.cs:52
void _AddCard(int x, int z, Card t, bool onAddToZone)
Definition: Map.cs:842
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 2016 of file Map.cs.

2017 {
2018 if (x < 0 || z < 0 || x >= Size || z >= Size)
2019 {
2020 return;
2021 }
2022 Cell cell = cells[x, z];
2023 if (cell.sourceFloor.tileType.AllowBlood && (cell.decal / 8 == id || cell.decal % 8 <= amount))
2024 {
2025 if (cell.decal / 8 != id && cell.decal % 8 == 0)
2026 {
2027 amount--;
2028 }
2029 int num = Mathf.Clamp(((cell.decal / 8 == id) ? (cell.decal % 8) : 0) + amount, 0, 7);
2030 cell.decal = (byte)(id * 8 + num);
2031 if (refresh)
2032 {
2034 }
2035 }
2036 }
SourceFloor.Row sourceFloor
Definition: Cell.cs:1054
byte decal
Definition: Cell.cs:44
int Size
Definition: MapBounds.cs:20
void RefreshNeighborTiles(int x, int z)
Definition: Map.cs:2106
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 1939 of file Map.cs.

1940 {
1941 PlantData plantData = new PlantData
1942 {
1943 seed = seed
1944 };
1945 plants[pos.index] = plantData;
1946 return plantData;
1947 }
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 2061 of file Map.cs.

2062 {
2063 if (EClass._zone.IsRegion)
2064 {
2065 return a switch
2066 {
2067 135 => 7,
2068 180 => 0,
2069 225 => 1,
2070 -90 => 2,
2071 -45 => 3,
2072 0 => 4,
2073 45 => 5,
2074 _ => 6,
2075 };
2076 }
2077 return a switch
2078 {
2079 135 => 0,
2080 180 => 1,
2081 225 => 2,
2082 -90 => 3,
2083 -45 => 4,
2084 0 => 5,
2085 45 => 6,
2086 _ => 7,
2087 };
2088 }
virtual bool IsRegion
Definition: Spatial.cs:501

References EClass._zone, and Spatial.IsRegion.

Referenced by SetFoormark().

◆ ApplyBackerObj()

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

Definition at line 1597 of file Map.cs.

1598 {
1599 if (!p.HasObj)
1600 {
1601 return;
1602 }
1603 bool flag = p.sourceObj.id == 82;
1604 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)));
1605 if (row == null)
1606 {
1607 return;
1608 }
1610 {
1611 backerObjs[p.index] = row.id;
1612 if (flag)
1613 {
1614 p.cell.objDir = row.skin;
1615 }
1616 }
1617 else
1618 {
1619 backerObjs.Remove(p.index);
1620 }
1621 }
static int indexRemain
Definition: BackerContent.cs:5
bool HasObj
Definition: Point.cs:137
List< Row > listRemain
Definition: SourceBacker.cs:67

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 1405 of file Map.cs.

1406 {
1407 Cell cell = cells[x, z];
1408 Point sharedPoint = cell.GetSharedPoint();
1409 if ((instant || EClass.rnd(10) == 0) && cell.HasObj)
1410 {
1411 if (cell.sourceObj.tileType is TileTypeTree)
1412 {
1413 SetObj(x, z, cell.matObj_fixed.id, 59, 0, EClass.rnd(4));
1414 }
1415 else
1416 {
1417 SetObj(x, z);
1418 if (EClass.rnd(2) == 0)
1419 {
1420 EClass._zone.AddCard(ThingGen.Create((EClass.rnd(2) == 0) ? "ash" : "ash2"), sharedPoint);
1421 }
1422 }
1423 }
1424 if ((instant || EClass.rnd(5) == 0) && cell._block != 0 && cell._block != 96)
1425 {
1426 if (EClass.rnd(10) == 0 || !cell.sourceBlock.tileType.IsWall)
1427 {
1428 cell._block = 0;
1429 }
1430 else
1431 {
1432 cell._block = 96;
1433 }
1434 SetObj(x, z);
1435 if (cell.room != null)
1436 {
1437 cell.room.SetDirty();
1438 }
1440 }
1441 if (instant || EClass.rnd(10) == 0)
1442 {
1443 if (EClass.rnd(4) != 0)
1444 {
1445 cell._floor = 49;
1446 }
1447 if (cell._bridge != 0 && EClass.rnd(5) != 0)
1448 {
1449 cell._bridge = 49;
1450 }
1451 }
1452 foreach (Card item in sharedPoint.ListCards())
1453 {
1454 if (item.trait.CanBeDestroyed && !item.trait.IsDoor && !item.isFireproof && !item.category.IsChildOf("currency") && item.rarity < Rarity.Legendary && !(item.trait is TraitFigure) && item.isThing)
1455 {
1456 if (instant)
1457 {
1458 item.Destroy();
1459 EClass._zone.AddCard(ThingGen.Create((EClass.rnd(2) == 0) ? "ash" : "ash2"), sharedPoint);
1460 }
1461 else
1462 {
1463 item.DamageHP(30, 910);
1464 }
1465 }
1466 }
1467 if (instant)
1468 {
1469 cell.effect = null;
1470 }
1471 }
byte _block
Definition: Cell.cs:30
Room room
Definition: Cell.cs:102
SourceBlock.Row sourceBlock
Definition: Cell.cs:1052
byte _bridge
Definition: Cell.cs:46
Point GetSharedPoint()
Definition: Cell.cs:1106
SourceObj.Row sourceObj
Definition: Cell.cs:1072
bool HasObj
Definition: Cell.cs:641
SourceMaterial.Row matObj_fixed
Definition: Cell.cs:1039
static int rnd(long a)
Definition: EClass.cs:58
void SetObj(int x, int z, int id=0, int value=1, int dir=0)
Definition: Map.cs:1531
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:1925

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 1522 of file Map.cs.

1523 {
1524 ForeachCell(delegate(Cell c)
1525 {
1526 c.effect = null;
1527 c.decal = 0;
1528 });
1529 }
new void ForeachCell(Action< Cell > action)
Definition: Map.cs:2333

References ForeachCell().

Referenced by Zone.Export().

◆ CountChara()

int Map.CountChara ( Faction  faction)
inline

Definition at line 2428 of file Map.cs.

2429 {
2430 int num = 0;
2431 foreach (Chara chara in charas)
2432 {
2433 if (chara.faction == faction)
2434 {
2435 num++;
2436 }
2437 }
2438 return num;
2439 }
Faction faction
Definition: Chara.cs:425
List< Chara > charas
Definition: Map.cs:81

References charas, and Chara.faction.

◆ CountGuest()

int Map.CountGuest ( )
inline

Definition at line 2441 of file Map.cs.

2442 {
2443 int num = 0;
2444 foreach (Chara chara in charas)
2445 {
2446 if (chara.IsGuest())
2447 {
2448 num++;
2449 }
2450 }
2451 return num;
2452 }
bool IsGuest()
Definition: Chara.cs:6276

References charas, and Chara.IsGuest().

◆ CountHostile()

int Map.CountHostile ( )
inline

Definition at line 2454 of file Map.cs.

2455 {
2456 int num = 0;
2457 foreach (Chara chara in charas)
2458 {
2459 if (!chara.IsPCFaction && chara.IsHostile())
2460 {
2461 num++;
2462 }
2463 }
2464 return num;
2465 }
override bool IsPCFaction
Definition: Chara.cs:669
bool IsHostile()
Definition: Chara.cs:6193

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

◆ CountNonHostile()

int Map.CountNonHostile ( )
inline

Definition at line 2480 of file Map.cs.

2481 {
2482 int num = 0;
2483 foreach (Chara chara in charas)
2484 {
2485 if (!chara.IsPCFaction && !chara.IsHostile())
2486 {
2487 num++;
2488 }
2489 }
2490 return num;
2491 }

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

◆ CountWildAnimal()

int Map.CountWildAnimal ( )
inline

Definition at line 2467 of file Map.cs.

2468 {
2469 int num = 0;
2470 foreach (Chara chara in charas)
2471 {
2472 if (!chara.IsPCFaction && chara.IsAnimal)
2473 {
2474 num++;
2475 }
2476 }
2477 return num;
2478 }
bool IsAnimal
Definition: Chara.cs:865

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:2356
void SetBounds(int size)
Definition: Map.cs:2318
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 2011 of file Map.cs.

2012 {
2013 SetBlock(x, z);
2014 }
void SetBlock(int x, int z, int idMat=0, int idBlock=0)
Definition: Map.cs:992

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

Referenced by OnCardAddedToZone().

◆ DestroyObj()

void Map.DestroyObj ( Point  point)
inline

Definition at line 1821 of file Map.cs.

1822 {
1823 Cell cell = point.cell;
1824 SourceObj.Row sourceObj = cell.sourceObj;
1825 SourceMaterial.Row matObj = cell.matObj;
1826 if (sourceObj.tileType.IsBlockPass)
1827 {
1828 Effect.Get("smoke").Play(point);
1829 }
1830 Effect.Get("mine").Play(point).SetParticleColor(cell.matObj.GetColor())
1831 .Emit(10 + EClass.rnd(10));
1832 point.PlaySound(matObj.GetSoundDead());
1833 matObj.AddBlood(point, 3);
1834 }
SourceMaterial.Row matObj
Definition: Cell.cs:1036
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:1233
TileType tileType
Definition: RenderRow.cs:77
void AddBlood(Point p, int a=1)
string GetSoundDead(RenderRow c=null)
virtual bool IsBlockPass
Definition: TileType.cs:153

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 1623 of file Map.cs.

1624 {
1626 {
1627 return;
1628 }
1629 Thing thing = null;
1630 if (r.components.Length == 0)
1631 {
1632 return;
1633 }
1635 if (recoverBlock)
1636 {
1637 thing = ((!(r is SourceFloor.Row)) ? ThingGen.CreateBlock(r.id, mat.id) : ThingGen.CreateFloor(r.id, mat.id, isPlatform));
1638 }
1639 else
1640 {
1641 RecipeSource recipeSource = RecipeManager.Get(r.RecipeID + (isPlatform ? "-b" : ""));
1642 if (recipeSource == null)
1643 {
1644 return;
1645 }
1646 string iDIngredient = recipeSource.GetIDIngredient();
1647 if (iDIngredient == null)
1648 {
1649 return;
1650 }
1651 thing = ThingGen.Create(iDIngredient);
1652 thing.ChangeMaterial(mat.alias);
1653 }
1655 {
1656 PutAway(thing);
1657 }
1658 else
1659 {
1660 TrySmoothPick(point, thing, c);
1661 }
1662 }
virtual bool IsBuildMode
Definition: ActionMode.cs:181
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
Definition: Card.cs:2994
bool godBuild
Definition: CoreDebug.cs:303
static Game game
Definition: EClass.cs:8
static CoreDebug debug
Definition: EClass.cs:48
bool disableUsermapBenefit
GamePrincipal principal
Definition: Game.cs:221
void TrySmoothPick(Cell cell, Thing t, Chara c)
Definition: Map.cs:1800
bool PutAway(Card c)
Definition: Map.cs:2519
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:266

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 716 of file Map.cs.

717 {
718 if (custom == null)
719 {
720 custom = new CustomData();
721 }
722 MapMetaData mapMetaData = new MapMetaData
723 {
724 name = EClass._zone.Name,
726 tag = (EClass._map.exportSetting?.tag ?? ""),
727 partial = partial,
728 underwater = EClass._zone.IsUnderwater
729 };
730 custom.id = (mapMetaData.id = id);
731 IO.SaveFile(_path + "meta", mapMetaData);
732 }
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:495
virtual bool IsUnderwater
Definition: Zone.cs:264
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 2567 of file Map.cs.

2568 {
2569 foreach (Chara chara in charas)
2570 {
2571 if (chara.uid == uid)
2572 {
2573 return chara;
2574 }
2575 }
2576 return null;
2577 }
int uid
Definition: Card.cs:120

References charas, and Card.uid.

◆ FindChara() [2/2]

Chara Map.FindChara ( string  id)
inline

Definition at line 2555 of file Map.cs.

2556 {
2557 foreach (Chara chara in charas)
2558 {
2559 if (chara.id == id)
2560 {
2561 return chara;
2562 }
2563 }
2564 return null;
2565 }
string id
Definition: Card.cs:33

References charas, and Card.id.

Referenced by QuestPuppy.CanUpdateOnTalk(), ZoneEventSubdue.CheckClear(), ActEffect.DamageEle(), ZonePreEnterOnCompleteQuestInstance.Execute(), Chara.FindMaster(), CharaList.Get(), ConSleep.OnRemoved(), DramaManager.ParseLine(), ItemQuestTracker.Refresh(), and TraitBed.ValidateOwners().

◆ FindPublicArea()

BaseArea Map.FindPublicArea ( )
inline

Definition at line 2702 of file Map.cs.

2703 {
2704 return (from a in ((IEnumerable<BaseArea>)rooms.listArea).Concat((IEnumerable<BaseArea>)rooms.listRoom)
2705 where a.type.IsPublicArea
2706 select a).RandomItem();
2707 }
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

Definition at line 2579 of file Map.cs.

2580 {
2581 foreach (Thing thing in things)
2582 {
2583 if (func(thing))
2584 {
2585 return thing;
2586 }
2587 }
2588 return null;
2589 }
List< Thing > things
Definition: Map.cs:49

References things.

Referenced by GoalGraze.GetPos(), ConSleep.OnRemoved(), Zone_Dungeon.PlaceRail(), AIWork.SetDestination(), Chara.Stumble(), CoreDebug.UpdateInput(), FactionBranch.Upgrade(), and BaseListPeople.WriteHobbies().

◆ FindThing() [2/6]

Thing Map.FindThing ( int  uid)
inline

Definition at line 2591 of file Map.cs.

2592 {
2593 foreach (Thing thing in things)
2594 {
2595 if (thing.uid == uid)
2596 {
2597 return thing;
2598 }
2599 }
2600 return null;
2601 }

References things, and Card.uid.

◆ FindThing() [3/6]

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

Definition at line 2662 of file Map.cs.

2663 {
2664 if (area1 == null && area2 == null)
2665 {
2666 return null;
2667 }
2668 Thing thing = null;
2669 PropSet orCreate = EClass._map.Installed.workMap.GetOrCreate(workTag);
2670 if (area1 != null)
2671 {
2672 IEnumerable<Card> enumerable = orCreate.Where((Card a) => a.pos.HasRoomOrArea(area1));
2673 if (enumerable.Count() > 0)
2674 {
2675 thing = enumerable.RandomItem() as Thing;
2676 }
2677 }
2678 if (thing == null && area2 != null)
2679 {
2680 IEnumerable<Card> enumerable2 = orCreate.Where((Card a) => a.pos.HasRoomOrArea(area2));
2681 if (enumerable2.Count() > 0)
2682 {
2683 thing = enumerable2.RandomItem() as Thing;
2684 }
2685 }
2686 return thing;
2687 }
PropsInstalled Installed
Definition: Map.cs:123
bool HasRoomOrArea(BaseArea a)
Definition: Point.cs:409
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 2689 of file Map.cs.

2690 {
2691 Thing result = null;
2692 IEnumerable<Card> enumerable = from a in EClass._map.Installed.workMap.GetOrCreate(workTag)
2693 where a.pos.IsPublicSpace()
2694 select a;
2695 if (enumerable.Count() > 0)
2696 {
2697 result = enumerable.RandomItem() as Thing;
2698 }
2699 return result;
2700 }

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

◆ FindThing() [5/6]

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

Definition at line 2632 of file Map.cs.

2633 {
2634 if (area1 == null && area2 == null)
2635 {
2636 return null;
2637 }
2638 Thing thing = Find(area1);
2639 if (thing == null && area2 != null)
2640 {
2641 thing = Find(area2);
2642 }
2643 return thing;
2644 Thing Find(BaseArea area)
2645 {
2646 _things.Clear();
2647 foreach (Thing thing2 in EClass._map.props.installed.things)
2648 {
2649 if (type.IsAssignableFrom(thing2.trait.GetType()) && thing2.pos.HasRoomOrArea(area))
2650 {
2651 _things.Add(thing2);
2652 }
2653 }
2654 if (_things.Count <= 0)
2655 {
2656 return null;
2657 }
2658 return _things.RandomItem();
2659 }
2660 }
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 2615 of file Map.cs.

2616 {
2617 _things.Clear();
2618 foreach (Thing thing in EClass._map.props.installed.things)
2619 {
2620 if (type.IsAssignableFrom(thing.trait.GetType()) && thing.pos.IsPublicSpace())
2621 {
2622 _things.Add(thing);
2623 }
2624 }
2625 if (_things.Count <= 0)
2626 {
2627 return null;
2628 }
2629 return _things.RandomItem();
2630 }
bool IsPublicSpace()
Definition: Point.cs:437

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 2603 of file Map.cs.

2603 : Trait
2604 {
2605 foreach (Thing thing in things)
2606 {
2607 if (thing.trait is T)
2608 {
2609 return thing.trait as T;
2610 }
2611 }
2612 return null;
2613 }
Definition: Trait.cs:7

References things, and Card.trait.

◆ ForeachCell()

◆ ForeachNeighbor()

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

Definition at line 2388 of file Map.cs.

2389 {
2390 int num = center.x;
2391 int num2 = center.z;
2392 Point point = new Point();
2393 for (int i = num - 1; i < num + 2; i++)
2394 {
2395 if (i < 0 || i >= Size)
2396 {
2397 continue;
2398 }
2399 for (int j = num2 - 1; j < num2 + 2; j++)
2400 {
2401 if (j >= 0 && j < Size)
2402 {
2403 point.Set(i, j);
2404 action(point);
2405 }
2406 }
2407 }
2408 }

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

◆ ForeachPoint()

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

Definition at line 2344 of file Map.cs.

2345 {
2346 Point point = new Point();
2347 for (int i = 0; i < Size; i++)
2348 {
2349 for (int j = 0; j < Size; j++)
2350 {
2351 action(point.Set(i, j));
2352 }
2353 }
2354 }

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 2367 of file Map.cs.

2368 {
2369 Point point = new Point();
2370 int num = (int)Mathf.Ceil(r);
2371 for (int i = _x - num; i < _x + num + 1; i++)
2372 {
2373 if (i < 0 || i >= Size)
2374 {
2375 continue;
2376 }
2377 for (int j = _z - num; j < _z + num + 1; j++)
2378 {
2379 if (j >= 0 && j < Size && (float)((i - _x) * (i - _x) + (j - _z) * (j - _z)) < r * r)
2380 {
2381 point.Set(i, j);
2382 action(point);
2383 }
2384 }
2385 }
2386 }

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

Referenced by 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 2356 of file Map.cs.

2357 {
2358 for (int i = 0; i < Size; i++)
2359 {
2360 for (int j = 0; j < Size; j++)
2361 {
2362 action(i, j);
2363 }
2364 }
2365 }

References MapBounds.Size.

Referenced by CreateNew().

◆ GetBackerObj()

SourceBacker.Row Map.GetBackerObj ( Point  p)
inline

Definition at line 1588 of file Map.cs.

1589 {
1590 if (!backerObjs.ContainsKey(p.index))
1591 {
1592 return null;
1593 }
1594 return EClass.sources.backers.map.TryGetValue(backerObjs[p.index]);
1595 }

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

Referenced by TaskHarvest.OnCreateProgress().

◆ GetCell()

Cell Map.GetCell ( int  index)
inline

Definition at line 883 of file Map.cs.

884 {
885 return cells[index % Size, index % SizeXZ / Size];
886 }
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 2177 of file Map.cs.

2178 {
2179 Cell right = cell.Right;
2180 if (right.HasRamp && !right.HasStairs && right.blockDir == 1)
2181 {
2182 return right;
2183 }
2184 Cell front = cell.Front;
2185 if (front.HasRamp && !front.HasStairs && front.blockDir == 0)
2186 {
2187 return front;
2188 }
2189 Cell left = cell.Left;
2190 if (left.HasRamp && !left.HasStairs && left.blockDir == 3)
2191 {
2192 return left;
2193 }
2194 Cell back = cell.Back;
2195 if (back.HasRamp && !back.HasStairs && back.blockDir == 2)
2196 {
2197 return back;
2198 }
2199 return null;
2200 }
Cell Back
Definition: Cell.cs:153
bool HasStairs
Definition: Cell.cs:855
Cell Front
Definition: Cell.cs:129
Cell Left
Definition: Cell.cs:165
Cell Right
Definition: Cell.cs:141
bool HasRamp
Definition: Cell.cs:837
int blockDir
Definition: Cell.cs:898

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 734 of file Map.cs.

735 {
736 try
737 {
738 using ZipFile zipFile = ZipFile.Read(pathZip);
739 ZipEntry zipEntry = zipFile["meta"];
740 if (zipEntry != null)
741 {
742 using (MemoryStream stream = new MemoryStream())
743 {
744 zipEntry.Extract(stream);
745 MapMetaData mapMetaData = IO.LoadStreamJson<MapMetaData>(stream);
746 mapMetaData.path = pathZip;
747 return mapMetaData;
748 }
749 }
750 }
751 catch (Exception message)
752 {
753 if (Application.isEditor)
754 {
755 Debug.Log(message);
756 }
757 }
758 return null;
759 }

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 2245 of file Map.cs.

2246 {
2247 Point point = new Point();
2248 int num = ((EClass.rnd(2) == 0) ? 1 : (-1));
2249 int num2 = ((EClass.rnd(2) == 0) ? 1 : (-1));
2250 for (int i = 0; i < 3; i++)
2251 {
2252 point.x = center.x - num + i * num;
2253 for (int j = 0; j < 3; j++)
2254 {
2255 point.z = center.z - num2 + j * num2;
2256 if (point.IsValid && point.area == null && point.cell.CanHarvest())
2257 {
2258 return point;
2259 }
2260 }
2261 }
2262 return Point.Invalid;
2263 }
bool CanHarvest()
Definition: Cell.cs:1664
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 2140 of file Map.cs.

2141 {
2142 Cell cell = cells[x, z];
2143 if (cell.HasFullBlock)
2144 {
2145 if (blockType == null)
2146 {
2147 blockType = cell.sourceBlock.tileType;
2148 }
2149 Cell right = cell.Right;
2150 Cell front = cell.Front;
2151 Cell left = cell.Left;
2152 Cell back = cell.Back;
2153 if (!right.HasBlock && !right.IsVoid && left.HasFullBlock && front.CanBuildRamp(1) && back.CanBuildRamp(1))
2154 {
2155 return 1;
2156 }
2157 if (!front.HasBlock && !front.IsVoid && back.HasFullBlock && left.CanBuildRamp(0) && right.CanBuildRamp(0))
2158 {
2159 return 0;
2160 }
2161 if (!left.HasBlock && !left.IsVoid && right.HasFullBlock && front.CanBuildRamp(3) && back.CanBuildRamp(3))
2162 {
2163 return 3;
2164 }
2165 if (!back.HasBlock && !back.IsVoid && front.HasFullBlock && left.CanBuildRamp(2) && right.CanBuildRamp(2))
2166 {
2167 return 2;
2168 }
2169 if (!blockType.IsRamp)
2170 {
2171 return 0;
2172 }
2173 }
2174 return -1;
2175 }
bool HasBlock
Definition: Cell.cs:643
bool CanBuildRamp(int dir)
Definition: Cell.cs:1143
bool HasFullBlock
Definition: Cell.cs:817
bool IsVoid
Definition: Cell.cs:959
bool IsRamp
Definition: TileType.cs:147

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 2220 of file Map.cs.

2221 {
2222 int num = 0;
2223 int num2 = 0;
2224 for (int i = 0; i < 10000; i++)
2225 {
2226 if (EClass.rnd(2) == 0)
2227 {
2228 num = ((EClass.rnd(2) == 0) ? EClass.rnd(r) : (Size - 1 - EClass.rnd(r)));
2229 num2 = EClass.rnd(Size);
2230 }
2231 else
2232 {
2233 num2 = ((EClass.rnd(2) == 0) ? EClass.rnd(r) : (Size - 1 - EClass.rnd(r)));
2234 num = EClass.rnd(Size);
2235 }
2236 Point surface = GetSurface(num, num2, walkable: false);
2237 if (surface.IsValid)
2238 {
2239 return surface;
2240 }
2241 }
2242 return GetSurface(Size / 2, Size / 2, walkable: false);
2243 }
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 MapGen.MakeRiver(), and ZoneEventSiege.OnFirstTick().

◆ GetRandomPoint()

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

Definition at line 2202 of file Map.cs.

2203 {
2204 Point point = new Point();
2205 for (int i = 0; i < tries; i++)
2206 {
2207 point.x = center.x + EClass.rnd(radius * 2 + 1) - radius;
2208 point.z = center.z + EClass.rnd(radius * 2 + 1) - radius;
2209 point.Clamp();
2210 if ((!mustBeWalkable || !point.cell.blocked) && (!requireLos || Los.IsVisible(center, point)))
2211 {
2212 return point;
2213 }
2214 }
2215 Debug.Log("GetRandomPoint failed center:" + center?.ToString() + " rad:" + radius);
2216 point.IsValid = false;
2217 return point;
2218 }
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:988

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 2493 of file Map.cs.

2494 {
2495 List<Chara> list = new List<Chara>();
2496 foreach (Chara chara in charas)
2497 {
2498 if (chara.faction == faction)
2499 {
2500 list.Add(chara);
2501 }
2502 }
2503 return list;
2504 }

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 2278 of file Map.cs.

2279 {
2280 List<Chara> list = new List<Chara>();
2281 foreach (Point item in ListPointsInCircle(center, radius, mustBeWalkable: false, los))
2282 {
2283 CellDetail detail = item.detail;
2284 if (detail == null || detail.charas.Count <= 0)
2285 {
2286 continue;
2287 }
2288 foreach (Chara chara in item.detail.charas)
2289 {
2290 list.Add(chara);
2291 }
2292 }
2293 return list;
2294 }
List< Chara > charas
Definition: CellDetail.cs:13
List< Point > ListPointsInCircle(Point center, float radius, bool mustBeWalkable=true, bool los=true)
Definition: Map.cs:2265

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 2296 of file Map.cs.

2297 {
2298 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));
2299 Point point = new Point(0, 0);
2300 List<Point> list = new List<Point>();
2301 float diff = point.GetAngle2(to2);
2302 ForeachSphere(center.x, center.z, radius, delegate(Point p)
2303 {
2304 float angle2 = center.GetAngle2(p);
2305 if ((Mathf.Abs(diff - angle2) < angle || Mathf.Abs(diff - angle2 + 360f) < angle || Mathf.Abs(360f - diff + angle2) < angle) && Los.IsVisible(center, p) && !p.IsBlocked)
2306 {
2307 list.Add(p.Copy());
2308 }
2309 });
2310 return list;
2311 }
void ForeachSphere(int _x, int _z, float r, Action< Point > action)
Definition: Map.cs:2367
bool IsBlocked
Definition: Point.cs:351
float GetAngle2(Point to)
Definition: Point.cs:601

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 2265 of file Map.cs.

2266 {
2267 List<Point> list = new List<Point>();
2268 ForeachSphere(center.x, center.z, radius, delegate(Point p)
2269 {
2270 if ((!mustBeWalkable || !p.cell.blocked) && (!los || Los.IsVisible(center, p)))
2271 {
2272 list.Add(p.Copy());
2273 }
2274 });
2275 return list;
2276 }

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 
)
inline

Definition at line 2313 of file Map.cs.

2314 {
2315 return Los.ListVisible(center, to, radius);
2316 }
static List< Point > ListVisible(Point p1, Point p2, int radius, Action< Point, bool > _onVisit=null)
Definition: Los.cs:90

References Los.ListVisible().

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

◆ ListThing< T >()

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

Definition at line 2506 of file Map.cs.

2506 : Trait
2507 {
2508 List<Thing> list = new List<Thing>();
2509 foreach (Thing thing in things)
2510 {
2511 if (thing.IsInstalled && thing.trait is T)
2512 {
2513 list.Add(thing);
2514 }
2515 }
2516 return list;
2517 }
bool IsInstalled
Definition: Card.cs:2343

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

◆ Load()

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

Definition at line 542 of file Map.cs.

543 {
544 if (partial == null)
545 {
546 Debug.Log("Map Load:" + compression.ToString() + ": " + path);
547 }
548 int num = Size;
549 int num2 = Size;
550 if (partial != null)
551 {
552 num = partial.w;
553 num2 = partial.h;
554 Debug.Log(compression.ToString() + ": " + num + "/" + num2);
555 }
556 int size = num * num2;
557 cells = new Cell[num, num2];
558 if (bounds.maxX == 0)
559 {
560 bounds.SetBounds(0, 0, num - 1, num2 - 1);
561 }
562 SetBounds(0, 0, num - 1, num2 - 1);
563 byte[] bytes2 = TryLoad("objVals");
564 byte[] bytes3 = TryLoad("blockMats");
565 byte[] bytes4 = TryLoad("blocks");
566 byte[] bytes5 = TryLoad("floorMats");
567 byte[] bytes6 = TryLoad("floors");
568 byte[] bytes7 = TryLoad("objs");
569 byte[] bytes8 = TryLoad("objMats");
570 byte[] bytes9 = TryLoad("decal");
571 byte[] bytes10 = TryLoad("dirs");
572 byte[] bytes11 = TryLoad("flags");
573 byte[] bytes12 = TryLoad("flags2");
574 byte[] bytes13 = TryLoad("heights");
575 byte[] bytes14 = TryLoad("bridges");
576 byte[] bytes15 = TryLoad("bridgeMats");
577 byte[] bytes16 = TryLoad("bridgeHeights");
578 byte[] bytes17 = TryLoad("bridgePillars");
579 byte[] bytes18 = TryLoad("roofBlocks");
580 byte[] bytes19 = TryLoad("roofBlockMats");
581 byte[] bytes20 = TryLoad("roofBlockDirs");
582 if (bytes17.Length < size)
583 {
584 bytes17 = new byte[size];
585 }
586 if (bytes2.Length < size)
587 {
588 bytes2 = new byte[size];
589 }
590 if (bytes12.Length < size)
591 {
592 bytes12 = new byte[size];
593 }
594 Validate(ref bytes2, "objVals");
595 Validate(ref bytes3, "blockMats");
596 Validate(ref bytes4, "blocks");
597 Validate(ref bytes5, "floorMats");
598 Validate(ref bytes6, "floors");
599 Validate(ref bytes7, "objs");
600 Validate(ref bytes8, "objMats");
601 Validate(ref bytes9, "decal");
602 Validate(ref bytes10, "dirs");
603 Validate(ref bytes11, "flags");
604 Validate(ref bytes12, "flags2");
605 Validate(ref bytes13, "heights");
606 Validate(ref bytes14, "bridges");
607 Validate(ref bytes15, "bridgeMats");
608 Validate(ref bytes16, "bridgeHeights");
609 Validate(ref bytes17, "bridgePillars");
610 Validate(ref bytes18, "roofBlocks");
611 Validate(ref bytes19, "roofBlockMats");
612 Validate(ref bytes20, "roofBlockDirs");
613 int count = EClass.sources.floors.rows.Count;
614 int count2 = EClass.sources.materials.rows.Count;
615 int num3 = 0;
616 for (int i = 0; i < num; i++)
617 {
618 for (int j = 0; j < num2; j++)
619 {
620 Cell cell = (cells[i, j] = new Cell
621 {
622 x = (byte)i,
623 z = (byte)j,
624 objVal = bytes2[num3],
625 _blockMat = bytes3[num3],
626 _block = bytes4[num3],
627 _floorMat = bytes5[num3],
628 _floor = bytes6[num3],
629 obj = bytes7[num3],
630 objMat = bytes8[num3],
631 decal = bytes9[num3],
632 _dirs = bytes10[num3],
633 height = bytes13[num3],
634 _bridge = bytes14[num3],
635 _bridgeMat = bytes15[num3],
636 bridgeHeight = bytes16[num3],
637 bridgePillar = bytes17[num3],
638 _roofBlock = bytes18[num3],
639 _roofBlockMat = bytes19[num3],
640 _roofBlockDir = bytes20[num3],
641 isSeen = bytes11[num3].GetBit(1),
642 isHarvested = bytes11[num3].GetBit(2),
643 impassable = bytes11[num3].GetBit(3),
644 isModified = bytes11[num3].GetBit(4),
645 isClearSnow = bytes11[num3].GetBit(5),
646 isForceFloat = bytes11[num3].GetBit(6),
647 isToggleWallPillar = bytes11[num3].GetBit(7),
648 isWatered = bytes12[num3].GetBit(0),
649 isObjDyed = bytes12[num3].GetBit(1),
650 crossWall = bytes12[num3].GetBit(2)
651 });
652 if (cell._bridge >= count)
653 {
654 cell._bridge = 0;
655 }
656 if (cell._bridgeMat >= count2)
657 {
658 cell._bridgeMat = 1;
659 }
661 num3++;
662 }
663 }
664 things.ForeachReverse(delegate(Thing t)
665 {
666 if (t.Num <= 0 || t.isDestroyed)
667 {
668 Debug.Log("[bug] Removing bugged thing:" + t.Num + "/" + t.isDestroyed + "/" + t);
669 things.Remove(t);
670 }
671 });
672 foreach (KeyValuePair<int, CellEffect> cellEffect in cellEffects)
673 {
674 int key = cellEffect.Key;
675 int num4 = key % Size;
676 int num5 = key / Size;
677 cells[num4, num5].effect = cellEffect.Value;
678 if (cellEffect.Value.IsFire)
679 {
680 effectManager.GetOrCreate(new Point(num4, num5));
681 }
682 }
683 cellEffects.Clear();
685 byte[] TryLoad(string s)
686 {
687 return TryLoadFile(path, s, size);
688 }
689 void Validate(ref byte[] bytes, string id)
690 {
691 if (bytes.Length < size)
692 {
693 Debug.LogError("expection: size invalid:" + id + " " + bytes.Length + "/" + size);
694 bytes = new byte[size];
695 }
696 }
697 }
bool isDestroyed
Definition: Card.cs:73
int Num
Definition: Card.cs:156
CellEffect effect
Definition: Cell.cs:94
byte _bridgeMat
Definition: Cell.cs:48
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:531
CellEffectManager effectManager
Definition: Map.cs:89
void ValidateVersion()
Definition: Map.cs:699
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 1664 of file Map.cs.

1665 {
1666 bool flag = ActionMode.Mine.IsRoofEditMode() && point.cell._roofBlock != 0;
1667 if (!point.IsValid || (!flag && !point.cell.HasBlock))
1668 {
1669 return;
1670 }
1671 SourceMaterial.Row row = (flag ? point.matRoofBlock : point.matBlock);
1672 byte b = (flag ? point.cell._roofBlock : point.cell._block);
1673 SourceBlock.Row row2 = EClass.sources.blocks.rows[b];
1674 Effect.Get("smoke").Play(point);
1675 Effect.Get("mine").Play(point).SetParticleColor(row.GetColor())
1676 .Emit(10 + EClass.rnd(10));
1677 point.PlaySound(row.GetSoundDead(row2));
1678 row.AddBlood(point, 8);
1679 bool flag2 = c == null || c.IsAgent || c.IsPCFactionOrMinion;
1681 {
1682 flag2 = false;
1683 }
1684 if (flag)
1685 {
1686 point.cell._roofBlock = 0;
1687 RefreshSingleTile(point.x, point.z);
1688 }
1689 else
1690 {
1691 if (point.cell.HasFullBlock)
1692 {
1693 RemoveLonelyRamps(point.cell);
1694 }
1695 point.SetBlock();
1696 if (flag2 && point.sourceObj.tileType.IsBlockMount && mineObj)
1697 {
1698 MineObj(point, null, c);
1699 }
1700 }
1701 if (flag2)
1702 {
1703 DropBlockComponent(point, row2, row, recoverBlock, isPlatform: false, c);
1704 }
1705 RefreshShadow(point.x, point.z);
1706 RefreshShadow(point.x, point.z - 1);
1707 ValidateInstalled(point);
1708 RefreshFOV(point.x, point.z);
1709 if (flag2 && !point.cell.isModified && !flag)
1710 {
1711 if (b == 17 || EClass.rnd(100) == 0)
1712 {
1713 zone.AddCard(ThingGen.Create("money2"), point);
1714 }
1715 if (EClass._zone.DangerLv >= 10 && EClass.rnd(200) == 0)
1716 {
1717 zone.AddCard(ThingGen.Create("crystal_earth"), point);
1718 }
1719 if (EClass._zone.DangerLv >= 25 && EClass.rnd(200) == 0)
1720 {
1721 zone.AddCard(ThingGen.Create("crystal_sun"), point);
1722 }
1723 if (EClass._zone.DangerLv >= 40 && EClass.rnd(200) == 0)
1724 {
1725 zone.AddCard(ThingGen.Create("crystal_mana"), point);
1726 }
1727 point.cell.isModified = true;
1728 }
1729 }
override bool IsRoofEditMode(Card c=null)
Definition: AM_Mine.cs:19
static AM_Mine Mine
Definition: ActionMode.cs:33
bool IsPCFactionOrMinion
Definition: Card.cs:2234
bool isModified
Definition: Cell.cs:438
void RefreshSingleTile(int x, int z)
Definition: Map.cs:2090
void RefreshFOV(int x, int z, int radius=6, bool recalculate=false)
Definition: Map.cs:925
void MineObj(Point point, Task task=null, Chara c=null)
Definition: Map.cs:1836
void RemoveLonelyRamps(Cell cell)
Definition: Map.cs:1997
void ValidateInstalled(Point p)
Definition: Map.cs:1954
void DropBlockComponent(Point point, TileRow r, SourceMaterial.Row mat, bool recoverBlock, bool isPlatform=false, Chara c=null)
Definition: Map.cs:1623
void RefreshShadow(int x, int z)
Definition: Map.cs:1796
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:898
SourceBlock blocks
override int DangerLv
Definition: Zone.cs:107

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 1748 of file Map.cs.

1749 {
1750 if (!point.IsValid || (!point.HasFloor && !point.HasBridge))
1751 {
1752 return;
1753 }
1754 SourceMaterial.Row row = (point.cell.HasBridge ? point.matBridge : point.matFloor);
1755 SourceFloor.Row c2 = (point.cell.HasBridge ? point.sourceBridge : point.sourceFloor);
1756 Effect.Get("mine").Play(point).SetParticleColor(row.GetColor())
1757 .Emit(10 + EClass.rnd(10));
1758 point.PlaySound(row.GetSoundDead(c2));
1759 MineObj(point, null, c);
1760 if (point.cell.HasBridge && removePlatform)
1761 {
1762 DropBlockComponent(EClass.pc.pos, point.sourceBridge, point.matBridge, recoverBlock, isPlatform: true, c);
1763 EClass._map.SetBridge(point.x, point.z);
1764 if (point.IsSky)
1765 {
1766 EClass.pc.Kick(point, ignoreSelf: true);
1767 }
1768 return;
1769 }
1771 {
1772 DropBlockComponent(EClass.pc.pos, point.sourceFloor, row, recoverBlock, isPlatform: false, c);
1773 SetFloor(point.x, point.z, 0, 90);
1774 if (point.IsSky)
1775 {
1776 EClass.pc.Kick(point, ignoreSelf: true);
1777 }
1778 return;
1779 }
1780 if (zone.IsRegion || point.cell._floor == 40)
1781 {
1782 Thing thing = ThingGen.CreateRawMaterial(row);
1783 thing.ChangeMaterial(row.alias);
1784 TrySmoothPick(point, thing, c);
1785 }
1786 else
1787 {
1788 DropBlockComponent(point, point.sourceFloor, row, recoverBlock, isPlatform: false, c);
1789 }
1790 if (!EClass._zone.IsRegion && !point.sourceFloor.components[0].Contains("chunk@soil"))
1791 {
1792 point.SetFloor(EClass.sources.floors.rows[1].DefaultMaterial.id, 40);
1793 }
1794 }
byte _floor
Definition: Cell.cs:34
bool HasBridge
Definition: Cell.cs:671
void Kick(Point p, bool ignoreSelf=false)
Definition: Chara.cs:5452
static Chara pc
Definition: EClass.cs:14
void SetBridge(int x, int z, int height=0, int idMat=0, int idBridge=0, int dir=0)
Definition: Map.cs:968
void SetFloor(int x, int z, int idMat=0, int idFloor=0)
Definition: Map.cs:953
SourceMaterial.Row matFloor
Definition: Point.cs:57
bool HasBridge
Definition: Point.cs:209
bool IsSky
Definition: Point.cs:212
SourceMaterial.Row matBridge
Definition: Point.cs:59
void SetFloor(int idMat=0, int idFloor=0)
Definition: Point.cs:903
SourceFloor.Row sourceFloor
Definition: Point.cs:65
bool HasFloor
Definition: Point.cs:207
SourceFloor.Row sourceBridge
Definition: Point.cs:67
static Thing CreateRawMaterial(SourceMaterial.Row m)
Definition: ThingGen.cs:68
virtual bool IsSkyLevel
Definition: Zone.cs:262

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, Chara.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 1836 of file Map.cs.

1837 {
1838 if (!point.IsValid || !point.HasObj)
1839 {
1840 return;
1841 }
1842 Cell cell = point.cell;
1843 SourceObj.Row sourceObj = cell.sourceObj;
1844 if (c == null && task != null)
1845 {
1846 c = task.owner;
1847 }
1848 bool num = c == null || c.IsAgent || c.IsPCFactionOrMinion;
1849 DestroyObj(point);
1850 if (num)
1851 {
1852 SourceMaterial.Row matObj_fixed = cell.matObj_fixed;
1853 if (task is TaskHarvest { IsReapSeed: not false })
1854 {
1855 int num2 = 1 + EClass.rnd(2) + ((EClass.rnd(3) == 0) ? 1 : 0);
1856 int soilCost = EClass._zone.GetSoilCost();
1857 int maxSoil = EClass._zone.MaxSoil;
1858 if (soilCost > maxSoil)
1859 {
1860 num2 -= EClass.rnd(2 + (soilCost - maxSoil) / 10);
1861 }
1862 if (num2 <= 0)
1863 {
1864 Msg.Say("seedSpoiled", cell.GetObjName());
1865 }
1866 else if (!EClass._zone.IsUserZone)
1867 {
1868 Thing t2 = TraitSeed.MakeSeed(sourceObj, TryGetPlant(cell)).SetNum(num2);
1869 EClass.pc.PickOrDrop(point, t2);
1870 }
1871 if (cell.growth.IsTree)
1872 {
1873 cell.isHarvested = true;
1874 return;
1875 }
1876 }
1877 else if (sourceObj.HasGrowth)
1878 {
1879 cell.growth.PopMineObj(c);
1880 }
1881 else
1882 {
1883 if (cell.HasBlock && (sourceObj.id == 18 || sourceObj.id == 19))
1884 {
1885 MineBlock(point, recoverBlock: false, c, mineObj: false);
1886 }
1887 switch (sourceObj.alias)
1888 {
1889 case "nest_bird":
1890 if (EClass.rnd(5) <= 1)
1891 {
1892 Pop(ThingGen.Create((EClass.rnd(10) == 0) ? "egg_fertilized" : "_egg").TryMakeRandomItem());
1893 }
1894 break;
1895 }
1896 int num3 = EClass.rnd(EClass.rnd(sourceObj.components.Length) + 1);
1897 string[] array = sourceObj.components[num3].Split('/');
1898 Thing thing = ThingGen.Create(array[0].Split('|')[0], matObj_fixed.alias);
1899 if (array.Length > 1)
1900 {
1901 thing.SetNum(EClass.rnd(array[1].ToInt()) + 1);
1902 }
1903 Pop(thing);
1904 }
1905 }
1906 SetObj(point.x, point.z);
1907 cell.gatherCount = 0;
1908 void Pop(Thing t)
1909 {
1911 {
1913 {
1914 EClass._map.PutAway(t);
1915 }
1916 else
1917 {
1918 TrySmoothPick(point, t, c);
1919 }
1920 }
1921 }
1922 }
new Chara owner
Definition: AIAct.cs:14
Thing TryMakeRandomItem(int lv=-1, TryMakeRandomItemSource itemSource=TryMakeRandomItemSource.Default, Chara crafter=null)
Definition: Card.cs:5204
Thing SetNum(int a)
Definition: Card.cs:3393
string GetObjName()
Definition: Cell.cs:1604
void PickOrDrop(Point p, string idThing, int idMat=-1, int num=1, bool msg=true)
Definition: Chara.cs:4148
void PopMineObj(Chara c=null)
Definition: GrowSystem.cs:528
PlantData TryGetPlant(Point p)
Definition: Map.cs:1929
void DestroyObj(Point point)
Definition: Map.cs:1821
void MineBlock(Point point, bool recoverBlock=false, Chara c=null, bool mineObj=true)
Definition: Map.cs:1664
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
bool HasGrowth
Definition: SourceObj.cs:26
string alias
Definition: TileRow.cs:12
static Thing MakeSeed(SourceObj.Row obj, PlantData plant=null)
Definition: TraitSeed.cs:88
virtual int MaxSoil
Definition: Zone.cs:509
int GetSoilCost()
Definition: Zone.cs:3575

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, GrowSystem.IsTree, Zone.IsUserZone, Point.IsValid, TraitSeed.MakeSeed(), Cell.matObj_fixed, Zone.MaxSoil, MineBlock(), EClass.pc, Chara.PickOrDrop(), GrowSystem.PopMineObj(), Game.principal, PutAway(), EClass.rnd(), Msg.Say(), EClass.scene, Card.SetNum(), SetObj(), Cell.sourceObj, 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 1924 of file Map.cs.

1925 {
1926 point.PlaySound(point.cell.matObj.GetSoundDead(point.cell.sourceObj));
1927 }

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 1731 of file Map.cs.

1732 {
1733 if (point.IsValid && point.cell.HasFullBlock)
1734 {
1735 SourceMaterial.Row matBlock = point.matBlock;
1736 byte block = point.cell._block;
1737 Effect.Get("smoke").Play(point);
1738 Effect.Get("mine").Play(point).SetParticleColor(point.matBlock.GetColor())
1739 .Emit(10 + EClass.rnd(10));
1740 MineObj(point);
1741 int rampDir = EClass._map.GetRampDir(point.x, point.z, EClass.sources.blocks.rows[ramp].tileType);
1742 RemoveLonelyRamps(point.cell);
1743 SetBlock(point.x, point.z, point.cell._blockMat, ramp, rampDir);
1744 DropBlockComponent(point, EClass.sources.blocks.rows[block], matBlock, recoverBlock);
1745 }
1746 }
byte _blockMat
Definition: Cell.cs:32
int GetRampDir(int x, int z, TileType blockType=null)
Definition: Map.cs:2140

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 1168 of file Map.cs.

1169 {
1170 Cell cell = cells[x, z];
1171 if (amount <= 0 || (!cell.IsTopWaterAndNoSnow && !cell.IsSnowTile && !EClass._zone.IsUnderwater))
1172 {
1173 if (cell.effect == null && amount > 0)
1174 {
1175 SE.Play("fire");
1176 }
1177 int num = amount + (cell.effect?.FireAmount ?? 0);
1178 if (num > 20)
1179 {
1180 num = 20;
1181 }
1182 if (num <= 0)
1183 {
1184 cell.effect = null;
1185 return;
1186 }
1187 cell.effect = new CellEffect
1188 {
1189 id = 3,
1190 amount = num
1191 };
1193 }
1194 }
int FireAmount
Definition: CellEffect.cs:150
bool IsSnowTile
Definition: Cell.cs:782
bool IsTopWaterAndNoSnow
Definition: Cell.cs:712

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 1509 of file Map.cs.

1510 {
1511 Cell cell = cells[x, z];
1512 if (!cell.IsTopWaterAndNoSnow && cell.effect != null)
1513 {
1514 cell.effect.amount += amount;
1515 if (cell.effect.amount <= 0)
1516 {
1517 cell.effect = null;
1518 }
1519 }
1520 }
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 837 of file Map.cs.

838 {
839 _AddCard(p.x, p.z, t, onAddToZone: false);
840 }

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 802 of file Map.cs.

803 {
804 if (t.isChara)
805 {
806 charas.Add(t.Chara);
807 }
808 else
809 {
810 things.Add(t.Thing);
811 }
813 if (t.isChara && new Point(x, z).cell.HasFullBlock)
814 {
815 DestroyBlock(x, z);
816 }
817 _AddCard(x, z, t, onAddToZone: true);
819 }
virtual Thing Thing
Definition: Card.cs:2020
void DestroyBlock(int x, int z)
Definition: Map.cs:2011
virtual void OnAddedToZone()
Definition: Trait.cs:675

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 821 of file Map.cs.

822 {
825 _RemoveCard(t);
826 t.parent = null;
827 if (t.isChara)
828 {
829 charas.Remove(t.Chara);
830 }
831 else
832 {
833 things.Remove(t.Thing);
834 }
835 }
void SetPlaceState(PlaceState newState, bool byPlayer=false)
Definition: Card.cs:3639
virtual void OnRemovedFromZone()
Definition: Trait.cs:679

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:59
override bool IsGlobal
Definition: Chara.cs:608
Definition: NoGoal.cs:4
void ClearMapHighlights()
Definition: Player.cs:2316
void RemoveCard(Card t)
Definition: Zone.cs:1965

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 710 of file Map.cs.

711 {
712 tasks = new TaskManager();
713 data.serializedCards.Restore(this, data.orgMap, addToZone: false);
714 }
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 704 of file Map.cs.

705 {
706 rooms.OnLoad();
707 tasks.OnLoad();
708 }
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 1020 of file Map.cs.

1021 {
1022 new Point(x, z);
1023 TryRemoveRoom(x, z);
1024 if (x > 0)
1025 {
1026 TryRemoveRoom(x - 1, z);
1027 }
1028 if (x < Size - 1)
1029 {
1030 TryRemoveRoom(x + 1, z);
1031 }
1032 if (z > 0)
1033 {
1034 TryRemoveRoom(x, z - 1);
1035 }
1036 if (z < Size - 1)
1037 {
1038 TryRemoveRoom(x, z + 1);
1039 }
1040 if (x > 0 && z < Size - 1)
1041 {
1042 TryRemoveRoom(x - 1, z + 1);
1043 }
1044 roomHash.Clear();
1045 TryAddRoom(x, z);
1046 if (x > 0)
1047 {
1048 TryAddRoom(x - 1, z);
1049 }
1050 if (x < Size - 1)
1051 {
1052 TryAddRoom(x + 1, z);
1053 }
1054 if (z > 0)
1055 {
1056 TryAddRoom(x, z - 1);
1057 }
1058 if (z < Size - 1)
1059 {
1060 TryAddRoom(x, z + 1);
1061 }
1062 if (x > 0 && z < Size - 1)
1063 {
1064 TryAddRoom(x - 1, z + 1);
1065 }
1066 }
HashSet< int > roomHash
Definition: Map.cs:105
void TryRemoveRoom(int x, int z)
Definition: Map.cs:1068
void TryAddRoom(int x, int z)
Definition: Map.cs:1080

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 2519 of file Map.cs.

2520 {
2522 {
2523 return false;
2524 }
2525 if (c.isChara)
2526 {
2528 {
2529 return false;
2530 }
2531 c.Destroy();
2532 return true;
2533 }
2534 Thing thing = c.Thing;
2535 if (thing.parent != null)
2536 {
2537 thing.parent.RemoveCard(thing);
2538 }
2539 thing.isMasked = false;
2540 thing.isRoofItem = false;
2541 if (EClass._zone.IsPCFaction && EClass._map.props.installed.traits.GetRandomThing<TraitSpotStockpile>() != null)
2542 {
2543 EClass._zone.TryAddThingInSpot<TraitSpotStockpile>(thing);
2544 return true;
2545 }
2546 if (EClass.debug.enable)
2547 {
2549 return true;
2550 }
2551 EClass.pc.Pick(thing, msg: false);
2552 return true;
2553 }
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:3057
ICardParent parent
Definition: Card.cs:53
void Destroy()
Definition: Card.cs:4850
virtual bool IsPC
Definition: Card.cs:2105
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:4168
bool enable
Definition: CoreDebug.cs:285
Thing GetOrCreateDebugContainer()
Definition: CoreDebug.cs:738
bool ignoreBuildRule
Definition: CoreDebug.cs:184
TraitManager traits
Definition: Props.cs:18
virtual bool CanOnlyCarry
Definition: Trait.cs:290
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 2410 of file Map.cs.

2411 {
2412 Point point = new Point();
2413 int num;
2414 for (num = 0; num < Size; num++)
2415 {
2416 int num2;
2417 for (num2 = 0; num2 < Size; num2++)
2418 {
2419 point.x = num;
2420 point.z = num2;
2421 point.Copy().Animate(AnimeID.Quake, animeBlock: true);
2422 num2 += EClass.rnd(2);
2423 }
2424 num += EClass.rnd(2);
2425 }
2426 }
AnimeID
Definition: AnimeID.cs:2
Point Copy()
Definition: Point.cs:479
void Animate(AnimeID id, bool animeBlock=false)
Definition: Point.cs:1282

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

◆ QuickRefreshTile()

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

Definition at line 2125 of file Map.cs.

2126 {
2127 Cell cell = cells[x, z];
2128 Cell cell2 = ((x > 0) ? cells[x - 1, z] : Cell.Void);
2129 Cell cell3 = ((x + 1 < Size) ? cells[x + 1, z] : Cell.Void);
2130 Cell cell4 = ((z > 0) ? cells[x, z - 1] : Cell.Void);
2131 Cell cell5 = ((z + 1 < Size) ? cells[x, z + 1] : Cell.Void);
2132 Cell cell6 = ((x > 0 && z > 0) ? cells[x - 1, z - 1] : Cell.Void);
2133 Cell cell7 = ((x + 1 < Size && z > 0) ? cells[x + 1, z - 1] : Cell.Void);
2134 Cell cell8 = ((x > 0 && z + 1 < Size) ? cells[x - 1, z + 1] : Cell.Void);
2135 Cell cell9 = ((x + 1 < Size && z + 1 < Size) ? cells[x + 1, z + 1] : Cell.Void);
2136 cell.isSurrounded4d = cell2.HasFullBlock && cell3.HasFullBlock && cell4.HasFullBlock && cell5.HasFullBlock;
2137 cell.isSurrounded = cell.isSurrounded4d && cell6.HasFullBlock && cell7.HasFullBlock && cell8.HasFullBlock && cell9.HasFullBlock;
2138 }
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 2095 of file Map.cs.

2096 {
2097 for (int i = 0; i < Size; i++)
2098 {
2099 for (int j = 0; j < Size; j++)
2100 {
2101 cells[i, j].Refresh();
2102 }
2103 }
2104 }
void Refresh()
Definition: Cell.cs:1152

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 925 of file Map.cs.

926 {
927 ForeachSphere(x, z, radius, delegate(Point p)
928 {
929 List<Card> list = p.ListCards();
930 if (recalculate)
931 {
932 foreach (Card item in list)
933 {
934 item.RecalculateFOV();
935 }
936 return;
937 }
938 foreach (Card item2 in list)
939 {
940 item2.CalculateFOV();
941 }
942 });
943 }

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

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

◆ RefreshFOVAll()

void Map.RefreshFOVAll ( )
inline

Definition at line 945 of file Map.cs.

946 {
947 foreach (Card item in ((IEnumerable<Card>)EClass._map.things).Concat((IEnumerable<Card>)EClass._map.charas))
948 {
949 item.RecalculateFOV();
950 }
951 }

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

Referenced by ColorProfile.OnValidate().

◆ RefreshNeighborTiles()

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

Definition at line 2106 of file Map.cs.

2107 {
2108 cells[x, z].Refresh();
2109 for (int i = x - 2; i < x + 3; i++)
2110 {
2111 if (i < 0 || i >= Size)
2112 {
2113 continue;
2114 }
2115 for (int j = z - 2; j < z + 3; j++)
2116 {
2117 if (j >= 0 && j < Size && (x != i || z != j))
2118 {
2119 cells[i, j].Refresh();
2120 }
2121 }
2122 }
2123 }

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

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

◆ RefreshShadow()

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

Definition at line 1796 of file Map.cs.

1797 {
1798 }

Referenced by MineBlock(), and TaskBuild.OnProgressComplete().

◆ RefreshSingleTile()

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

◆ RefreshSunMap()

void Map.RefreshSunMap ( )
inline

Definition at line 2709 of file Map.cs.

2710 {
2711 if (!isDirtySunMap)
2712 {
2713 return;
2714 }
2715 sunMap.Clear();
2716 foreach (Card sun in EClass._map.props.installed.traits.suns)
2717 {
2718 foreach (Point item in sun.trait.ListPoints(null, onlyPassable: false))
2719 {
2720 sunMap.Add(item.index);
2721 }
2722 }
2723 isDirtySunMap = false;
2724 }
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:748

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);
318 RevealAll();
319 TweenUtil.Tween(0.1f, null, delegate
320 {
321 ReloadRoom();
322 });
323 }
Definition: Game.cs:8
static void Load(string id, bool cloud)
Definition: Game.cs:313
static string id
Definition: Game.cs:147
bool Save(bool isAutoSave=false, bool silent=false)
Definition: Game.cs:983
bool isCloud
Definition: Game.cs:239
void ReloadRoom()
Definition: Map.cs:325
void RevealAll(bool reveal=true)
Definition: Map.cs:901
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.isCloud, 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:57

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 1997 of file Map.cs.

1998 {
1999 for (int i = 0; i < 4; i++)
2000 {
2001 Cell dependedRamp = GetDependedRamp(cell);
2002 if (dependedRamp != null)
2003 {
2004 MineBlock(dependedRamp.GetPoint());
2005 continue;
2006 }
2007 break;
2008 }
2009 }
Point GetPoint()
Definition: Cell.cs:1101
Cell GetDependedRamp(Cell cell)
Definition: Map.cs:2177

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

Referenced by MineBlock(), and MineRamp().

◆ RemovePlant()

void Map.RemovePlant ( Point  pos)
inline

Definition at line 1949 of file Map.cs.

1950 {
1951 plants.Remove(pos.index);
1952 }

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:1526

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:480
Point orgPos
Definition: Chara.cs:21
void MoveCard(Point p, Card t)
Definition: Map.cs:837
void Revive()
Definition: Zone.cs:1088

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 914 of file Map.cs.

915 {
916 ForeachSphere(center.x, center.z, 10 + power / 5, delegate(Point p)
917 {
918 if (EClass.rnd(power) >= Mathf.Min(p.Distance(center) * 10, power - 10))
919 {
920 EClass._map.SetSeen(p.x, p.z);
921 }
922 });
923 }
int Distance(Point p)
Definition: Point.cs:969

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 901 of file Map.cs.

902 {
903 for (int i = 0; i < Size; i++)
904 {
905 for (int j = 0; j < Size; j++)
906 {
907 EClass._map.SetSeen(i, j, reveal, refresh: false);
908 }
909 }
912 }
bool revealed
Definition: Map.cs:103
void SetSeen(int x, int z, bool seen=true, bool refresh=true)
Definition: Map.cs:888
static void UpdateMap(List< Cell > newPoints)

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

Referenced by BuildMenu.Activate(), Zone.ClaimZone(), ZoneProfile.Generate(), DramaManager.ParseLine(), 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 cellEffects.Clear();
413 int num6 = 0;
414 for (int i = num; i < num + num3; i++)
415 {
416 for (int j = num2; j < num2 + num4; j++)
417 {
418 Cell cell = cells[i, j];
419 array[num6] = cell.objVal;
420 array3[num6] = cell._blockMat;
421 array2[num6] = cell._block;
422 array5[num6] = cell._floorMat;
423 array4[num6] = cell._floor;
424 array6[num6] = cell.obj;
425 array7[num6] = cell.objMat;
426 array8[num6] = cell.decal;
427 array9[num6] = cell._dirs;
428 array12[num6] = cell.height;
429 array13[num6] = cell._bridge;
430 array14[num6] = cell._bridgeMat;
431 array15[num6] = cell.bridgeHeight;
432 array17[num6] = cell._roofBlockDir;
433 array18[num6] = cell._roofBlock;
434 array19[num6] = cell._roofBlockMat;
435 array16[num6] = cell.bridgePillar;
436 array10[num6] = array10[num6].SetBit(1, cell.isSeen);
437 array10[num6] = array10[num6].SetBit(2, cell.isHarvested);
438 array10[num6] = array10[num6].SetBit(3, cell.impassable);
439 array10[num6] = array10[num6].SetBit(4, cell.isModified);
440 array10[num6] = array10[num6].SetBit(5, cell.isClearSnow);
441 array10[num6] = array10[num6].SetBit(6, cell.isForceFloat);
442 array10[num6] = array10[num6].SetBit(7, cell.isToggleWallPillar);
443 array11[num6] = array11[num6].SetBit(0, cell.isWatered);
444 array11[num6] = array11[num6].SetBit(1, cell.isObjDyed);
445 array11[num6] = array11[num6].SetBit(2, cell.crossWall);
446 if (cell.effect != null)
447 {
448 cellEffects[j * num4 + i] = cell.effect;
449 }
450 num6++;
451 }
452 }
454 IO.WriteLZ4(path + "objVals", array);
455 IO.WriteLZ4(path + "blocks", array2);
456 IO.WriteLZ4(path + "blockMats", array3);
457 IO.WriteLZ4(path + "floors", array4);
458 IO.WriteLZ4(path + "floorMats", array5);
459 IO.WriteLZ4(path + "objs", array6);
460 IO.WriteLZ4(path + "objMats", array7);
461 IO.WriteLZ4(path + "decal", array8);
462 IO.WriteLZ4(path + "flags", array10);
463 IO.WriteLZ4(path + "flags2", array11);
464 IO.WriteLZ4(path + "dirs", array9);
465 IO.WriteLZ4(path + "heights", array12);
466 IO.WriteLZ4(path + "bridges", array13);
467 IO.WriteLZ4(path + "bridgeMats", array14);
468 IO.WriteLZ4(path + "bridgeHeights", array15);
469 IO.WriteLZ4(path + "bridgePillars", array16);
470 IO.WriteLZ4(path + "roofBlocks", array18);
471 IO.WriteLZ4(path + "roofBlockMats", array19);
472 IO.WriteLZ4(path + "roofBlockDirs", array17);
473 things.Sort((Thing a, Thing b) => a.stackOrder - b.stackOrder);
474 if (export == null)
475 {
476 foreach (Chara chara in charas)
477 {
478 if (!chara.IsGlobal)
479 {
480 serializedCharas.Add(chara);
481 }
482 }
483 GameIO.SaveFile(path + "map", this);
484 }
485 else
486 {
487 export.serializedCards.cards.Clear();
488 if (partial == null)
489 {
490 MapExportSetting mapExportSetting = exportSetting ?? new MapExportSetting();
491 foreach (Chara chara2 in charas)
492 {
493 if (export.usermap)
494 {
495 if ((!mapExportSetting.clearLocalCharas || chara2.IsPCFactionOrMinion) && !chara2.trait.IsUnique && !chara2.IsPC)
496 {
497 export.serializedCards.Add(chara2);
498 }
499 }
500 else if (!chara2.IsGlobal && chara2.isPlayerCreation)
501 {
502 export.serializedCards.Add(chara2);
503 }
504 }
505 foreach (Thing thing in things)
506 {
507 if (thing.isPlayerCreation && thing.c_altName != "DebugContainer")
508 {
509 export.serializedCards.Add(thing);
510 }
511 }
512 }
513 else
514 {
515 foreach (Thing thing2 in things)
516 {
517 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)
518 {
519 export.serializedCards.Add(thing2);
520 }
521 }
522 }
523 List<Thing> list = things;
524 things = new List<Thing>();
525 GameIO.SaveFile(path + "map", this);
526 things = list;
527 }
528 serializedCharas.Clear();
529 }
static AM_Copy Copy
Definition: ActionMode.cs:45
bool IsActive
Definition: ActionMode.cs:121
string c_altName
Definition: Card.cs:1567
byte objMat
Definition: Cell.cs:42
bool isHarvested
Definition: Cell.cs:330
bool isClearSnow
Definition: Cell.cs:450
byte objVal
Definition: Cell.cs:40
byte _floorMat
Definition: Cell.cs:36
byte _roofBlock
Definition: Cell.cs:50
byte height
Definition: Cell.cs:72
bool isWatered
Definition: Cell.cs:342
byte _roofBlockDir
Definition: Cell.cs:54
bool isToggleWallPillar
Definition: Cell.cs:558
byte _roofBlockMat
Definition: Cell.cs:52
bool isSeen
Definition: Cell.cs:282
byte obj
Definition: Cell.cs:38
bool isForceFloat
Definition: Cell.cs:306
bool impassable
Definition: Cell.cs:402
bool crossWall
Definition: Cell.cs:630
bool isObjDyed
Definition: Cell.cs:618
byte bridgeHeight
Definition: Cell.cs:74
byte _dirs
Definition: Cell.cs:28
byte bridgePillar
Definition: Cell.cs:82
new TraitChara trait
Definition: Chara.cs:501
override bool IsPC
Definition: Chara.cs:610
Definition: GameIO.cs:10
static void SaveFile(string path, object obj)
Definition: GameIO.cs:254
Compression
Definition: IO.cs:13
static void WriteLZ4(string _path, byte[] _bytes)
Definition: IO.cs:134
static void CreateDirectory(string path)
Definition: IO.cs:333
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:153

References Cell._block, Cell._blockMat, Cell._bridge, Cell._bridgeMat, 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, 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, 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 997 of file Map.cs.

998 {
999 Cell cell = cells[x, z];
1000 bool hasFloodBlock = cell.HasFloodBlock;
1001 cell._blockMat = (byte)idMat;
1002 cell._block = (byte)idBlock;
1003 cell.blockDir = dir;
1004 if (cell.effect == null || !cell.effect.IsFire)
1005 {
1006 cell.effect = null;
1007 }
1008 cell.isToggleWallPillar = false;
1009 if (cell.room != null)
1010 {
1011 cell.room.SetDirty();
1012 }
1013 if (hasFloodBlock || cell.HasFloodBlock)
1014 {
1016 }
1018 }
bool IsFire
Definition: CellEffect.cs:135
bool HasFloodBlock
Definition: Cell.cs:1017
void OnSetBlockOrDoor(int x, int z)
Definition: Map.cs:1020

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 992 of file Map.cs.

993 {
994 SetBlock(x, z, idMat, idBlock, 0);
995 }

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 1161 of file Map.cs.

1162 {
1163 Cell cell = cells[x, z];
1164 cell._block = (byte)cell.sourceBlock.id;
1165 cell.blockDir = dir;
1166 }

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 2318 of file Map.cs.

2319 {
2320 if (size > Size / 2 + 1)
2321 {
2322 size = Size / 2 - 1;
2323 }
2324 bounds.SetBounds(Size / 2 - size, Size / 2 - size, Size / 2 + size, Size / 2 + size);
2325 }

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 2327 of file Map.cs.

2328 {
2329 bounds.SetBounds(b.x, b.z, b.maxX, b.maxZ);
2330 bounds.Size = b.Size;
2331 }

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 
)
inline

Definition at line 968 of file Map.cs.

969 {
970 Cell cell = cells[x, z];
971 cell.bridgeHeight = (byte)height;
972 cell._bridgeMat = (byte)idMat;
973 cell._bridge = (byte)idBridge;
974 cell.bridgePillar = 0;
975 cell.floorDir = dir;
976 if (cell.room != null)
977 {
978 cell.room.SetDirty();
979 }
981 }

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 2038 of file Map.cs.

2039 {
2040 cells[x, z].decal = (byte)((id != 0 && amount != 0) ? ((uint)(id * 8 + amount)) : 0u);
2041 if (refresh)
2042 {
2044 }
2045 }

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().

◆ SetEffect()

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

Definition at line 1504 of file Map.cs.

1505 {
1506 cells[x, z].effect = effect;
1507 }

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 958 of file Map.cs.

959 {
960 Cell cell = cells[x, z];
961 cell._floorMat = (byte)idMat;
962 cell._floor = (byte)idFloor;
963 cell.floorDir = dir;
966 }

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 953 of file Map.cs.

954 {
955 SetFloor(x, z, idMat, idFloor, 0);
956 }

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 2047 of file Map.cs.

2048 {
2049 Cell cell = pos.cell;
2050 int tile = AngleToIndex(angle) + offset;
2051 Footmark footmark = new Footmark
2052 {
2053 tile = tile,
2054 remaining = 10
2055 };
2056 footmark.pos.Set(pos);
2057 footmarks.Add(footmark);
2058 cell.GetOrCreateDetail().footmark = footmark;
2059 }
Footmark footmark
Definition: CellDetail.cs:17
CellDetail GetOrCreateDetail()
Definition: Cell.cs:1533
Point pos
Definition: Footmark.cs:3
int AngleToIndex(int a)
Definition: Map.cs:2061
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 1482 of file Map.cs.

1483 {
1484 Cell cell = cells[x, z];
1485 if (!cell.IsTopWaterAndNoSnow || value == 0)
1486 {
1487 if (value > 3)
1488 {
1489 value = 3;
1490 }
1491 if (value <= 0)
1492 {
1493 cell.effect = null;
1494 return;
1495 }
1496 cell.effect = new CellEffect
1497 {
1498 id = id,
1499 amount = value
1500 };
1501 }
1502 }

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 1536 of file Map.cs.

1537 {
1538 Cell cell = cells[x, z];
1539 if (cell.sourceObj.id == 118 || idObj == 118)
1540 {
1541 EClass._zone.dirtyElectricity = true;
1542 }
1543 cell.obj = (byte)idObj;
1544 cell.objVal = (byte)value;
1545 cell.objMat = (byte)idMat;
1546 cell.objDir = dir;
1547 cell.isHarvested = false;
1548 cell.isObjDyed = false;
1549 SourceObj.Row sourceObj = cell.sourceObj;
1550 if (!ignoreRandomMat && !sourceObj.matCategory.IsEmpty())
1551 {
1552 int num = EClass._zone.DangerLv;
1553 if (sourceObj.tag.Contains("spot"))
1554 {
1555 num += EClass.pc.Evalue(1656) * 5;
1556 }
1557 cell.objMat = (byte)MATERIAL.GetRandomMaterialFromCategory(num, sourceObj.matCategory.Split(','), cell.matObj).id;
1558 }
1559 if (backerObjs.ContainsKey(cell.index))
1560 {
1561 backerObjs.Remove(cell.index);
1562 }
1563 if (plants.ContainsKey(cell.index))
1564 {
1565 plants.Remove(cell.index);
1566 }
1567 cell.growth?.OnSetObj();
1568 Critter.RebuildCritter(cell);
1570 }
int Evalue(int ele)
Definition: Card.cs:2533
virtual void OnSetObj()
Definition: GrowSystem.cs:264
static SourceMaterial.Row GetRandomMaterialFromCategory(int lv, string cat, SourceMaterial.Row fallback)
Definition: MATERIAL.cs:85
string[] tag
Definition: RenderRow.cs:58
string matCategory
Definition: SourceObj.cs:21

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 983 of file Map.cs.

984 {
985 Cell cell = cells[x, z];
986 cell._roofBlockMat = (byte)idMat;
987 cell._roofBlock = (byte)idBlock;
988 cell._roofBlockDir = (byte)(dir + height * 4);
990 }

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 888 of file Map.cs.

889 {
890 if (cells[x, z].isSeen != seen)
891 {
892 cells[x, z].isSeen = seen;
893 if (refresh)
894 {
896 }
898 }
899 }

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 1080 of file Map.cs.

1081 {
1082 if (EClass._zone.DisableRooms || roomHash.Contains(x + z * Size) || cells[x, z].HasFloodBlock)
1083 {
1084 return;
1085 }
1086 FloodSpiller floodSpiller = flood;
1087 IFloodCell[,] array = cells;
1088 FloodSpiller.Result result = floodSpiller.SpillFlood(array, x, z);
1089 if (!result.IsValid)
1090 {
1091 return;
1092 }
1093 bool flag = false;
1094 foreach (IFloodCell item in result.visited)
1095 {
1096 if (item.hasDoor)
1097 {
1098 flag = true;
1099 break;
1100 }
1101 Cell cell = item as Cell;
1102 if (cell.sourceBlock.tileType.IsFloodDoor || cell.Front.hasDoor || cell.Right.hasDoor || cell.FrontRight.hasDoor || cell.Back.hasDoor || cell.Left.hasDoor || cell.BackLeft.hasDoor)
1103 {
1104 flag = true;
1105 break;
1106 }
1107 }
1108 if (!flag && IsIndoor)
1109 {
1110 foreach (IFloodCell item2 in result.visited)
1111 {
1112 Cell cell2 = item2 as Cell;
1113 if (cell2.detail == null || cell2.detail.things.Count == 0)
1114 {
1115 continue;
1116 }
1117 foreach (Thing thing in cell2.detail.things)
1118 {
1119 if (thing.trait is TraitRoomPlate || thing.trait is TraitHouseBoard)
1120 {
1121 flag = true;
1122 break;
1123 }
1124 }
1125 if (flag)
1126 {
1127 break;
1128 }
1129 }
1130 }
1131 if (!flag)
1132 {
1133 return;
1134 }
1135 Room room = rooms.AddRoom(new Room());
1136 foreach (IFloodCell item3 in result.visited)
1137 {
1138 Cell cell3 = item3 as Cell;
1139 byte b = cell3.x;
1140 byte b2 = cell3.z;
1141 room.AddPoint(new Point(b, b2));
1142 roomHash.Add(b + b2 * Size);
1143 if (b2 > 0 && cell3.Front.HasFloodBlock && cell3.Front.room == null)
1144 {
1145 room.AddPoint(new Point(b, b2 - 1));
1146 roomHash.Add(b + (b2 - 1) * Size);
1147 }
1148 if (b < Size - 1 && cell3.Right.HasFloodBlock && cell3.Right.room == null)
1149 {
1150 room.AddPoint(new Point(b + 1, b2));
1151 roomHash.Add(b + 1 + b2 * Size);
1152 }
1153 if (b2 > 0 && b < Size - 1 && cell3.FrontRight.HasFloodBlock && cell3.FrontRight.room == null)
1154 {
1155 room.AddPoint(new Point(b + 1, b2 - 1));
1156 roomHash.Add(b + 1 + (b2 - 1) * Size);
1157 }
1158 }
1159 }
Cell BackLeft
Definition: Cell.cs:213
bool hasDoor
Definition: Cell.cs:258
Cell FrontRight
Definition: Cell.cs:177
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:118

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 1934 of file Map.cs.

1935 {
1936 return plants.TryGetValue(c.index);
1937 }

References Cell.index, and plants.

◆ TryGetPlant() [2/2]

◆ TryLoadFile()

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

Definition at line 531 of file Map.cs.

532 {
533 byte[] array = IO.ReadLZ4(path + s, size, compression);
534 if (array == null)
535 {
536 Debug.Log("Couldn't load:" + s);
537 return new byte[size];
538 }
539 return array;
540 }
static byte[] ReadLZ4(string _path, int size, Compression compression)
Definition: IO.cs:151

References compression, and Debug.

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

◆ TryRemoveRoom()

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

Definition at line 1068 of file Map.cs.

1069 {
1070 if (!cells[x, z].HasFloodBlock)
1071 {
1072 Room room = cells[x, z].room;
1073 if (room != null)
1074 {
1075 rooms.RemoveRoom(room);
1076 }
1077 }
1078 }
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 1196 of file Map.cs.

1197 {
1198 Element element = Element.Create(ele);
1199 List<Card> list = new List<Card>();
1200 bool fire = ele == 910;
1201 bool cold = ele == 911;
1202 _ = fire;
1203 List<Card> list2 = pos.ListCards();
1204 if (fire && (pos.cell.IsSnowTile || pos.cell.IsTopWater))
1205 {
1206 return;
1207 }
1208 foreach (Card item in list2)
1209 {
1210 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>()))
1211 {
1212 continue;
1213 }
1215 {
1216 Card rootCard = item.GetRootCard();
1217 if (!rootCard.isChara || rootCard.Chara.IsPCFaction)
1218 {
1219 if (pos.IsSync)
1220 {
1221 Msg.Say("damage_protectCore", item);
1222 }
1223 continue;
1224 }
1225 }
1226 if (item.isThing && item.things.Count == 0)
1227 {
1228 list.Add(item);
1229 }
1230 else
1231 {
1232 if (ele == 911 && item.HasElement(1236))
1233 {
1234 continue;
1235 }
1236 Thing thing = ((ele == 910) ? item.things.FindBest<TraitBlanketFireproof>((Thing t) => -t.c_charges) : item.things.FindBest<TraitBlanketColdproof>((Thing t) => -t.c_charges));
1237 if (thing != null)
1238 {
1239 thing.ModCharge(-1);
1240 Card rootCard2 = item.GetRootCard();
1241 if (pos.IsSync)
1242 {
1243 Msg.Say((item.isChara ? "blanketInv_" : "blanketGround_") + element.source.alias, thing, item);
1244 }
1245 if (thing.c_charges <= 0)
1246 {
1247 thing.Die(element);
1248 if (rootCard2.IsPCParty)
1249 {
1251 }
1252 }
1253 continue;
1254 }
1255 foreach (Thing item2 in item.things.List((Thing a) => a.things.Count == 0))
1256 {
1257 Card parentCard = item2.parentCard;
1258 if (parentCard == null || (!(parentCard.trait is TraitChestMerchant) && !parentCard.HasEditorTag(EditorTag.PreciousContainer)))
1259 {
1260 list.Add(item2);
1261 }
1262 }
1263 }
1264 }
1265 list.Shuffle();
1266 int num = 0;
1267 foreach (Card item3 in list)
1268 {
1269 if (!item3.trait.CanBeDestroyed || item3.category.IsChildOf("currency") || item3.trait is TraitDoor || item3.trait is TraitFigure || item3.trait is TraitTrainingDummy || item3.rarity >= Rarity.Legendary)
1270 {
1271 continue;
1272 }
1273 Card rootCard3 = item3.GetRootCard();
1274 if (item3.IsEquipmentOrRangedOrAmmo && (EClass.rnd(4) != 0 || ((item3.IsRangedWeapon || item3.Thing.isEquipped) && rootCard3.IsPCFaction && EClass.rnd(4) != 0)))
1275 {
1276 continue;
1277 }
1278 switch (ele)
1279 {
1280 case 910:
1281 if (item3.isFireproof || (!item3.category.IsChildOf("book") && EClass.rnd(2) == 0))
1282 {
1283 continue;
1284 }
1285 break;
1286 case 911:
1287 if (!item3.category.IsChildOf("drink") && EClass.rnd(5) == 0)
1288 {
1289 continue;
1290 }
1291 break;
1292 }
1293 if (EClass.rnd(num * num) != 0)
1294 {
1295 continue;
1296 }
1297 bool flag = CanCook(item3);
1298 string text = "";
1299 if (flag)
1300 {
1301 if (fire)
1302 {
1303 List<SourceThing.Row> list3 = new List<SourceThing.Row>();
1304 foreach (RecipeSource item4 in RecipeManager.list)
1305 {
1306 if (!(item4.row is SourceThing.Row { isOrigin: false } row) || row.components.IsEmpty() || (row.components.Length >= 3 && !row.components[2].StartsWith('+')) || !row.Category.IsChildOf("meal"))
1307 {
1308 continue;
1309 }
1310 if (!row.factory.IsEmpty())
1311 {
1312 switch (row.factory[0])
1313 {
1314 case "chopper":
1315 case "mixer":
1316 case "camppot":
1317 case "cauldron":
1318 continue;
1319 }
1320 }
1321 if (row.components[0].Split('|').Contains(item3.id) || row.components[0].Split('|').Contains(item3.sourceCard._origin))
1322 {
1323 list3.Add(row);
1324 }
1325 }
1326 if (list3.Count > 0)
1327 {
1328 text = list3.RandomItem().id;
1329 }
1330 }
1331 else
1332 {
1333 text = "711";
1334 }
1335 }
1336 if (flag && !text.IsEmpty())
1337 {
1338 item3.GetRoot();
1339 Thing thing2 = item3.Split(1);
1340 List<Thing> list4 = new List<Thing>();
1341 list4.Add(thing2);
1342 Thing thing3 = ThingGen.Create(text);
1343 CraftUtil.MakeDish(thing3, list4, 999);
1344 thing3.elements.ModBase(2, EClass.curve(power / 10, 50, 10));
1345 if (pos.IsSync)
1346 {
1347 Msg.Say(((rootCard3 == item3) ? "cook_groundItem" : "cook_invItem") + (fire ? "" : "_cold"), thing2, rootCard3, thing3.Name);
1348 }
1349 if (rootCard3 == item3)
1350 {
1351 EClass._zone.AddCard(thing3, item3.pos);
1352 }
1353 else if (rootCard3.isChara)
1354 {
1355 rootCard3.Chara.Pick(thing3, msg: false);
1356 }
1357 else
1358 {
1359 rootCard3.AddThing(thing3);
1360 }
1361 thing2.Destroy();
1362 }
1363 else
1364 {
1365 int num2 = EClass.rnd(item3.Num) / 2 + 1;
1366 if (item3.Num > num2)
1367 {
1368 Thing thing4 = item3.Split(num2);
1369 if (pos.IsSync)
1370 {
1371 Msg.Say((rootCard3 == item3) ? "damage_groundItem" : "damage_invItem", thing4, rootCard3);
1372 }
1373 thing4.Destroy();
1374 if (rootCard3.IsPCFaction)
1375 {
1376 WidgetPopText.Say("popDestroy".lang(thing4.Name, rootCard3.Name));
1377 }
1378 }
1379 else
1380 {
1381 item3.Die(element);
1382 if (rootCard3.IsPCFaction)
1383 {
1384 WidgetPopText.Say("popDestroy".lang(item3.Name, rootCard3.Name));
1385 }
1386 }
1387 }
1388 if (rootCard3.IsPCParty)
1389 {
1391 }
1392 num++;
1393 }
1394 _ValidateInstalled(pos.x, pos.z);
1395 bool CanCook(Card c)
1396 {
1397 if ((fire || cold) && c.IsFood)
1398 {
1399 return c.category.IsChildOf("foodstuff");
1400 }
1401 return false;
1402 }
1403 }
EditorTag
Definition: EditorTag.cs:2
int itemLost
Definition: AM_Adv.cs:109
static AM_Adv Adv
Definition: ActionMode.cs:15
string _origin
Definition: CardRow.cs:15
string id
Definition: CardRow.cs:7
Thing Split(int a)
Definition: Card.cs:3382
ElementContainerCard elements
Definition: Card.cs:39
virtual void Die(Element e=null, Card origin=null, AttackSource attackSource=AttackSource.None, Chara originalTarget=null)
Definition: Card.cs:4783
ICardParent GetRoot()
Definition: Card.cs:3315
virtual bool IsPCParty
Definition: Card.cs:2111
bool IsEquipmentOrRangedOrAmmo
Definition: Card.cs:2192
string Name
Definition: Card.cs:2099
bool IsFood
Definition: Card.cs:2137
void ModCharge(int a, bool destroy=false)
Definition: Card.cs:3842
bool HasEditorTag(EditorTag tag)
Definition: Card.cs:2562
bool isFireproof
Definition: Card.cs:660
Card GetRootCard()
Definition: Card.cs:3324
virtual bool IsPCFaction
Definition: Card.cs:2231
Card parentCard
Definition: Card.cs:101
virtual CardRow sourceCard
Definition: Card.cs:2093
Thing Add(string id, int num=1, int lv=1)
Definition: Card.cs:3034
SourceCategory.Row category
Definition: Card.cs:2011
int c_charges
Definition: Card.cs:1243
bool IsTopWater
Definition: Cell.cs:700
Definition: ConWet.cs:2
static void MakeDish(Thing food, int lv, Chara crafter=null)
Definition: CraftUtil.cs:61
static int curve(int a, int start, int step, int rate=75)
Definition: EClass.cs:68
static FactionBranch Branch
Definition: EClass.cs:22
Element ModBase(int ele, int v)
SourceElement.Row source
Definition: ELEMENT.cs:271
static Element Create(int id, int v=0)
Definition: ELEMENT.cs:1097
bool HasItemProtection
void _ValidateInstalled(int x, int y)
Definition: Map.cs:1963
bool IsSync
Definition: Point.cs:332
static List< RecipeSource > list
Definition: RecipeManager.cs:9
RenderRow row
Definition: RecipeSource.cs:5
bool isEquipped
Definition: Thing.cs:17
virtual bool CanBeDestroyed
Definition: Trait.cs:292
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, CardRow.id, 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 1805 of file Map.cs.

1806 {
1807 if (c != null && c.IsAgent)
1808 {
1809 EClass.pc.PickOrDrop(p, t);
1810 }
1811 else if (c != null && (c.pos.Equals(p) || EClass.core.config.game.smoothPick || EClass._zone.IsRegion))
1812 {
1813 c.PickOrDrop(p, t);
1814 }
1815 else
1816 {
1817 EClass._zone.AddCard(t, p);
1818 }
1819 }
bool IsAgent
Definition: Card.cs:2211
new GameConfig game
Definition: CoreConfig.cs:602
bool Equals(int _x, int _z)
Definition: Point.cs:940

References EClass._zone, Zone.AddCard(), Core.config, EClass.core, Point.Equals(), CoreConfig.game, Card.IsAgent, 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 761 of file Map.cs.

762 {
764 ZipFile zipFile = ZipFile.Read(pathZip);
765 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
766 zipFile.ExtractAll(IO.TempPath);
767 zipFile.Dispose();
768 EClass._map.ExportMetaData(IO.TempPath + "/", Path.GetFileNameWithoutExtension(pathZip), partial);
769 using (zipFile = new ZipFile())
770 {
771 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
772 zipFile.AddDirectory(IO.TempPath);
773 zipFile.Save(pathZip);
774 zipFile.Dispose();
775 }
777 }
static void CreateTempDirectory(string path=null)
Definition: IO.cs:367
static string TempPath
Definition: IO.cs:64
static void DeleteTempDirectory(string path=null)
Definition: IO.cs:372
void ExportMetaData(string _path, string id, PartialMap partial=null)
Definition: Map.cs:716

References EClass._map, and ExportMetaData().

Referenced by PartialMap.Update().

◆ ValidateInstalled()

void Map.ValidateInstalled ( Point  p)
inline

Definition at line 1954 of file Map.cs.

1955 {
1956 _ValidateInstalled(p.x, p.z);
1957 _ValidateInstalled(p.x + 1, p.z);
1958 _ValidateInstalled(p.x - 1, p.z);
1959 _ValidateInstalled(p.x, p.z + 1);
1960 _ValidateInstalled(p.x, p.z - 1);
1961 }

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

Referenced by MineBlock().

◆ ValidateVersion()

void Map.ValidateVersion ( )
inline

Definition at line 699 of file Map.cs.

700 {
702 }

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 ActPlan._Update(), Zone.Activate(), ActionMode.Activate(), SerializedCards.Add(), Zone.AddGlobalCharasOnActivate(), LayerSleep.Advance(), ZoneEventQuest.AggroEnemy(), 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(), Zone.GetRandomVisitPos(), TaskCullLife.GetTarget(), QuestManager.HasFarAwayEscort(), Chara.HasMinion(), TraitShackle.IsRestraining(), ListChara(), Point.ListCharasInRadius(), Zone.ListMinions(), Region.ListMobs(), CraftUtil.MakeDarkSoup(), Chara.MoveZone(), Zone_Casino.OnActivate(), TraitTrap.OnActivateTrap(), FactionBranch.OnAfterSimulate(), Zone_WindRest.OnAfterSimulate(), AI_Torture.OnCancelOrSuccess(), OnCardAddedToZone(), OnCardRemovedFromZone(), NotificationBattle.OnClick(), NotificationGuest.OnClick(), AM_EditMarker.OnDeactivate(), OnDeactivate(), QuestDeliver.OnEnterZone(), ZoneEventSiege.OnFirstTick(), 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(), ActCryRage.Perform(), ActSummonGuard.Perform(), ActEffect.Proc(), Card.PurgeDuplicateArtifact(), Zone.RefreshCriminal(), RefreshFOVAll(), Zone.RefreshListCitizen(), WidgetMinimap.RefreshMarkers(), LayerQuestBoard.RefreshQuest(), ActionMode.RefreshTexts(), CoreDebug.RegenerateNames(), Chara.ReleaseMinion(), Chara.RequestProtection(), ResetEditorPos(), Zone.ResetHostility(), Resize(), AI_Fuck.Run(), AI_Idle.Run(), AI_Offer.Run(), Save(), WidgetSearch.Search(), 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(), ThingGen.TryLickChest(), GoalCombat.TryUseAbility(), GameUpdater.Update(), CoreDebug.UpdateInput(), 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(), 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(), 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(), 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: