Elin Decompiled Documentation EA 23.329 Nightly
Loading...
Searching...
No Matches
CustomZoneContent Class Reference
Inheritance diagram for CustomZoneContent:
CustomSourceContent CustomContent EClass

Public Member Functions

override void OnGameLoad (GameIOContext context)
 
override string ToString ()
 
- Public Member Functions inherited from CustomContent
virtual void OnGameLoad (GameIOContext context)
 
virtual void OnGameSave (GameIOContext context)
 
override string ToString ()
 

Static Public Member Functions

static CustomZoneContent CreateFromRow (SourceZone.Row r, ModPackage owner=null)
 
- Static Public Member Functions inherited from CustomSourceContent
static string string string[] kv GetParams (string tag)
 
- Static Public Member Functions inherited from EClass
static int rndSeed (int a, int seed)
 
static int rnd (long a)
 
static int rnd (int a)
 
static int curve (long _a, int start, int step, int rate=75)
 
static int sqrt (int a)
 
static int rndHalf (int a)
 
static float rndf (float a)
 
static int rndSqrt (int a)
 
static void Wait (float a, Card c)
 
static void Wait (float a, Point p)
 
static int Bigger (int a, int b)
 
static int Smaller (int a, int b)
 

Public Attributes

string parent
 
bool autoSpawn
 

Properties

override string SourceType [get]
 
- Properties inherited from CustomSourceContent
virtual string SourceType [get]
 
string SourceId [get, set]
 
- Properties inherited from CustomContent
string ContentId [get, protected set]
 
EMod Owner [get, protected set]
 
- 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]
 

Additional Inherited Members

- Static Public Attributes inherited from CustomSourceContent
static string action
 
static string string spec
 
- Static Public Attributes inherited from EClass
static Core core
 

Detailed Description

Definition at line 5 of file CustomZoneContent.cs.

Member Function Documentation

◆ CreateFromRow()

static CustomZoneContent CustomZoneContent.CreateFromRow ( SourceZone::Row  r,
ModPackage  owner = null 
)
inlinestatic

Definition at line 13 of file CustomZoneContent.cs.

14 {
15 if (owner == null)
16 {
17 owner = ModUtil.FindSourceRowPackage(r);
18 }
19 CustomZoneContent customZoneContent = new CustomZoneContent
20 {
21 ContentId = "Zone/" + r.id,
22 SourceId = r.id,
23 Owner = owner
24 };
25 string[] tag = r.tag;
26 for (int i = 0; i < tag.Length; i++)
27 {
28 var (text, str, _) = CustomSourceContent.GetParams(tag[i]);
29 if (text == "addMap")
30 {
31 customZoneContent.parent = str.IsEmpty(r.parent.IsEmpty("ntyris"));
32 customZoneContent.autoSpawn = true;
33 }
34 }
35 return customZoneContent;
36 }
string ContentId
Definition: CustomContent.cs:6
static string string string[] kv GetParams(string tag)
string[] tag
Definition: SourceZone.cs:37
string parent
Definition: SourceZone.cs:11

References CustomContent.ContentId, CustomSourceContent.GetParams(), CustomContent.Owner, and CustomSourceContent.SourceId.

Referenced by ModPackage.GenerateCustomContentProfiles().

◆ OnGameLoad()

override void CustomZoneContent.OnGameLoad ( GameIOContext  context)
inlinevirtual

Reimplemented from CustomContent.

Definition at line 38 of file CustomZoneContent.cs.

39 {
40 if (!autoSpawn || parent == null)
41 {
42 return;
43 }
44 Debug.Log($"#mod-content loading {this}");
45 if (EClass.game.spatials.Find(base.SourceId) != null)
46 {
47 Debug.Log("#mod-content skipping existing custom zone " + base.SourceId);
48 return;
49 }
50 Zone zone = ModUtil.FindZoneByFullName(parent);
51 if (zone != null)
52 {
53 Spatial spatial = SpatialGen.Create(base.SourceId, zone, register: true);
54 EClass.game.world.region.elomap.SetZone(spatial.x, spatial.y, spatial as Zone);
55 Debug.Log($"#mod-content spawned custom zone {spatial}");
56 return;
57 }
58 ModUtil.LogModError("source zone row '" + base.SourceId + "' has invalid addMap parent '" + parent + "'", base.Owner);
59 }
Definition: EClass.cs:6
static Game game
Definition: EClass.cs:9
void SetZone(int gx, int gy, Zone z, bool updateMesh=false)
Definition: EloMap.cs:234
SpatialManager spatials
Definition: Game.cs:153
new World world
Definition: Game.cs:177
EloMap elomap
Definition: Region.cs:9
static Spatial Create(string id, Spatial parent, bool register, int x=-99999, int y=-99999, int icon=0)
Definition: SpatialGen.cs:16
Zone Find(string id)
int y
Definition: Spatial.cs:106
int x
Definition: Spatial.cs:94
Region region
Definition: World.cs:23
Definition: Zone.cs:12

References $, autoSpawn, SpatialGen.Create(), Debug, Region.elomap, SpatialManager.Find(), EClass.game, parent, World.region, EloMap.SetZone(), Game.spatials, Game.world, Spatial.x, and Spatial.y.

◆ ToString()

override string CustomZoneContent.ToString ( )
inline

Definition at line 61 of file CustomZoneContent.cs.

62 {
63 return base.ContentId + "/" + parent;
64 }

References parent.

Member Data Documentation

◆ autoSpawn

bool CustomZoneContent.autoSpawn

Definition at line 9 of file CustomZoneContent.cs.

Referenced by OnGameLoad().

◆ parent

string CustomZoneContent.parent

Definition at line 7 of file CustomZoneContent.cs.

Referenced by OnGameLoad(), and ToString().

Property Documentation

◆ SourceType

override string CustomZoneContent.SourceType
get

Definition at line 11 of file CustomZoneContent.cs.


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