Skip to content

Commit

Permalink
fix teleport trigger + spider orb interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
nytelytee committed Nov 27, 2024
1 parent 73d705e commit 0eae6b4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v1.4.1
- fix teleport trigger + spider orb interaction
- credit: hiimjustin000 for identifying the cause

# v1.4.0
- update to 2.2074
- fix teleportation
Expand Down
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"geode": "4.0.1",
"gd": {"android": "2.2074", "win": "2.2074"},
"version": "v1.4.0",
"version": "v1.4.1",
"id": "nytelyte.wave_trail_drag_fix",
"name": "Wave Trail Drag Fix",
"developer": "NyteLyte",
Expand Down
8 changes: 5 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,11 @@ class $modify(PlayLayer) {
class $modify(GJBaseGameLayer) {
void teleportPlayer(TeleportPortalObject *portal, PlayerObject *player) {
GJBaseGameLayer::teleportPlayer(portal, player);
// no idea why player can be null, but it happened in one level and thus caused a crash
// it was a platformer level, if anyone has an explanation, let me know
if (LevelEditorLayer::get() || !player || !player->m_isDart) return;
// teleport trigger passes the player as null, the original function falls back to player 1
// this does mean that the teleport trigger does not let you teleport player 2. lol.
// thank you hiimjustin000 for identifying the case where player can be null
if (!player) player = m_player1;
if (LevelEditorLayer::get() || !player->m_isDart) return;
static_cast<WTDFPlayerObject *>(player)->m_fields->previousPos = player->getRealPosition();
static_cast<WTDFPlayerObject *>(player)->m_fields->justTeleported = true;
}
Expand Down

0 comments on commit 0eae6b4

Please sign in to comment.