-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDashlessDreamBlocksMapProcessor.cs
37 lines (31 loc) · 1.18 KB
/
DashlessDreamBlocksMapProcessor.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using MonoMod.Utils;
using System.Collections.Generic;
using System;
namespace Celeste.Mod.DashlessDreamBlocks {
public class DashlessDreamBlocksMapProcessor : EverestMapDataProcessor {
public string DashlessInventory;
public override void Reset() {
DashlessInventory = null;
}
public override Dictionary<string, Action<BinaryPacker.Element>> Init() {
return new Dictionary<string, Action<BinaryPacker.Element>> {
{ "meta", meta => {
foreach (BinaryPacker.Element el in meta.Children)
Context.Run(el.Name, el);
}},
{ "mode", mode => {
mode.AttrIf("Inventory", val => {
if (val.StartsWith(DashlessDreamBlocksModule.INVENTORY_PREFIX)) {
DashlessInventory = val;
}
});
}}
};
}
public override void End() {
if (!string.IsNullOrEmpty(DashlessInventory)) {
new DynData<MapData>(MapData)[DashlessDreamBlocksModule.PROPERTY_KEY] = true;
}
}
}
}