Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sayterdarkwynd committed Jan 11, 2020
1 parent e25bc52 commit 4d94e4f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .metadata
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"requires" : [],
"steamContentId" : "763259329",
"tags" : "Species|Mechanics",
"version" : "5.2.65"
"version" : "5.2.67"
}
21 changes: 13 additions & 8 deletions items/active/weapons/ranged/gunfire.lua
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ end


function GunFire:update(dt, fireMode, shiftHeld)
WeaponAbility.update(self, dt, fireMode, shiftHeld)

WeaponAbility.update(self, dt, fireMode, shiftHeld)
self.currentFireMode = fireMode
-- *** FU Weapon Additions

--check if ammo bar should vanish
Expand All @@ -93,7 +93,9 @@ function GunFire:update(dt, fireMode, shiftHeld)
self.timerReloadBar = 5
end
if (self.timerReloadBar == 5) then -- is reload bar timer expired?
world.sendEntityMessage(self.playerId,"removeBar","ammoBar") --clear ammo bar
if (self.isAmmoBased == 1) then
world.sendEntityMessage(self.playerId,"removeBar","ammoBar") --clear ammo bar
end
self.timerReloadBar = 0
end

Expand Down Expand Up @@ -441,14 +443,16 @@ function GunFire:checkAmmo()
--check current ammo and create an ammo bar to inform the user
self.currentAmmoPercent = 1
self.barColor = {0,250,112,125}


if (self.fireMode == "primary") then
world.sendEntityMessage(
self.playerId,
"setBar",
"ammoBar",
self.currentAmmoPercent,
self.barColor
)
)
end
self.weapon:setStance(self.stances.cooldown)
self:setState(self.cooldown)
end
Expand All @@ -460,17 +464,18 @@ function GunFire:checkMagazine()
self.isAmmoBased = config.getParameter("isAmmoBased",0)
if (self.isAmmoBased == 1) then
--check current ammo and create an ammo bar to inform the user
self.currentAmmoPercent = self.magazineAmount / self.magazineSize

self.currentAmmoPercent = self.magazineAmount / self.magazineSize

if (self.fireMode == "primary") then
world.sendEntityMessage(
self.playerId,
"setBar",
"ammoBar",
self.currentAmmoPercent,
self.barColor
)

end

if self.magazineAmount <= 0 then
self.weapon:setStance(self.stances.cooldown)
self:setState(self.cooldown)
Expand Down
16 changes: 9 additions & 7 deletions items/active/weapons/ranged/gunfirefixed.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ end

function GunFireFixed:update(dt, fireMode, shiftHeld)
WeaponAbility.update(self, dt, fireMode, shiftHeld)

self.currentFireMode = fireMode
-- *** FU Weapon Additions

--check if ammo bar should vanish
Expand All @@ -108,7 +108,9 @@ function GunFireFixed:update(dt, fireMode, shiftHeld)
self.timerReloadBar = 5
end
if (self.timerReloadBar == 5) then -- is reload bar timer expired?
world.sendEntityMessage(self.playerId,"removeBar","ammoBar") --clear ammo bar
if (self.isAmmoBased == 1) then
world.sendEntityMessage(self.playerId,"removeBar","ammoBar") --clear ammo bar
end
self.timerReloadBar = 0
end

Expand Down Expand Up @@ -369,7 +371,6 @@ end

function GunFireFixed:uninit()
status.clearPersistentEffects("weaponBonus")
world.sendEntityMessage(self.playerId,"removeBar","ammoBar") --clear ammo bar
end

function GunFireFixed:isResetting()
Expand Down Expand Up @@ -493,15 +494,16 @@ function GunFireFixed:checkAmmo()
--check current ammo and create an ammo bar to inform the user
self.currentAmmoPercent = 1.0
self.barColor = {0,250,112,125}


if (self.fireMode == "primary") then
world.sendEntityMessage(
self.playerId,
"setBar",
"ammoBar",
self.currentAmmoPercent,
self.barColor
)

end
self.weapon:setStance(self.stances.cooldown)
self:setState(self.cooldown)
end
Expand All @@ -526,15 +528,15 @@ function GunFireFixed:checkMagazine()
elseif self.currentAmmoPercent <= 0.25 then
self.barColor = {255,0,0,255}
end

if (self.fireMode == "primary") then
world.sendEntityMessage(
self.playerId,
"setBar",
"ammoBar",
self.currentAmmoPercent,
self.barColor
)

end
if self.magazineAmount <= 0 then
self.weapon:setStance(self.stances.cooldown)
self:setState(self.cooldown)
Expand Down

0 comments on commit 4d94e4f

Please sign in to comment.