Skip to content

Commit

Permalink
gunfire fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sayterdarkwynd committed Dec 11, 2019
1 parent d815632 commit 47563d6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions items/active/weapons/ranged/gunfire.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
--activeItem.setInstanceValue() can be used to set a property on the active item (ammo reload pause if discarding)
--and the property should be accessible via config.getParameter()

require "/scripts/util.lua"
require "/scripts/interp.lua"
require "/scripts/FRHelper.lua"
Expand Down Expand Up @@ -120,7 +123,6 @@ function GunFire:update(dt, fireMode, shiftHeld)
self:setState(self.burst)
end
end

end


Expand Down Expand Up @@ -273,7 +275,7 @@ function GunFire:aimVector(inaccuracy)
end

function GunFire:energyPerShot()
if self.isAmmoBased then
if (self.isAmmoBased == 1) and not (self.fireMode == "alt") then
return (self.energyUsage * self.fireTime * (self.energyUsageMultiplier or 1.0))/2
else
return self.energyUsage * self.fireTime * (self.energyUsageMultiplier or 1.0)
Expand Down Expand Up @@ -357,7 +359,7 @@ function GunFire:hasShotgunReload()
end
end

function GunFire:checkAmmo()
function GunFire:checkAmmo()
if (self.isAmmoBased==1) and (self.magazineAmount <= 0) then
if self.burstCooldown then
self.cooldownTimer = self.burstCooldown + self.reloadTime
Expand Down
6 changes: 3 additions & 3 deletions items/active/weapons/ranged/gunfirefixed.lua
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,10 @@ function GunFireFixed:aimVector(inaccuracy)
end

function GunFireFixed:energyPerShot()
if self.useEnergy == "nil" or self.useEnergy then -- key "useEnergy" defaults to true.
return self.energyUsage * self.fireTime * (self.energyUsageMultiplier or 1.0)
elseif self.isAmmoBased then --ammo based guns use 1/2 as much energy
if (self.isAmmoBased == 1) and not (self.fireMode == "alt") then --ammo based guns use 1/2 as much energy
return (self.energyUsage * self.fireTime * (self.energyUsageMultiplier or 1.0))/2
elseif self.useEnergy == "nil" or self.useEnergy then -- key "useEnergy" defaults to true.
return self.energyUsage * self.fireTime * (self.energyUsageMultiplier or 1.0)
else
return 0
end
Expand Down

0 comments on commit 47563d6

Please sign in to comment.