Make default sneak mode settable
This commit is contained in:
parent
4afd183f47
commit
e287b9e245
20
init.lua
20
init.lua
@ -1,6 +1,7 @@
|
|||||||
minetest.register_privilege("secret", "Wouldn't you like to know?")
|
minetest.register_privilege("secret", "Wouldn't you like to know?")
|
||||||
minetest.register_privilege("hidden_one", {description = "Can hide from players.", give_to_singleplayer=false})
|
minetest.register_privilege("hidden_one", {description = "Can hide from players.", give_to_singleplayer=false})
|
||||||
|
|
||||||
|
local default_sneak_mode = "old" -- change this to "new" if you want new movement.
|
||||||
|
|
||||||
-- Admin Curses
|
-- Admin Curses
|
||||||
|
|
||||||
@ -102,20 +103,24 @@ minetest.register_on_joinplayer(function(player)
|
|||||||
if player:get_attribute("slowed") == "true" then
|
if player:get_attribute("slowed") == "true" then
|
||||||
slowmo(name,name)
|
slowmo(name,name)
|
||||||
end
|
end
|
||||||
if player:get_attribute("unglitched") == "true" then
|
|
||||||
noglitch(name,name)
|
|
||||||
end
|
|
||||||
if player:get_attribute("frozen") == "true" then
|
if player:get_attribute("frozen") == "true" then
|
||||||
freeze(name,name)
|
freeze(name,name)
|
||||||
end
|
end
|
||||||
if player:get_attribute("lost") == "true" then
|
if player:get_attribute("lost") == "true" then
|
||||||
getlost(name,name)
|
getlost(name,name)
|
||||||
end
|
end
|
||||||
|
-- set sneak mode if unassigned
|
||||||
|
if player:get_attribute("sneak_mode") == nil then
|
||||||
|
player:set_attribute("sneak_mode", default_sneak_mode)
|
||||||
|
end
|
||||||
|
-- set movement physics based on sneak_mode
|
||||||
if player:get_attribute("sneak_mode") == "old" then
|
if player:get_attribute("sneak_mode") == "old" then
|
||||||
player:set_physics_override({new_move = false, sneak_glitch = true})
|
player:set_physics_override({new_move = false, sneak_glitch = true, sneak = true})
|
||||||
elseif player:get_attribute("sneak_mode") == "new" then
|
elseif player:get_attribute("sneak_mode") == "new" then
|
||||||
player:set_physics_override({new_move = true, sneak_glitch = false})
|
player:set_physics_override({new_move = true, sneak_glitch = false, sneak = true})
|
||||||
end
|
elseif player:get_attribute("sneak_mode") == "none" then
|
||||||
|
player:set_physics_override({sneak = false})
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- reset player physics
|
-- reset player physics
|
||||||
@ -274,8 +279,7 @@ minetest.register_chatcommand("uncage", {
|
|||||||
priv_table[target_name] = nil
|
priv_table[target_name] = nil
|
||||||
table_save()
|
table_save()
|
||||||
-- restore sneak and move target to release point
|
-- restore sneak and move target to release point
|
||||||
local mode = "old" -- TODO: need to check conf here
|
sneak_mode(target, default_sneak_mode)
|
||||||
sneak_mode(target, mode)
|
|
||||||
target:set_attribute("caged", "")
|
target:set_attribute("caged", "")
|
||||||
target:setpos(releasepos)
|
target:setpos(releasepos)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user