Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local bufferJump = {}
- --v1.3
- function bufferJump.onInitAPI()
- registerEvent(bufferJump, "onTick")
- end
- bufferJump.always = false
- bufferJump.disableTanooki = true
- local alreadyJumped = {false,false}
- -- ^^ ^^ < In order to make this work for two players independently I do this.
- -- I don't know if there's a better way of doing this but hey, it works, I'm proud, and I'm happy! ⌐■_■
- local disableCharacters = {
- 3, --PEACH
- 5, --LINK
- 6, --MEGAMAN
- 9, --KLONOA
- 10, --NINJABOMBERMAN
- 11, --ROSALINA
- 16 --SAMUS
- }
- function bufferJump.onTick()
- for k, p in ipairs(Player.get()) do
- local function isUnderwater()
- return(
- p:mem(0x36,FIELD_BOOL) -- In a liquid
- and p:mem(0x06,FIELD_WORD) == 0 -- In quicksand
- )
- end
- if not isUnderwater() and
- p.forcedState == 0 and
- p.deathTimer == 0 and
- Level.winState() == 0 and
- not p:mem(0x50,FIELD_BOOL) and
- not p:mem(0x44, FIELD_BOOL) and -- Riding a rainbow shell
- not p:mem(0x13C, FIELD_BOOL) and
- p.mount ~= MOUNT_CLOWNCAR then
- for _,name in ipairs(disableCharacters) do
- if p.character == name then return end
- if bufferJump.disableTanooki then
- if p.powerup == 4 or p.powerup == 5 then return end
- end
- end
- local function canDo()
- return (
- p:isOnGround()
- or (p.mount == MOUNT_BOOT and p:mem(0x10C,FIELD_BOOL)) -- Hopping in boot
- or p:mem(0x40,FIELD_WORD) > 0 -- Climbing
- )
- end
- p:mem(0x11E, FIELD_BOOL, false) -- Override Jumping
- if bufferJump.always then
- alreadyJumped[k] = false
- else
- if not p.keys.jump then
- alreadyJumped[k] = false
- end
- end
- if canDo() and p.keys.jump and alreadyJumped[k] == false then
- Audio.playSFX(1)
- p:mem(0x11C, FIELD_WORD, 20)
- alreadyJumped[k] = true
- end
- end
- end
- end
- return bufferJump
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement