Garry's Mod

Garry's Mod

TFA Base
RPM / RPM_SEMI get reset during safety switch
I have an attachment that modifies RPM and RPM_Semi.

These values get reset when taking the gun on/off safety.

```
ATTACHMENT.WeaponTable = { -- The place where you change the stats (CACHED STATS ONLY!)
["Primary"] = {
["Automatic"] = true,
["RPM"] = function(wep, stat)
print(stat)
if stat > 550 then
return 500 -- Don't increase RPM if it's already high
end
return stat * 1.1 -- Increase RPM by 10%
end,
["RPM_Semi"] = function(wep, stat)
print(stat)
if stat > 550 then
return 500 -- Don't increase RPM if it's already high
end
return stat * 1.1 -- Increase RPM_Semi by 10%
end,
["Damage"] = function(wep, stat)
print(stat)
return stat * 0.9 -- Decrease damage by 10%
end,
}
}```
< >
Showing 1-6 of 6 comments
YuRaNnNzZZ  [developer] 2 Dec @ 1:01pm 
safety toggle is just a firemode change, it doesn't clear or change any stats, it shouldn't modify the rpm
nnykez 2 Dec @ 1:08pm 
Originally posted by YuRaNnNzZZ:
safety toggle is just a firemode change, it doesn't clear or change any stats, it shouldn't modify the rpm

It looks like it sets it to Automatic = false and doesn't look at the cached stat when switching it back, only the stat the weapon was loaded with.

if self:IsSafety() then
self.Primary.Automatic = false
self.Primary_TFA.Automatic = false
else
self.Primary.Automatic = self:IsFireModeAutomatic()
self.Primary_TFA.Automatic = self.Primary.Automatic
end

common/utils.lua

Not sure if there is a way around this without modifying the base.
nnykez 2 Dec @ 1:09pm 
In the attachment table I am setting ["Automatic"] = true btw
YuRaNnNzZZ  [developer] 2 Dec @ 1:10pm 
Primary.Automatic is not a cached stat, you need to modify it in ATTACHMENT:Attach/Detach
nnykez 2 Dec @ 1:21pm 
Originally posted by YuRaNnNzZZ:
Primary.Automatic is not a cached stat, you need to modify it in ATTACHMENT:Attach/Detach

Yeah I tried that. Sadly, safety sets it back to "false" and then does not use the value applied by the attachment (which would be true).
YuRaNnNzZZ  [developer] 3 Dec @ 5:24am 
well yes, you have to override the firemodes table too if you want to force automatic firemode
the firemodes table is cached
Last edited by YuRaNnNzZZ; 3 Dec @ 5:25am
< >
Showing 1-6 of 6 comments
Per page: 1530 50