Skip to content
This repository has been archived by the owner on Jul 1, 2020. It is now read-only.

Commit

Permalink
Remove hardcoded scoping damage buff; reduce inaccuracy if using scope
Browse files Browse the repository at this point in the history
  • Loading branch information
ClobberXD committed Apr 11, 2020
1 parent 9fe3c3a commit c1221aa
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,15 @@ local function fire(stack, player)
local random = PcgRandom(os.time())

for i = 1, def.pellets do
-- Mimic inaccuracy by applying randomised miniscule deviations
-- Mimic inaccuracy by applying randomized miniscule deviations
-- Reduce inaccuracy by half if player is using scope
if def.spread_mult ~= 0 then
-- TODO: Unhardcode scoping factor by taking scope FOVs into consideration
local scoping_factor = gunslinger.__scopes[player:get_player_name()] and 0.5 or 1
dir = vector.apply(dir, function(n)
return n +
random:next(-def.spread_mult, def.spread_mult) * config.base_spread
random:next(-def.spread_mult, def.spread_mult) *
config.base_spread * scoping_factor
end)
end

Expand All @@ -217,15 +221,6 @@ local function fire(stack, player)
local target = pointed.ref
if target:get_player_name() ~= obj:get_player_name() then
local dmg = config.base_dmg * gun_def.dmg_mult

-- FIXME: Actually improve accuracy while player is scoping in,
-- instead of simulating accuracy by increasing damage per shot.

-- Add 20% more damage if player using scope
if gunslinger.__scopes[obj:get_player_name()] then
dmg = dmg * 1.2
end

target:punch(obj, nil, {damage_groups = {fleshy = dmg}})
end
end
Expand Down

0 comments on commit c1221aa

Please sign in to comment.