diff options
Diffstat (limited to 'AnodyneArchipelago/Patches/PatchHelper.cs')
-rw-r--r-- | AnodyneArchipelago/Patches/PatchHelper.cs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/AnodyneArchipelago/Patches/PatchHelper.cs b/AnodyneArchipelago/Patches/PatchHelper.cs index 6b6d532..090533b 100644 --- a/AnodyneArchipelago/Patches/PatchHelper.cs +++ b/AnodyneArchipelago/Patches/PatchHelper.cs | |||
@@ -1,6 +1,10 @@ | |||
1 | using AnodyneSharp.Entities; | 1 | using AnodyneSharp.Entities; |
2 | using AnodyneSharp.MapData; | ||
3 | using AnodyneSharp.Registry; | ||
2 | using System; | 4 | using System; |
5 | using System.Collections.Generic; | ||
3 | using System.Reflection; | 6 | using System.Reflection; |
7 | using Layer = AnodyneSharp.MapData.Layer; | ||
4 | 8 | ||
5 | namespace AnodyneArchipelago.Patches | 9 | namespace AnodyneArchipelago.Patches |
6 | { | 10 | { |
@@ -11,5 +15,17 @@ namespace AnodyneArchipelago.Patches | |||
11 | FieldInfo presetField = type.GetField("_preset", BindingFlags.NonPublic | BindingFlags.Instance); | 15 | FieldInfo presetField = type.GetField("_preset", BindingFlags.NonPublic | BindingFlags.Instance); |
12 | return presetField.GetValue(instance) as EntityPreset; | 16 | return presetField.GetValue(instance) as EntityPreset; |
13 | } | 17 | } |
18 | |||
19 | public static void SetMapTile(int x, int y, int value, Layer layer) | ||
20 | { | ||
21 | FieldInfo layersField = typeof(Map).GetField("mapLayers", BindingFlags.NonPublic | BindingFlags.Instance); | ||
22 | TileMap[] mapLayers = (TileMap[])layersField.GetValue(GlobalState.Map); | ||
23 | TileMap mapLayer = mapLayers[(int)layer]; | ||
24 | |||
25 | FieldInfo tilesField = typeof(TileMap).GetField("tiles", BindingFlags.NonPublic | BindingFlags.Instance); | ||
26 | List<int> tiles = (List<int>)tilesField.GetValue(mapLayer); | ||
27 | |||
28 | tiles[x + y * mapLayer.Width] = value; | ||
29 | } | ||
14 | } | 30 | } |
15 | } | 31 | } |