Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
illuna-minetest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Illuna-Minetest
illuna-minetest
Commits
b94f1829
Commit
b94f1829
authored
11 years ago
by
PilzAdam
Browse files
Options
Downloads
Patches
Plain Diff
Sort modlist alphabetically
parent
d52185c4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
builtin/filterlist.lua
+33
-0
33 additions, 0 deletions
builtin/filterlist.lua
builtin/modmgr.lua
+4
-0
4 additions, 0 deletions
builtin/modmgr.lua
with
37 additions
and
0 deletions
builtin/filterlist.lua
+
33
−
0
View file @
b94f1829
...
...
@@ -246,3 +246,36 @@ function sort_worlds_alphabetic(this)
return
a
.
name
:
lower
()
<
b
.
name
:
lower
()
end
)
end
--------------------------------------------------------------------------------
function
sort_mod_list
(
this
)
table.sort
(
this
.
m_processed_list
,
function
(
a
,
b
)
-- Show game mods at bottom
if
a
.
typ
~=
b
.
typ
then
return
b
.
typ
==
"game_mod"
end
-- If in same or no modpack, sort by name
if
a
.
modpack
==
b
.
modpack
then
if
a
.
name
:
lower
()
==
b
.
name
:
lower
()
then
return
a
.
name
<
b
.
name
end
return
a
.
name
:
lower
()
<
b
.
name
:
lower
()
-- Else compare name to modpack name
else
-- Always show modpack pseudo-mod on top of modpack mod list
if
a
.
name
==
b
.
modpack
then
return
true
elseif
b
.
name
==
a
.
modpack
then
return
false
end
local
name_a
=
a
.
modpack
or
a
.
name
local
name_b
=
b
.
modpack
or
b
.
name
if
name_a
:
lower
()
==
name_b
:
lower
()
then
return
name_a
<
name_b
end
return
name_a
:
lower
()
<
name_b
:
lower
()
end
end
)
end
This diff is collapsed.
Click to expand it.
builtin/modmgr.lua
+
4
−
0
View file @
b94f1829
...
...
@@ -972,6 +972,8 @@ function modmgr.init_worldconfig()
hide_game
=
modmgr
.
hide_gamemods
,
hide_modpackcontents
=
modmgr
.
hide_modpackcontents
})
filterlist
.
add_sort_mechanism
(
modmgr
.
modlist
,
"alphabetic"
,
sort_mod_list
)
filterlist
.
set_sortmode
(
modmgr
.
modlist
,
"alphabetic"
)
return
true
end
...
...
@@ -1068,6 +1070,8 @@ function modmgr.refresh_globals()
nil
,
--filter
{}
)
filterlist
.
add_sort_mechanism
(
modmgr
.
global_mods
,
"alphabetic"
,
sort_mod_list
)
filterlist
.
set_sortmode
(
modmgr
.
global_mods
,
"alphabetic"
)
end
--------------------------------------------------------------------------------
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment