Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
-- autofly by cora
|
|
|
|
-- gui shit shamelessly stolen from advmarkers
|
|
|
|
-- https://git.minetest.land/luk3yx/advmarkers-csm
|
|
|
|
--[[
|
|
|
|
PATCHING MINETEST: (for autoaim)
|
|
|
|
in l_localplayer.h add:
|
|
|
|
static int l_set_yaw(lua_State *L);
|
|
|
|
static int l_set_pitch(lua_State *L);
|
|
|
|
|
|
|
|
in l_localplayer.cpp add:
|
|
|
|
int LuaLocalPlayer::l_set_yaw(lua_State *L)
|
|
|
|
{
|
|
|
|
LocalPlayer *player = getobject(L, 1);
|
|
|
|
f32 p = (float) luaL_checkinteger(L, 2);
|
|
|
|
player->setYaw(p);
|
|
|
|
g_game->cam_view.camera_yaw = p;
|
|
|
|
g_game->cam_view_target.camera_yaw = p;
|
|
|
|
player->setYaw(p);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
int LuaLocalPlayer::l_set_pitch(lua_State *L)
|
|
|
|
{
|
|
|
|
LocalPlayer *player = getobject(L, 1);
|
|
|
|
f32 p = (float) luaL_checkinteger(L, 2);
|
|
|
|
player->setPitch(p);
|
|
|
|
g_game->cam_view.camera_pitch = p;
|
|
|
|
g_game->cam_view_target.camera_pitch = p;
|
|
|
|
player->setPitch(p);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
in src/client/game.h, below class Game { public: add:
|
|
|
|
CameraOrientation cam_view = {0};
|
|
|
|
CameraOrientation cam_view_target = { 0 };
|
|
|
|
|
|
|
|
from src/client/game.cpp remove
|
|
|
|
CameraOrientation cam_view = {0};
|
|
|
|
CameraOrientation cam_view_target = { 0 };
|
|
|
|
|
|
|
|
--]]
|
|
|
|
|
|
|
|
-- Chat commands:
|
|
|
|
-- .wa x,y,z name - add waypoint with coords and name
|
|
|
|
-- .wah - quickadd this location (name will be time and date)
|
|
|
|
-- .wp - open the selection menu
|
|
|
|
-- .cls - remove hud
|
|
|
|
|
|
|
|
autofly = {}
|
|
|
|
wps={}
|
2020-11-24 16:29:25 +01:00
|
|
|
|
|
|
|
|
2021-02-09 18:20:09 +01:00
|
|
|
local landing_distance=5
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
local speed=0;
|
|
|
|
local ltime=0
|
|
|
|
|
|
|
|
local storage = minetest.get_mod_storage()
|
2020-10-25 11:15:08 +01:00
|
|
|
local oldpm=false
|
2020-11-01 16:09:09 +01:00
|
|
|
local lpos={x=0,y=0,z=0}
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
local info=minetest.get_server_info()
|
|
|
|
local stprefix="autofly-".. info['address'] .. '-'
|
2021-02-11 03:58:26 +01:00
|
|
|
local hud_wps={}
|
2020-11-14 23:45:34 +01:00
|
|
|
autofly.flying=false
|
2020-11-24 16:29:25 +01:00
|
|
|
autofly.cruiseheight = 30
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
|
|
|
|
local modname = minetest.get_current_modname()
|
|
|
|
local modpath = minetest.get_modpath(modname)
|
|
|
|
dofile(modpath .. "/wpforms.lua")
|
2021-02-09 18:20:09 +01:00
|
|
|
dofile(modpath .. "/pathfly.lua")
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
|
|
|
|
local hud_wp
|
|
|
|
local hud_info
|
|
|
|
-- /COMMON
|
2021-02-11 04:17:51 +01:00
|
|
|
local pos_to_string = ws.pos_to_string
|
|
|
|
local string_to_pos = ws.string_to_pos
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
|
|
|
|
|
2020-11-15 23:16:56 +01:00
|
|
|
function autofly.get2ddst(pos1,pos2)
|
|
|
|
return vector.distance({x=pos1.x,y=0,z=pos1.z},{x=pos2.x,y=0,z=pos2.z})
|
|
|
|
end
|
|
|
|
|
2020-11-08 17:34:26 +00:00
|
|
|
local last_sprint = false
|
|
|
|
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
minetest.register_globalstep(function()
|
2021-02-11 03:58:26 +01:00
|
|
|
if not minetest.localplayer then return end
|
2020-11-14 14:05:13 +01:00
|
|
|
autofly.axissnap()
|
2020-11-01 16:28:27 +01:00
|
|
|
if minetest.settings:get_bool("autosprint") or (minetest.settings:get_bool("continuous_forward") and minetest.settings:get_bool("autofsprint")) then
|
2020-10-23 02:19:12 +02:00
|
|
|
core.set_keypress("special1", true)
|
2020-11-08 17:34:26 +00:00
|
|
|
last_sprint = true
|
|
|
|
elseif last_sprint then
|
2020-11-01 16:28:27 +01:00
|
|
|
core.set_keypress("special1", false)
|
2020-11-08 17:34:26 +00:00
|
|
|
last_sprint = false
|
2020-10-23 02:19:12 +02:00
|
|
|
end
|
2020-11-14 23:45:34 +01:00
|
|
|
if not autofly.flying then autofly.set_hud_info("")
|
|
|
|
else
|
2021-02-11 03:58:26 +01:00
|
|
|
autofly.set_hud_info("")
|
2020-11-14 23:45:34 +01:00
|
|
|
local pos = autofly.last_coords
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
if pos then
|
|
|
|
local dst = vector.distance(pos,minetest.localplayer:get_pos())
|
|
|
|
local etatime=-1
|
2021-02-11 06:12:43 +01:00
|
|
|
if not (speed == 0) then etatime = ws.round2(dst / speed / 60,2) end
|
2020-11-20 15:50:33 +01:00
|
|
|
autofly.etatime=etatime
|
2020-11-14 23:45:34 +01:00
|
|
|
autofly.set_hud_info(autofly.last_name .. "\n" .. pos_to_string(pos) .. "\n" .. "ETA" .. etatime .. " mins")
|
2021-02-09 18:20:09 +01:00
|
|
|
local hdst=autofly.get2ddst(pos,minetest.localplayer:get_pos())
|
|
|
|
if autofly.flying and hdst < landing_distance then
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
autofly.arrived()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2021-02-11 03:58:26 +01:00
|
|
|
|
2020-11-15 17:27:14 +00:00
|
|
|
if not minetest.settings:get_bool("freecam") and autofly.flying and (minetest.settings:get_bool('afly_autoaim')) then
|
2020-11-14 23:45:34 +01:00
|
|
|
autofly.aim(autofly.last_coords)
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
if ( os.time() < ltime + 1 ) then return end
|
|
|
|
ltime=os.time()
|
|
|
|
if lpos then
|
|
|
|
local dst=vector.distance(minetest.localplayer:get_pos(),lpos)
|
2021-02-11 06:12:43 +01:00
|
|
|
speed=ws.round2(dst,1)
|
2020-11-01 16:09:09 +01:00
|
|
|
autofly.speed=speed
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
end
|
|
|
|
lpos=minetest.localplayer:get_pos()
|
2020-11-15 23:16:56 +01:00
|
|
|
autofly.cruise()
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
end)
|
|
|
|
|
2020-11-15 23:16:56 +01:00
|
|
|
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
function autofly.set_hud_wp(pos, title)
|
|
|
|
if hud_wp then
|
|
|
|
minetest.localplayer:hud_remove(hud_wp)
|
|
|
|
end
|
|
|
|
pos = string_to_pos(pos)
|
|
|
|
hud_wp=nil
|
|
|
|
if not pos then return end
|
|
|
|
if not title then
|
|
|
|
title = pos.x .. ', ' .. pos.y .. ', ' .. pos.z
|
|
|
|
end
|
2020-11-14 23:45:34 +01:00
|
|
|
autofly.last_name=title
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
if hud_wp then
|
|
|
|
minetest.localplayer:hud_change(hud_wp, 'name', title)
|
|
|
|
minetest.localplayer:hud_change(hud_wp, 'world_pos', pos)
|
|
|
|
else
|
|
|
|
hud_wp = minetest.localplayer:hud_add({
|
|
|
|
hud_elem_type = 'waypoint',
|
|
|
|
name = title,
|
|
|
|
text = 'm',
|
|
|
|
number = 0x00ff00,
|
|
|
|
world_pos = pos
|
|
|
|
})
|
|
|
|
end
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
local hud_info
|
2021-02-11 03:58:26 +01:00
|
|
|
function autofly.get_quad()
|
2021-02-09 18:20:09 +01:00
|
|
|
local lp=minetest.localplayer:get_pos()
|
|
|
|
local quad=""
|
2021-02-11 03:58:26 +01:00
|
|
|
|
2021-02-09 18:20:09 +01:00
|
|
|
if lp.z < 0 then quad="Q: South"
|
|
|
|
else quad="Q: North" end
|
2021-02-11 03:58:26 +01:00
|
|
|
|
2021-02-09 18:20:09 +01:00
|
|
|
if lp.x < 0 then quad=quad.."-west"
|
|
|
|
else quad=quad.."-east" end
|
2021-02-11 03:58:26 +01:00
|
|
|
|
2021-02-09 18:20:09 +01:00
|
|
|
return quad
|
|
|
|
end
|
2021-02-11 03:58:26 +01:00
|
|
|
|
|
|
|
function autofly.get_local_name()
|
|
|
|
local ww=autofly.getwps()
|
|
|
|
local lp=minetest.localplayer:get_pos()
|
|
|
|
local odst=500;
|
|
|
|
local rt=false
|
|
|
|
for k,v in pairs(ww) do
|
|
|
|
local lwp=autofly.get_waypoint(v)
|
|
|
|
if type(lwp) == 'table' then
|
|
|
|
local dst=vector.distance(lp,lwp)
|
|
|
|
if dst < 500 then
|
|
|
|
if dst < odst then
|
|
|
|
odst=dst
|
|
|
|
rt=v
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if not rt then rt=autofly.get_quad() end
|
|
|
|
return rt
|
|
|
|
end
|
|
|
|
|
|
|
|
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
function autofly.set_hud_info(text)
|
|
|
|
if not minetest.localplayer then return end
|
2020-11-20 15:50:33 +01:00
|
|
|
if type(text) ~= "string" then return end
|
2021-02-11 03:58:26 +01:00
|
|
|
local lp=minetest.localplayer
|
|
|
|
local vspeed=lp:get_velocity()
|
|
|
|
local ttext=text.."\nSpeed: "..speed.."n/s\n"
|
2021-02-11 06:12:43 +01:00
|
|
|
..ws.round2(vspeed.x,2) ..','
|
|
|
|
..ws.round2(vspeed.y,2) ..','
|
|
|
|
..ws.round2(vspeed.z,2) .."\n"
|
|
|
|
.."Yaw:"..ws.round2(lp:get_yaw(),2).."° Pitch:" ..ws.round2(lp:get_pitch(),2).."° "
|
2021-02-11 03:58:26 +01:00
|
|
|
if turtle then ttext=ttext..turtle.getdir() end
|
|
|
|
if minetest.settings:get_bool('afly_shownames') then
|
|
|
|
ttext=ttext.."\n"..autofly.get_local_name()
|
2021-02-09 18:20:09 +01:00
|
|
|
end
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
if hud_info then
|
|
|
|
minetest.localplayer:hud_change(hud_info,'text',ttext)
|
|
|
|
else
|
|
|
|
hud_info = minetest.localplayer:hud_add({
|
|
|
|
hud_elem_type = 'text',
|
|
|
|
name = "Flight Info",
|
|
|
|
text = ttext,
|
|
|
|
number = 0x00ff00,
|
|
|
|
direction = 0,
|
2021-02-09 18:20:09 +01:00
|
|
|
position = {x=0,y=0.8},
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
alignment ={x=1,y=1},
|
|
|
|
offset = {x=0, y=0}
|
|
|
|
})
|
|
|
|
end
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
2021-02-11 03:58:26 +01:00
|
|
|
function autofly.display(pos,name)
|
|
|
|
if name == nil then name=pos_to_string(pos) end
|
|
|
|
local pos=string_to_pos(pos)
|
|
|
|
autofly.set_hud_wp(pos, name)
|
2021-02-09 05:54:31 +01:00
|
|
|
return true
|
|
|
|
end
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
function autofly.display_waypoint(name)
|
2021-02-09 05:54:31 +01:00
|
|
|
local pos=name
|
|
|
|
if type(name) ~= 'table' then pos=autofly.get_waypoint(name) end
|
2020-11-20 15:50:33 +01:00
|
|
|
autofly.last_name = name
|
2021-02-11 03:58:26 +01:00
|
|
|
--autofly.last_coords = pos
|
2020-11-20 15:50:33 +01:00
|
|
|
autofly.set_hud_info(name)
|
|
|
|
autofly.aim(autofly.last_coords)
|
2021-02-11 03:58:26 +01:00
|
|
|
autofly.display(pos,name)
|
2020-11-20 15:50:33 +01:00
|
|
|
return true
|
2020-10-23 11:55:48 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function autofly.goto_waypoint(name)
|
2020-11-20 15:50:33 +01:00
|
|
|
local wp=autofly.get_waypoint(name)
|
|
|
|
autofly.goto(wp)
|
2020-11-14 23:49:05 +01:00
|
|
|
autofly.last_name=name
|
2020-11-20 20:20:53 +00:00
|
|
|
autofly.display_waypoint(autofly.last_name)
|
2020-11-20 15:50:33 +01:00
|
|
|
return true
|
2020-11-14 23:45:34 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
function autofly.goto(pos)
|
2020-11-20 15:50:33 +01:00
|
|
|
oldpm=minetest.settings:get_bool("pitch_move")
|
|
|
|
minetest.settings:set_bool("pitch_move",true)
|
2021-02-09 18:20:09 +01:00
|
|
|
minetest.settings:set_bool("free_move",true)
|
2020-11-20 15:50:33 +01:00
|
|
|
minetest.settings:set_bool("continuous_forward",true)
|
2020-11-20 20:20:53 +00:00
|
|
|
if minetest.settings:get_bool("afly_sprint") then
|
|
|
|
minetest.settings:set_bool("autofsprint",true)
|
|
|
|
minetest.settings:set_bool("autoeat_timed",true)
|
|
|
|
end
|
2020-11-20 15:50:33 +01:00
|
|
|
minetest.settings:set_bool("afly_autoaim",true)
|
|
|
|
autofly.last_coords = pos
|
|
|
|
autofly.last_name = minetest.pos_to_string(pos)
|
|
|
|
autofly.aim(autofly.last_coords)
|
|
|
|
autofly.flying=true
|
2020-11-20 20:20:53 +00:00
|
|
|
autofly.set_hud_wp(autofly.last_coords, autofly.last_name)
|
2020-11-20 15:50:33 +01:00
|
|
|
return true
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function autofly.arrived()
|
2020-11-20 15:50:33 +01:00
|
|
|
if not autofly.flying then return end
|
|
|
|
minetest.settings:set("continuous_forward", "false")
|
|
|
|
minetest.settings:set_bool("autofsprint",false)
|
|
|
|
minetest.settings:set_bool("pitch_move",oldpm)
|
|
|
|
minetest.settings:set_bool("afly_autoaim",false)
|
|
|
|
minetest.settings:set_bool("autoeat_timed",false)
|
2021-02-11 03:58:26 +01:00
|
|
|
autofly.set_hud_info("Arrived!")
|
2020-11-20 15:50:33 +01:00
|
|
|
autofly.flying = false
|
|
|
|
minetest.sound_play({name = "default_alert", gain = 1.0})
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
end
|
|
|
|
|
2020-11-24 16:29:25 +01:00
|
|
|
local cruise_wason=false
|
|
|
|
local nfctr=0
|
2020-11-26 14:42:59 +01:00
|
|
|
|
2020-11-24 16:29:25 +01:00
|
|
|
|
2020-11-15 23:16:56 +01:00
|
|
|
function autofly.cruise()
|
2020-11-24 16:29:25 +01:00
|
|
|
if not minetest.settings:get_bool('afly_cruise') then
|
|
|
|
if cruise_wason then
|
|
|
|
cruise_wason=false
|
|
|
|
core.set_keypress("jump",false)
|
|
|
|
core.set_keypress("sneak",false)
|
|
|
|
end
|
|
|
|
return end
|
|
|
|
|
2020-11-15 23:16:56 +01:00
|
|
|
local lp=minetest.localplayer:get_pos()
|
2020-11-26 14:21:20 +01:00
|
|
|
local pos1 = vector.add(lp,{x=16,y=100,z=16})
|
|
|
|
local pos2 = vector.add(lp,{x=-16,y=-100,z=-16})
|
2021-02-09 18:20:09 +01:00
|
|
|
local nds=minetest.find_nodes_in_area_under_air(pos1, pos2, nlist.get_mclnodes())
|
2020-11-24 16:29:25 +01:00
|
|
|
local y=0
|
|
|
|
local found=false
|
|
|
|
|
|
|
|
|
|
|
|
for k,v in ipairs(nds) do
|
|
|
|
local nd = minetest.get_node_or_nil(v)
|
|
|
|
if nd ~= nil and nd.name ~= "air" then
|
|
|
|
if v.y > y then
|
|
|
|
y=v.y
|
|
|
|
found=true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if (autofly.cruiseheight ~= nil) then y=y+autofly.cruiseheight end
|
|
|
|
local diff = math.ceil(lp.y - y)
|
|
|
|
|
|
|
|
if not cruise_wason then --initially set the cruiseheight to the current value above ground
|
2020-11-26 14:38:51 +01:00
|
|
|
-- if not found then return end --wait with activation til a ground node has been found.
|
|
|
|
local clr,nnd=minetest.line_of_sight(lp,vector.add(lp,{x=1,y=-200,z=1}))
|
|
|
|
if not clr then diff = math.ceil(lp.y - nnd.y)
|
|
|
|
elseif not found then return end
|
2020-11-24 16:45:13 +01:00
|
|
|
if diff < 1 then autofly.cruiseheight = 20
|
|
|
|
else autofly.cruiseheight = diff end
|
|
|
|
|
2020-11-24 16:29:25 +01:00
|
|
|
cruise_wason=true
|
|
|
|
minetest.display_chat_message("cruise mode activated. target height set to " .. diff .. " nodes above ground.")
|
|
|
|
end
|
|
|
|
|
|
|
|
if not found then
|
|
|
|
if nfctr<20 then nfctr = nfctr + 1 return end
|
|
|
|
--minetest.display_chat_message("no nodes found for 20 iterations. lowering altitude.")
|
|
|
|
nfctr=0
|
|
|
|
minetest.settings:set_bool("free_move",false)
|
|
|
|
core.set_keypress("jump",false)
|
|
|
|
core.set_keypress("sneak",false)
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
local tolerance = 1
|
|
|
|
if diff < -tolerance then
|
|
|
|
minetest.settings:set_bool("free_move",true)
|
|
|
|
core.set_keypress("jump",true)
|
|
|
|
core.set_keypress("sneak",false)
|
|
|
|
--minetest.display_chat_message("too low: " .. y)
|
|
|
|
elseif diff > tolerance * 10 then
|
|
|
|
core.set_keypress("jump",false)
|
|
|
|
core.set_keypress("sneak",true)
|
|
|
|
minetest.settings:set_bool("free_move",false)
|
|
|
|
--minetest.display_chat_message("too high: " .. y)
|
|
|
|
elseif diff > tolerance then
|
|
|
|
core.set_keypress("jump",false)
|
|
|
|
core.set_keypress("sneak",true)
|
|
|
|
else
|
2020-11-15 23:16:56 +01:00
|
|
|
minetest.settings:set_bool("free_move",true)
|
2020-11-24 16:29:25 +01:00
|
|
|
core.set_keypress("jump",false)
|
|
|
|
core.set_keypress("sneak",false)
|
|
|
|
--minetest.display_chat_message("target height reached: " .. y)
|
2020-11-15 23:16:56 +01:00
|
|
|
end
|
2020-11-24 16:29:25 +01:00
|
|
|
|
|
|
|
|
2020-11-15 23:16:56 +01:00
|
|
|
end
|
|
|
|
|
2020-11-20 15:50:33 +01:00
|
|
|
function autofly.aim(tpos)
|
|
|
|
local ppos=minetest.localplayer:get_pos()
|
|
|
|
--local dir=tpos
|
|
|
|
local dir=vector.direction(ppos,tpos)
|
|
|
|
local yyaw=0;
|
|
|
|
local pitch=0;
|
|
|
|
if dir.x < 0 then
|
|
|
|
yyaw = math.atan2(-dir.x, dir.z) + (math.pi * 2)
|
|
|
|
else
|
|
|
|
yyaw = math.atan2(-dir.x, dir.z)
|
|
|
|
end
|
2021-02-11 06:12:43 +01:00
|
|
|
yyaw = ws.round2(math.deg(yyaw),2)
|
|
|
|
pitch = ws.round2(math.deg(math.asin(-dir.y) * 1),2);
|
2020-11-20 15:50:33 +01:00
|
|
|
minetest.localplayer:set_yaw(yyaw)
|
|
|
|
minetest.localplayer:set_pitch(pitch)
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
|
2020-11-20 15:50:33 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
function autofly.autotp(tpname)
|
2021-02-05 01:31:07 +01:00
|
|
|
if minetest.localplayer == nil then autofly.autotp(tpname) end
|
2020-11-20 15:50:33 +01:00
|
|
|
local tpos=nil
|
|
|
|
if tpname == nil then
|
|
|
|
tpos = autofly.get_waypoint('AUTOTP')
|
2020-11-21 20:08:53 +00:00
|
|
|
elseif type(tpname) == "table" then
|
|
|
|
tpos = tpname
|
2020-11-20 15:50:33 +01:00
|
|
|
else
|
|
|
|
tpos=autofly.get_waypoint(tpname)
|
|
|
|
end
|
|
|
|
if tpos == nil then return end
|
|
|
|
local lp=minetest.localplayer
|
|
|
|
local dst=vector.distance(lp:get_pos(),tpos)
|
2021-02-05 01:31:07 +01:00
|
|
|
if (dst < 300) then
|
2020-11-20 15:50:33 +01:00
|
|
|
minetest.sound_play({name = "default_alert", gain = 3.0})
|
|
|
|
autofly.delete_waypoint('AUTOTP')
|
2021-02-05 01:31:07 +01:00
|
|
|
return true
|
2020-11-20 15:50:33 +01:00
|
|
|
end
|
|
|
|
autofly.set_waypoint(tpos,'AUTOTP')
|
2021-02-05 01:31:07 +01:00
|
|
|
local boat_found=false
|
2020-11-20 15:50:33 +01:00
|
|
|
for k, v in ipairs(lp.get_nearby_objects(4)) do
|
|
|
|
local txt = v:get_item_textures()
|
|
|
|
if ( txt:find('mcl_boats_texture')) then
|
2021-02-05 01:31:07 +01:00
|
|
|
boat_found=true
|
2021-02-09 05:54:31 +01:00
|
|
|
minetest.display_chat_message("boat found. entering and tping to "..minetest.pos_to_string(autofly.get_waypoint('AUTOTP')))
|
2020-11-20 15:50:33 +01:00
|
|
|
autofly.aim(vector.add(v:get_pos(),{x=0,y=-1.5,z=0}))
|
|
|
|
minetest.after("0.2",function()
|
2020-11-21 19:49:58 +00:00
|
|
|
minetest.interact("place") end)
|
2021-02-05 01:31:07 +01:00
|
|
|
minetest.after("1.5",function()
|
2020-11-20 15:50:33 +01:00
|
|
|
autofly.warpae('AUTOTP')
|
|
|
|
end)
|
2021-02-05 01:31:07 +01:00
|
|
|
return true
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
end
|
2020-11-20 15:50:33 +01:00
|
|
|
end
|
2021-02-09 05:54:31 +01:00
|
|
|
if not boat_found then
|
|
|
|
minetest.display_chat_message("no boat found. trying again in 5.")
|
|
|
|
minetest.after("5.0",function() autofly.autotp(tpname) end)
|
|
|
|
return end
|
2020-11-20 15:50:33 +01:00
|
|
|
end
|
2021-02-09 18:20:09 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2021-02-09 05:54:31 +01:00
|
|
|
autofly.register_transport('Fly',function(pos,name) autofly.goto_waypoint(name) end)
|
2021-02-11 04:17:51 +01:00
|
|
|
autofly.register_transport('wrp',function(pos,name) autofly.warp(name) end)
|
|
|
|
autofly.register_transport('atp',function(pos,name) autofly.autotp(name) end)
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
|
2020-11-20 15:50:33 +01:00
|
|
|
function autofly.axissnap()
|
|
|
|
if not minetest.settings:get_bool('afly_snap') then return end
|
2021-02-11 03:58:26 +01:00
|
|
|
if minetest.settings:get_bool("freecam") then return end
|
2020-11-20 15:50:33 +01:00
|
|
|
local y=minetest.localplayer:get_yaw()
|
|
|
|
local yy=nil
|
|
|
|
if ( y < 45 or y > 315 ) then
|
|
|
|
yy=0
|
|
|
|
elseif (y < 135) then
|
|
|
|
yy=90
|
|
|
|
elseif (y < 225 ) then
|
|
|
|
yy=180
|
|
|
|
elseif ( y < 315 ) then
|
|
|
|
yy=270
|
|
|
|
end
|
|
|
|
if yy ~= nil then
|
|
|
|
minetest.localplayer:set_yaw(yy)
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-11-20 15:50:33 +01:00
|
|
|
minetest.register_on_death(function()
|
|
|
|
if minetest.localplayer then
|
|
|
|
local name = 'Death waypoint'
|
|
|
|
local pos = minetest.localplayer:get_pos()
|
|
|
|
autofly.last_coords = pos
|
2021-02-11 03:58:26 +01:00
|
|
|
autofly.last_name = name
|
|
|
|
autofly.set_waypoint(pos,name)
|
|
|
|
autofly.display(pos,name)
|
2020-11-20 15:50:33 +01:00
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
2021-02-09 05:54:31 +01:00
|
|
|
local function get_dimension(pos)
|
|
|
|
if pos.y > -65 then return "overworld"
|
|
|
|
elseif pos.y > -8000 then return "void"
|
|
|
|
elseif pos.y > -27000 then return "end"
|
|
|
|
elseif pos.y >29000 then return "void"
|
|
|
|
elseif pos.y >31000 then return "nether"
|
|
|
|
else return "void"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
function autofly.warp(name)
|
2021-02-09 05:54:31 +01:00
|
|
|
local pos=autofly.get_waypoint(name)
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
if pos then
|
2021-02-09 05:54:31 +01:00
|
|
|
if pos.y > -64 then
|
|
|
|
pos=vector.add(pos,{x=0,y=150,z=0})
|
|
|
|
end
|
|
|
|
if get_dimension(pos) == "void" then return false end
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
minetest.localplayer:set_pos(pos)
|
2020-11-20 15:50:33 +01:00
|
|
|
return true
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
function autofly.warpae(name)
|
|
|
|
local s, m = autofly.warp(name)
|
|
|
|
if s then
|
|
|
|
minetest.disconnect()
|
|
|
|
end
|
2020-11-20 15:50:33 +01:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
function autofly.getwps()
|
|
|
|
local wp={}
|
|
|
|
for name, _ in pairs(storage:to_table().fields) do
|
|
|
|
if name:sub(1, string.len(stprefix)) == stprefix then
|
|
|
|
table.insert(wp, name:sub(string.len(stprefix)+1))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
table.sort(wp)
|
|
|
|
return wp
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function autofly.set_waypoint(pos, name)
|
|
|
|
pos = pos_to_string(pos)
|
|
|
|
if not pos then return end
|
|
|
|
storage:set_string(stprefix .. tostring(name), pos)
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
function autofly.delete_waypoint(name)
|
|
|
|
storage:set_string(stprefix .. tostring(name), '')
|
|
|
|
end
|
|
|
|
|
|
|
|
function autofly.get_waypoint(name)
|
|
|
|
return string_to_pos(storage:get_string(stprefix .. tostring(name)))
|
|
|
|
end
|
|
|
|
|
|
|
|
function autofly.rename_waypoint(oldname, newname)
|
|
|
|
oldname, newname = tostring(oldname), tostring(newname)
|
|
|
|
local pos = autofly.get_waypoint(oldname)
|
|
|
|
if not pos or not autofly.set_waypoint(pos, newname) then return end
|
|
|
|
if oldname ~= newname then
|
|
|
|
autofly.delete_waypoint(oldname)
|
|
|
|
end
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
2021-02-11 04:17:51 +01:00
|
|
|
minetest.after("5.0",function()
|
|
|
|
if autofly.get_waypoint('AUTOTP') ~= nil then autofly.autotp(nil) end
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
|
|
math.randomseed(os.time())
|
|
|
|
|
|
|
|
local randflying = false
|
|
|
|
|
|
|
|
minetest.register_globalstep(function()
|
|
|
|
if randflying and not autofly.flying then
|
|
|
|
local x = math.random(-31000, 31000)
|
|
|
|
local y = math.random(2000, 31000)
|
|
|
|
local z = math.random(-31000, 31000)
|
|
|
|
|
|
|
|
autofly.goto({x = x, y = y, z = z})
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
|
|
|
local function randfly()
|
|
|
|
if not randflying then
|
|
|
|
randflying = true
|
|
|
|
local lp = minetest.localplayer:get_pos()
|
|
|
|
autofly.goto(turtle.coord(lp.x, 6000, lp.z))
|
|
|
|
else
|
|
|
|
randflying = false
|
|
|
|
autofly.arrived()
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-02-11 04:17:51 +01:00
|
|
|
|
|
|
|
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
minetest.register_chatcommand('waypoints', {
|
|
|
|
params = '',
|
|
|
|
description = 'Open the autofly GUI',
|
2020-11-21 04:34:50 +01:00
|
|
|
func = function(param) autofly.display_formspec() end
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
})
|
|
|
|
|
2021-02-11 06:12:43 +01:00
|
|
|
ws.register_chatcommand_alias('waypoints','wp', 'wps', 'waypoint')
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
|
|
|
|
-- Add a waypoint
|
|
|
|
minetest.register_chatcommand('add_waypoint', {
|
|
|
|
params = '<pos / "here" / "there"> <name>',
|
|
|
|
description = 'Adds a waypoint.',
|
|
|
|
func = function(param)
|
|
|
|
local s, e = param:find(' ')
|
|
|
|
if not s or not e then
|
|
|
|
return false, 'Invalid syntax! See .help add_mrkr for more info.'
|
|
|
|
end
|
|
|
|
local pos = param:sub(1, s - 1)
|
|
|
|
local name = param:sub(e + 1)
|
|
|
|
|
|
|
|
-- Validate the position
|
|
|
|
if not pos then
|
|
|
|
return false, err
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Validate the name
|
|
|
|
if not name or #name < 1 then
|
|
|
|
return false, 'Invalid name!'
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Set the waypoint
|
|
|
|
return autofly.set_waypoint(pos, name), 'Done!'
|
|
|
|
end
|
|
|
|
})
|
2021-02-11 06:12:43 +01:00
|
|
|
ws.register_chatcommand_alias('add_waypoint','wa', 'add_wp')
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
minetest.register_chatcommand('add_waypoint_here', {
|
|
|
|
params = 'name',
|
|
|
|
description = 'marks the current position',
|
|
|
|
func = function(param)
|
|
|
|
local name = os.date("%Y-%m-%d %H:%M:%S")
|
|
|
|
local pos = minetest.localplayer:get_pos()
|
|
|
|
return autofly.set_waypoint(pos, name), 'Done!'
|
|
|
|
end
|
|
|
|
})
|
2021-02-11 06:12:43 +01:00
|
|
|
ws.register_chatcommand_alias('add_waypoint_here', 'wah', 'add_wph')
|
2020-11-20 15:50:33 +01:00
|
|
|
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
minetest.register_chatcommand('clear_waypoint', {
|
|
|
|
params = '',
|
|
|
|
description = 'Hides the displayed waypoint.',
|
|
|
|
func = function(param)
|
2020-11-14 23:45:34 +01:00
|
|
|
if autofly.flying then autofly.flying=false end
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
if hud_wp then
|
|
|
|
minetest.localplayer:hud_remove(hud_wp)
|
|
|
|
hud_wp = nil
|
|
|
|
return true, 'Hidden the currently displayed waypoint.'
|
|
|
|
elseif not minetest.localplayer.hud_add then
|
|
|
|
minetest.run_server_chatcommand('clrmrkr')
|
|
|
|
return
|
|
|
|
elseif not hud_wp then
|
|
|
|
return false, 'No waypoint is currently being displayed!'
|
|
|
|
end
|
|
|
|
for k,v in wps do
|
|
|
|
minetest.localplayer:hud_remove(v)
|
|
|
|
table.remove(k)
|
|
|
|
end
|
|
|
|
|
|
|
|
end,
|
|
|
|
})
|
2021-02-11 06:12:43 +01:00
|
|
|
ws.register_chatcommand_alias('clear_waypoint', 'cwp','cls')
|
2020-11-20 15:50:33 +01:00
|
|
|
|
|
|
|
minetest.register_chatcommand('autotp', {
|
2020-11-11 20:25:05 +01:00
|
|
|
params = 'position',
|
|
|
|
description = 'autotp',
|
|
|
|
func = function(param)
|
2020-11-11 21:33:12 +01:00
|
|
|
autofly.autotp(minetest.string_to_pos(param))
|
2020-11-11 20:25:05 +01:00
|
|
|
end
|
|
|
|
})
|
2021-02-11 06:12:43 +01:00
|
|
|
ws.register_chatcommand_alias('autotp', 'atp')
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
|
2021-02-11 03:58:26 +01:00
|
|
|
minetest.register_chatcommand('wpdisplay', {
|
|
|
|
params = 'position name',
|
|
|
|
description = 'display waypoint',
|
|
|
|
func = function(pos,name)
|
|
|
|
autofly.display(pos,name)
|
|
|
|
end
|
|
|
|
})
|
2021-02-11 06:12:43 +01:00
|
|
|
ws.register_chatcommand_alias('wpdisplay', 'wpd')
|
2020-11-14 14:05:13 +01:00
|
|
|
|
2020-11-20 20:20:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
minetest.register_chatcommand("randfly", {
|
|
|
|
description = "Randomly fly up high (toggle).",
|
|
|
|
func = randfly
|
|
|
|
})
|
|
|
|
|
Add changes from waspsaliva initial commit
This commit contains changes best credited to flyc0r
<flyc0r@localhost.localdomain>, although the changes were separated
out from waspsaliva's original initial commit rev. 0e9e1f352, which
added the files from DFC work tree, and squashed in numerous additions
by flyc0r and collaborators. That commit log:
commit 0e9e1f3528c3d2fa1f1e9a79d4a00576be8552f5
Author: flyc0r <flyc0r@localhost.localdomain>
Date: Sun Oct 4 03:37:08 2020 +0200
init
This rebase had the effect of griefing the git history xD, so
for example `git blame` of DFC and even upstream Minetest sources
appear to be originally authored by `flyc0r` in that commit.
To fix this, I will recommit only the changes onto the appropriate
commit in DFC, and recreate the following git history (incl. merges).
After this, the git history will be at least visually the same as the
original Waspsaliva, even if commit sha1sums have changed.
AFAICT, the closest commit from DFC was af085acbd. That commit was
found simply by running `git diff wsc-master <some_DFC_rev>`, and
locating the commit with the smallest number of differences.
This commit was then created as follows:
# Check out the DFC base commit
git checkout af085acbd
# Check out the *files* from WSC's initial commit
git checkout 0e9e1f352 -- .
# Make sure everything is added and commit the changes
git add -A
git commit
2020-10-04 03:37:08 +02:00
|
|
|
|
2020-11-04 23:22:43 +00:00
|
|
|
minetest.register_cheat("Aim", "Autofly", "afly_autoaim")
|
2020-11-14 14:05:13 +01:00
|
|
|
minetest.register_cheat("AxisSnap", "Autofly", "afly_snap")
|
2020-11-15 23:16:56 +01:00
|
|
|
minetest.register_cheat("Cruise", "Autofly", "afly_cruise")
|
2020-11-20 20:20:53 +00:00
|
|
|
minetest.register_cheat("Sprint", "Autofly", "afly_sprint")
|
2021-02-09 18:20:09 +01:00
|
|
|
minetest.register_cheat("ShowNames", "Autofly", "afly_shownames")
|
2020-11-04 23:22:43 +00:00
|
|
|
minetest.register_cheat("Waypoints", "Autofly", autofly.display_formspec)
|