From a141cd285d1fc7a512d5cec8f2d8f1cd343e7f9b Mon Sep 17 00:00:00 2001 From: yeet dab Date: Thu, 30 Aug 2018 19:55:30 -0700 Subject: [PATCH] Added a Reload Output usefull for e2's to know for custom reload sounds/hud indication, ect --- lua/entities/acf_gun.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lua/entities/acf_gun.lua b/lua/entities/acf_gun.lua index 6e5ec24b6..f9968e8d5 100644 --- a/lua/entities/acf_gun.lua +++ b/lua/entities/acf_gun.lua @@ -145,7 +145,7 @@ function ENT:Initialize() self.Inaccuracy = 1 self.Inputs = Wire_CreateInputs( self, { "Fire", "Unload", "Reload" } ) - self.Outputs = WireLib.CreateSpecialOutputs( self, { "Ready", "AmmoCount", "Entity", "Shots Left", "Fire Rate", "Muzzle Weight", "Muzzle Velocity" }, { "NORMAL", "NORMAL", "ENTITY", "NORMAL", "NORMAL", "NORMAL", "NORMAL" } ) + self.Outputs = WireLib.CreateSpecialOutputs( self, { "Ready", "AmmoCount", "Entity", "Shots Left", "Fire Rate", "Muzzle Weight", "Muzzle Velocity", "Reloading" }, { "NORMAL", "NORMAL", "ENTITY", "NORMAL", "NORMAL", "NORMAL", "NORMAL", "NORMAL" } ) Wire_TriggerOutput(self, "Entity", self) end @@ -472,10 +472,18 @@ function ENT:Think() self.Ammo = Ammo self:UpdateOverlayText() + Wire_TriggerOutput(self, "AmmoCount", Ammo) + + local isReloading = not isEmpty and CurTime() < self.NextFire and (self.MagSize == 1 or (self.LastLoadDuration > self.ReloadTime)) - - if( self.MagSize ) then + if isReloading then + Wire_TriggerOutput(self, "Reloading", 1) + else + Wire_TriggerOutput(self, "Reloading", 0) + end + + if ( self.MagSize ) then Wire_TriggerOutput(self, "Shots Left", self.MagSize - self.CurrentShot) else Wire_TriggerOutput(self, "Shots Left", 1)