More actions
m Prototype support for "weapon" special damage value |
m Test of cargo query for weapon |
||
Line 249: | Line 249: | ||
-- weapons table for the specific damage values | -- weapons table for the specific damage values | ||
local function weapon_parse(args, weapon_name) | local function weapon_parse(args, weapon_name) | ||
-- | -- Fields stored in the weapons table. These are liable to change. | ||
local | local fields = [[ | ||
name, | |||
damage, | |||
damage_type, | |||
extra_damage, | |||
} | extra_damage_type, | ||
extra_damage_2, | |||
extra_damage_2_type, | |||
melee_or_ranged | |||
]] | |||
local query = mw.ext.cargo.query('weapons', fields, { | |||
where = "name=\"" .. weapon_name .. "\"" | |||
}) | |||
if #query > 0 then | |||
weapon = query[1] | |||
for _, damage_field in ipairs({"damage", "extra_damage", "extra_damage_2"}) do | |||
if weapon[damage_field] then | |||
damage_parse(args, weapon[damage_field], weapon[damage_field .. "_type"], "") | |||
end | |||
end | end | ||
end | end |