aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/client/cheats.lua11
-rw-r--r--clientmods/dragonfire/autoeat/init.lua21
-rw-r--r--clientmods/dragonfire/autoeat/mod.conf3
-rw-r--r--clientmods/dragonfire/autoeat/settingtypes.txt1
-rw-r--r--clientmods/dragonfire/chat/colors.lua (renamed from clientmods/chat/init.lua)18
-rw-r--r--clientmods/dragonfire/chat/init.lua13
-rw-r--r--clientmods/dragonfire/chat/leak.lua10
-rw-r--r--clientmods/dragonfire/chat/mod.conf (renamed from clientmods/chat/mod.conf)0
-rw-r--r--clientmods/dragonfire/chat/rainbow.lua (renamed from clientmods/chat/rainbow.lua)0
-rw-r--r--clientmods/dragonfire/chat/settingtypes.txt (renamed from clientmods/chat/settingtypes.txt)2
-rw-r--r--clientmods/dragonfire/chat/spam.lua12
-rw-r--r--clientmods/dragonfire/chat/status.lua5
-rw-r--r--clientmods/dragonfire/commands/init.lua (renamed from clientmods/commands/init.lua)11
-rw-r--r--clientmods/dragonfire/commands/mod.conf (renamed from clientmods/commands/mod.conf)0
-rw-r--r--clientmods/dragonfire/inventory/autotool.lua (renamed from clientmods/inventory/autotool.lua)2
-rw-r--r--clientmods/dragonfire/inventory/enderchest.lua (renamed from clientmods/inventory/enderchest.lua)2
-rw-r--r--clientmods/dragonfire/inventory/hand.lua27
-rw-r--r--clientmods/dragonfire/inventory/init.lua (renamed from clientmods/inventory/init.lua)1
-rw-r--r--clientmods/dragonfire/inventory/invhack.lua (renamed from clientmods/inventory/invhack.lua)0
-rw-r--r--clientmods/dragonfire/inventory/mod.conf (renamed from clientmods/inventory/mod.conf)0
-rw-r--r--clientmods/dragonfire/inventory/next_item.lua (renamed from clientmods/inventory/next_item.lua)2
-rw-r--r--clientmods/dragonfire/inventory/settingtypes.txt (renamed from clientmods/inventory/settingtypes.txt)0
-rw-r--r--clientmods/dragonfire/modpack.txt1
-rw-r--r--clientmods/dragonfire/pathfinding/init.lua109
-rw-r--r--clientmods/dragonfire/pathfinding/mod.conf3
-rw-r--r--clientmods/dragonfire/pathfinding/settingtypes.txt3
-rw-r--r--clientmods/dragonfire/perlin/init.lua33
-rw-r--r--clientmods/dragonfire/perlin/mod.conf3
-rw-r--r--clientmods/dragonfire/perlin/perlin.lua144
-rw-r--r--clientmods/dragonfire/respawn/init.lua (renamed from clientmods/respawn/init.lua)2
-rw-r--r--clientmods/dragonfire/respawn/mod.conf (renamed from clientmods/respawn/mod.conf)0
-rw-r--r--clientmods/dragonfire/respawn/settingtypes.txt (renamed from clientmods/respawn/settingtypes.txt)0
-rw-r--r--clientmods/dragonfire/schematicas/init.lua (renamed from clientmods/schematicas/init.lua)15
-rw-r--r--clientmods/dragonfire/schematicas/mod.conf4
-rw-r--r--clientmods/dragonfire/warp/init.lua (renamed from clientmods/warp/init.lua)0
-rw-r--r--clientmods/dragonfire/warp/mod.conf (renamed from clientmods/warp/mod.conf)0
-rw-r--r--clientmods/dragonfire/world/init.lua (renamed from clientmods/world/init.lua)2
-rw-r--r--clientmods/dragonfire/world/mod.conf3
-rw-r--r--clientmods/dragonfire/world/settingtypes.txt (renamed from clientmods/world/settingtypes.txt)1
-rw-r--r--clientmods/mods.conf3
-rw-r--r--doc/client_lua_api.txt31
-rw-r--r--src/client/client.cpp5
-rw-r--r--src/client/game.cpp20
-rw-r--r--src/client/game.h3
-rw-r--r--src/client/gameui.cpp3
-rw-r--r--src/client/inputhandler.h22
-rw-r--r--src/defaultsettings.cpp4
-rw-r--r--src/network/clientpackethandler.cpp7
-rw-r--r--src/script/cpp_api/s_cheats.cpp2
-rw-r--r--src/script/lua_api/l_client.cpp22
-rw-r--r--src/script/lua_api/l_client.h3
-rw-r--r--src/script/lua_api/l_env.cpp7
-rw-r--r--src/script/lua_api/l_localplayer.cpp35
-rw-r--r--src/script/lua_api/l_localplayer.h11
-rwxr-xr-xutil/buildbot/buildwin32.sh2
-rwxr-xr-xutil/buildbot/buildwin64.sh2
56 files changed, 591 insertions, 55 deletions
diff --git a/builtin/client/cheats.lua b/builtin/client/cheats.lua
index 839021ad2..a6aa13dc7 100644
--- a/builtin/client/cheats.lua
+++ b/builtin/client/cheats.lua
@@ -2,10 +2,9 @@ core.cheats = {
["Combat"] = {
["Killaura"] = "killaura",
["AntiKnockback"] = "antiknockback",
- ["NoFallDamage"] = "prevent_natural_damage",
+ ["FastHit"] = "spamclick",
},
["Movement"] = {
- ["GodMode"] = "entity_speed",
["Freecam"] = "freecam",
["PrivBypass"] = "priv_bypass",
["AutoForward"] = "continuous_forward",
@@ -20,7 +19,6 @@ core.cheats = {
["NoHurtCam"] = "no_hurt_cam",
["BrightNight"] = "no_night",
["Coords"] = "coords",
- ["Clouds"] = "enable_clouds",
},
["World"] = {
["FastDig"] = "fastdig",
@@ -32,6 +30,13 @@ core.cheats = {
["UnlimitedRange"] = "increase_tool_range_plus",
["PointLiquids"] = "point_liquids",
},
+ ["Exploit"] = {
+ ["EntitySpeed"] = "entity_speed",
+ ["ParticleExploit"] = "log_particles",
+ },
+ ["Player"] = {
+ ["NoFallDamage"] = "prevent_natural_damage",
+ },
}
function core.register_cheat(cheatname, category, func)
diff --git a/clientmods/dragonfire/autoeat/init.lua b/clientmods/dragonfire/autoeat/init.lua
new file mode 100644
index 000000000..7435e1796
--- /dev/null
+++ b/clientmods/dragonfire/autoeat/init.lua
@@ -0,0 +1,21 @@
+autoeat = {}
+
+local last_step_eating = false
+
+minetest.register_on_damage_taken(function()
+ if not minetest.settings:get_bool("autoeat") then return end
+ local player = minetest.localplayer
+ player:set_wield_index(0)
+ minetest.place_node(player:get_pos())
+ autoeat.eating = true
+end)
+
+minetest.register_globalstep(function()
+ if last_step_eating then
+ autoeat.eating, last_step_eating = false, false
+ elseif autoeat.eating then
+ last_step_eating = true
+ end
+end)
+
+minetest.register_cheat("AutoEat", "Player", "autoeat")
diff --git a/clientmods/dragonfire/autoeat/mod.conf b/clientmods/dragonfire/autoeat/mod.conf
new file mode 100644
index 000000000..d6dc9dbc4
--- /dev/null
+++ b/clientmods/dragonfire/autoeat/mod.conf
@@ -0,0 +1,3 @@
+name = autoeat
+description = Automatically eat when damage was taken, assuming that there is food in the first hotbar slot. This is only useful when used in combination with an afk bot, like schematicas.
+author = Fleckenstein
diff --git a/clientmods/dragonfire/autoeat/settingtypes.txt b/clientmods/dragonfire/autoeat/settingtypes.txt
new file mode 100644
index 000000000..9614de087
--- /dev/null
+++ b/clientmods/dragonfire/autoeat/settingtypes.txt
@@ -0,0 +1 @@
+autoeat (Automatically eat when damage was taken) bool false
diff --git a/clientmods/chat/init.lua b/clientmods/dragonfire/chat/colors.lua
index 45d61e06b..b3ab596fb 100644
--- a/clientmods/chat/init.lua
+++ b/clientmods/dragonfire/chat/colors.lua
@@ -1,7 +1,3 @@
-chat = {}
-
-chat.rainbow = dofile(minetest.get_modpath("chat") .. "/rainbow.lua")
-
function chat.send(message)
local starts_with = message:sub(1, 1)
@@ -34,16 +30,4 @@ function chat.send(message)
end
minetest.register_on_sending_chat_message(chat.send)
-
-local etime = 0
-
-minetest.register_globalstep(function(dtime)
- etime = etime + dtime
- if etime < 10/8 then return end
- etime = 0
- local spam = minetest.settings:get("chat_spam")
- local enable_spam = minetest.settings:get("chat_enable_spam")
- if enable_spam and spam then
- local _ = chat.send(spam) or minetest.send_chat_message(spam)
- end
-end)
+
diff --git a/clientmods/dragonfire/chat/init.lua b/clientmods/dragonfire/chat/init.lua
new file mode 100644
index 000000000..5086bc570
--- /dev/null
+++ b/clientmods/dragonfire/chat/init.lua
@@ -0,0 +1,13 @@
+chat = {}
+
+local modname = minetest.get_current_modname()
+local modpath = minetest.get_modpath(modname)
+
+chat.rainbow = dofile(modpath .. "/rainbow.lua")
+
+dofile(modpath .. "/colors.lua")
+dofile(modpath .. "/spam.lua")
+dofile(modpath .. "/status.lua")
+dofile(modpath .. "/leak.lua")
+
+
diff --git a/clientmods/dragonfire/chat/leak.lua b/clientmods/dragonfire/chat/leak.lua
new file mode 100644
index 000000000..a11704d55
--- /dev/null
+++ b/clientmods/dragonfire/chat/leak.lua
@@ -0,0 +1,10 @@
+local etime = 0
+
+minetest.register_globalstep(function(dtime)
+ if not minetest.settings:get_bool("leak") then return end
+ etime = etime + dtime
+ if etime < 5 then return end
+ etime = 0
+ local player = minetest.localplayer
+ minetest.send_chat_message(minetest.pos_to_string(vector.floor(player:get_pos())))
+end)
diff --git a/clientmods/chat/mod.conf b/clientmods/dragonfire/chat/mod.conf
index ce94dc1bc..ce94dc1bc 100644
--- a/clientmods/chat/mod.conf
+++ b/clientmods/dragonfire/chat/mod.conf
diff --git a/clientmods/chat/rainbow.lua b/clientmods/dragonfire/chat/rainbow.lua
index 1519619a7..1519619a7 100644
--- a/clientmods/chat/rainbow.lua
+++ b/clientmods/dragonfire/chat/rainbow.lua
diff --git a/clientmods/chat/settingtypes.txt b/clientmods/dragonfire/chat/settingtypes.txt
index 5e5aa8a8b..9428dd955 100644
--- a/clientmods/chat/settingtypes.txt
+++ b/clientmods/dragonfire/chat/settingtypes.txt
@@ -2,3 +2,5 @@ chat_color (Chat Color) string white
chat_reverse (Reverse Chat messages) bool false
chat_enable_spam (Spam Chat) bool false
chat_spam (Message to spam into Chat) string
+ignore_status_messages (Ignore status messages from server) bool true
+leak (Frequently leak your coordinates to chat) bool false
diff --git a/clientmods/dragonfire/chat/spam.lua b/clientmods/dragonfire/chat/spam.lua
new file mode 100644
index 000000000..991846d33
--- /dev/null
+++ b/clientmods/dragonfire/chat/spam.lua
@@ -0,0 +1,12 @@
+local etime = 0
+
+minetest.register_globalstep(function(dtime)
+ etime = etime + dtime
+ if etime < 10/8 then return end
+ etime = 0
+ local spam = minetest.settings:get("chat_spam")
+ local enable_spam = minetest.settings:get("chat_enable_spam")
+ if enable_spam and spam then
+ local _ = chat.send(spam) or minetest.send_chat_message(spam)
+ end
+end)
diff --git a/clientmods/dragonfire/chat/status.lua b/clientmods/dragonfire/chat/status.lua
new file mode 100644
index 000000000..4cf56a09e
--- /dev/null
+++ b/clientmods/dragonfire/chat/status.lua
@@ -0,0 +1,5 @@
+minetest.register_on_receiving_chat_message(function(message)
+ if message:sub(1, 1) == "#" and minetest.settings:get_bool("ignore_status_messages") ~= false then
+ return true
+ end
+end)
diff --git a/clientmods/commands/init.lua b/clientmods/dragonfire/commands/init.lua
index e481e6c34..94c824f14 100644
--- a/clientmods/commands/init.lua
+++ b/clientmods/dragonfire/commands/init.lua
@@ -22,7 +22,7 @@ minetest.register_chatcommand("teleport", {
minetest.register_chatcommand("wielded", {
description = "Print itemstring of wieleded item",
func = function()
- return true, minetest.get_wielded_item():get_name()
+ return true, minetest.localplayer:get_wielded_item():get_name()
end
})
@@ -47,6 +47,13 @@ minetest.register_chatcommand("kill", {
end,
})
+minetest.register_chatcommand("hop", {
+ description = "Hop",
+ func = function()
+ minetest.set_keypress("jump", true)
+ end,
+})
+
minetest.register_chatcommand("set", {
params = "([-n] <name> <value>) | <name>",
description = "Set or read client configuration setting",
@@ -78,4 +85,4 @@ minetest.register_chatcommand("set", {
return false, "Invalid parameters (see .help set)."
end,
})
-
+
diff --git a/clientmods/commands/mod.conf b/clientmods/dragonfire/commands/mod.conf
index 48f2d6f25..48f2d6f25 100644
--- a/clientmods/commands/mod.conf
+++ b/clientmods/dragonfire/commands/mod.conf
diff --git a/clientmods/inventory/autotool.lua b/clientmods/dragonfire/inventory/autotool.lua
index 430e6025b..7df39823f 100644
--- a/clientmods/inventory/autotool.lua
+++ b/clientmods/dragonfire/inventory/autotool.lua
@@ -32,5 +32,5 @@ minetest.register_on_punchnode(function(pos, node)
player:set_wield_index(new_index)
end)
-minetest.register_cheat("AutoTool", "Inventory", "autotool")
+minetest.register_cheat("AutoTool", "Player", "autotool")
diff --git a/clientmods/inventory/enderchest.lua b/clientmods/dragonfire/inventory/enderchest.lua
index 45ac216f3..37a4c84f8 100644
--- a/clientmods/inventory/enderchest.lua
+++ b/clientmods/dragonfire/inventory/enderchest.lua
@@ -24,4 +24,4 @@ function minetest.open_special_inventory()
minetest.show_formspec("enderchest:enderchest", formspec)
end
-minetest.register_cheat("Enderchest", "Inventory", minetest.open_special_inventory)
+minetest.register_cheat("Enderchest", "Player", minetest.open_special_inventory)
diff --git a/clientmods/dragonfire/inventory/hand.lua b/clientmods/dragonfire/inventory/hand.lua
new file mode 100644
index 000000000..05ec66b5d
--- /dev/null
+++ b/clientmods/dragonfire/inventory/hand.lua
@@ -0,0 +1,27 @@
+function get_itemslot_bg(x, y, w, h)
+ local out = ""
+ for i = 0, w - 1, 1 do
+ for j = 0, h - 1, 1 do
+ out = out .."image["..x+i..","..y+j..";1,1;mcl_formspec_itemslot.png]"
+ end
+ end
+ return out
+end
+
+local formspec = "size[9,8.75]"..
+ "label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", "Hand")).."]"..
+ "list[current_player;hand;0,0.5;1,1;]"..
+ get_itemslot_bg(0,0.5,1,1)..
+ "label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", "Inventory")).."]"..
+ "list[current_player;main;0,4.5;9,3;9]"..
+ get_itemslot_bg(0,4.5,9,3)..
+ "list[current_player;main;0,7.74;9,1;]"..
+ get_itemslot_bg(0,7.74,9,1)..
+ "listring[current_player;hand]"..
+ "listring[current_player;main]"
+
+local function hand()
+ minetest.show_formspec("inventory:hand", formspec)
+end
+
+minetest.register_cheat("Hand", "Player", hand)
diff --git a/clientmods/inventory/init.lua b/clientmods/dragonfire/inventory/init.lua
index 52791b338..4440992a6 100644
--- a/clientmods/inventory/init.lua
+++ b/clientmods/dragonfire/inventory/init.lua
@@ -5,3 +5,4 @@ dofile(modpath .. "/invhack.lua")
dofile(modpath .. "/enderchest.lua")
dofile(modpath .. "/next_item.lua")
dofile(modpath .. "/autotool.lua")
+dofile(modpath .. "/hand.lua")
diff --git a/clientmods/inventory/invhack.lua b/clientmods/dragonfire/inventory/invhack.lua
index eb6f48bf2..eb6f48bf2 100644
--- a/clientmods/inventory/invhack.lua
+++ b/clientmods/dragonfire/inventory/invhack.lua
diff --git a/clientmods/inventory/mod.conf b/clientmods/dragonfire/inventory/mod.conf
index 18b883fbd..18b883fbd 100644
--- a/clientmods/inventory/mod.conf
+++ b/clientmods/dragonfire/inventory/mod.conf
diff --git a/clientmods/inventory/next_item.lua b/clientmods/dragonfire/inventory/next_item.lua
index 0b7b88be4..64eb2b7ae 100644
--- a/clientmods/inventory/next_item.lua
+++ b/clientmods/dragonfire/inventory/next_item.lua
@@ -14,5 +14,5 @@ minetest.register_globalstep(function(dtime)
elapsed_time = 0
end)
-minetest.register_cheat("NextItem", "Inventory", "next_item")
+minetest.register_cheat("NextItem", "Player", "next_item")
diff --git a/clientmods/inventory/settingtypes.txt b/clientmods/dragonfire/inventory/settingtypes.txt
index fef673b1f..fef673b1f 100644
--- a/clientmods/inventory/settingtypes.txt
+++ b/clientmods/dragonfire/inventory/settingtypes.txt
diff --git a/clientmods/dragonfire/modpack.txt b/clientmods/dragonfire/modpack.txt
new file mode 100644
index 000000000..8d1c8b69c
--- /dev/null
+++ b/clientmods/dragonfire/modpack.txt
@@ -0,0 +1 @@
+
diff --git a/clientmods/dragonfire/pathfinding/init.lua b/clientmods/dragonfire/pathfinding/init.lua
new file mode 100644
index 000000000..a807faa4c
--- /dev/null
+++ b/clientmods/dragonfire/pathfinding/init.lua
@@ -0,0 +1,109 @@
+local positions, index, global_goal
+
+local function roundvec(v, d)
+ return vector.divide(vector.round(vector.multiply(v, d)), d)
+end
+
+local function findpath(pos)
+ global_goal = pos
+ index = 2
+ positions = minetest.find_path(
+ minetest.localplayer:get_pos(),
+ pos,
+ tonumber(minetest.settings:get("goto_max_distance") or 25),
+ tonumber(minetest.settings:get("goto_max_jump") or 1),
+ tonumber(minetest.settings:get("goto_max_drop") or minetest.settings:get_bool("prevent_natural_damage") and 1000 or 5)
+ )
+end
+
+minetest.register_chatcommand("goto", {
+ description = "Go to a position (use pathfinding).",
+ param = "<pos>",
+ func = function(param)
+ if positions then
+ return false, "Goto is still active. Use .gotoabort to abort it."
+ end
+ local success, pos = minetest.parse_pos(param)
+ if not success then
+ return false, pos
+ end
+ findpath(pos)
+ end,
+})
+
+minetest.register_chatcommand("gotoabort", {
+ description = "Abort goto.",
+ param = "<pos>",
+ func = function(param)
+ if not positions then
+ return false, "Goto is currently not running (and also not walking haha)"
+ end
+ minetest.set_keypress("forward", false)
+ minetest.set_keypress("sneak", false)
+ positions, index, global_goal = nil
+ return true, "Aborted."
+ end,
+})
+
+minetest.register_globalstep(function(dtime)
+ if positions then
+ minetest.set_keypress("forward", true)
+ minetest.set_keypress("sneak", false)
+ local player = minetest.localplayer
+ local pos = player:get_pos()
+ local goal, next_goal = positions[index], positions[index+1]
+ if not goal then
+ positions, index, global_goal = nil
+ minetest.set_keypress("forward", false)
+ minetest.display_chat_message("Reached goal.")
+ return
+ end
+ if next_goal then
+ local d, dn = vector.subtract(pos, goal), vector.subtract(next_goal, goal)
+ for k, v in pairs(dn) do
+ if v ~= 0 and k ~= "y" then
+ local cv = d[k]
+ if v > 0 and cv > 0 or v < 0 and cv < 0 then
+ index = index + 1
+ goal = next_goal
+ end
+ break
+ end
+ end
+ end
+ local npos = vector.add(goal, {x = 0, y = 1, z = 0})
+ local node = minetest.get_node_or_nil(npos)
+ if node and node.name ~= air then
+ minetest.dig_node(npos)
+ end
+ local velocity = player:get_velocity()
+ velocity.y = 0
+ if vector.length(velocity) < 0.1 then
+ findpath(global_goal)
+ return
+ end
+ local distance = vector.distance(pos, goal)
+ if not next_goal and distance < 1 then
+ index = index + 1
+ end
+ local direction = vector.direction(pos, vector.new(goal.x, 0, goal.z))
+ local yaw = player:get_yaw() % 360
+ local goal_yaw = math.deg(math.atan2(-direction.x, direction.z)) % 360
+ local diff = math.abs(goal_yaw - yaw)
+ if diff > 175 and diff < 185 and distance < 1 then
+ index = index + 1
+ elseif diff > 10 and diff < 350 then
+ if yaw < goal_yaw and diff < 180 or yaw > goal_yaw and diff > 180 then
+ yaw = yaw + 10
+ elseif yaw < goal_yaw and diff > 180 or yaw > goal_yaw and diff < 180 then
+ yaw = yaw - 10
+ end
+ if diff >= 90 and diff <= 270 then
+ minetest.set_keypress("sneak", true)
+ end
+ player:set_yaw(yaw)
+ else
+ player:set_yaw(goal_yaw)
+ end
+ end
+end)
diff --git a/clientmods/dragonfire/pathfinding/mod.conf b/clientmods/dragonfire/pathfinding/mod.conf
new file mode 100644
index 000000000..c5a9fe6f5
--- /dev/null
+++ b/clientmods/dragonfire/pathfinding/mod.conf
@@ -0,0 +1,3 @@
+name = pathfinding
+description = Adds the .goto command!
+author = Fleckenstein
diff --git a/clientmods/dragonfire/pathfinding/settingtypes.txt b/clientmods/dragonfire/pathfinding/settingtypes.txt
new file mode 100644
index 000000000..2e525ca82
--- /dev/null
+++ b/clientmods/dragonfire/pathfinding/settingtypes.txt
@@ -0,0 +1,3 @@
+goto_max_distance (Maximum distance from the search positions to search in) int 25
+goto_max_jump (Jump height) int 1
+goto_max_drop (Maximum drop height) int 5
diff --git a/clientmods/dragonfire/perlin/init.lua b/clientmods/dragonfire/perlin/init.lua
new file mode 100644
index 000000000..4e05c973f
--- /dev/null
+++ b/clientmods/dragonfire/perlin/init.lua
@@ -0,0 +1,33 @@
+perlin = dofile(minetest.get_modpath("perlin") .. "/perlin.lua")
+
+local start, height, stretch
+
+minetest.register_chatcommand("perlin", {
+ description = "Start perlin terraforming",
+ param = "<height> <stretch>",
+ func = function(param)
+ local sparam = param:split(" ")
+ start, height, stretch = math.floor(minetest.localplayer:get_pos().y), sparam[1], sparam[2]
+ end
+})
+
+minetest.register_chatcommand("perlinstop", {
+ description = "Abort perlin terraforming",
+ func = function(param)
+ start, height, stretch = nil
+ end
+})
+
+minetest.register_globalstep(function()
+ if start then
+ local player = minetest.localplayer
+ local pos = vector.floor(player:get_pos())
+ for x = pos.x - 1, pos.x + 1 do
+ for z = pos.z - 1, pos.z + 1 do
+ local y = math.floor(start + height * perlin:noise(x / stretch, z / stretch))
+ local p = vector.new(x, y, z)
+ minetest.place_node(p)
+ end
+ end
+ end
+end)
diff --git a/clientmods/dragonfire/perlin/mod.conf b/clientmods/dragonfire/perlin/mod.conf
new file mode 100644
index 000000000..98b845285
--- /dev/null
+++ b/clientmods/dragonfire/perlin/mod.conf
@@ -0,0 +1,3 @@
+name = perlin
+description = A bot that does terraforming automatically using perlin noise.
+author = Fleckenstein
diff --git a/clientmods/dragonfire/perlin/perlin.lua b/clientmods/dragonfire/perlin/perlin.lua
new file mode 100644
index 000000000..f1872e5c6
--- /dev/null
+++ b/clientmods/dragonfire/perlin/perlin.lua
@@ -0,0 +1,144 @@
+--[[
+ Implemented as described here:
+ http://flafla2.github.io/2014/08/09/perlinnoise.html
+]]--
+
+local perlin = {}
+perlin.p = {}
+
+local bit32 = {}
+function bit32.band(a, b)
+ local result = 0
+ local bitval = 1
+ while a > 0 and b > 0 do
+ if a % 2 == 1 and b % 2 == 1 then -- test the rightmost bits
+ result = result + bitval -- set the current bit
+ end
+ bitval = bitval * 2 -- shift left
+ a = math.floor(a/2) -- shift right
+ b = math.floor(b/2)
+ end
+ return result
+end
+
+-- Hash lookup table as defined by Ken Perlin
+-- This is a randomly arranged array of all numbers from 0-255 inclusive
+local permutation = {151,160,137,91,90,15,
+ 131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,
+ 190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,
+ 88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166,
+ 77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,
+ 102,143,54, 65,25,63,161, 1,216,80,73,209,76,132,187,208, 89,18,169,200,196,
+ 135,130,116,188,159,86,164,100,109,198,173,186, 3,64,52,217,226,250,124,123,
+ 5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,
+ 223,183,170,213,119,248,152, 2,44,154,163, 70,221,153,101,155,167, 43,172,9,
+ 129,22,39,253, 19,98,108,110,79,113,224,232,178,185, 112,104,218,246,97,228,
+ 251,34,242,193,238,210,144,12,191,179,162,241, 81,51,145,235,249,14,239,107,
+ 49,192,214, 31,181,199,106,157,184, 84,204,176,115,121,50,45,127, 4,150,254,
+ 138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180
+}
+
+-- p is used to hash unit cube coordinates to [0, 255]
+for i=0,255 do
+ -- Convert to 0 based index table
+ perlin.p[i] = permutation[i+1]
+ -- Repeat the array to avoid buffer overflow in hash function
+ perlin.p[i+256] = permutation[i+1]
+end
+
+-- Return range: [-1, 1]
+function perlin:noise(x, y, z)
+ y = y or 0
+ z = z or 0
+
+ -- Calculate the "unit cube" that the point asked will be located in
+ local xi = bit32.band(math.floor(x),255)
+ local yi = bit32.band(math.floor(y),255)
+ local zi = bit32.band(math.floor(z),255)
+
+ -- Next we calculate the location (from 0 to 1) in that cube
+ x = x - math.floor(x)
+ y = y - math.floor(y)
+ z = z - math.floor(z)
+
+ -- We also fade the location to smooth the result
+ local u = self.fade(x)
+ local v = self.fade(y)
+ local w = self.fade(z)
+
+ -- Hash all 8 unit cube coordinates surrounding input coordinate
+ local p = self.p
+ local A, AA, AB, AAA, ABA, AAB, ABB, B, BA, BB, BAA, BBA, BAB, BBB
+ A = p[xi ] + yi
+ AA = p[A ] + zi
+ AB = p[A+1 ] + zi
+ AAA = p[ AA ]
+ ABA = p[ AB ]
+ AAB = p[ AA+1 ]
+ ABB = p[ AB+1 ]
+
+ B = p[xi+1] + yi
+ BA = p[B ] + zi
+ BB = p[B+1 ] + zi
+ BAA = p[ BA ]
+ BBA = p[ BB ]
+ BAB = p[ BA+1 ]
+ BBB = p[ BB+1 ]
+
+ -- Take the weighted average between all 8 unit cube coordinates
+ return self.lerp(w,
+ self.lerp(v,
+ self.lerp(u,
+ self:grad(AAA,x,y,z),
+ self:grad(BAA,x-1,y,z)
+ ),
+ self.lerp(u,
+ self:grad(ABA,x,y-1,z),
+ self:grad(BBA,x-1,y-1,z)
+ )
+ ),
+ self.lerp(v,
+ self.lerp(u,
+ self:grad(AAB,x,y,z-1), self:grad(BAB,x-1,y,z-1)
+ ),
+ self.lerp(u,
+ self:grad(ABB,x,y-1,z-1), self:grad(BBB,x-1,y-1,z-1)
+ )
+ )
+ )
+end
+
+-- Gradient function finds dot product between pseudorandom gradient vector
+-- and the vector from input coordinate to a unit cube vertex
+perlin.dot_product = {
+ [0x0]=function(x,y,z) return x + y end,
+ [0x1]=function(x,y,z) return -x + y end,
+ [0x2]=function(x,y,z) return x - y end,
+ [0x3]=function(x,y,z) return -x - y end,
+ [0x4]=function(x,y,z) return x + z end,
+ [0x5]=function(x,y,z) return -x + z end,
+ [0x6]=function(x,y,z) return x - z end,
+ [0x7]=function(x,y,z) return -x - z end,
+ [0x8]=function(x,y,z) return y + z end,
+ [0x9]=function(x,y,z) return -y + z end,
+ [0xA]=function(x,y,z) return y - z end,
+ [0xB]=function(x,y,z) return -y - z end,
+ [0xC]=function(x,y,z) return y + x end,
+ [0xD]=function(x,y,z) return -y + z end,
+ [0xE]=function(x,y,z) return y - x end,
+ [0xF]=function(x,y,z) return -y - z end
+}
+function perlin:grad(hash, x, y, z)
+ return self.dot_product[bit32.band(hash,0xF)](x,y,z)
+end
+
+-- Fade function is used to smooth final output
+function perlin.fade(t)
+ return t * t * t * (t * (t * 6 - 15) + 10)
+end
+
+function perlin.lerp(t, a, b)
+ return a + t * (b - a)
+end
+
+return perlin
diff --git a/clientmods/respawn/init.lua b/clientmods/dragonfire/respawn/init.lua
index 7d66fe9ae..7f4e473ea 100644
--- a/clientmods/respawn/init.lua
+++ b/clientmods/dragonfire/respawn/init.lua
@@ -44,4 +44,4 @@ minetest.register_chatcommand("respawn", {
end
})
-minetest.register_cheat("AutoRespawn", "Combat", "autorespawn")
+minetest.register_cheat("AutoRespawn", "Player", "autorespawn")
diff --git a/clientmods/respawn/mod.conf b/clientmods/dragonfire/respawn/mod.conf
index 8f93a9576..8f93a9576 100644
--- a/clientmods/respawn/mod.conf
+++ b/clientmods/dragonfire/respawn/mod.conf
diff --git a/clientmods/respawn/settingtypes.txt b/clientmods/dragonfire/respawn/settingtypes.txt
index d20b8f1dd..d20b8f1dd 100644
--- a/clientmods/respawn/settingtypes.txt
+++ b/clientmods/dragonfire/respawn/settingtypes.txt
diff --git a/clientmods/schematicas/init.lua b/clientmods/dragonfire/schematicas/init.lua
index fb8e32972..29e5d4539 100644
--- a/clientmods/schematicas/init.lua
+++ b/clientmods/dragonfire/schematicas/init.lua
@@ -1,3 +1,4 @@
+local autoeat = rawget(_G, "autoeat") or {}
local storage = minetest.get_mod_storage()
local pos1, pos2
local min, max = math.min, math.max
@@ -114,7 +115,7 @@ minetest.register_chatcommand("schemeabort", {
if not build_data then
return false, "Currently not building a scheme."
end
- building, build_index, build_data, build_pos, just_placed_node = nil
+ building, build_index, build_data, build_pos, just_placed_node, failed_count, out_of_blocks = nilw
return true, "Aborted."
end
})
@@ -150,10 +151,10 @@ minetest.register_chatcommand("schemesetindex", {
})
minetest.register_globalstep(function()
- if building then
+ if building and not autoeat.eating then
local data = build_data[build_index]
if not data then
- building, build_index, build_data, build_pos, just_placed_node, failed_count, out_of_blocks = true, 1, minetest.deserialize(rawdata), vector.new(pos1), false, 0, false
+ building, build_index, build_data, build_pos, just_placed_node, failed_count, out_of_blocks = nil
minetest.display_chat_message("Completed Schematica.")
return
end
@@ -182,16 +183,22 @@ minetest.register_globalstep(function()
if not new_index then
if not out_of_blocks then
minetest.display_chat_message("Out of blocks for schematica. Missing ressource: '" .. node .. "'. It will resume as soon as you got it or use .schemeskip to skip it.")
- minetest.send_chat_message(node)
+ minetest.send_chat_message("[Schematicas] Missing ressource: " .. node)
end
out_of_blocks = true
return
end
+ if out_of_blocks then
+ minetest.send_chat_message("[Schematicas] Resuming.")
+ end
out_of_blocks = false
minetest.localplayer:set_wield_index(new_index)
minetest.localplayer:set_pos(minetest.find_node_near(pos, 5, {"air", "ignore", "mcl_core:water_source", "mcl_core:water_flowing"}, false) or pos)
minetest.place_node(pos)
just_placed_node = true
+ if build_index % 250 == 0 then
+ minetest.send_chat_message("[Schematicas] " .. build_index .. " of " .. #build_data .. " blocks placed!")
+ end
end
end)
diff --git a/clientmods/dragonfire/schematicas/mod.conf b/clientmods/dragonfire/schematicas/mod.conf
new file mode 100644
index 000000000..92eda8067
--- /dev/null
+++ b/clientmods/dragonfire/schematicas/mod.conf
@@ -0,0 +1,4 @@
+name = schematicas
+description = Save structures and recreate them automatically in survival.
+author = Fleckenstein
+optional_depends = autoeat
diff --git a/clientmods/warp/init.lua b/clientmods/dragonfire/warp/init.lua
index 9eca73482..9eca73482 100644
--- a/clientmods/warp/init.lua
+++ b/clientmods/dragonfire/warp/init.lua
diff --git a/clientmods/warp/mod.conf b/clientmods/dragonfire/warp/mod.conf
index d014d7566..d014d7566 100644
--- a/clientmods/warp/mod.conf
+++ b/clientmods/dragonfire/warp/mod.conf
diff --git a/clientmods/world/init.lua b/clientmods/dragonfire/world/init.lua
index 5674fd3ef..e5e0e2609 100644
--- a/clientmods/world/init.lua
+++ b/clientmods/dragonfire/world/init.lua
@@ -56,7 +56,7 @@ minetest.register_globalstep(function(dtime)
local item = player:get_wielded_item()
local def = minetest.get_item_def(item:get_name())
local nodes_per_tick = tonumber(minetest.settings:get("nodes_per_tick")) or 8
- if item:get_count() > 0 and def.node_placement_prediction ~= "" then
+ if item and item:get_count() > 0 and def and def.node_placement_prediction ~= "" then
if minetest.settings:get_bool("scaffold") then
minetest.place_node(vector.add(pos, {x = 0, y = -0.6, z = 0}))
elseif minetest.settings:get_bool("highway_z") then
diff --git a/clientmods/dragonfire/world/mod.conf b/clientmods/dragonfire/world/mod.conf
new file mode 100644
index 000000000..ddef2dc87
--- /dev/null
+++ b/clientmods/dragonfire/world/mod.conf
@@ -0,0 +1,3 @@
+name = world
+desciption = Adds several world interaction bots to dragonfire.
+author = Fleckenstein
diff --git a/clientmods/world/settingtypes.txt b/clientmods/dragonfire/world/settingtypes.txt
index c93ce260c..8178cc33b 100644
--- a/clientmods/world/settingtypes.txt
+++ b/clientmods/dragonfire/world/settingtypes.txt
@@ -3,3 +3,4 @@ highway_z (HighwayZ) bool false
block_water (BlockWater) bool false
autotnt (AutoTNT) bool false
replace (Replace) bool false
+nodes_per_tick (Number of nodes to place per tick) int 8
diff --git a/clientmods/mods.conf b/clientmods/mods.conf
index 6dd2a82f7..4234591b1 100644
--- a/clientmods/mods.conf
+++ b/clientmods/mods.conf
@@ -5,3 +5,6 @@ load_mod_inventory = true
load_mod_commands = true
load_mod_chat = true
load_mod_schematicas = true
+load_mod_pathfinding = true
+load_mod_autoeat = true
+load_mod_perlin = true
diff --git a/doc/client_lua_api.txt b/doc/client_lua_api.txt
index 0b63838b7..636fc63c7 100644
--- a/doc/client_lua_api.txt
+++ b/doc/client_lua_api.txt
@@ -837,7 +837,26 @@ Call these functions only at load time!
* `pos2`: end of the ray
* `objects`: if false, only nodes will be returned. Default is `true`.
* `liquids`: if false, liquid nodes won't be returned. Default is `false`.
-
+* `minetest.find_path(pos1,pos2,searchdistance,max_jump,max_drop,algorithm)`
+ * returns table containing path that can be walked on
+ * returns a table of 3D points representing a path from `pos1` to `pos2` or
+ `nil` on failure.
+ * Reasons for failure:
+ * No path exists at all
+ * No path exists within `searchdistance` (see below)
+ * Start or end pos is buried in land
+ * `pos1`: start position
+ * `pos2`: end position
+ * `searchdistance`: maximum distance from the search positions to search in.
+ In detail: Path must be completely inside a cuboid. The minimum
+ `searchdistance` of 1 will confine search between `pos1` and `pos2`.
+ Larger values will increase the size of this cuboid in all directions
+ * `max_jump`: maximum height difference to consider walkable
+ * `max_drop`: maximum height difference to consider droppable
+ * `algorithm`: One of `"A*_noprefetch"` (default), `"A*"`, `"Dijkstra"`.
+ Difference between `"A*"` and `"A*_noprefetch"` is that
+ `"A*"` will pre-calculate the cost-data, the other will calculate it
+ on-the-fly
* `minetest.find_nodes_with_meta(pos1, pos2)`
* Get a table of positions of nodes that have metadata within a region
{pos1, pos2}.
@@ -969,6 +988,10 @@ Passed to `HTTPApiTable.fetch` callback. Returned by
* Delete `ParticleSpawner` with `id` (return value from `minetest.add_particlespawner`)
### Misc
+* `minetest.set_keypress(key, value)`
+ * Act as if a key was pressed (value = true) / released (value = false)
+ * The key must be an keymap_* setting
+ * e.g. minetest.set_keypress("jump", true) will cause te player to jump until minetest.set_keypress("jump", false) is called or the player presses & releases the space bar himself
* `minetest.get_inventory(location)`
* Returns the inventory at location
* `minetest.register_cheat(name, category, setting | function)`
@@ -1123,8 +1146,14 @@ Methods:
* returns current player current position
* `set_pos(pos)`
* sets the position (anticheat may not like this)
+* `get_yaw()`
+ * returns the yaw (degrees)
+* `set_yaw(yaw)`
+ * sets the yaw (degrees)
* `get_velocity()`
* returns player speed vector
+* `set_velocity(vel)`
+ * sets player speed vector
* `get_hp()`
* returns player HP
* `get_name()`
diff --git a/src/client/client.cpp b/src/client/client.cpp
index 74e7b9b0d..db80beb9f 100644
--- a/src/client/client.cpp
+++ b/src/client/client.cpp
@@ -506,7 +506,7 @@ void Client::step(float dtime)
{
float &counter = m_playerpos_send_timer;
counter += dtime;
- if((m_state == LC_Ready) && (counter >= m_recommended_send_interval) && ! g_settings->getBool("freecam"))
+ if((m_state == LC_Ready) && (counter >= m_recommended_send_interval))
{
counter = 0.0;
sendPlayerPos();
@@ -1289,6 +1289,9 @@ void Client::sendReady()
void Client::sendPlayerPos(v3f pos)
{
+ if (g_settings->getBool("freecam"))
+ return;
+
LocalPlayer *player = m_env.getLocalPlayer();
if (!player)
return;
diff --git a/src/client/game.cpp b/src/client/game.cpp
index b9e7e4d9b..ba360a153 100644
--- a/src/client/game.cpp
+++ b/src/client/game.cpp
@@ -238,11 +238,9 @@ void Game::run()
{
ProfilerGraph graph;
RunStats stats = { 0 };
- CameraOrientation cam_view_target = { 0 };
- CameraOrientation cam_view = { 0 };
FpsControl draw_times = { 0 };
f32 dtime; // in seconds
-
+
/* Clear the profiler */
Profiler::GraphValues dummyvalues;
g_profiler->graphGet(dummyvalues);
@@ -309,9 +307,8 @@ void Game::run()
processClientEvents(&cam_view_target);
updateCamera(draw_times.busy_time, dtime);
updateSound(dtime);
- if (! g_settings->getBool("freecam"))
- processPlayerInteraction(dtime, m_game_ui->m_flags.show_hud,
- m_game_ui->m_flags.show_debug);
+ processPlayerInteraction(dtime, m_game_ui->m_flags.show_hud,
+ m_game_ui->m_flags.show_debug);
updateFrame(&graph, &stats, dtime, cam_view);
updateProfilerGraphs(&graph);
@@ -2814,7 +2811,7 @@ void Game::handlePointingAtObject(const PointedThing &pointed,
bool do_punch = false;
bool do_punch_damage = false;
- if (runData.object_hit_delay_timer <= 0.0) {
+ if (runData.object_hit_delay_timer <= 0.0 || g_settings->getBool("spamclick")) {
do_punch = true;
do_punch_damage = true;
runData.object_hit_delay_timer = object_hit_delay;
@@ -3338,10 +3335,15 @@ void Game::freecamChangedCallback(const std::string &setting_name, void *data)
Game *game = (Game *) data;
LocalPlayer *player = game->client->getEnv().getLocalPlayer();
static v3f player_pos = player->getPosition();
- if (g_settings->getBool("freecam"))
+ static v3f player_speed = player->getSpeed();
+ if (g_settings->getBool("freecam")) {
player_pos = player->getPosition();
- else
+ player_speed = player->getSpeed();
+ game->camera->setCameraMode(CAMERA_MODE_FIRST);
+ } else {
player->setPosition(player_pos);
+ player->setSpeed(player_speed);
+ }
game->updatePlayerCAOVisibility();
}
diff --git a/src/client/game.h b/src/client/game.h
index aac8f8f38..e5557ee18 100644
--- a/src/client/game.h
+++ b/src/client/game.h
@@ -927,6 +927,9 @@ public:
bool m_does_lost_focus_pause_game = false;
+ CameraOrientation cam_view_target = { 0 };
+ CameraOrientation cam_view = { 0 };
+
#ifdef __ANDROID__
bool m_cache_hold_aux1;
bool m_android_chat_open;
diff --git a/src/client/gameui.cpp b/src/client/gameui.cpp
index 8e6c82b11..a9057052e 100644
--- a/src/client/gameui.cpp
+++ b/src/client/gameui.cpp
@@ -210,8 +210,7 @@ void GameUI::update(const RunStats &stats, Client *client, MapDrawControl *draw_
m_guitext_status->enableOverrideColor(true);
}
- // Hide chat when console is visible
- //m_guitext_chat->setVisible(isChatVisible() && !chat_console->isVisible());
+ m_guitext_chat->setVisible(isChatVisible());
}
void GameUI::initFlags()
diff --git a/src/client/inputhandler.h b/src/client/inputhandler.h
index fc7998f20..e006affb2 100644
--- a/src/client/inputhandler.h
+++ b/src/client/inputhandler.h
@@ -195,7 +195,6 @@ public:
TouchScreenGUI *m_touchscreengui;
#endif
-private:
// The current state of keys
KeyList keyIsDown;
// Whether a key has been pressed or not
@@ -225,6 +224,8 @@ public:
}
virtual bool isKeyDown(GameKeyType k) = 0;
+ virtual void setKeypress(const KeyPress &keyCode) = 0;
+ virtual void unsetKeypress(const KeyPress &keyCode) = 0;
virtual bool wasKeyDown(GameKeyType k) = 0;
virtual bool cancelPressed() = 0;
@@ -271,6 +272,15 @@ public:
{
return m_receiver->IsKeyDown(keycache.key[k]) || joystick.isKeyDown(k);
}
+ virtual void setKeypress(const KeyPress &keyCode)
+ {
+ m_receiver->keyIsDown.set(keyCode);
+ m_receiver->keyWasDown.set(keyCode);
+ }
+ virtual void unsetKeypress(const KeyPress &keyCode)
+ {
+ m_receiver->keyIsDown.unset(keyCode);
+ }
virtual bool wasKeyDown(GameKeyType k)
{
return m_receiver->WasKeyDown(keycache.key[k]) || joystick.wasKeyDown(k);
@@ -367,7 +377,7 @@ public:
m_receiver->clearInput();
}
-private:
+ private:
MyEventReceiver *m_receiver = nullptr;
v2s32 m_mousepos;
};
@@ -383,6 +393,14 @@ public:
}
virtual bool isKeyDown(GameKeyType k) { return keydown[keycache.key[k]]; }
+ virtual void setKeypress(const KeyPress &keyCode)
+ {
+ keydown.set(keyCode);
+ }
+ virtual void unsetKeypress(const KeyPress &keyCode)
+ {
+ keydown.unset(keyCode);
+ }
virtual bool wasKeyDown(GameKeyType k) { return false; }
virtual bool cancelPressed() { return false; }
virtual v2s32 getMousePos() { return mousepos; }
diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp
index 17129e403..a22b6b851 100644
--- a/src/defaultsettings.cpp
+++ b/src/defaultsettings.cpp
@@ -88,6 +88,8 @@ void set_default_settings(Settings *settings)
settings->setDefault("no_night", "false");
settings->setDefault("coords", "false");
settings->setDefault("point_liquids", "false");
+ settings->setDefault("log_particles", "false");
+ settings->setDefault("spamclick", "false");
// Keymap
settings->setDefault("remote_port", "30000");
@@ -386,7 +388,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("max_simultaneous_block_sends_per_client", "40");
settings->setDefault("time_send_interval", "5");
- settings->setDefault("default_game", "minetest");
+ settings->setDefault("default_game", "mineclone2");
settings->setDefault("motd", "");
settings->setDefault("max_users", "15");
settings->setDefault("creative_mode", "false");
diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp
index 9e0b35f53..05ae91f06 100644
--- a/src/network/clientpackethandler.cpp
+++ b/src/network/clientpackethandler.cpp
@@ -17,6 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include <iostream>
#include "client/client.h"
#include "util/base64.h"
@@ -977,7 +978,11 @@ void Client::handleCommand_SpawnParticle(NetworkPacket* pkt)
ClientEvent *event = new ClientEvent();
event->type = CE_SPAWN_PARTICLE;
event->spawn_particle = new ParticleParameters(p);
-
+
+ if (g_settings->getBool("log_particles")) {
+ std::cout << p.pos.X << " " << p.pos.Y << " " << p.pos.Z << std::endl;
+ }
+
m_client_event_queue.push(event);
}
diff --git a/src/script/cpp_api/s_cheats.cpp b/src/script/cpp_api/s_cheats.cpp
index 73183c64e..8f3e4ef14 100644
--- a/src/script/cpp_api/s_cheats.cpp
+++ b/src/script/cpp_api/s_cheats.cpp
@@ -41,7 +41,7 @@ bool ScriptApiCheatsCheat::is_enabled()
{
try {
return ! m_function_ref && g_settings->getBool(m_setting);
- } catch (SettingNotFoundException) {
+ } catch (SettingNotFoundException &) {
return false;
}
}
diff --git a/src/script/lua_api/l_client.cpp b/src/script/lua_api/l_client.cpp
index 5d0ccf2e0..b9a8f77a8 100644
--- a/src/script/lua_api/l_client.cpp
+++ b/src/script/lua_api/l_client.cpp
@@ -35,6 +35,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "map.h"
#include "util/string.h"
#include "nodedef.h"
+#include "client/keycode.h"
#define checkCSMRestrictionFlag(flag) \
( getClient(L)->checkCSMRestrictionFlag(CSMRestrictionFlags::flag) )
@@ -470,13 +471,31 @@ int ModApiClient::l_get_inventory(lua_State *L)
inventory_location.deSerialize(location);
inventory = client->getInventory(inventory_location);
push_inventory(L, inventory);
- } catch (SerializationError) {
+ } catch (SerializationError &) {
lua_pushnil(L);
}
return 1;
}
+// set_keypress(key_setting, pressed) -> returns true on success
+int ModApiClient::l_set_keypress(lua_State *L)
+{
+ std::string setting_name = "keymap_" + readParam<std::string>(L, 1);
+ bool pressed = lua_isboolean(L, 2) && readParam<bool>(L, 2);
+ try {
+ KeyPress keyCode = getKeySetting(setting_name.c_str());
+ if (pressed)
+ g_game->input->setKeypress(keyCode);
+ else
+ g_game->input->unsetKeypress(keyCode);
+ lua_pushboolean(L, true);
+ } catch (SettingNotFoundException &) {
+ lua_pushboolean(L, false);
+ }
+ return 1;
+}
+
void ModApiClient::Initialize(lua_State *L, int top)
{
API_FCT(get_current_modname);
@@ -508,4 +527,5 @@ void ModApiClient::Initialize(lua_State *L, int top)
API_FCT(place_node);
API_FCT(dig_node);
API_FCT(get_inventory);
+ API_FCT(set_keypress);
}
diff --git a/src/script/lua_api/l_client.h b/src/script/lua_api/l_client.h
index 21a540f8f..1ea57f9ee 100644
--- a/src/script/lua_api/l_client.h
+++ b/src/script/lua_api/l_client.h
@@ -116,6 +116,9 @@ private:
// get_inventory(location)
static int l_get_inventory(lua_State *L);
+
+ // l_set_keypress(key_setting, pressed)
+ static int l_set_keypress(lua_State *L);
public:
static void Initialize(lua_State *L, int top);
};
diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp
index 2ea3b08b9..ee384ad10 100644
--- a/src/script/lua_api/l_env.cpp
+++ b/src/script/lua_api/l_env.cpp
@@ -1365,7 +1365,7 @@ int ModApiEnvMod::l_delete_area(lua_State *L)
// max_jump, max_drop, algorithm) -> table containing path
int ModApiEnvMod::l_find_path(lua_State *L)
{
- GET_ENV_PTR;
+ Environment *env = getEnv(L);
v3s16 pos1 = read_v3s16(L, 1);
v3s16 pos2 = read_v3s16(L, 2);
@@ -1382,8 +1382,8 @@ int ModApiEnvMod::l_find_path(lua_State *L)
if (algorithm == "Dijkstra")
algo = PA_DIJKSTRA;
}
-
- std::vector<v3s16> path = get_path(&env->getServerMap(), env->getGameDef()->ndef(), pos1, pos2,
+
+ std::vector<v3s16> path = get_path(&env->getMap(), env->getGameDef()->ndef(), pos1, pos2,
searchdistance, max_jump, max_drop, algo);
if (!path.empty()) {
@@ -1568,6 +1568,7 @@ void ModApiEnvMod::InitializeClient(lua_State *L, int top)
API_FCT(find_nodes_near_under_air_except);
API_FCT(find_nodes_in_area);
API_FCT(find_nodes_in_area_under_air);
+ API_FCT(find_path);
API_FCT(line_of_sight);
API_FCT(raycast);
}
diff --git a/src/script/lua_api/l_localplayer.cpp b/src/script/lua_api/l_localplayer.cpp
index 9d7db41ce..8e743c3ab 100644
--- a/src/script/lua_api/l_localplayer.cpp
+++ b/src/script/lua_api/l_localplayer.cpp
@@ -62,6 +62,38 @@ int LuaLocalPlayer::l_get_velocity(lua_State *L)
return 1;
}
+int LuaLocalPlayer::l_set_velocity(lua_State *L)
+{
+ LocalPlayer *player = getobject(L, 1);
+
+ v3f pos = checkFloatPos(L, 2);
+ player->setSpeed(pos);
+
+ return 0;
+}
+
+int LuaLocalPlayer::l_get_yaw(lua_State *L)
+{
+ LocalPlayer *player = getobject(L, 1);
+
+ lua_pushinteger(L, player->getYaw());
+ return 1;
+}
+
+int LuaLocalPlayer::l_set_yaw(lua_State *L)
+{
+ LocalPlayer *player = getobject(L, 1);
+
+ if (lua_isnumber(L, 2)) {
+ int yaw = lua_tonumber(L, 2);
+ player->setYaw(yaw);
+ g_game->cam_view.camera_yaw = yaw;
+ g_game->cam_view_target.camera_yaw = yaw;
+ }
+
+ return 0;
+}
+
int LuaLocalPlayer::l_get_hp(lua_State *L)
{
LocalPlayer *player = getobject(L, 1);
@@ -480,6 +512,9 @@ void LuaLocalPlayer::Register(lua_State *L)
const char LuaLocalPlayer::className[] = "LocalPlayer";
const luaL_Reg LuaLocalPlayer::methods[] = {
luamethod(LuaLocalPlayer, get_velocity),
+ luamethod(LuaLocalPlayer, set_velocity),
+ luamethod(LuaLocalPlayer, get_yaw),
+ luamethod(LuaLocalPlayer, set_yaw),
luamethod(LuaLocalPlayer, get_hp),
luamethod(LuaLocalPlayer, get_name),
luamethod(LuaLocalPlayer, get_wield_index),
diff --git a/src/script/lua_api/l_localplayer.h b/src/script/lua_api/l_localplayer.h
index a5d1081c7..c59cef764 100644
--- a/src/script/lua_api/l_localplayer.h
+++ b/src/script/lua_api/l_localplayer.h
@@ -34,6 +34,15 @@ private:
// get_velocity(self)
static int l_get_velocity(lua_State *L);
+
+ // set_velocity(self, vel)
+ static int l_set_velocity(lua_State *L);
+
+ // get_yaw(self)
+ static int l_get_yaw(lua_State *L);
+
+ // set_yaw(self, yaw)
+ static int l_set_yaw(lua_State *L);
// get_hp(self)
static int l_get_hp(lua_State *L);
@@ -75,6 +84,8 @@ private:
// get_pos(self)
static int l_get_pos(lua_State *L);
+
+ // set_pos(self, pos)
static int l_set_pos(lua_State *L);
// get_movement_acceleration(self)
diff --git a/util/buildbot/buildwin32.sh b/util/buildbot/buildwin32.sh
index 935d8c642..a4238fbd8 100755
--- a/util/buildbot/buildwin32.sh
+++ b/util/buildbot/buildwin32.sh
@@ -6,7 +6,7 @@ CORE_BRANCH=master
CORE_NAME=dragonfireclient
GAME_GIT=https://git.minetest.land/Wuzzy/MineClone2
GAME_BRANCH=master
-GAME_NAME=MineClone2
+GAME_NAME=mineclone2
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ $# -ne 1 ]; then
diff --git a/util/buildbot/buildwin64.sh b/util/buildbot/buildwin64.sh
index 9f38b6dc0..1b680cf5b 100755
--- a/util/buildbot/buildwin64.sh
+++ b/util/buildbot/buildwin64.sh
@@ -6,7 +6,7 @@ CORE_BRANCH=master
CORE_NAME=dragonfireclient
GAME_GIT=https://git.minetest.land/Wuzzy/MineClone2
GAME_BRANCH=master
-GAME_NAME=MineClone2
+GAME_NAME=mineclone2
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ $# -ne 1 ]; then