• Physgun coloring without sine effect
    2 replies, posted
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 [URL="https://github.com/Facepunch/garrysmod-requests/issues/852#issuecomment-260330768"]said this thread[/URL] that it can be fixed via [B]calling matproxy[/B]. Unfortunately I have no idea how things work and I would really appreciate if someone could help me out. [t]http://i.imgur.com/ajS9leI.gif[/t] Original code of [I]player_weapon_color.lua[/I]. It can be found at [I]SteamApps\common\GarrysMod\garrysmod\lua\matproxy[/I] [CODE] 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 } ) [/CODE]
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] [QUOTE=Robotboy655;51369348]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.[/QUOTE] 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 [IMG]http://puu.sh/si2Jn/4e70d097bb.png[/IMG]
Sorry, you need to Log In to post a reply to this thread.