sneakjump 100

Post Reply
User avatar
jas
Member
Posts: 550
Joined: Mon Jul 24, 2017 18:15
Location: Within

sneakjump 100

by jas » Post

This is the server-side portion of this mod:

http://github.com/jastevenson303/sjssm

Requires CSM part: viewtopic.php?f=53&t=22683

Code: Select all

-- sneakjump server-side mod
-- copyright 2019 james stevenson
-- gnu lgpl 2.1+

local settings = minetest.settings

local function player_physics(player, speed, jump, gravity,
			sneak, sneak_glitch, new_move)
	player:set_physics_override({
		speed = speed or 1,
		jump = jump or 1,
		gravity = gravity or 1,
		sneak = sneak or true,
		sneak_glitch = sneak_glitch or true,
		new_move = new_move or false,
	})
end

local function sprint(name, enabled)
	local player = minetest.get_player_by_name(name)
	if enabled then
		player:set_physics_override({
			speed = 1.8,
			jump = 1.25,
			gravity = 0.85,
		})
	else
		player:set_physics_override({
			speed = 1,
			jump = 1,
			gravity = 1,
		})
	end
end

minetest.register_on_joinplayer(function(player)
	player_physics(player)
end)

minetest.register_on_modchannel_message(function(channel_name,
		sender, message)
	if message == "t" then
		sprint(sender, true)
	else
		sprint(sender, false)
	end
end)
It's just a sprint mod, in two parts - server-side and client-side - sneak jumping is always on anyways. There's no stamina or anything, just hold aux1 to go faster, jump higher, and use less gravity.

Here's a video.
2012-06-18 14:44:50: INFO[Server]: deactivateFarObjects: Static data changed considerably 1x 2

Post Reply

Who is online

Users browsing this forum: Andrey01 and 2 guests