mirror of
https://github.com/minetest-mods/i3.git
synced 2025-07-03 17:10:23 +02:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
0ab3dd5ffa | |||
7820d88a30 | |||
34841eddf3 | |||
6f588e1927 | |||
d0ff046873 |
4
API.md
4
API.md
@ -38,7 +38,7 @@ i3.new_tab {
|
|||||||
|
|
||||||
Updates the current formspec. `extra_formspec` adds an additional formspec string.
|
Updates the current formspec. `extra_formspec` adds an additional formspec string.
|
||||||
|
|
||||||
#### `i3.delete_tab(tabname)`
|
#### `i3.remove_tab(tabname)`
|
||||||
|
|
||||||
Deletes a tab by name.
|
Deletes a tab by name.
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ end)
|
|||||||
|
|
||||||
Removes all recipe filters and adds a new one.
|
Removes all recipe filters and adds a new one.
|
||||||
|
|
||||||
#### `i3.delete_recipe_filter(name)`
|
#### `i3.remove_recipe_filter(name)`
|
||||||
|
|
||||||
Removes the recipe filter with the given `name`.
|
Removes the recipe filter with the given `name`.
|
||||||
|
|
||||||
|
@ -49,4 +49,4 @@ Love this mod? Donations are appreciated: https://www.paypal.me/jpg84240
|
|||||||
|
|
||||||
Demo video (outdated): https://www.youtube.com/watch?v=25nCAaqeacU
|
Demo video (outdated): https://www.youtube.com/watch?v=25nCAaqeacU
|
||||||
|
|
||||||

|

|
||||||
|
27
init.lua
27
init.lua
@ -21,7 +21,7 @@ local compress_groups, compressed = loadfile(modpath .. "/etc/compress.lua")()
|
|||||||
local group_stereotypes, group_names = loadfile(modpath .. "/etc/groups.lua")()
|
local group_stereotypes, group_names = loadfile(modpath .. "/etc/groups.lua")()
|
||||||
|
|
||||||
local progressive_mode = core.settings:get_bool "i3_progressive_mode"
|
local progressive_mode = core.settings:get_bool "i3_progressive_mode"
|
||||||
local item_compression = core.settings:get_bool "i3_item_compression"
|
local item_compression = core.settings:get_bool("i3_item_compression", true)
|
||||||
local damage_enabled = core.settings:get_bool "enable_damage"
|
local damage_enabled = core.settings:get_bool "enable_damage"
|
||||||
|
|
||||||
local __3darmor, __skinsdb, __awards
|
local __3darmor, __skinsdb, __awards
|
||||||
@ -117,6 +117,10 @@ end
|
|||||||
local old_is_creative_enabled = core.is_creative_enabled
|
local old_is_creative_enabled = core.is_creative_enabled
|
||||||
|
|
||||||
function core.is_creative_enabled(name)
|
function core.is_creative_enabled(name)
|
||||||
|
if name == "" then
|
||||||
|
return old_is_creative_enabled(name)
|
||||||
|
end
|
||||||
|
|
||||||
return check_privs(name, {creative = true}) or old_is_creative_enabled(name)
|
return check_privs(name, {creative = true}) or old_is_creative_enabled(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -422,7 +426,7 @@ function i3.set_recipe_filter(name, f)
|
|||||||
recipe_filters = {[name] = f}
|
recipe_filters = {[name] = f}
|
||||||
end
|
end
|
||||||
|
|
||||||
function i3.delete_recipe_filter(name)
|
function i3.remove_recipe_filter(name)
|
||||||
recipe_filters[name] = nil
|
recipe_filters[name] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -583,6 +587,8 @@ local function search(data)
|
|||||||
local filters = {}
|
local filters = {}
|
||||||
|
|
||||||
if search_filter then
|
if search_filter then
|
||||||
|
search_filter = search_filter:trim()
|
||||||
|
|
||||||
for filter_name, values in gmatch(filter, sub(opt, 6)) do
|
for filter_name, values in gmatch(filter, sub(opt, 6)) do
|
||||||
if search_filters[filter_name] then
|
if search_filters[filter_name] then
|
||||||
values = split(values, ",")
|
values = split(values, ",")
|
||||||
@ -616,7 +622,18 @@ local function search(data)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
to_add = find(search_in, filter, 1, true)
|
local ok = true
|
||||||
|
|
||||||
|
for keyword in gmatch(filter, "%S+") do
|
||||||
|
if not find(search_in, keyword, 1, true) then
|
||||||
|
ok = nil
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if ok then
|
||||||
|
to_add = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if to_add then
|
if to_add then
|
||||||
@ -2207,9 +2224,9 @@ function i3.get_tabs()
|
|||||||
return tabs
|
return tabs
|
||||||
end
|
end
|
||||||
|
|
||||||
function i3.delete_tab(tabname)
|
function i3.remove_tab(tabname)
|
||||||
if not true_str(tabname) then
|
if not true_str(tabname) then
|
||||||
return err "i3.delete_tab: tab name missing"
|
return err "i3.remove_tab: tab name missing"
|
||||||
end
|
end
|
||||||
|
|
||||||
for i, def in ipairs(tabs) do
|
for i, def in ipairs(tabs) do
|
||||||
|
Reference in New Issue
Block a user