@@ -67,8 +67,9 @@ function add_lines_to_list(t1,t2)
67
67
end
68
68
69
69
function GetMatPlant (item )
70
- if dfhack .matinfo .decode (item ).mode == " plant" then
71
- return dfhack .matinfo .decode (item ).plant
70
+ local matinfo = dfhack .matinfo .decode (item )
71
+ if matinfo and matinfo .mode == " plant" then
72
+ return matinfo .plant
72
73
end
73
74
end
74
75
78
79
79
80
function GetMatPropertiesStringList (item )
80
81
local item = item -- as:df.item_actual
81
- local mat = dfhack .matinfo .decode (item ).material
82
82
local list = {}
83
+ local matinfo = dfhack .matinfo .decode (item )
84
+ if not matinfo then
85
+ return list
86
+ end
87
+ local mat = matinfo .material
83
88
local deg_U = item .temperature .whole
84
89
local deg_C = math.floor ((deg_U - 10000 )* 5 / 9 )
85
90
append (list ," Temperature: " .. deg_C .. " \248 C (" .. deg_U .. " U)" )
123
128
124
129
function GetArmorPropertiesStringList (item )
125
130
local item = item -- as:df.item_armorst
126
- local mat = dfhack .matinfo .decode (item ).material
127
131
local list = {}
128
132
append (list ," Armor properties: " )
129
133
append (list ," Thickness: " .. item .subtype .props .layer_size ,1 )
137
141
138
142
function GetShieldPropertiesStringList (item )
139
143
local item = item -- as:df.item_shieldst
140
- local mat = dfhack .matinfo .decode (item ).material
141
144
local list = {}
142
145
append (list ," Shield properties:" )
143
146
append (list ," Base block chance: " .. item .subtype .blockchance ,1 )
@@ -149,7 +152,6 @@ function GetShieldPropertiesStringList (item)
149
152
end
150
153
151
154
function GetWeaponPropertiesStringList (item )
152
- local mat = dfhack .matinfo .decode (item ).material
153
155
local list = {}
154
156
if item ._type == df .item_toolst and # item .subtype .attacks < 1 then -- hint:df.item_toolst
155
157
return list
@@ -201,7 +203,6 @@ function GetWeaponPropertiesStringList (item)
201
203
end
202
204
203
205
function GetAmmoPropertiesStringList (item )
204
- local mat = dfhack .matinfo .decode (item ).material
205
206
local list = {}
206
207
if item ._type == df .item_toolst and # item .subtype .attacks < 1 then -- hint:df.item_toolst
207
208
return list
0 commit comments