[Mod] Sprint [sprint]

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

Re: [Mod] Sprint [sprint]

by texmex » Post

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

User avatar
LMD
Member
Posts: 931
Joined: Sat Apr 08, 2017 08:16
GitHub: appgurueu
IRC: appguru[eu]
In-game: LMD
Location: Germany
Contact:

Re: [Mod] Sprint [sprint]

by LMD » Post

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.
My stuff: Projects - Mods - Website

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

Re: [Mod] Sprint [sprint]

by hexYeah » Post

awesome thank you !

User avatar
LMD
Member
Posts: 931
Joined: Sat Apr 08, 2017 08:16
GitHub: appgurueu
IRC: appguru[eu]
In-game: LMD
Location: Germany
Contact:

Re: [Mod] Sprint [sprint]

by LMD » Post

You're welcome !
My stuff: Projects - Mods - Website

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests