Skip to content

Commit

Permalink
Merge branch 'master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
thecraftianman committed May 15, 2024
2 parents c066f3d + 3371a28 commit 6439556
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 23 deletions.
10 changes: 6 additions & 4 deletions lua/entities/acf_ammo/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -646,11 +646,13 @@ end ---------------------------------------------

do -- Ammo Consumption -------------------------
function ENT:CanConsume()
if self.Disabled then return false end
if not self.Load then return false end
if self.Damaged then return false end
local SelfTbl = self:GetTable()

return self.Ammo > 0
if SelfTbl.Disabled then return false end
if not SelfTbl.Load then return false end
if SelfTbl.Damaged then return false end

return SelfTbl.Ammo > 0
end

function ENT:Consume(Num)
Expand Down
8 changes: 2 additions & 6 deletions lua/entities/acf_base_scalable/cl_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ DEFINE_BASECLASS("base_scalable") -- Required to get the local BaseClass
include("shared.lua")

local HideInfo = ACF.HideInfoBubble
local WireRender = Wire_Render

function ENT:Initialize(...)
BaseClass.Initialize(self, ...)
Expand All @@ -17,10 +18,5 @@ end
function ENT:Draw()
self:DoNormalDraw(false, HideInfo())

Wire_Render(self)

if self.GetBeamLength and (not self.GetShowBeam or self:GetShowBeam()) then
-- Every SENT that has GetBeamLength should draw a tracer. Some of them have the GetShowBeam boolean
Wire_DrawTracerBeam(self, 1, self.GetBeamHighlight and self:GetBeamHighlight() or false)
end
WireRender(self)
end
8 changes: 2 additions & 6 deletions lua/entities/acf_base_simple/cl_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ DEFINE_BASECLASS("base_wire_entity") -- Required to get the local BaseClass
include("shared.lua")

local HideInfo = ACF.HideInfoBubble
local WireRender = Wire_Render

function ENT:Initialize(...)
BaseClass.Initialize(self, ...)
Expand All @@ -17,10 +18,5 @@ end
function ENT:Draw()
self:DoNormalDraw(false, HideInfo())

Wire_Render(self)

if self.GetBeamLength and (not self.GetShowBeam or self:GetShowBeam()) then
-- Every SENT that has GetBeamLength should draw a tracer. Some of them have the GetShowBeam boolean
Wire_DrawTracerBeam(self, 1, self.GetBeamHighlight and self:GetBeamHighlight() or false)
end
WireRender(self)
end
15 changes: 8 additions & 7 deletions lua/entities/acf_gun/cl_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@ end
function ENT:Think()
BaseClass.Think(self)

local SinceFire = Clock.CurTime - self.LastFire
local SelfTbl = self:GetTable()
local SinceFire = Clock.CurTime - SelfTbl.LastFire

self:SetCycle(SinceFire * self.Rate / self.RateScale)
self:SetCycle(SinceFire * SelfTbl.Rate / SelfTbl.RateScale)

if Clock.CurTime > self.LastFire + self.CloseTime and self.CloseAnim then
self:ResetSequence(self.CloseAnim)
self:SetCycle((SinceFire - self.CloseTime) * self.Rate / self.RateScale)
self.Rate = 1 / (self.Reload - self.CloseTime) -- Base anim time is 1s, rate is in 1/10 of a second
self:SetPlaybackRate(self.Rate)
if Clock.CurTime > SelfTbl.LastFire + SelfTbl.CloseTime and SelfTbl.CloseAnim then
self:ResetSequence(SelfTbl.CloseAnim)
self:SetCycle((SinceFire - SelfTbl.CloseTime) * SelfTbl.Rate / SelfTbl.RateScale)
SelfTbl.Rate = 1 / (SelfTbl.Reload - SelfTbl.CloseTime) -- Base anim time is 1s, rate is in 1/10 of a second
self:SetPlaybackRate(SelfTbl.Rate)
end
end

Expand Down

0 comments on commit 6439556

Please sign in to comment.