-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
234 additions
and
5 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+145 Bytes
Graphics/Atlases/Gameplay/TASHelper/SpinnerCollider/S16_outline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+154 Bytes
Graphics/Atlases/Gameplay/TASHelper/SpinnerCollider/S16_outlineDashed1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+147 Bytes
Graphics/Atlases/Gameplay/TASHelper/SpinnerCollider/S16_outlineDashed2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
using Celeste.Mod.TASHelper.Utils; | ||
using Microsoft.Xna.Framework; | ||
using Monocle; | ||
using System.Reflection; | ||
|
||
namespace Celeste.Mod.TASHelper.Gameplay; | ||
internal static class HKNailDebugRender { | ||
|
||
[Initialize] | ||
private static void Initialize() { | ||
prepared = true; | ||
if (ModUtils.GetType("FlaglinesAndSuch", "FlaglinesAndSuch.HKnail") is { } hkNail) { | ||
nailTimerGetter = hkNail.GetFieldInfo("nailTimer"); | ||
rechargeTimerGetter = hkNail.GetFieldInfo("nailRechargeTimer"); | ||
nailDir = hkNail.GetFieldInfo("nailDir"); | ||
if (nailTimerGetter is null || rechargeTimerGetter is null || nailDir is null) { | ||
prepared = false; | ||
} | ||
} | ||
else { | ||
prepared = false; | ||
} | ||
if (prepared && ModUtils.GetType("FlaglinesAndSuch", "FlaglinesAndSuch.Class1") is { } moduleType && ModUtils.GetType("FlaglinesAndSuch", "FlaglinesAndSuch.FlaglinesAndSuchModuleSettings") is { } settingType && settingType.GetPropertyInfo("PlayerAlwaysHasNail") is { } alwaysHasNail && moduleType.GetPropertyValue<EverestModuleSettings>("Settings") is { } settings) { | ||
flaglinesAndSuchSettings = settings; | ||
alwaysHasNailGetter = alwaysHasNail; | ||
} | ||
else { | ||
prepared = false; | ||
} | ||
} | ||
|
||
private static FieldInfo nailTimerGetter; | ||
|
||
private static FieldInfo rechargeTimerGetter; | ||
|
||
private static FieldInfo nailDir; | ||
|
||
private static EverestModuleSettings flaglinesAndSuchSettings; | ||
|
||
private static PropertyInfo alwaysHasNailGetter; | ||
|
||
private static bool PlayerAlwaysHasNail => (bool)alwaysHasNailGetter.GetValue(flaglinesAndSuchSettings); | ||
|
||
private static bool prepared = false; | ||
|
||
[AddDebugRender] | ||
private static void PatchEntityListDebugRender(EntityList self, Camera camera) { | ||
if (!prepared || Engine.Scene is not Level level) { | ||
return; | ||
} | ||
if (!PlayerAlwaysHasNail && !level.Session.GetFlag("flaglinesandsuch_nail_enabled")) { | ||
return; | ||
} | ||
if (playerInstance is not Player player) { | ||
return; | ||
} | ||
if ((float)nailTimerGetter.GetValue(null) > 0f || (float)rechargeTimerGetter.GetValue(null) == 0.1f) { | ||
Vector2 orig_Position = player.Position; | ||
Collider collider = player.Collider; | ||
int dir = (int)nailDir.GetValue(null); | ||
player.Position = ActualPosition.PlayerPositionBeforeSelfUpdate; | ||
player.Collider = dir switch { | ||
0 => nailhitboxUp, | ||
1 => nailhitboxDown, | ||
2 => nailhitboxLeft, | ||
3 => nailhitboxRight, | ||
_ => nailhitboxRight | ||
}; | ||
player.Collider.Render(camera); | ||
player.Collider = collider; | ||
player.Position = orig_Position; | ||
} | ||
} | ||
|
||
private static readonly Hitbox nailhitboxDown = new Hitbox(16f, 14f, -8f); | ||
|
||
private static readonly Hitbox nailhitboxUp = new Hitbox(16f, 14f, -8f, -25f); | ||
|
||
private static readonly Hitbox nailhitboxRight = new Hitbox(14f, 16f, 4f, -12f); | ||
|
||
private static readonly Hitbox nailhitboxLeft = new Hitbox(14f, 16f, -18f, -12f); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters