Garry's Mod

Garry's Mod

TFA Base
nnykez 12 月 2 日 下午 12:56
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,
}
}```
< >
正在显示第 1 - 6 条,共 6 条留言
YuRaNnNzZZ  [开发者] 12 月 2 日 下午 1:01 
safety toggle is just a firemode change, it doesn't clear or change any stats, it shouldn't modify the rpm
nnykez 12 月 2 日 下午 1:08 
引用自 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 12 月 2 日 下午 1:09 
In the attachment table I am setting ["Automatic"] = true btw
YuRaNnNzZZ  [开发者] 12 月 2 日 下午 1:10 
Primary.Automatic is not a cached stat, you need to modify it in ATTACHMENT:Attach/Detach
nnykez 12 月 2 日 下午 1:21 
引用自 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  [开发者] 12 月 3 日 上午 5:24 
well yes, you have to override the firemodes table too if you want to force automatic firemode
the firemodes table is cached
最后由 YuRaNnNzZZ 编辑于; 12 月 3 日 上午 5:25
< >
正在显示第 1 - 6 条,共 6 条留言
每页显示数: 1530 50