mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-06-28 06:11:47 +02:00
add new mod player_physics and update sprint and 3d_armor to use player_physics
This commit is contained in:
@ -244,7 +244,8 @@ armor.set_player_armor = function(self, player)
|
||||
armor_groups.radiation = 100 - armor_radiation
|
||||
end
|
||||
player:set_armor_groups(armor_groups)
|
||||
player:set_physics_override(physics_o)
|
||||
--player:set_physics_override(physics_o)
|
||||
player_physics.set_stats(player, "3d_armor", {speed=physics_o.speed-1, jump=physics_o.jump-1, gravity=physics_o.gravity-1})
|
||||
self.textures[name].armor = armor_texture
|
||||
self.textures[name].preview = preview
|
||||
self.def[name].state = state
|
||||
|
@ -1,4 +1,5 @@
|
||||
default
|
||||
player_physics
|
||||
inventory_plus?
|
||||
unified_inventory?
|
||||
fire?
|
||||
|
@ -1 +1,2 @@
|
||||
hudbars?
|
||||
player_physics
|
||||
|
@ -182,35 +182,12 @@ end)
|
||||
|
||||
function setSprinting(playerName, sprinting) --Sets the state of a player (0=stopped/moving, 1=sprinting)
|
||||
local player = minetest.get_player_by_name(playerName)
|
||||
local bonus_speed = 0
|
||||
local bonus_jump = 0
|
||||
if minetest.get_modpath("3d_armor") then
|
||||
local player_inv = player:get_inventory()
|
||||
if player_inv then
|
||||
for i=1, player_inv:get_size("armor") do
|
||||
local stack = player_inv:get_stack("armor", i)
|
||||
if stack:get_count() > 0 then
|
||||
local def = stack:get_definition()
|
||||
if def and def.groups then
|
||||
if def.groups["physics_speed"] then
|
||||
bonus_speed = bonus_speed + def.groups["physics_speed"]
|
||||
end
|
||||
|
||||
if def.groups["physics_jump"] then
|
||||
bonus_jump = bonus_jump + def.groups["physics_jump"]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if sprint.players[playerName] then
|
||||
sprint.players[playerName]["sprinting"] = sprinting
|
||||
if sprinting == true then
|
||||
player:set_physics_override({speed=SPRINT_SPEED + bonus_speed,jump=SPRINT_JUMP + bonus_jump})
|
||||
player_physics.set_stats(player, "sprint", {speed=SPRINT_SPEED, jump=SPRINT_JUMP})
|
||||
elseif sprinting == false then
|
||||
player:set_physics_override({speed=1.0 + bonus_speed,jump=1.0 + bonus_jump})
|
||||
player_physics.set_stats(player, "sprint", {speed=0, jump=0})
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
@ -9,8 +9,8 @@ distributed without any warranty.
|
||||
|
||||
--Configuration variables, these are all explained in README.md
|
||||
SPRINT_METHOD = 1
|
||||
SPRINT_SPEED = 1.35
|
||||
SPRINT_JUMP = 1.1
|
||||
SPRINT_SPEED = 0.35
|
||||
SPRINT_JUMP = 0.1
|
||||
SPRINT_STAMINA = 10
|
||||
SPRINT_TIMEOUT = 0.5 --Only used if SPRINT_METHOD = 0
|
||||
|
||||
|
@ -140,11 +140,11 @@ function setState(playerName, state) --Sets the state of a player (0=stopped, 1=
|
||||
if players[playerName] then
|
||||
players[playerName]["state"] = state
|
||||
if state == 0 then--Stopped
|
||||
player:set_physics_override({speed=1.0,jump=1.0})
|
||||
player_physics.set_stats(player, "sprint", {speed=0, jump=0})
|
||||
elseif state == 2 then --Primed
|
||||
players[playerName]["timeOut"] = gameTime
|
||||
elseif state == 3 then --Sprinting
|
||||
player:set_physics_override({speed=SPRINT_SPEED,jump=SPRINT_JUMP})
|
||||
player_physics.set_stats(player, "sprint", {speed=SPRINT_SPEED, jump=SPRINT_JUMP})
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
Reference in New Issue
Block a user