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
|
||||
|
||||
|
|
Ŝarĝante…
Reference in New Issue