Skip to content

Commit

Permalink
Use recommended practice for calling base.base methods
Browse files Browse the repository at this point in the history
  • Loading branch information
coloursofnoise committed May 11, 2021
1 parent e095a38 commit 1856016
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 13 deletions.
10 changes: 7 additions & 3 deletions FancyTileEntities/Entities/CoverupWall.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Celeste.Mod.Entities;
using Microsoft.Xna.Framework;
using Monocle;
using MonoMod;
using System;
using System.Reflection;
using static Celeste.Mod.FancyTileEntities.Extensions;
Expand All @@ -26,10 +27,13 @@ public FancyCoverupWall(EntityData data, Vector2 offset)
Collider = GenerateBetterColliderGrid(tileMap, 8, 8);
}

[MonoModLinkTo("Monocle.Entity", "System.Void Added(Monocle.Scene)")]
public void base_Added(Scene scene) {
base.Added(scene);
}

public override void Added(Scene scene) {
IntPtr ptr = typeof(Entity).GetMethod("Added").MethodHandle.GetFunctionPointer();
Action<Scene> m_Entity_added = (Action<Scene>) Activator.CreateInstance(typeof(Action<Scene>), this, ptr);
m_Entity_added(scene);
base_Added(scene);

if (blendIn) {
Level level = SceneAs<Level>();
Expand Down
10 changes: 7 additions & 3 deletions FancyTileEntities/Entities/CrumbleWallOnRumble.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Celeste.Mod.Entities;
using Microsoft.Xna.Framework;
using Monocle;
using MonoMod;
using MonoMod.Utils;
using System;
using System.Reflection;
Expand All @@ -26,10 +27,13 @@ public FancyCrumbleWallOnRumble(EntityData data, Vector2 offset, EntityID id)
Collider = colliders;
}

[MonoModLinkTo("Celeste.Solid", "System.Void Awake(Monocle.Scene)")]
public void base_Awake(Scene scene) {
base.Awake(scene);
}

public override void Awake(Scene scene) {
IntPtr ptr = typeof(Solid).GetMethod("Awake").MethodHandle.GetFunctionPointer();
Action<Scene> awake_Solid = (Action<Scene>) Activator.CreateInstance(typeof(Action<Scene>), this, ptr);
awake_Solid(scene);
base_Awake(scene);

TileGrid tileGrid;
if (!f_CrumbleWallOnRumble_blendIn[this]) {
Expand Down
10 changes: 7 additions & 3 deletions FancyTileEntities/Entities/DashBlock.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Celeste.Mod.Entities;
using Microsoft.Xna.Framework;
using Monocle;
using MonoMod;
using System;
using System.Reflection;
using static Celeste.Mod.FancyTileEntities.Extensions;
Expand All @@ -25,10 +26,13 @@ public FancyDashBlock(EntityData data, Vector2 offset, EntityID id)
Collider = GenerateBetterColliderGrid(tileMap, 8, 8);
}

[MonoModLinkTo("Celeste.Solid", "System.Void Awake(Monocle.Scene)")]
public void base_Awake(Scene scene) {
base.Awake(scene);
}

public override void Awake(Scene scene) {
IntPtr ptr = typeof(Solid).GetMethod("Awake").MethodHandle.GetFunctionPointer();
Action<Scene> awake_Solid = (Action<Scene>) Activator.CreateInstance(typeof(Action<Scene>), this, ptr);
awake_Solid(scene);
base_Awake(scene);

TileGrid tileGrid;
if (!f_DashBlock_blendIn[this]) {
Expand Down
10 changes: 7 additions & 3 deletions FancyTileEntities/Entities/ExitBlock.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Celeste.Mod.Entities;
using Microsoft.Xna.Framework;
using Monocle;
using MonoMod;
using System;
using System.Reflection;
using static Celeste.Mod.FancyTileEntities.Extensions;
Expand Down Expand Up @@ -29,10 +30,13 @@ public FancyExitBlock(EntityData data, Vector2 offset)
Collider = GenerateBetterColliderGrid(tileMap, 8, 8);
}

[MonoModLinkTo("Monocle.Entity", "System.Void Added(Monocle.Scene)")]
public void base_Added(Scene scene) {
base.Added(scene);
}

public override void Added(Scene scene) {
IntPtr ptr = typeof(Entity).GetMethod("Added").MethodHandle.GetFunctionPointer();
Action<Scene> added_Entity = (Action<Scene>) Activator.CreateInstance(typeof(Action<Scene>), this, ptr);
added_Entity(scene);
base_Added(scene);

Level level = SceneAs<Level>();
Rectangle tileBounds = level.Session.MapData.TileBounds;
Expand Down
1 change: 1 addition & 0 deletions FancyTileEntities/FancyTileEntities.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MonoMod" Version="21.4.2.3" PrivateAssets="all" ExcludeAssets="runtime" />
<PackageReference Include="MonoMod.RuntimeDetour" Version="21.01.11.01" PrivateAssets="all" ExcludeAssets="runtime" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion everest.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- Name: FancyTileEntities
Version: 1.4.3
Version: 1.4.5
DLL: FancyTileEntities/bin/Debug/net452/FancyTileEntities.dll
Dependencies:
- Name: Everest
Expand Down

0 comments on commit 1856016

Please sign in to comment.