--Xian --Kirb the Korb -- Spin Dash turning modification addHook("PlayerThink", function(player) --Apply only to players with the normal spindash if player.charability2 ~= CA2_SPINDASH then return end if (player.pflags & PF_SPINNING) -- Check to see if spinning and not (player.pflags & PF_STARTDASH) -- Revving the Spindash does not count and (P_IsObjectOnGround(player.mo)) -- Drifting only occures when on the ground and (player.cmd.forwardmove ~= 0) and (player.cmd.sidemove ~= 0) -- only turn when the player wants to and (player.speed > 1*FRACUNIT) then -- minimum speed requirment -- Current information about the player local mom = FixedHypot(player.mo.momx, player.mo.momy) -- Base Speed (No friction or drag) local motion = R_PointToAngle2(0, 0, player.mo.momx, player.mo.momy) -- base direction (No outside forces) -- Direction player is inputting local pangle = player.cmd.angleturn<<16 + R_PointToAngle2(0, 0, player.cmd.forwardmove*FRACUNIT, -player.cmd.sidemove*FRACUNIT) -- Calculate the new direction local turn = 0 local turning = FixedAngle(FixedMul(FixedDiv(AngleFixed(ANG2), 29*FRACUNIT/32), player.mo.friction)) -- scale by friction local dif = pangle - motion if dif > turning or dif < -turning then -- Presision handling if dif > 0 then -- Angle between 0 and 180 degrees (Left) turn = motion + turning -- Turn Left else turn = motion - turning -- Turn Right end else turn = pangle --Go straight end -- Apply new movement and replace old movement P_InstaThrust(player.mo, turn, mom) end end) -- Scale dust made by the spindash to match how charged it is local SpindustCheck = false addHook("SpinSpecial", function(player) if not (skins[player.mo.skin].flags & SF_NOSPINDASHDUST) -- Player's skin didn't already override the dust and (player.charability2 == CA2_SPINDASH) -- Player's skin uses the Spindash and (player.pflags & PF_STARTDASH) -- Player is charging the spindash and (P_IsObjectOnGround(player.mo)) then -- Player is on the ground player.charflags = $ | SF_NOSPINDASHDUST -- Disable original spindash dust -- Check if player is in a liquid so that the spindash makes bubbles instead of dust local particleType if (player.mo.eflags & (MFE_TOUCHWATER | MFE_UNDERWATER)) then particleType = MT_SMALLBUBBLE else particleType = MT_SPINDUST end local charge = FixedDiv(player.dashspeed, player.maxdash) -- Get a 0 - 1 percentage charge of the spindash if (P_RandomFixed() < charge + FU/2) then -- create dust particle and set its effects/scale/velocity based off of how charged the spindash is local dust = P_SpawnMobjFromMobj(player.realmo, P_RandomRange(-2, 2)*FU, P_RandomRange(-2, 2)*FU, 0, particleType) dust.momx = P_RandomRange(-2, 2) * charge dust.momy = P_RandomRange(-2, 2) * charge dust.momz = P_RandomRange( 0, 2) * charge P_Thrust(dust, player.mo.angle, -12 * charge) dust.destscale = 3 * charge / 2 end end -- Change nothing else return false end)