129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
mp.torque = constants.grind_torque_factor * mp.hardness
mp.grindvalue = mp.grindvalue or constants.default_grindvalue
mp.grindcost = mp.grindcost or constants.default_grindcost
if item:get_wear() ~= 0 then
-- prevent cheating by recovering metal from items before they
-- are destroyed
local wearfac = (item:get_wear() / 65535)
mp.grindvalue = math.max(1,math.ceil(mp.grindvalue * wearfac))
mp.hardness = math.max(1,math.ceil(mp.grindcost * wearfac))
mp.torque = math.max(1,math.ceil(mp.torque * wearfac))
end
return mp
end
|
|
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
mp.torque = constants.grind_torque_factor * mp.hardness
mp.grindvalue = mp.grindvalue or constants.default_grindvalue
mp.grindcost = mp.grindcost or constants.default_grindcost
if item:get_wear() ~= 0 then
-- prevent cheating by recovering metal from items before they
-- are destroyed
local wearfac = 1-(item:get_wear() / 65535)
mp.grindvalue = math.max(1,math.ceil(mp.grindvalue * wearfac))
mp.hardness = math.max(1,math.ceil(mp.grindcost * wearfac))
mp.torque = math.max(1,math.ceil(mp.torque * wearfac))
end
return mp
end
|