player_monoids/test.lua

31 lines
826 B
Lua
Raw Normal View History

2016-06-13 07:15:13 +02:00
local speed = player_monoids.speed
minetest.register_privilege("monoid_master", {
description = "Allows testing of player monoids.",
give_to_singleplayer = false,
give_to_admin = true,
2016-06-13 07:15:13 +02:00
})
local function test(player)
local ch_id = speed:add_change(player, 10)
local p_name = player:get_player_name()
minetest.chat_send_player(p_name, "Your speed is: " .. speed:value(player))
2017-03-14 02:52:06 +01:00
2016-06-13 07:15:13 +02:00
minetest.after(3, function()
2022-03-06 06:16:01 +01:00
local player = minetest.get_player_by_name(p_name)
if not player then return end
2016-06-13 07:15:13 +02:00
speed:del_change(player, ch_id)
minetest.chat_send_player(p_name, "Your speed is: " .. speed:value(player))
end)
end
minetest.register_chatcommand("test_monoids", {
description = "Runs a test on monoids",
privs = { monoid_master = true },
func = function(p_name)
test(minetest.get_player_by_name(p_name))
end,
})