autofly: add normal autosprint; some gui fixes

wsc-master-rebase
cora 2020-10-23 11:55:48 +02:00 committed by Schmappie Eldress
parent 510f8da63f
commit bee4d3d326
2 changed files with 17 additions and 6 deletions

View File

@ -86,7 +86,9 @@ end
minetest.register_globalstep(function()
autofly.checkfall()
if minetest.settings:get_bool("continuous_forward") and minetest.settings:get_bool("autosprint") then
if minetest.settings:get_bool("autosprint") then
core.set_keypress("special1", true)
elseif minetest.settings:get_bool("continuous_forward") and minetest.settings:get_bool("autofsprint") then
core.set_keypress("special1", true)
end
if not minetest.localplayer then return end
@ -202,13 +204,20 @@ function autofly.checkfall()
end
function autofly.display_waypoint(name)
autofly.last_coords = autofly.get_waypoint(name)
autofly.last_name = name
autofly.set_hud_info(name)
autofly.aim(autofly.last_coords)
return autofly.set_hud_wp(autofly.get_waypoint(name), name)
end
function autofly.goto_waypoint(name)
autofly.last_coords = autofly.get_waypoint(name)
autofly.last_name = name
autofly.set_hud_info(name)
--minetest.settings:set("movement_speed_walk", "5")
core.set_keypress("special1", true)
if (minetest.settings:get_bool("afly_autoaim")) then autofly.aim(autofly.last_coords)
end
autofly.aim(autofly.last_coords)
minetest.settings:set_bool("pitch_move",true)
minetest.settings:set_bool("continuous_forward",true)
return autofly.set_hud_wp(autofly.get_waypoint(name), name)
@ -432,6 +441,7 @@ register_chatcommand_alias('clear_waypoint', 'cwp','cls')
if (_G["minetest"]["register_cheat"] ~= nil) then
minetest.register_cheat("AutoAim", "Autofly", "afly_autoaim")
minetest.register_cheat("AutoSprint", "Movement", "autosprint")
minetest.register_cheat("AutoForwardSprint", "Movement", "autofsprint")
minetest.register_cheat("SoftLanding", "Autofly", "afly_softlanding")
minetest.register_cheat("Display GUI", "Autofly", autofly.display_formspec)
else

View File

@ -20,9 +20,10 @@ local ltime=0
function autofly.display_formspec()
local formspec = 'size[5.25,8]' ..
'label[0,0;Waypoint list]' ..
'button_exit[0,7.5;1.3125,0.5;display;GO]' ..
'button[1.1125,7.5;0.9,0.5;warp;wrp]' ..
'button[1.6125,7.5;1.2,0.5;warpae;w+e]' ..
'button_exit[0,7.5;1,0.5;display;GO]' ..
'button_exit[0.8,7.5;1,0.5;display;SHO]' ..
'button[1.5125,7.5;0.9,0.5;warp;wrp]' ..
'button[2.125,7.5;1.2,0.5;warpae;w+e]' ..
'button[2.625,7.5;1.3,0.5;rename;Rename]' ..
'button[3.9375,7.5;1.3,0.5;delete;Delete]' ..
'textlist[0,0.75;5,6;marker;'