Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- addHook("ThinkFrame", do
- for player in players.iterate
- if player.mo
- and not (player.nocharge)
- and not (player.mo.skin == "thonic")//no improvements
- and not (player.mo.skin == "samus")
- //setting up the variable to check for how many charges a spindash has
- if player.spincharges == nil
- player.spincharges = 0
- end
- //These checks do two things: 1. Enable momentum when spinning in the air,
- //& 2. Keep the player from skimming on water when rolling.
- if player.pflags & PF_SPINNING
- and not P_IsObjectOnGround(player.mo)
- if player.pflags & PF_JUMPED
- player.pflags = $1 & ~PF_SPINNING
- else
- player.pflags = $1 & ~PF_SPINNING
- player.pflags = $1 | PF_JUMPED
- player.pflags = $1 | PF_THOKKED
- end
- end
- if not (player.mo.skin == "tsonic") //Toei breaks counter: 5
- //To make this a little easier on ourselves
- if player.spincharges > 0
- player.mindash = player.maxdash
- end
- //Prevents the default spindash sound after the first chage
- if player.spincharges > 0
- player.dashtime = 1
- end
- if player.jumpwasdown == nil
- player.jumpwasdown = 0
- end
- //print(player.maxdash/FRACUNIT,"","","")
- if not (player.mo.skin == "silver")
- and not (player.mo.skin == "metal_sonic")
- and not (player.mo.skin == "samus")
- and not (player.mo.skin == "thonic")//just sonic
- and (player.isclassic)
- and not (player.mo.state == S_PLAY_DEAD)
- //These characters have special spindash functions and should not be charging
- and player.charability2 == CA2_SPINDASH
- and not ((leveltime < 4*TICRATE) and (gametype == GT_RACE or gametype == GT_COMPETITION)) //because someone had the bright idea to make it so none of the buttons register durring the race countdown
- player.mindash = player.maxdash
- //You gotta be spindashing, man!
- if (player.pflags & PF_STARTDASH)
- //This ensures that the player can't jump while spindashing
- player.jumpfactor = 0
- //Main loop
- //This is only for the first one, it ensures that the spincharge
- //sound plays once
- if player.spincharges == 0
- player.mindash = 23*FRACUNIT
- player.maxdash = 25*FRACUNIT
- end
- //Second charge, continues on from the first
- if player.spincharges == 0
- and player.cmd.buttons & BT_JUMP
- and player.jumpwasdown == 0
- S_StartSound(player.mo, sfx_rev1)
- player.maxdash = 30*FRACUNIT
- player.spincharges = 1
- //From here, the process automates
- elseif player.spincharges <= 7
- and player.cmd.buttons & BT_JUMP
- and player.jumpwasdown == 0
- if player.maxdash < 60*FRACUNIT
- player.maxdash = $1 + 5*FRACUNIT
- else
- player.maxdash = 60*FRACUNIT
- end
- player.spincharges = $1 + 1
- //Sound logic
- if player.spincharges == 2
- S_StartSound(player.mo, sfx_rev2)
- elseif player.spincharges == 3
- S_StartSound(player.mo, sfx_rev3)
- elseif player.spincharges == 4
- S_StartSound(player.mo, sfx_rev4)
- elseif player.spincharges == 5
- S_StartSound(player.mo, sfx_rev5)
- elseif player.spincharges == 6
- S_StartSound(player.mo, sfx_rev6)
- elseif player.spincharges == 7
- S_StartSound(player.mo, sfx_rev7)
- player.spincharges = 6
- end
- end
- else
- //This resets our spincharges
- player.jumpfactor = skins[player.mo.skin].jumpfactor
- player.spincharges = 0
- end
- end
- //Our "was jump pressed last frame?" check ends here
- player.jumpwasdown = (player.cmd.buttons & BT_JUMP)
- end
- if ((leveltime < 4*TICRATE) and (gametype == GT_RACE or gametype == GT_COMPETITION) and P_IsObjectOnGround(player.mo)) //also because someone had the bright idea to make it so none of the buttons register durring the race countdown
- player.charability2 = CA2_NONE
- if player.weapondelay ~= nil
- player.weapondelay = 1
- end
- elseif (leveltime == (4*TICRATE)+1)
- player.charability2 = skins[player.mo.skin].ability2
- if player.weapondelay ~= nil
- player.weapondelay = 0
- end
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement