Elin Decompiled Documentation EA 23.312 Nightly Patch 4
Loading...
Searching...
No Matches
CustomZoneContent.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using System.Linq;
3using Newtonsoft.Json;
4using UnityEngine;
5
6[JsonObject(MemberSerialization.OptOut)]
8{
9 public string parent;
10
11 public override string SourceType => "SourceZone";
12
14 {
15 List<string> list = r.tag.Where((string t) => t.StartsWith("add")).ToList();
16 if (list.Count == 0)
17 {
18 return null;
19 }
20 if (owner == null)
21 {
22 owner = ModUtil.FindSourceRowPackage(r);
23 }
24 CustomZoneContent customZoneContent = new CustomZoneContent
25 {
26 ContentId = "Zone/" + r.id,
27 SourceId = r.id,
28 Owner = owner
29 };
30 foreach (string item in list)
31 {
32 var (text, str, _) = CustomSourceContent.GetParams(item);
33 if (text == "addMap")
34 {
35 customZoneContent.parent = str.IsEmpty(r.parent.IsEmpty("ntyris"));
36 }
37 }
38 return customZoneContent;
39 }
40
41 public override void OnGameLoad(GameIOContext context)
42 {
43 Debug.Log($"#mod-content loading {this}");
44 if (EClass.game.spatials.Find(base.SourceId) != null)
45 {
46 Debug.Log("#mod-content skipping existing custom zone " + base.SourceId);
47 return;
48 }
49 Zone zone = ModUtil.FindZoneByFullName(parent);
50 if (zone != null)
51 {
52 Spatial arg = SpatialGen.Create(base.SourceId, zone, register: true);
53 Debug.Log($"#mod-content spawned custom zone {arg}");
54 return;
55 }
56 ModUtil.LogModError("source zone row '" + base.SourceId + "' has invalid addMap parent '" + parent + "'", base.Owner);
57 }
58
59 public override string ToString()
60 {
61 return base.ContentId + "/" + parent;
62 }
63}
$
Definition: ModManager.cs:76
string ContentId
Definition: CustomContent.cs:6
static string string string[] kv GetParams(string tag)
override string ToString()
static CustomZoneContent CreateFromRow(SourceZone.Row r, ModPackage owner=null)
override string SourceType
override void OnGameLoad(GameIOContext context)
Definition: EClass.cs:6
static Game game
Definition: EClass.cs:9
SpatialManager spatials
Definition: Game.cs:153
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)
Definition: Zone.cs:12