diff --git a/Code/TriggerTrigger.cs b/Code/TriggerTrigger.cs index 133cb55..73042de 100644 --- a/Code/TriggerTrigger.cs +++ b/Code/TriggerTrigger.cs @@ -16,6 +16,7 @@ public class TriggerTrigger : Trigger { public static void Load() { On.Celeste.Level.LoadLevel += Level_LoadLevel; On.Celeste.Player.Jump += Player_Jump; + On.Celeste.Player.WallJump += Player_WallJump; On.Celeste.PlayerCollider.Check += PlayerCollider_Check; IL.Monocle.Engine.Update += Engine_Update; } @@ -23,6 +24,7 @@ public static void Load() { public static void Unload() { On.Celeste.Level.LoadLevel -= Level_LoadLevel; On.Celeste.Player.Jump -= Player_Jump; + On.Celeste.Player.WallJump -= Player_WallJump; On.Celeste.PlayerCollider.Check -= PlayerCollider_Check; IL.Monocle.Engine.Update -= Engine_Update; } @@ -73,6 +75,8 @@ public TriggerTrigger(EntityData data, Vector2 offset) : base(data, offset) { excludeTalkers = data.Bool("excludeTalkers", false); ifSafe = data.Bool("onlyIfSafe", false); includeCoyote = data.Bool("includeCoyote", false); + includeWalljump = data.Bool("includeWallJump", false); + resetAfterJump = data.Bool("resetAfterJump", false); playerState = data.Int("playerState", 0); if (string.IsNullOrEmpty(data.Attr("entityType", ""))) { collideType = data.Attr("entityTypeToCollide", "Celeste.Strawberry"); @@ -501,7 +505,35 @@ private static void Player_Jump(On.Celeste.Player.orig_Jump orig, Player self, b foreach (TriggerTrigger trigger in self.SceneAs().Tracker.GetEntities()) { if (trigger.activationType == ActivationTypes.Jumping) { trigger.externalActivation = true; - self.Add(new Coroutine(trigger.JumpRoutine(self, trigger), true)); + if (trigger.resetAfterJump) + { + trigger.resetActivation = true; + } + else + { + self.Add(new Coroutine(trigger.JumpRoutine(self, trigger), true)); + } + } + } + } + + private static void Player_WallJump(On.Celeste.Player.orig_WallJump orig, Player self, int dir) + { + orig(self, dir); + if (self == null) { return; } + foreach (TriggerTrigger trigger in self.SceneAs().Tracker.GetEntities()) + { + if (trigger.activationType == ActivationTypes.Jumping && trigger.includeWalljump) + { + trigger.externalActivation = true; + if (trigger.resetAfterJump) + { + trigger.resetActivation = true; + } + else + { + self.Add(new Coroutine(trigger.JumpRoutine(self, trigger), true)); + } } } } @@ -589,6 +621,8 @@ public static void UpdateFreezeInput() private bool excludeTalkers; private bool ifSafe; private bool includeCoyote; + public bool includeWalljump; + public bool resetAfterJump; private int playerState; private TalkComponent talker; private List entitiesInside; diff --git a/Loenn/lang/en_gb.lang b/Loenn/lang/en_gb.lang index 097952e..1b38579 100644 --- a/Loenn/lang/en_gb.lang +++ b/Loenn/lang/en_gb.lang @@ -388,6 +388,7 @@ triggers.vitellary/triggertrigger.attributes.description.solidType=Class name of triggers.vitellary/triggertrigger.attributes.description.inputType=The type of input the player needs to press. triggers.vitellary/triggertrigger.attributes.description.holdInput=Whether the trigger will be active for the entire time the input is held, or just for the frame it's pressed. triggers.vitellary/triggertrigger.attributes.description.onlyIfSafe=Whether the floor the player is standing on needs to be safe ground (aka. ground that a berry could be collected on). +triggers.vitellary/triggertrigger.attributes.description.resetAfterJump=If true, the trigger will only be activated for one frame when you jump, rather than waiting until you touch the floor to deactivate. # Edit Depth Trigger triggers.vitellary/editdepthtrigger.attributes.description.depth=New depth to set the entity to. Lower / negative values will make the entities render above others. diff --git a/Loenn/triggers/trigger_trigger.lua b/Loenn/triggers/trigger_trigger.lua index 2bebfa7..6b5442b 100644 --- a/Loenn/triggers/trigger_trigger.lua +++ b/Loenn/triggers/trigger_trigger.lua @@ -94,7 +94,9 @@ function triggerTrigger.ignoredFields(entity) "excludeTalkers", "onlyIfSafe", "playerState", - "includeCoyote" + "includeCoyote", + "includeWallJump", + "resetAfterJump", } local function doNotIgnore(value) @@ -145,6 +147,9 @@ function triggerTrigger.ignoredFields(entity) elseif atype == "OnGrounded" then doNotIgnore("onlyIfSafe") doNotIgnore("includeCoyote") + elseif atype == "Jumping" then + doNotIgnore("includeWallJump") + doNotIgnore("resetAfterJump") elseif atype == "OnPlayerState" then doNotIgnore("playerState") end @@ -190,6 +195,8 @@ for _, mode in pairs(activationTypes) do onlyIfSafe = false, playerState = 0, includeCoyote = false, + includeWallJump = true, + resetAfterJump = false, } } table.insert(triggerTrigger.placements, placement)