diff --git a/init.lua b/init.lua index 2490ac4..f091a83 100644 --- a/init.lua +++ b/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 = " | 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