Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.11 KB | None | 0 0
  1. addHook("ThinkFrame", do
  2.     for player in players.iterate
  3.         if player.mo
  4.         and not (player.nocharge)
  5.         and not (player.mo.skin == "thonic")//no improvements
  6.         and not (player.mo.skin == "samus")
  7.         //setting up the variable to check for how many charges a spindash has
  8.             if player.spincharges == nil
  9.                 player.spincharges = 0
  10.             end
  11.        
  12.         //These checks do two things: 1. Enable momentum when spinning in the air,
  13.         //& 2. Keep the player from skimming on water when rolling.    
  14.  
  15.             if player.pflags & PF_SPINNING
  16.             and not P_IsObjectOnGround(player.mo)
  17.                 if player.pflags & PF_JUMPED
  18.                     player.pflags = $1 & ~PF_SPINNING
  19.                 else
  20.                     player.pflags = $1 & ~PF_SPINNING
  21.                     player.pflags = $1 | PF_JUMPED
  22.                     player.pflags = $1 | PF_THOKKED
  23.                 end
  24.             end
  25.        
  26.             if not (player.mo.skin == "tsonic") //Toei breaks counter: 5
  27.         //To make this a little easier on ourselves
  28.                 if player.spincharges > 0
  29.                     player.mindash = player.maxdash
  30.                 end
  31.  
  32.             //Prevents the default spindash sound after the first chage
  33.                 if player.spincharges > 0
  34.                     player.dashtime = 1
  35.                 end
  36.                
  37.                 if player.jumpwasdown == nil
  38.                     player.jumpwasdown = 0
  39.                 end
  40.             //print(player.maxdash/FRACUNIT,"","","")
  41.        
  42.                 if not (player.mo.skin == "silver")
  43.                 and not (player.mo.skin == "metal_sonic")
  44.                 and not (player.mo.skin == "samus")
  45.                 and not (player.mo.skin == "thonic")//just sonic
  46.                 and (player.isclassic)
  47.                 and not (player.mo.state == S_PLAY_DEAD)
  48.             //These characters have special spindash functions and should not be charging
  49.                 and player.charability2 == CA2_SPINDASH
  50.                 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
  51.                     player.mindash = player.maxdash
  52.            
  53.                 //You gotta be spindashing, man!
  54.                     if (player.pflags & PF_STARTDASH)
  55.                 //This ensures that the player can't jump while spindashing
  56.                     player.jumpfactor = 0
  57.                
  58.             //Main loop
  59.                 //This is only for the first one, it ensures that the spincharge
  60.                 //sound plays once
  61.                     if player.spincharges == 0
  62.                         player.mindash = 23*FRACUNIT
  63.                         player.maxdash = 25*FRACUNIT
  64.                     end
  65.                
  66.                 //Second charge, continues on from the first
  67.                     if player.spincharges == 0
  68.                     and player.cmd.buttons & BT_JUMP
  69.                     and player.jumpwasdown == 0
  70.                         S_StartSound(player.mo, sfx_rev1)
  71.                         player.maxdash = 30*FRACUNIT
  72.                         player.spincharges = 1
  73.                 //From here, the process automates
  74.                     elseif player.spincharges <= 7
  75.                     and player.cmd.buttons & BT_JUMP
  76.                     and player.jumpwasdown == 0
  77.                         if player.maxdash < 60*FRACUNIT
  78.                             player.maxdash = $1 + 5*FRACUNIT
  79.                         else
  80.                             player.maxdash = 60*FRACUNIT
  81.                         end
  82.                         player.spincharges = $1 + 1
  83.                     //Sound logic
  84.                         if player.spincharges == 2
  85.                             S_StartSound(player.mo, sfx_rev2)
  86.                         elseif player.spincharges == 3
  87.                             S_StartSound(player.mo, sfx_rev3)
  88.                         elseif player.spincharges == 4
  89.                             S_StartSound(player.mo, sfx_rev4)
  90.                         elseif player.spincharges == 5
  91.                             S_StartSound(player.mo, sfx_rev5)
  92.                         elseif player.spincharges == 6
  93.                             S_StartSound(player.mo, sfx_rev6)
  94.                         elseif player.spincharges == 7
  95.                             S_StartSound(player.mo, sfx_rev7)
  96.                             player.spincharges = 6
  97.                         end
  98.                     end
  99.                 else
  100.                 //This resets our spincharges
  101.                     player.jumpfactor = skins[player.mo.skin].jumpfactor
  102.                     player.spincharges = 0
  103.                 end
  104.             end
  105.         //Our "was jump pressed last frame?" check ends here
  106.             player.jumpwasdown = (player.cmd.buttons & BT_JUMP)
  107.         end
  108.         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
  109.             player.charability2 = CA2_NONE
  110.             if player.weapondelay ~= nil
  111.                 player.weapondelay = 1
  112.             end
  113.         elseif (leveltime == (4*TICRATE)+1)
  114.             player.charability2 = skins[player.mo.skin].ability2
  115.                 if player.weapondelay ~= nil
  116.                     player.weapondelay = 0
  117.                 end
  118.             end
  119.         end
  120.     end
  121. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement