-
Notifications
You must be signed in to change notification settings - Fork 469
/
items.lua
55 lines (45 loc) · 1002 Bytes
/
items.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
local _ENV = mkmodule('plugins.sort.items')
local utils = require('utils')
orders = orders or {}
-- Relies on NULL being auto-translated to NULL, and then sorted
orders.exists = {
key = function(item)
return 1
end
}
orders.type = {
key = function(item)
return item:getType()
end
}
orders.description = {
key = function(item)
return dfhack.items.getDescription(item,0)
end
}
orders.quality = {
key = function(item)
return item:getQuality()
end
}
orders.improvement = {
key = function(item)
return item:getImprovementQuality()
end
}
orders.wear = {
key = function(item)
return item:getWear()
end
}
orders.material = {
key = function(item)
local mattype = item:getActualMaterial()
local matindex = item:getActualMaterialIndex()
local info = dfhack.matinfo.decode(mattype, matindex)
if info then
return info:toString()
end
end
}
return _ENV