mirror of
https://github.com/minetest-mods/teleport-request.git
synced 2025-01-06 13:07:33 +01:00
Add /tpe
hehe
This commit is contained in:
parent
e2483592e5
commit
2f82b11d9c
19
init.lua
19
init.lua
@ -253,6 +253,19 @@ local function tpj(name,param)
|
||||
end
|
||||
end
|
||||
|
||||
-- Evade
|
||||
local function tpe(name)
|
||||
local negatives = { '-','' } -- either it's this way or that way
|
||||
local isnegative = negatives[math.random(2)]
|
||||
local distance = negatives .. math.random(4,15) -- the distance to jump
|
||||
local times = math.random(3,6) -- how many times to jump - minimum,maximum
|
||||
local options = { 'x', 'y', 'z' }
|
||||
local axis = options[math.random(3)]
|
||||
for i = 1,times do
|
||||
minetest.after(1, tpj(axis,distance)) -- do this every 1 second
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("tpr", {
|
||||
description = "Request teleport to another player",
|
||||
params = "<playername> | leave playername empty to see help message",
|
||||
@ -281,6 +294,12 @@ minetest.register_chatcommand("tpj", {
|
||||
func = tpj
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("tpe", {
|
||||
description = "Evade Enemy",
|
||||
privs = {interact=true},
|
||||
func = tpe
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("tpy", {
|
||||
description = "Accept teleport requests from another player",
|
||||
func = tpr_accept
|
||||
|
Loading…
Reference in New Issue
Block a user