mirror of
https://github.com/minetest-mods/i3.git
synced 2024-12-24 01:40:38 +01:00
Add max_waypoints setting
This commit is contained in:
parent
5e8ecf9903
commit
e3941a7b71
1
init.lua
1
init.lua
@ -25,6 +25,7 @@ i3 = {
|
||||
settings = {
|
||||
debug_mode = false,
|
||||
max_favs = 6,
|
||||
max_waypoints = 30,
|
||||
min_fs_version = 4,
|
||||
item_btn_size = 1.1,
|
||||
drop_bag_on_die = true,
|
||||
|
@ -174,12 +174,19 @@ local function inv_fields(player, data, fields)
|
||||
return
|
||||
|
||||
elseif fields.waypoint_add then
|
||||
local max_waypoints = i3.settings.max_waypoints
|
||||
|
||||
if #data.waypoints >= max_waypoints then
|
||||
play_sound(name, "i3_cannot", 0.8)
|
||||
return msg(name, fmt("Waypoints limit reached (%u)", max_waypoints))
|
||||
end
|
||||
|
||||
local pos = player:get_pos()
|
||||
|
||||
for _, v in ipairs(data.waypoints) do
|
||||
if vec_eq(vec_round(pos), vec_round(str_to_pos(v.pos))) then
|
||||
play_sound(name, "i3_cannot", 0.8)
|
||||
return msg(name, "You already set a waypoint at this position")
|
||||
return msg(name, S"You already set a waypoint at this position")
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user