Skip to content

Commit b02e260

Browse files
authored
Fixes SuperTux#3079 Buttjump bonusblock runs script twice & unports trampoline (SuperTux#3227)
* Fixes SuperTux#3079 Buttjump bonusblock runs script twice & unports trampoline When someone buttjumps onto a bonus_block it calls the try_drop function in which some objects on that function would call try_open, another function on which it would run a script, then come back to try_drop and run the script again since the condition to run the script didn't include countdown, the bool that checks if try_open is called, so I just added it to the condition. Then for the trampoline error the add function had the position that the trampoline is created and an enum (1 or 0, or respectivelly true or false) which was incorrect and creating the wrong trampoline, so I just changed from true, which created a stationary trampoline, to a false, a portable one. Closes SuperTux#3079 * Fixes SuperTux#3079 Buttjump bonusblock runs script twice & unports trampoline When someone buttjumps onto a bonus_block it calls the try_drop function in which some objects on that function would call try_open, another function on which it would run a script, then come back to try_drop and run the script again since the condition to run the script didn't include countdown, the bool that checks if try_open is called, so I just added it to the condition. Then for the trampoline error the add function had the position that the trampoline is created and an enum (1 or 0, or respectivelly true or false) which was incorrect and creating the wrong trampoline, so I just changed from true, which created a stationary trampoline, to Trampoline::PORTABLE, a portable one.
1 parent 7f24554 commit b02e260

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/object/bonus_block.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ BonusBlock::try_drop(Player *player)
616616
}
617617
case Content::PORTABLE_TRAMPOLINE:
618618
{
619-
Sector::get().add<Trampoline>(get_pos() + Vector(0, 32), true);
619+
Sector::get().add<Trampoline>(get_pos() + Vector(0, 32), Trampoline::PORTABLE);
620620
countdown = true;
621621
break;
622622
}
@@ -638,7 +638,7 @@ BonusBlock::try_drop(Player *player)
638638
if (play_upgrade_sound)
639639
SoundManager::current()->play("sounds/upgrade.wav", get_pos(), UPGRADE_SOUND_GAIN);
640640

641-
if (!m_script.empty()) { // Scripts always run if defined.
641+
if (!m_script.empty() && countdown) { // Scripts always run if defined.
642642
Sector::get().run_script(m_script, "powerup-script");
643643
}
644644

0 commit comments

Comments
 (0)