diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-05-25 15:37:05 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-05-25 15:37:05 -0400 |
commit | 6a518ca7bdb787ef6d37469d26648afb8385c987 (patch) | |
tree | e2e0374bfd158c33d6b87ae37d00bd3205f51fe8 /AnodyneArchipelago | |
parent | 6a9ff88b6c07a7f7d236da008f8a328418c49571 (diff) | |
download | anodyne-archipelago-6a518ca7bdb787ef6d37469d26648afb8385c987.tar.gz anodyne-archipelago-6a518ca7bdb787ef6d37469d26648afb8385c987.tar.bz2 anodyne-archipelago-6a518ca7bdb787ef6d37469d26648afb8385c987.zip |
Block access to terminal without Red Key
Diffstat (limited to 'AnodyneArchipelago')
-rw-r--r-- | AnodyneArchipelago/Patches/GameplayPatches.cs | 23 | ||||
-rw-r--r-- | AnodyneArchipelago/Patches/PatchHelper.cs | 16 |
2 files changed, 39 insertions, 0 deletions
diff --git a/AnodyneArchipelago/Patches/GameplayPatches.cs b/AnodyneArchipelago/Patches/GameplayPatches.cs index ba33457..a6b572a 100644 --- a/AnodyneArchipelago/Patches/GameplayPatches.cs +++ b/AnodyneArchipelago/Patches/GameplayPatches.cs | |||
@@ -15,6 +15,7 @@ using AnodyneSharp.Dialogue; | |||
15 | using AnodyneSharp.Sounds; | 15 | using AnodyneSharp.Sounds; |
16 | using AnodyneSharp.States; | 16 | using AnodyneSharp.States; |
17 | using AnodyneSharp.Entities.Interactive.Npc; | 17 | using AnodyneSharp.Entities.Interactive.Npc; |
18 | using AnodyneSharp.MapData; | ||
18 | 19 | ||
19 | namespace AnodyneArchipelago.Patches | 20 | namespace AnodyneArchipelago.Patches |
20 | { | 21 | { |
@@ -321,4 +322,26 @@ namespace AnodyneArchipelago.Patches | |||
321 | } | 322 | } |
322 | } | 323 | } |
323 | } | 324 | } |
325 | |||
326 | [HarmonyPatch(typeof(PlayState), "Warp")] | ||
327 | class PlayWarpPatch | ||
328 | { | ||
329 | static void Postfix() | ||
330 | { | ||
331 | if (GlobalState.CURRENT_MAP_NAME == "FIELDS") | ||
332 | { | ||
333 | // Place a rock blocking access to Terminal without the red key. | ||
334 | PatchHelper.SetMapTile(31, 47, 11, Layer.BG); | ||
335 | } | ||
336 | } | ||
337 | } | ||
338 | |||
339 | /*[HarmonyPatch(typeof(Player), "Movement")] | ||
340 | class PlayerMovementPatch | ||
341 | { | ||
342 | static void Postfix(Player __instance) | ||
343 | { | ||
344 | Plugin.Instance.Log.LogInfo($"Player pos: {GlobalState.Map.ToMapLoc(__instance.Position)}"); | ||
345 | } | ||
346 | }*/ | ||
324 | } | 347 | } |
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 | } |