Skip to content

Commit 2095ab4

Browse files
Merge branch 'dev' into interact-trigger-support
2 parents 6ef5166 + bc13caa commit 2095ab4

File tree

9 files changed

+71
-16
lines changed

9 files changed

+71
-16
lines changed

.github/tas-check/2-2-install-inner.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ rm -v t.zip
2727

2828
# install CelesteTAS
2929
cd celeste/Mods
30-
curl --fail -Lo CelesteTAS.zip "https://github.com/EverestAPI/CelesteTAS-EverestInterop/releases/download/v3.46.2/CelesteTAS.zip"
30+
curl --fail -Lo CelesteTAS.zip "https://github.com/EverestAPI/CelesteTAS-EverestInterop/releases/download/v3.47.0/CelesteTAS.zip"
3131

3232
# install the mod that is going to be TASed, downloaded as a bundle zip containing the mod zip
3333
# and all of its dependencies (https://maddie480.ovh/celeste/bundle-download?id=${TAS_TO_RUN})

.github/tas-check/run-locally.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ set -xeo pipefail
1111

1212
case "$1" in
1313
"Celeste")
14-
TAS_URL="https://github.com/VampireFlower/CelesteTAS/archive/fbfbd6c3026e6fb946f85eb98498e4e632ee399b.zip"
15-
TAS_PATH="CelesteTAS-fbfbd6c3026e6fb946f85eb98498e4e632ee399b/0 - 100%.tas"
14+
TAS_URL="https://github.com/VampireFlower/CelesteTAS/archive/e6dfa34b8782c3dc88118d1fc14d29ceb73d036d.zip"
15+
TAS_PATH="CelesteTAS-e6dfa34b8782c3dc88118d1fc14d29ceb73d036d/0 - 100%.tas"
1616
;;
1717

1818
"StrawberryJam2021")
19-
TAS_URL="https://github.com/VampireFlower/StrawberryJamTAS/archive/d7775dc7f38c4fb06eb63700ec5aec6dfee86031.zip"
20-
TAS_PATH="StrawberryJamTAS-d7775dc7f38c4fb06eb63700ec5aec6dfee86031/0-SJ All Levels.tas"
21-
BUNDLE_DOWNLOAD="https://celestemodupdater.0x0a.de/pinned-mods/StrawberryJam2021-Bundle-582b1269.zip"
19+
TAS_URL="https://github.com/VampireFlower/StrawberryJamTAS/archive/495dd485b4e94f4d23d4fb5aa1350f24ff066d29.zip"
20+
TAS_PATH="StrawberryJamTAS-495dd485b4e94f4d23d4fb5aa1350f24ff066d29/0-SJ All Levels.tas"
21+
BUNDLE_DOWNLOAD="https://celestemodupdater.0x0a.de/pinned-mods/StrawberryJam2021-Bundle-46cc7e85.zip"
2222
;;
2323

2424
*)

.github/workflows/tas-sync-check.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ jobs:
1010
matrix:
1111
tas:
1212
- name: Celeste 100%
13-
url: "https://github.com/VampireFlower/CelesteTAS/archive/fbfbd6c3026e6fb946f85eb98498e4e632ee399b.zip"
14-
path: "CelesteTAS-fbfbd6c3026e6fb946f85eb98498e4e632ee399b/0 - 100%.tas"
13+
url: "https://github.com/VampireFlower/CelesteTAS/archive/e6dfa34b8782c3dc88118d1fc14d29ceb73d036d.zip"
14+
path: "CelesteTAS-e6dfa34b8782c3dc88118d1fc14d29ceb73d036d/0 - 100%.tas"
1515

1616
- name: Strawberry Jam All Levels
17-
url: "https://github.com/VampireFlower/StrawberryJamTAS/archive/d7775dc7f38c4fb06eb63700ec5aec6dfee86031.zip"
18-
path: "StrawberryJamTAS-d7775dc7f38c4fb06eb63700ec5aec6dfee86031/0-SJ All Levels.tas"
19-
bundle: "https://celestemodupdater.0x0a.de/pinned-mods/StrawberryJam2021-Bundle-582b1269.zip"
17+
url: "https://github.com/VampireFlower/StrawberryJamTAS/archive/495dd485b4e94f4d23d4fb5aa1350f24ff066d29.zip"
18+
path: "StrawberryJamTAS-495dd485b4e94f4d23d4fb5aa1350f24ff066d29/0-SJ All Levels.tas"
19+
bundle: "https://celestemodupdater.0x0a.de/pinned-mods/StrawberryJam2021-Bundle-46cc7e85.zip"
2020

2121
runs-on: ubuntu-latest
2222
timeout-minutes: 60
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
namespace Celeste.Mod.Entities;
2+
3+
/// <summary>
4+
/// To be implemented on custom triggers that affect the camera target, but doesn't extend any of the vanilla / Everest triggers.<br/>
5+
/// This enables <see cref="Level.GetFullCameraTargetAt"/>, which is called on respawn and room transition,<br/>
6+
/// to check for whether the player would collide with this trigger at the given position, thus updating the camera's position properly.
7+
/// </summary>
8+
public interface ICameraTargetTrigger {
9+
/// <summary>
10+
/// Called every frame the player remains in the trigger.<br/>
11+
/// Also called by <see cref="Level.GetFullCameraTargetAt"/> if the player would collide with this trigger at the given position.
12+
/// </summary>
13+
void OnStay(Player player);
14+
}

Celeste.Mod.mm/Mod/Entities/SmoothCameraOffsetTrigger.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Celeste.Mod.Entities {
1111
/// - `onlyOnce`: enable to have the trigger remove itself when the player leaves it.
1212
/// </summary>
1313
[CustomEntity("everest/smoothCameraOffsetTrigger", "SpringCollab2020/SmoothCameraOffsetTrigger")]
14-
public class SmoothCameraOffsetTrigger : Trigger {
14+
public class SmoothCameraOffsetTrigger : Trigger, ICameraTargetTrigger {
1515

1616
private Vector2 offsetFrom;
1717
private Vector2 offsetTo;

Celeste.Mod.mm/Mod/Registry/DecalRegistryHandlers/SolidDecalRegistryHandler.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Celeste.Mod.Registry.DecalRegistryHandlers;
44

55
internal sealed class SolidDecalRegistryHandler : DecalRegistryHandler {
6-
private int _x, _y, _width, _height, _index;
6+
private int _x, _y, _width, _height, _index, _priority;
77
private bool _blockWaterfalls, _safe;
88

99
public override string Name => "solid";
@@ -15,6 +15,8 @@ public override void Parse(XmlAttributeCollection xml) {
1515
_height = Get(xml, "height", 16);
1616

1717
_index = Get(xml, "index", SurfaceIndex.ResortRoof);
18+
_priority = Get(xml, "priority", 0);
19+
1820
_blockWaterfalls = GetBool(xml, "blockWaterfalls", true);
1921
_safe = GetBool(xml, "safe", true);
2022
}
@@ -24,6 +26,6 @@ public override void ApplyTo(Decal decal) {
2426

2527
decal.ScaleRectangle(ref x, ref y, ref width, ref height);
2628

27-
((patch_Decal)decal).MakeSolid(x, y, width, height, _index, _blockWaterfalls, _safe);
29+
((patch_Decal)decal).MakeSolid(x, y, width, height, _index, _priority, _blockWaterfalls, _safe);
2830
}
2931
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using Microsoft.Xna.Framework;
2+
using Mono.Cecil;
3+
using MonoMod;
4+
using MonoMod.InlineRT;
5+
using System;
6+
7+
namespace Celeste {
8+
[PatchCameraTargetTriggerInterface]
9+
class patch_CameraAdvanceTargetTrigger : CameraAdvanceTargetTrigger {
10+
public patch_CameraAdvanceTargetTrigger(EntityData data, Vector2 offset) : base(data, offset) { }
11+
}
12+
}
13+
14+
namespace MonoMod {
15+
/// <summary>
16+
/// Patch the Camera Target Trigger to implement <see cref="Celeste.Mod.Entities.ICameraTargetTrigger"/>.
17+
/// </summary>
18+
[MonoModCustomAttribute(nameof(MonoModRules.PatchCameraTargetTriggerInterface))]
19+
class PatchCameraTargetTriggerInterfaceAttribute : Attribute { }
20+
21+
static partial class MonoModRules {
22+
23+
public static void PatchCameraTargetTriggerInterface(ICustomAttributeProvider provider, CustomAttribute attrib) {
24+
InterfaceImplementation i_cameraTargetTrigger = new(MonoModRule.Modder.FindType("Celeste.Mod.Entities.ICameraTargetTrigger"));
25+
26+
((TypeDefinition) provider).Interfaces.Add(i_cameraTargetTrigger);
27+
}
28+
}
29+
}

Celeste.Mod.mm/Patches/Decal.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,16 @@ public void MakeSolid(float x, float y, float w, float h, int surfaceSoundIndex,
206206
Scene.Add(solid);
207207
}
208208

209+
public void MakeSolid(float x, float y, float w, float h, int surfaceSoundIndex, int surfaceSoundPriority, bool blockWaterfalls = true, bool safe = true) {
210+
Solid solid = new Solid(Position + new Vector2(x, y), w, h, safe) {
211+
BlockWaterfalls = blockWaterfalls,
212+
SurfaceSoundIndex = surfaceSoundIndex,
213+
SurfaceSoundPriority = surfaceSoundPriority,
214+
};
215+
solids.Add(solid);
216+
Scene.Add(solid);
217+
}
218+
209219
[Obsolete("Use MakeFlagSwap with the cold flag instead.")]
210220
public void MakeCoreSwap(string coldPath, string hotPath) {
211221
Add(image = new patch_CoreSwapImage(GFX.Game[coldPath], GFX.Game[hotPath]));

Celeste.Mod.mm/Patches/Level.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,8 +577,8 @@ private static void _GCCollect() {
577577
Vector2 originalPosition = player.Position;
578578
player.Position = at;
579579
foreach (Entity trigger in Tracker.GetEntities<Trigger>()) {
580-
if (trigger is SmoothCameraOffsetTrigger smoothCameraOffset && player.CollideCheck(trigger)) {
581-
smoothCameraOffset.OnStay(player);
580+
if (trigger is ICameraTargetTrigger iCameraTarget && player.CollideCheck(trigger)) {
581+
iCameraTarget.OnStay(player);
582582
}
583583
}
584584
player.Position = originalPosition;

0 commit comments

Comments
 (0)