Physgun coloring without sine effect

Hello absolute zero in coding here. I am having an issue with default matproxy from player_weapon_color.lua. The problem is with the sine line that is there to create pulsating effect for glowing parts as I am using it for coloring the chassis of the gun via $color (a vmt material parameter for coloring models). Is there a way to modify the properties without touching original lua?

Because these things never worked:

  1. Duplicating file, removing sine and including it with addon doesn’t help. Original will always override the one from the addon.
  2. Creating unique mat proxy based the said lua will not work for multiplayer. It will work for singleplayer though.

Robotboy655 said this thread that it can be fixed via calling matproxy.
Unfortunately I have no idea how things work and I would really appreciate if someone could help me out.

Original code of player_weapon_color.lua. It can be found at SteamApps\common\GarrysMod\garrysmod\lua\matproxy





matproxy.Add( {
    name = "PlayerWeaponColor",


    init = function( self, mat, values )


        self.ResultTo = values.resultvar


    end,


    bind = function( self, mat, ent )


        if ( !IsValid( ent ) ) then return end


        local owner = ent:GetOwner()
        if ( !IsValid( owner ) or !owner:IsPlayer() ) then return end


        local col = owner:GetWeaponColor()
        if ( !isvector( col ) ) then return end


        local mul = ( 1 + math.sin( CurTime() * 5 ) ) * 0.5


        mat:SetVector( self.ResultTo, col + col * mul )


    end
} )




If you are overridng the material, you can specify a new proxy to use in the .vmt.

Obviously it will not work in multiplayer no matter what you do, all clientside Lua is automatically loaded from the server. No Lua is loaded from your client or your clientside addons.

The only exception is when server owners allow custom clientside Lua scripts, in which case you gotta manually load the script through console.

Oh man that’s disappointing. That’s why I originally started the request on git.

[editline]14th November 2016[/editline]

Is there a chance that the matproxy would be modyfied in the future so it can support tweaks for sine? I.e. a few parameters that would give us control for amount and ability to disable it completely.

Something similiar to Valve’s sine that can be adjusted in VMT

http://puu.sh/si2Jn/4e70d097bb.png