[Mod] Sprint [sprint]

User avatar
texmex
Member
 
Posts: 1686
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: [Mod] Sprint [sprint]

by texmex » Thu Jun 08, 2017 13:30

I'm gonna try animated particles…
Image
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw
 

User avatar
LMD
Member
 
Posts: 798
Joined: Sat Apr 08, 2017 08:16
Location: Germany
GitHub: appgurueu
In-game: LMD + PRO_LMD + Limo

Re: [Mod] Sprint [sprint]

by LMD » Thu Jun 07, 2018 17:15

Very basic requirement. However, not compatible with other speed potions etc, insert this code to change :
Code: Select all
local function setSprinting(playerName, sprinting) --Sets the state of a player (0=stopped/moving, 1=sprinting)
   local player = minetest.get_player_by_name(playerName)
   if players[playerName] then
      local physics=player:get_physics_override()
      local was_sprinting=players[playerName]["sprinting"]
      players[playerName]["sprinting"] = sprinting
      if sprinting == true then
         if not was_sprinting then
             player:set_physics_override({speed=physics["speed"]*SPRINT_SPEED,jump=physics["jump"]*SPRINT_JUMP})
         end
      elseif sprinting == false then
         if was_sprinting then
            player:set_physics_override({speed=physics.speed/SPRINT_SPEED,jump=physics.jump/SPRINT_JUMP})
         end
      end
      return true
   end
   return false
end

Replace the original sprint function. Note : This interprets sprint as AMPLIFICATION, not as ADDITION! Thats a huge difference.
 

hexYeah
New member
 
Posts: 8
Joined: Wed Dec 12, 2018 02:09
In-game: hexYeah
 

User avatar
LMD
Member
 
Posts: 798
Joined: Sat Apr 08, 2017 08:16
Location: Germany
GitHub: appgurueu
In-game: LMD + PRO_LMD + Limo
 

Previous

Return to Mod Releases



Who is online

Users browsing this forum: No registered users and 11 guests