Module:Sandbox/DutyS12345/weapon

-- local get = {}

function get:id return self.id end

function get:name return self.name end

function get:description return self.description end

function get:cert_cost return self.cert_cost end

function get:dc_cost return self.dc_cost end

function get:weapon_type return self.weapon_type end

function get:faction return self.faction end

function get:fire_modes return self.fire_modes end

function get:range return self.range end

function get:aim_move_speed_multiplier return self.stats.move_modifier end

function get:equip_time return self.stats.equip_ms end

function get:headshot_multiplier return self.stats.damage_head_multiplier end

function get:fire_rate return self.stats.fire_rate or math.floor((60000 / self.stats.fire_refire_ms) + 0.5) end

function get:max_damage return self.stats.max_damage end

function get:max_damage_range return self.stats.max_damage_range end

function get:min_damage return self.stats.min_damage end

function get:min_damage_range return self.stats.min_damage_range end

function get:muzzle_velocity return self.stats.muzzle_velocity end

function get:short_reload return self.stats.short_reload end

function get:long_reload return self.stats.long_reload end

function get:magazine_size return self.stats.magazine_size or self.stats.clip_size end

function get:ammunition return self.stats.ammunition or self.stats.capacity end

function get:hip_accuracy(stance) return self.stats.hip_accuracy[stance] end

function get:aim_accuracy(stance) return self.stats.aim_accuracy[stance] end

function get:vertical_recoil return self.stats.vertical_recoil end

function get:min_horizontal_recoil return self.stats.recoil_horizontal_min end

function get:max_horizontal_recoil return self.stats.recoil_horizontal_max end

function get:horizontal_recoil_tolerance return self.stats.recoil_horizontal_tolerance end

function get:min_recoil_angle return self.stats.recoil_angle_min end

function get:max_recoil_angle return self.stats.recoil_angle_max end

function get:recoil_decrease return self.stats.recoil_recovery_rate end

function get:first_shot_recoil_multiplier return self.stats.recoil_first_shot_modifier end

-- heat function get:isHeatWeapon return self.stats.heat_threshold ~= nil end

function get:heat_recovery return self.stats.heat_bleed_off_rate end function get:heat_recovery_delay return self.stats.heat_recovery_delay_ms end function get:overheat_penalty return self.stats.heat_overheat_penalty_ms end

function get:heat_per_shot return self.stats.heat_per_shot end

function get:heat_capacity return self.stats.heat_threshold or self.stats.heat_capacity end

local Weapon = {}

function Weapon:get(field, ...) return get[field] and get[field](self, unpack(arg)) end

function Weapon:isHeatWeapon return get.isHeatWeapon(self) end

function Weapon:new(weapon, dataModule) local o = {} -- local weaponData = mw.loadData("Module:WeaponData/data/ ") local weaponData = mw.loadData(dataModule or ("Module:Sandbox/DutyS12345/data/" .. weapon))[weapon] setmetatable(o, {		__index = function (t, k) return self[k] or weaponData[k] end,		__newindex = weaponData,	}) return o end

return Weapon --