Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion Code/TriggerTrigger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ 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;
}

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;
}
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -501,7 +505,35 @@ private static void Player_Jump(On.Celeste.Player.orig_Jump orig, Player self, b
foreach (TriggerTrigger trigger in self.SceneAs<Level>().Tracker.GetEntities<TriggerTrigger>()) {
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<Level>().Tracker.GetEntities<TriggerTrigger>())
{
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));
}
}
}
}
Expand Down Expand Up @@ -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<Entity> entitiesInside;
Expand Down
1 change: 1 addition & 0 deletions Loenn/lang/en_gb.lang
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 8 additions & 1 deletion Loenn/triggers/trigger_trigger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ function triggerTrigger.ignoredFields(entity)
"excludeTalkers",
"onlyIfSafe",
"playerState",
"includeCoyote"
"includeCoyote",
"includeWallJump",
"resetAfterJump",
}

local function doNotIgnore(value)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Loading