Compare commits

..

52 Commits
1.1 ... 1.3.2

Author SHA1 Message Date
7e2256253d Fix skin_id in skins dropdown 2021-07-06 10:58:19 +02:00
f2cc874ec0 Some tweakings 2021-07-06 01:38:16 +02:00
5c96ede065 Add confirmation dialog on inventory clearing 2021-07-05 23:38:43 +02:00
1c4ae1df28 Outdated clients are now kicked ruthlessly without fallback 2021-07-05 22:45:32 +02:00
970220c561 Add .editorconfig 2021-07-05 03:32:31 +02:00
4ca50e846d Fix potential issue with progressive mode 2021-07-05 03:23:19 +02:00
0ab3dd5ffa Fix item compression setting (fix #27) 2021-07-04 18:19:49 +02:00
7820d88a30 Rename some API functions 2021-06-30 21:54:18 +02:00
34841eddf3 Small fix for search filters 2021-06-30 21:41:38 +02:00
6f588e1927 Searches are now additive (Google-like) 2021-06-30 21:23:58 +02:00
d0ff046873 Update screenshot again 2021-06-28 00:45:57 +02:00
996b39fb39 Update Screenshot 2021-06-27 21:00:56 +02:00
0e411d8696 Minor stuff 2021-06-27 06:26:30 +02:00
c69f45ecd8 Also compress moreblocks micronodes 2021-06-27 05:00:43 +02:00
a0eb4803d1 Another fix 2021-06-26 07:08:14 +02:00
ac4a7352fd Remove now useless search filter 2021-06-26 06:57:25 +02:00
c7987a6c72 Fix 2021-06-26 05:48:08 +02:00
b24411b189 Add tabs to item list 2021-06-26 04:43:28 +02:00
a1b2d03a71 Move some files 2021-06-26 03:10:05 +02:00
c3f050b737 Some fixes 2021-06-25 17:20:15 +02:00
00042c77e1 Add small check 2021-06-25 04:52:18 +02:00
c1bd944465 Split some code to own files 2021-06-25 04:41:31 +02:00
b1fff8617b Add Item Compression 2021-06-25 04:09:56 +02:00
c5dd2be569 Re-enable player animation when MT 5.5 is out 2021-06-20 02:29:50 +02:00
f2eb377d96 Fix potential issues 2021-06-20 02:07:39 +02:00
3b5c81cb3a Fix item loss if placed past slot 36 2021-06-20 00:07:14 +02:00
dde5148934 Show a tooltip for waypoints 2021-06-12 16:52:07 +02:00
ce9a29de80 Save player data at interval of 10 min 2021-05-31 22:46:02 +02:00
6ccfd52267 Safe teleport 2021-05-31 21:50:43 +02:00
d392f04c11 Small fix 2021-05-31 21:35:09 +02:00
978c2b23a2 Change the way metadata are saved 2021-05-31 20:48:12 +02:00
d612f8697d Prevent adding waypoint at same pos 2021-05-31 20:11:57 +02:00
2274b426a5 Do things the right way 2021-05-15 00:18:47 +02:00
612039cc26 Code cleaning 2021-05-14 03:26:50 +02:00
a98b0c08af Fix crash with pipeworks 2021-05-11 00:22:01 +02:00
e0166288c6 Hide hearts when damage ain't enabled 2021-05-09 16:56:49 +02:00
9ab92ba056 *Really* disable sfinv 2021-05-07 03:31:55 +02:00
8d55d89efe Chech another param 2021-05-07 00:33:34 +02:00
554acd002b Small cleaning 2021-05-02 19:22:45 +02:00
ca5cd92ff3 Update Screenshot 2021-05-01 20:38:20 +02:00
0c2d3a5cba Fix 2021-05-01 16:44:34 +02:00
5a36209ac9 Rename variable 2021-05-01 16:02:35 +02:00
666200df76 Change priv check for teleport 2021-05-01 04:10:30 +02:00
4bc1bfee8b Small fix 2021-05-01 02:23:56 +02:00
304f74c7a4 Fix 2021-05-01 02:02:07 +02:00
833d27975e More tweaks 2021-05-01 01:53:54 +02:00
d2d8be9f18 Properly change mode after granting/revoking creative 2021-05-01 01:07:17 +02:00
6fe9f96cad More tweaks 2021-05-01 00:48:49 +02:00
b0002eb7cf Some tweaks 2021-05-01 00:39:47 +02:00
7e648246eb Unify items list and inventory 2021-05-01 00:28:11 +02:00
f0b5eb7a18 UI improvements 2021-04-30 23:17:17 +02:00
859feb4105 Minor cleaning 2021-04-23 05:20:24 +02:00
16 changed files with 1102 additions and 579 deletions

9
.editorconfig Normal file
View File

@ -0,0 +1,9 @@
[*]
end_of_line = lf
[*.{lua,txt,md,json}]
charset = utf8
indent_size = 8
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true

View File

@ -6,7 +6,6 @@ ignore = {
read_globals = {
"minetest",
"default",
"armor",
"skins",
"awards",
@ -19,4 +18,6 @@ read_globals = {
globals = {
"i3",
"core",
"sfinv",
"unified_inventory",
}

27
API.md
View File

@ -27,12 +27,6 @@ i3.new_tab {
fields = function(player, data, fields)
end,
-- Determine if the recipe panels must be hidden or not (must return a boolean)
hide_panels = function(player, data)
local name = player:get_player_name()
return core.is_creative_enabled(name)
end,
}
```
@ -44,7 +38,7 @@ i3.new_tab {
Updates the current formspec. `extra_formspec` adds an additional formspec string.
#### `i3.delete_tab(tabname)`
#### `i3.remove_tab(tabname)`
Deletes a tab by name.
@ -147,7 +141,7 @@ Recipes can be registered from a given URL containing a JSON file (HTTP support
```Lua
i3.register_craft({
url = "https://raw.githubusercontent.com/minetest-mods/i3/main/test_online_recipe.json"
url = "https://raw.githubusercontent.com/minetest-mods/i3/main/tests/test_online_recipe.json"
})
```
@ -184,7 +178,7 @@ end)
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`.
@ -203,12 +197,12 @@ They can be used like so: `<optional_name> +<filter name>=<value1>,<value2>,<...
Example usages:
- `+groups=cracky,crumbly`: search for groups `cracky` and `crumbly` in all items.
- `wood +groups=flammable +types=node`: search for group `flammable` amongst items which contain
`wood` in their names AND have a `node` drawtype.
- `wood +groups=flammable`: search for group `flammable` amongst items which contain
`wood` in their names.
Notes:
- If `optional_name` is omitted, the search filter will apply to all items, without pre-filtering.
- The `+groups` and `+types` filters are currently implemented by default.
- The `+groups` filter is currently implemented by default.
#### `i3.add_search_filter(name, function(item, values))`
@ -243,15 +237,6 @@ Returns a map of search filters, indexed by name.
### Miscellaneous
#### `i3.group_stereotypes`
This is the table indexing the item groups by stereotypes.
You can add a stereotype like so:
```Lua
i3.group_stereotypes.radioactive = "mod:item"
```
#### `i3.export_url`
If set, the mod will export all the cached recipes and usages in a JSON format

View File

@ -18,6 +18,7 @@ This mod requires **Minetest 5.4+**
- Inventory Sorting (alphabetical + item stack compression)
- Item Bookmarks
- Waypoints
- Item List Compression (**`moreblocks`** supported)
**¹** *This mode is a Terraria-like system that shows recipes you can craft from items you ever had in your inventory.
To enable it: `i3_progressive_mode = true` in `minetest.conf`.*
@ -48,4 +49,4 @@ Love this mod? Donations are appreciated: https://www.paypal.me/jpg84240
Demo video (outdated): https://www.youtube.com/watch?v=25nCAaqeacU
![Preview](https://user-images.githubusercontent.com/7883281/115294125-7827cb80-a158-11eb-89f1-1f533621a9fe.png)
![Preview](https://user-images.githubusercontent.com/7883281/123561657-10ba7780-d7aa-11eb-8bbe-dcec348bb28c.png)

319
etc/compress.lua Normal file
View File

@ -0,0 +1,319 @@
local fmt, insert = string.format, table.insert
local wood_types = {
"acacia_wood", "aspen_wood", "junglewood", "pine_wood",
}
local material_tools = {
"bronze", "diamond", "mese", "stone", "wood",
}
local material_stairs = {
"acacia_wood", "aspen_wood", "brick", "bronzeblock", "cobble", "copperblock",
"desert_cobble", "desert_sandstone", "desert_sandstone_block", "desert_sandstone_brick",
"desert_stone", "desert_stone_block", "desert_stonebrick",
"glass", "goldblock", "ice", "junglewood", "mossycobble", "obsidian",
"obsidian_block", "obsidian_glass", "obsidianbrick", "pine_wood",
"sandstone", "sandstone_block", "sandstonebrick",
"silver_sandstone", "silver_sandstone_block", "silver_sandstone_brick",
"snowblock", "steelblock", "stone", "stone_block", "stonebrick",
"straw", "tinblock",
}
local colors = {
"black", "blue", "brown", "cyan", "dark_green", "dark_grey", "green",
"grey", "magenta", "orange", "pink", "red", "violet", "yellow",
}
local to_compress = {
["default:wood"] = {
replace = "wood",
by = wood_types,
},
["default:fence_wood"] = {
replace = "wood",
by = wood_types,
},
["default:fence_rail_wood"] = {
replace = "wood",
by = wood_types,
},
["default:mese_post_light"] = {
replace = "mese_post_light",
by = {
"mese_post_light_acacia",
"mese_post_light_aspen_wood",
"mese_post_light_junglewood",
"mese_post_light_pine_wood",
}
},
["doors:gate_wood_closed"] = {
replace = "wood",
by = wood_types,
},
["wool:white"] = {
replace = "white",
by = colors
},
["dye:white"] = {
replace = "white",
by = colors
},
["default:axe_steel"] = {
replace = "steel",
by = material_tools
},
["default:pick_steel"] = {
replace = "steel",
by = material_tools
},
["default:shovel_steel"] = {
replace = "steel",
by = material_tools
},
["default:sword_steel"] = {
replace = "steel",
by = material_tools
},
["farming:hoe_steel"] = {
replace = "steel",
by = {"wood", "stone"}
},
["stairs:slab_wood"] = {
replace = "wood",
by = material_stairs
},
["stairs:stair_wood"] = {
replace = "wood",
by = material_stairs
},
["stairs:stair_inner_wood"] = {
replace = "wood",
by = material_stairs
},
["stairs:stair_outer_wood"] = {
replace = "wood",
by = material_stairs
},
["walls:cobble"] = {
replace = "cobble",
by = {"desertcobble", "mossycobble"}
},
}
local circular_saw_names = {
{"micro", "_1"},
{"panel", "_1"},
{"micro", "_2"},
{"panel", "_2"},
{"micro", "_4"},
{"panel", "_4"},
{"micro", ""},
{"panel", ""},
{"micro", "_12"},
{"panel", "_12"},
{"micro", "_14"},
{"panel", "_14"},
{"micro", "_15"},
{"panel", "_15"},
{"stair", "_outer"},
{"stair", ""},
{"stair", "_inner"},
{"slab", "_1"},
{"slab", "_2"},
{"slab", "_quarter"},
{"slab", ""},
{"slab", "_three_quarter"},
{"slab", "_14"},
{"slab", "_15"},
{"slab", "_two_sides"},
{"slab", "_three_sides"},
{"slab", "_three_sides_u"},
{"stair", "_half"},
{"stair", "_alt_1"},
{"stair", "_alt_2"},
{"stair", "_alt_4"},
{"stair", "_alt"},
{"stair", "_right_half"},
{"slope", ""},
{"slope", "_half"},
{"slope", "_half_raised"},
{"slope", "_inner"},
{"slope", "_inner_half"},
{"slope", "_inner_half_raised"},
{"slope", "_inner_cut"},
{"slope", "_inner_cut_half"},
{"slope", "_inner_cut_half_raised"},
{"slope", "_outer"},
{"slope", "_outer_half"},
{"slope", "_outer_half_raised"},
{"slope", "_outer_cut"},
{"slope", "_outer_cut_half"},
{"slope", "_outer_cut_half_raised"},
{"slope", "_cut"},
}
local moreblocks_nodes = {
"coal_stone",
"wood_tile",
"iron_checker",
"circle_stone_bricks",
"cobble_compressed",
"plankstone",
"clean_glass",
"split_stone_tile",
"all_faces_tree",
"dirt_compressed",
"coal_checker",
"clean_glow_glass",
"tar",
"clean_super_glow_glass",
"stone_tile",
"cactus_brick",
"super_glow_glass",
"desert_cobble_compressed",
"copperpatina",
"coal_stone_bricks",
"glow_glass",
"cactus_checker",
"all_faces_pine_tree",
"all_faces_aspen_tree",
"all_faces_acacia_tree",
"all_faces_jungle_tree",
"iron_stone",
"grey_bricks",
"wood_tile_left",
"wood_tile_down",
"wood_tile_center",
"wood_tile_right",
"wood_tile_full",
"checker_stone_tile",
"iron_glass",
"iron_stone_bricks",
"wood_tile_flipped",
"wood_tile_offset",
"coal_glass",
"straw",
"stone",
"stone_block",
"cobble",
"mossycobble",
"brick",
"sandstone",
"steelblock",
"goldblock",
"copperblock",
"bronzeblock",
"diamondblock",
"tinblock",
"desert_stone",
"desert_stone_block",
"desert_cobble",
"meselamp",
"glass",
"tree",
"wood",
"jungletree",
"junglewood",
"pine_tree",
"pine_wood",
"acacia_tree",
"acacia_wood",
"aspen_tree",
"aspen_wood",
"obsidian",
"obsidian_block",
"obsidianbrick",
"obsidian_glass",
"stonebrick",
"desert_stonebrick",
"sandstonebrick",
"silver_sandstone",
"silver_sandstone_brick",
"silver_sandstone_block",
"desert_sandstone",
"desert_sandstone_brick",
"desert_sandstone_block",
"sandstone_block",
"coral_skeleton",
"ice",
}
local colors_moreblocks = table.copy(colors)
insert(colors_moreblocks, "white")
local moreblocks_mods = {
wool = colors_moreblocks,
moreblocks = moreblocks_nodes,
}
local t = {}
for mod, v in pairs(moreblocks_mods) do
for _, nodename in ipairs(v) do
t[nodename] = {}
for _, shape in ipairs(circular_saw_names) do
local to_add = true
if shape[1] == "slope" and shape[2] == "" then
to_add = nil
end
if to_add then
insert(t[nodename], fmt("%s_%s%s", shape[1], nodename, shape[2]))
end
end
local slope_name = fmt("slope_%s", nodename)
to_compress[fmt("%s:%s", mod, slope_name)] = {
replace = slope_name,
by = t[nodename]
}
end
end
local compressed = {}
for k, v in pairs(to_compress) do
compressed[k] = compressed[k] or {}
for _, str in ipairs(v.by) do
local it = k:gsub(v.replace, str)
insert(compressed[k], it)
end
end
local _compressed = {}
for _, v in pairs(compressed) do
for _, v2 in ipairs(v) do
_compressed[v2] = true
end
end
return compressed, _compressed

62
etc/groups.lua Normal file
View File

@ -0,0 +1,62 @@
local S = core.get_translator "i3"
local group_stereotypes = {
dye = "dye:white",
wool = "wool:white",
wood = "default:wood",
tree = "default:tree",
sand = "default:sand",
glass = "default:glass",
stick = "default:stick",
stone = "default:stone",
leaves = "default:leaves",
coal = "default:coal_lump",
vessel = "vessels:glass_bottle",
flower = "flowers:dandelion_yellow",
water_bucket = "bucket:bucket_water",
mesecon_conductor_craftable = "mesecons:wire_00000000_off",
}
local group_names = {
dye = S"Any dye",
coal = S"Any coal",
sand = S"Any sand",
tree = S"Any tree",
wool = S"Any wool",
glass = S"Any glass",
stick = S"Any stick",
stone = S"Any stone",
carpet = S"Any carpet",
flower = S"Any flower",
leaves = S"Any leaves",
vessel = S"Any vessel",
wood = S"Any wood planks",
mushroom = S"Any mushroom",
["color_red,flower"] = S"Any red flower",
["color_blue,flower"] = S"Any blue flower",
["color_black,flower"] = S"Any black flower",
["color_white,flower"] = S"Any white flower",
["color_green,flower"] = S"Any green flower",
["color_orange,flower"] = S"Any orange flower",
["color_yellow,flower"] = S"Any yellow flower",
["color_violet,flower"] = S"Any violet flower",
["color_red,dye"] = S"Any red dye",
["color_blue,dye"] = S"Any blue dye",
["color_grey,dye"] = S"Any grey dye",
["color_pink,dye"] = S"Any pink dye",
["color_cyan,dye"] = S"Any cyan dye",
["color_black,dye"] = S"Any black dye",
["color_white,dye"] = S"Any white dye",
["color_brown,dye"] = S"Any brown dye",
["color_green,dye"] = S"Any green dye",
["color_orange,dye"] = S"Any orange dye",
["color_yellow,dye"] = S"Any yellow dye",
["color_violet,dye"] = S"Any violet dye",
["color_magenta,dye"] = S"Any magenta dye",
["color_dark_grey,dye"] = S"Any dark grey dye",
["color_dark_green,dye"] = S"Any dark green dye",
}
return group_stereotypes, group_names

13
etc/model_aliases.lua Normal file
View File

@ -0,0 +1,13 @@
local model_alias = {
["boats:boat"] = {name = "boats:boat", drawtype = "entity"},
["carts:cart"] = {name = "carts:cart", drawtype = "entity", frames = "0,0"},
["default:chest"] = {name = "default:chest_open"},
["default:chest_locked"] = {name = "default:chest_locked_open"},
["doors:door_wood"] = {name = "doors:door_wood_a"},
["doors:door_glass"] = {name = "doors:door_glass_a"},
["doors:door_obsidian_glass"] = {name = "doors:door_obsidian_glass_a"},
["doors:door_steel"] = {name = "doors:door_steel_a"},
["xpanes:door_steel_bar"] = {name = "xpanes:door_steel_bar_a"},
}
return model_alias

119
etc/styles.lua Normal file
View File

@ -0,0 +1,119 @@
local fmt = string.format
local PNG = {
bg = "i3_bg.png",
bg_full = "i3_bg_full.png",
bar = "i3_bar.png",
hotbar = "i3_hotbar.png",
search = "i3_search.png",
heart = "i3_heart.png",
heart_half = "i3_heart_half.png",
heart_grey = "i3_heart_grey.png",
prev = "i3_next.png^\\[transformFX",
next = "i3_next.png",
arrow = "i3_arrow.png",
trash = "i3_trash.png",
sort_az = "i3_sort_az.png",
sort_za = "i3_sort_za.png",
compress = "i3_compress.png",
fire = "i3_fire.png",
fire_anim = "i3_fire_anim.png",
book = "i3_book.png",
sign = "i3_sign.png",
cancel = "i3_cancel.png",
export = "i3_export.png",
slot = "i3_slot.png",
tab = "i3_tab.png",
tab_small = "i3_tab_small.png",
tab_top = "i3_tab.png^\\[transformFY",
furnace_anim = "i3_furnace_anim.png",
bag = "i3_bag.png",
armor = "i3_armor.png",
awards = "i3_award.png",
skins = "i3_skin.png",
waypoints = "i3_waypoint.png",
teleport = "i3_teleport.png",
add = "i3_add.png",
refresh = "i3_refresh.png",
visible = "i3_visible.png^\\[brighten",
nonvisible = "i3_non_visible.png",
exit = "i3_exit.png",
cancel_hover = "i3_cancel.png^\\[brighten",
search_hover = "i3_search.png^\\[brighten",
export_hover = "i3_export.png^\\[brighten",
trash_hover = "i3_trash.png^\\[brighten^\\[colorize:#f00:100",
compress_hover = "i3_compress.png^\\[brighten",
sort_az_hover = "i3_sort_az.png^\\[brighten",
sort_za_hover = "i3_sort_za.png^\\[brighten",
prev_hover = "i3_next_hover.png^\\[transformFX",
next_hover = "i3_next_hover.png",
tab_hover = "i3_tab_hover.png",
tab_small_hover = "i3_tab_small_hover.png",
tab_hover_top = "i3_tab_hover.png^\\[transformFY",
bag_hover = "i3_bag_hover.png",
armor_hover = "i3_armor_hover.png",
awards_hover = "i3_award_hover.png",
skins_hover = "i3_skin_hover.png",
waypoints_hover = "i3_waypoint_hover.png",
teleport_hover = "i3_teleport.png^\\[brighten",
add_hover = "i3_add.png^\\[brighten",
refresh_hover = "i3_refresh.png^\\[brighten",
exit_hover = "i3_exit.png^\\[brighten",
}
local styles = fmt([[
style_type[field;border=false;bgcolor=transparent]
style_type[label,field;font_size=16]
style_type[button;border=false;content_offset=0]
style_type[image_button,item_image_button;border=false;sound=i3_click]
style_type[item_image_button;bgimg_hovered=%s]
style[pagenum,no_item,no_rcp;font=bold;font_size=18]
style[exit;fgimg=%s;fgimg_hovered=%s;content_offset=0]
style[cancel;fgimg=%s;fgimg_hovered=%s;content_offset=0]
style[search;fgimg=%s;fgimg_hovered=%s;content_offset=0]
style[prev_page;fgimg=%s;fgimg_hovered=%s]
style[next_page;fgimg=%s;fgimg_hovered=%s]
style[prev_recipe;fgimg=%s;fgimg_hovered=%s]
style[next_recipe;fgimg=%s;fgimg_hovered=%s]
style[prev_usage;fgimg=%s;fgimg_hovered=%s]
style[next_usage;fgimg=%s;fgimg_hovered=%s]
style[waypoint_add;fgimg=%s;fgimg_hovered=%s;content_offset=0]
style[btn_bag,btn_armor,btn_skins;font=bold;font_size=18;content_offset=0;sound=i3_click]
style[craft_rcp,craft_usg;noclip=true;font_size=16;sound=i3_craft;
bgimg=i3_btn9.png;bgimg_hovered=i3_btn9_hovered.png;
bgimg_pressed=i3_btn9_pressed.png;bgimg_middle=4,6]
style[confirm_trash_yes,confirm_trash_no;noclip=true;font_size=16;
bgimg=i3_btn9.png;bgimg_hovered=i3_btn9_hovered.png;
bgimg_pressed=i3_btn9_pressed.png;bgimg_middle=4,6]
]],
PNG.slot,
PNG.exit, PNG.exit_hover,
PNG.cancel, PNG.cancel_hover,
PNG.search, PNG.search_hover,
PNG.prev, PNG.prev_hover,
PNG.next, PNG.next_hover,
PNG.prev, PNG.prev_hover,
PNG.next, PNG.next_hover,
PNG.prev, PNG.prev_hover,
PNG.next, PNG.next_hover,
PNG.add, PNG.add_hover)
local fs_elements = {
label = "label[%f,%f;%s]",
box = "box[%f,%f;%f,%f;%s]",
image = "image[%f,%f;%f,%f;%s]",
tooltip = "tooltip[%f,%f;%f,%f;%s]",
button = "button[%f,%f;%f,%f;%s;%s]",
item_image = "item_image[%f,%f;%f,%f;%s]",
hypertext = "hypertext[%f,%f;%f,%f;%s;%s]",
bg9 = "background9[%f,%f;%f,%f;%s;false;%u]",
scrollbar = "scrollbar[%f,%f;%f,%f;%s;%s;%u]",
model = "model[%f,%f;%f,%f;%s;%s;%s;%s;%s;%s;%s]",
image_button = "image_button[%f,%f;%f,%f;%s;%s;%s]",
animated_image = "animated_image[%f,%f;%f,%f;;%s;%u;%u]",
item_image_button = "item_image_button[%f,%f;%f,%f;%s;%s;%s]",
}
return PNG, styles, fs_elements

1123
init.lua

File diff suppressed because it is too large Load Diff

View File

@ -1,2 +1,5 @@
# The progressive mode shows recipes you can craft from items you ever had in your inventory.
i3_progressive_mode (Learn crafting recipes progressively) bool false
# Regroup the items of the same type in the item list.
i3_item_compression (Regroup items of the same type) bool true

BIN
textures/i3_exit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

BIN
textures/i3_tab_small.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB