2020-10-12 03:41:46 +02:00
|
|
|
--
|
|
|
|
-- cora's defensive combat hax
|
|
|
|
|
|
|
|
local tprange=50
|
|
|
|
|
|
|
|
|
|
|
|
local function sleep(n) -- seconds
|
|
|
|
local t0 = os.clock()
|
|
|
|
while os.clock() - t0 <= n do end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local function mwarp(pos)
|
|
|
|
minetest.localplayer:set_pos(pos)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local tprangeh=20
|
|
|
|
local tprangepy=50
|
|
|
|
local tprangeny=60
|
2020-10-12 04:20:07 +02:00
|
|
|
local karange=10
|
2020-10-12 03:41:46 +02:00
|
|
|
|
|
|
|
local function gettarget(epos)
|
|
|
|
--local mpos=minetest.localplayer:get_pos()
|
|
|
|
math.randomseed(os.time())
|
2020-10-12 04:20:07 +02:00
|
|
|
local angle=math.random(90,270)
|
2020-10-12 03:41:46 +02:00
|
|
|
local tg={x=0,y=0,z=0}
|
2020-10-12 04:20:07 +02:00
|
|
|
tg.x=( karange + 2 ) * math.sin(angle)
|
|
|
|
tg.z=( karange + 2 ) * math.cos(angle)
|
2020-10-12 03:41:46 +02:00
|
|
|
return vector.add(epos,tg)
|
|
|
|
end
|
|
|
|
|
|
|
|
local function rro() -- reverse restraining order
|
2020-10-12 04:20:07 +02:00
|
|
|
for k, v in ipairs(minetest.localplayer.get_nearby_objects(karange+5)) do
|
2020-10-12 03:41:46 +02:00
|
|
|
if (v:is_player() and v:get_name() ~= minetest.localplayer:get_name()) then
|
|
|
|
local pos = v:get_pos()
|
|
|
|
pos.y = pos.y - 1
|
|
|
|
local mpos=minetest.localplayer:get_pos()
|
|
|
|
local distance=vector.distance(mpos,pos)
|
2020-10-12 04:20:07 +02:00
|
|
|
if distance < karange then mwarp(gettarget(pos)) minetest.after(0.2,function() autofly.aim(pos) end) end
|
2020-10-12 03:41:46 +02:00
|
|
|
return
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
minetest.register_globalstep(function()
|
|
|
|
if minetest.settings:get_bool("goddess") then
|
|
|
|
rro()
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- REG cheats on DF
|
|
|
|
if (_G["minetest"]["register_cheat"] ~= nil) then
|
|
|
|
minetest.register_cheat("Goddess Mode", "Combat", "goddess")
|
|
|
|
else
|
|
|
|
minetest.settings:set_bool('goddess',true)
|
|
|
|
end
|