mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-12-26 03:07:32 +01:00
Add unprintable escape char to creative search
This commit is contained in:
parent
5c61d0dd19
commit
53802c3da2
@ -30,48 +30,48 @@ local function set_inv(filter, player)
|
|||||||
local is_weapon = function(def)
|
local is_weapon = function(def)
|
||||||
return def.groups.weapon or def.groups.weapon_ranged or def.groups.ammo or def.groups.armor_head or def.groups.armor_torso or def.groups.armor_legs or def.groups.armor_feet
|
return def.groups.weapon or def.groups.weapon_ranged or def.groups.ammo or def.groups.armor_head or def.groups.armor_torso or def.groups.armor_legs or def.groups.armor_feet
|
||||||
end
|
end
|
||||||
if filter == "#blocks" then
|
if filter == "\0blocks" then
|
||||||
if def.groups.building_block then
|
if def.groups.building_block then
|
||||||
table.insert(creative_list, name)
|
table.insert(creative_list, name)
|
||||||
end
|
end
|
||||||
elseif filter == "#deco" then
|
elseif filter == "\0deco" then
|
||||||
if def.groups.deco_block then
|
if def.groups.deco_block then
|
||||||
table.insert(creative_list, name)
|
table.insert(creative_list, name)
|
||||||
end
|
end
|
||||||
elseif filter == "#redstone" then
|
elseif filter == "\0redstone" then
|
||||||
if is_redstone(def) then
|
if is_redstone(def) then
|
||||||
table.insert(creative_list, name)
|
table.insert(creative_list, name)
|
||||||
end
|
end
|
||||||
elseif filter == "#rail" then
|
elseif filter == "\0rail" then
|
||||||
if def.groups.transport then
|
if def.groups.transport then
|
||||||
table.insert(creative_list, name)
|
table.insert(creative_list, name)
|
||||||
end
|
end
|
||||||
elseif filter == "#food" then
|
elseif filter == "\0food" then
|
||||||
if def.groups.food or def.groups.eatable then
|
if def.groups.food or def.groups.eatable then
|
||||||
table.insert(creative_list, name)
|
table.insert(creative_list, name)
|
||||||
end
|
end
|
||||||
elseif filter == "#tools" then
|
elseif filter == "\0tools" then
|
||||||
if is_tool(def) then
|
if is_tool(def) then
|
||||||
table.insert(creative_list, name)
|
table.insert(creative_list, name)
|
||||||
end
|
end
|
||||||
elseif filter == "#combat" then
|
elseif filter == "\0combat" then
|
||||||
if is_weapon(def) then
|
if is_weapon(def) then
|
||||||
table.insert(creative_list, name)
|
table.insert(creative_list, name)
|
||||||
end
|
end
|
||||||
elseif filter == "#brew" then
|
elseif filter == "\0brew" then
|
||||||
if def.groups.brewitem then
|
if def.groups.brewitem then
|
||||||
table.insert(creative_list, name)
|
table.insert(creative_list, name)
|
||||||
end
|
end
|
||||||
elseif filter == "#matr" then
|
elseif filter == "\0matr" then
|
||||||
if def.groups.craftitem then
|
if def.groups.craftitem then
|
||||||
table.insert(creative_list, name)
|
table.insert(creative_list, name)
|
||||||
end
|
end
|
||||||
elseif filter == "#misc" then
|
elseif filter == "\0misc" then
|
||||||
if not def.groups.building_block and not def.groups.deco_block and not is_redstone(def) and not def.groups.transport and not def.groups.food and not def.groups.eatable and not is_tool(def) and not is_weapon(def) and not def.groups.craftitem and not def.groups.brewitem then
|
if not def.groups.building_block and not def.groups.deco_block and not is_redstone(def) and not def.groups.transport and not def.groups.food and not def.groups.eatable and not is_tool(def) and not is_weapon(def) and not def.groups.craftitem and not def.groups.brewitem then
|
||||||
|
|
||||||
table.insert(creative_list, name)
|
table.insert(creative_list, name)
|
||||||
end
|
end
|
||||||
elseif filter == "#all" then
|
elseif filter == "\0all" then
|
||||||
table.insert(creative_list, name)
|
table.insert(creative_list, name)
|
||||||
else --for all other
|
else --for all other
|
||||||
if string.find(string.lower(def.name), filter) or string.find(string.lower(def.description), filter) then
|
if string.find(string.lower(def.name), filter) or string.find(string.lower(def.description), filter) then
|
||||||
@ -120,7 +120,7 @@ local function init()
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
set_inv("#all")
|
set_inv("\0all")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Create the trash field
|
-- Create the trash field
|
||||||
@ -311,42 +311,42 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
minetest.log("error", "NONAME")
|
minetest.log("error", "NONAME")
|
||||||
end
|
end
|
||||||
if fields.blocks then
|
if fields.blocks then
|
||||||
set_inv("#blocks",player)
|
set_inv("\0blocks",player)
|
||||||
page = "blocks"
|
page = "blocks"
|
||||||
elseif fields.deco then
|
elseif fields.deco then
|
||||||
set_inv("#deco",player)
|
set_inv("\0deco",player)
|
||||||
page = "deco"
|
page = "deco"
|
||||||
elseif fields.redstone then
|
elseif fields.redstone then
|
||||||
set_inv("#redstone",player)
|
set_inv("\0redstone",player)
|
||||||
page = "redstone"
|
page = "redstone"
|
||||||
elseif fields.rail then
|
elseif fields.rail then
|
||||||
set_inv("#rail",player)
|
set_inv("\0rail",player)
|
||||||
page = "rail"
|
page = "rail"
|
||||||
elseif fields.misc then
|
elseif fields.misc then
|
||||||
set_inv("#misc",player)
|
set_inv("\0misc",player)
|
||||||
page = "misc"
|
page = "misc"
|
||||||
elseif fields.nix then
|
elseif fields.nix then
|
||||||
set_inv("#all",player)
|
set_inv("\0all",player)
|
||||||
page = "nix"
|
page = "nix"
|
||||||
elseif fields.food then
|
elseif fields.food then
|
||||||
set_inv("#food",player)
|
set_inv("\0food",player)
|
||||||
page = "food"
|
page = "food"
|
||||||
elseif fields.tools then
|
elseif fields.tools then
|
||||||
set_inv("#tools",player)
|
set_inv("\0tools",player)
|
||||||
page = "tools"
|
page = "tools"
|
||||||
elseif fields.combat then
|
elseif fields.combat then
|
||||||
set_inv("#combat",player)
|
set_inv("\0combat",player)
|
||||||
page = "combat"
|
page = "combat"
|
||||||
elseif fields.brew then
|
elseif fields.brew then
|
||||||
set_inv("#brew",player)
|
set_inv("\0brew",player)
|
||||||
page = "brew"
|
page = "brew"
|
||||||
elseif fields.matr then
|
elseif fields.matr then
|
||||||
set_inv("#matr",player)
|
set_inv("\0matr",player)
|
||||||
page = "matr"
|
page = "matr"
|
||||||
elseif fields.inv then
|
elseif fields.inv then
|
||||||
page = "inv"
|
page = "inv"
|
||||||
elseif fields.suche == "" then
|
elseif fields.suche == "" then
|
||||||
set_inv("#all", player)
|
set_inv("\0all", player)
|
||||||
page = "nix"
|
page = "nix"
|
||||||
elseif fields.suche ~= nil then
|
elseif fields.suche ~= nil then
|
||||||
set_inv(string.lower(fields.suche),player)
|
set_inv(string.lower(fields.suche),player)
|
||||||
|
Loading…
Reference in New Issue
Block a user