Fix: Code beautification.
parent
231c0c2c77
commit
40a487cc10
|
@ -1,8 +1,11 @@
|
||||||
if minetest_wadsprint.HIDE_HUD_BARS == true then
|
if minetest_wadsprint.HIDE_HUD_BARS == true then
|
||||||
|
|
||||||
function minetest_wadsprint.initialize_hudbar(player) end
|
function minetest_wadsprint.initialize_hudbar(player) end
|
||||||
function minetest_wadsprint.hudbar_update_stamina(player) end
|
function minetest_wadsprint.hudbar_update_stamina(player) end
|
||||||
function minetest_wadsprint.hudbar_update_ready_to_sprint(player) end
|
function minetest_wadsprint.hudbar_update_ready_to_sprint(player) end
|
||||||
|
|
||||||
elseif minetest.get_modpath("hudbars") ~= nil then
|
elseif minetest.get_modpath("hudbars") ~= nil then
|
||||||
|
|
||||||
-- @see http://repo.or.cz/minetest_hudbars.git/blob_plain/HEAD:/API.md
|
-- @see http://repo.or.cz/minetest_hudbars.git/blob_plain/HEAD:/API.md
|
||||||
function minetest_wadsprint.register_hudbar()
|
function minetest_wadsprint.register_hudbar()
|
||||||
-- This function registers a new custom HUD bar definition to the HUD bars mod, so it can be later used to be displayed, changed, hidden and unhidden on a per-player basis. Note this does not yet display the HUD bar.
|
-- This function registers a new custom HUD bar definition to the HUD bars mod, so it can be later used to be displayed, changed, hidden and unhidden on a per-player basis. Note this does not yet display the HUD bar.
|
||||||
|
@ -81,7 +84,9 @@ elseif minetest.get_modpath("hudbars") ~= nil then
|
||||||
minetest_wadsprint.STAMINA_MAX_VALUE -- `new_max_value`: The new maximum value of the HUD bar
|
minetest_wadsprint.STAMINA_MAX_VALUE -- `new_max_value`: The new maximum value of the HUD bar
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif minetest.get_modpath("hud") ~= nil then
|
elseif minetest.get_modpath("hud") ~= nil then
|
||||||
|
|
||||||
-- @see https://github.com/BlockMen/hud_hunger/blob/master/API.txt
|
-- @see https://github.com/BlockMen/hud_hunger/blob/master/API.txt
|
||||||
function minetest_wadsprint.register_hudbar()
|
function minetest_wadsprint.register_hudbar()
|
||||||
hud.register(
|
hud.register(
|
||||||
|
@ -139,7 +144,9 @@ elseif minetest.get_modpath("hud") ~= nil then
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
-- @see http://dev.minetest.net/HUD
|
-- @see http://dev.minetest.net/HUD
|
||||||
function minetest_wadsprint.initialize_hudbar(player)
|
function minetest_wadsprint.initialize_hudbar(player)
|
||||||
player.hud = player.obj:hud_add(
|
player.hud = player.obj:hud_add(
|
||||||
|
@ -163,4 +170,5 @@ else
|
||||||
player.obj:hud_change(player.hud, "text", minetest_wadsprint.MINETESTHUD_IS_NOT_SPRINTING_ICON)
|
player.obj:hud_change(player.hud, "text", minetest_wadsprint.MINETESTHUD_IS_NOT_SPRINTING_ICON)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -1,8 +1,9 @@
|
||||||
if minetest_wadsprint.BAD_PHYSICS_OVERRIDE_MODE == true then
|
if minetest_wadsprint.BAD_PHYSICS_OVERRIDE_MODE == true then
|
||||||
function minetest_wadsprint.set_sprinting_physics(player,is_on)
|
|
||||||
if player.is_sprinting_physics_on ~= is_on then
|
function minetest_wadsprint.set_sprinting_physics(player,is_on_val)
|
||||||
|
if player.is_sprinting_physics_on ~= is_on_val then
|
||||||
local physics = player.obj:get_physics_override()
|
local physics = player.obj:get_physics_override()
|
||||||
if is_on == true then
|
if is_on_val == true then
|
||||||
player.obj:set_physics_override(
|
player.obj:set_physics_override(
|
||||||
{
|
{
|
||||||
jump = (round(physics.jump,0.01) - 1 + minetest_wadsprint.SPRINT_JUMP_HEIGHT_BOOST_COEFFICIENT),
|
jump = (round(physics.jump,0.01) - 1 + minetest_wadsprint.SPRINT_JUMP_HEIGHT_BOOST_COEFFICIENT),
|
||||||
|
@ -15,13 +16,15 @@ if minetest_wadsprint.BAD_PHYSICS_OVERRIDE_MODE == true then
|
||||||
speed = 1,
|
speed = 1,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
player.is_sprinting_physics_on = is_on
|
player.is_sprinting_physics_on = is_on_val
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif minetest.get_modpath("player_monoids") ~= nil then
|
elseif minetest.get_modpath("player_monoids") ~= nil then
|
||||||
function minetest_wadsprint.set_sprinting_physics(player,is_on)
|
|
||||||
if player.is_sprinting_physics_on ~= is_on then
|
function minetest_wadsprint.set_sprinting_physics(player,is_on_val)
|
||||||
if is_on == true then
|
if player.is_sprinting_physics_on ~= is_on_val then
|
||||||
|
if is_on_val == true then
|
||||||
player_monoids.jump:add_change(
|
player_monoids.jump:add_change(
|
||||||
player.obj,
|
player.obj,
|
||||||
minetest_wadsprint.SPRINT_JUMP_HEIGHT_BOOST_COEFFICIENT,
|
minetest_wadsprint.SPRINT_JUMP_HEIGHT_BOOST_COEFFICIENT,
|
||||||
|
@ -36,14 +39,16 @@ elseif minetest.get_modpath("player_monoids") ~= nil then
|
||||||
player_monoids.jump:del_change(player.obj, "minetest_wadsprint:jump")
|
player_monoids.jump:del_change(player.obj, "minetest_wadsprint:jump")
|
||||||
player_monoids.speed:del_change(player.obj, "minetest_wadsprint:speed")
|
player_monoids.speed:del_change(player.obj, "minetest_wadsprint:speed")
|
||||||
end
|
end
|
||||||
player.is_sprinting_physics_on = is_on
|
player.is_sprinting_physics_on = is_on_val
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
function minetest_wadsprint.set_sprinting_physics(player,is_on)
|
|
||||||
if player.is_sprinting_physics_on ~= is_on then
|
function minetest_wadsprint.set_sprinting_physics(player,is_on_val)
|
||||||
|
if player.is_sprinting_physics_on ~= is_on_val then
|
||||||
local physics = player.obj:get_physics_override()
|
local physics = player.obj:get_physics_override()
|
||||||
if is_on == true then
|
if is_on_val == true then
|
||||||
player.obj:set_physics_override(
|
player.obj:set_physics_override(
|
||||||
{
|
{
|
||||||
jump = (round(physics.jump,0.01) - 1 + minetest_wadsprint.SPRINT_JUMP_HEIGHT_BOOST_COEFFICIENT),
|
jump = (round(physics.jump,0.01) - 1 + minetest_wadsprint.SPRINT_JUMP_HEIGHT_BOOST_COEFFICIENT),
|
||||||
|
@ -56,7 +61,8 @@ else
|
||||||
speed = (round(physics.speed,0.01) + 1 - minetest_wadsprint.SPRINT_RUN_SPEED_BOOST_COEFFICIENT),
|
speed = (round(physics.speed,0.01) + 1 - minetest_wadsprint.SPRINT_RUN_SPEED_BOOST_COEFFICIENT),
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
player.is_sprinting_physics_on = is_on
|
player.is_sprinting_physics_on = is_on_val
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
BIN
util/version.png
BIN
util/version.png
Binary file not shown.
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.6 KiB |
Loading…
Reference in New Issue