Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --player : CPlayerPuppetEntity
- local worldInfo = worldGlobals.worldInfo
- local NotVersus = {
- ["SinglePlayer"] = true,
- ["Cooperative"] = true,
- ["Survival"] = true,
- ["TeamSurvival"] = true,
- ["BeastHunt"] = true,
- ["BeastSurvival"] = true,
- ["CooperativeStandard"] = true,
- ["CooperativeCoinOp"] = true,
- ["TeamBeastHunt"] = true,
- ["OneShotSurvival"] = true,
- }
- local DJEnabled = false
- if NotVersus[worldInfo:GetGameMode()] or worldInfo:IsSinglePlayer() then DJEnabled = true end
- Wait(Times(2,CustomEvent("OnStep")))
- if not (worldGlobals.DoubleJumpEnabled == nil) then
- DJEnabled = worldGlobals.DoubleJumpEnabled
- end
- if not DJEnabled then return end
- local player
- local Pi = 3.14159265359
- local dashDelay = 5
- local findPlayer = function()
- while (player == nil) do
- local Players = worldInfo:GetAllPlayersInRange(worldInfo,10000)
- for i=1,#Players,1 do
- if Players[i]:IsLocalOperator() then
- player = Players[i]
- break
- end
- end
- end
- end
- findPlayer()
- local prevVel = player:GetLinearVelocity()
- local searching = false
- local k = 0
- local deltaDash = dashDelay
- RunHandled(WaitForever,
- OnEvery(CustomEvent("OnStep")),
- function(step)
- if not IsDeleted(player) then
- local tempo = player:GetDesiredTempoAbs()
- local vel = player:GetLinearVelocity()
- local speed = player:GetSpeedMultiplier()
- if player:IsCommandPressed("plcmdShield") and deltaDash >= dashDelay then
- print("cur=" + deltaDash)
- deltaDash = 0
- if (tempo.y <= 0) then
- if ((vel.y - prevVel.y) < 0) then
- tempo.x = tempo.x * 40 * speed.x
- tempo.y = tempo.y * 1 * speed.y
- tempo.z = tempo.z * 40 * speed.z
- player:SetLinearVelocity(tempo)
- player:PlaySchemeSound("Dash")
- end
- end
- else
- deltaDash = deltaDash + worldInfo:SimGetStep()
- print("btw=" + deltaDash)
- end
- prevVel = vel
- elseif not searching then
- searching = true
- player = nil
- findPlayer()
- searching = false
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement