mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-16 21:33:46 +03:00
Upload
This commit is contained in:
49
lua/matproxy/player_color.lua
Normal file
49
lua/matproxy/player_color.lua
Normal file
@@ -0,0 +1,49 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
PlayerColor Material Proxy
|
||||
Sets the clothing colour of custom made models to
|
||||
ent.GetPlayerColor, a normalized vector colour.
|
||||
-----------------------------------------------------------]]
|
||||
|
||||
local clrFallback = Vector( 62 / 255, 88 / 255, 106 / 255 )
|
||||
|
||||
matproxy.Add( {
|
||||
name = "PlayerColor",
|
||||
|
||||
init = function( self, mat, values )
|
||||
-- Store the name of the variable we want to set
|
||||
self.ResultTo = values.resultvar
|
||||
end,
|
||||
|
||||
bind = function( self, mat, ent )
|
||||
if ( !IsValid( ent ) ) then return end
|
||||
|
||||
-- If entity is a ragdoll try to convert it into the player
|
||||
-- ( this applies to their corpses )
|
||||
if ( ent:IsRagdoll() ) then
|
||||
local owner = ent:GetRagdollOwner()
|
||||
if ( IsValid( owner ) ) then ent = owner end
|
||||
end
|
||||
|
||||
-- If the target ent has a function called GetPlayerColor then use that
|
||||
-- The function SHOULD return a Vector with the chosen player's colour.
|
||||
if ( ent.GetPlayerColor ) then
|
||||
local col = ent:GetPlayerColor()
|
||||
if ( isvector( col ) ) then
|
||||
mat:SetVector( self.ResultTo, col )
|
||||
end
|
||||
else
|
||||
mat:SetVector( self.ResultTo, clrFallback )
|
||||
end
|
||||
end
|
||||
} )
|
||||
44
lua/matproxy/player_weapon_color.lua
Normal file
44
lua/matproxy/player_weapon_color.lua
Normal file
@@ -0,0 +1,44 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
local megaGravClr = Vector( 0.4, 1, 1 )
|
||||
|
||||
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
|
||||
|
||||
-- A hack for the mega gravity gun
|
||||
local wep = owner:GetActiveWeapon()
|
||||
if ( IsValid( wep ) && wep:GetClass() == "weapon_physcannon" && !wep:IsScripted() ) then
|
||||
col = megaGravClr
|
||||
end
|
||||
|
||||
local mul = ( 1 + math.sin( CurTime() * 5 ) ) * 0.5
|
||||
|
||||
mat:SetVector( self.ResultTo, col + col * mul )
|
||||
|
||||
end
|
||||
} )
|
||||
52
lua/matproxy/sky_paint.lua
Normal file
52
lua/matproxy/sky_paint.lua
Normal file
@@ -0,0 +1,52 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
matproxy.Add( {
|
||||
name = "SkyPaint",
|
||||
|
||||
init = function( self, mat, values )
|
||||
end,
|
||||
|
||||
bind = function( self, mat, ent )
|
||||
|
||||
local skyPaint = g_SkyPaint
|
||||
if ( !IsValid( skyPaint ) ) then return end
|
||||
|
||||
local values = skyPaint:GetNetworkVars()
|
||||
|
||||
mat:SetVector( "$TOPCOLOR", values.TopColor )
|
||||
mat:SetVector( "$BOTTOMCOLOR", values.BottomColor )
|
||||
mat:SetVector( "$DUSKCOLOR", values.DuskColor )
|
||||
mat:SetFloat( "$DUSKSCALE", values.DuskScale )
|
||||
mat:SetFloat( "$DUSKINTENSITY", values.DuskIntensity )
|
||||
mat:SetFloat( "$FADEBIAS", values.FadeBias )
|
||||
mat:SetFloat( "$HDRSCALE", values.HDRScale )
|
||||
|
||||
mat:SetVector( "$SUNNORMAL", values.SunNormal )
|
||||
mat:SetVector( "$SUNCOLOR", values.SunColor )
|
||||
mat:SetFloat( "$SUNSIZE", values.SunSize )
|
||||
|
||||
if ( values.DrawStars ) then
|
||||
|
||||
mat:SetInt( "$STARLAYERS", values.StarLayers )
|
||||
mat:SetFloat( "$STARSCALE", values.StarScale )
|
||||
mat:SetFloat( "$STARFADE", values.StarFade )
|
||||
mat:SetFloat( "$STARPOS", values.StarSpeed * RealTime() )
|
||||
mat:SetTexture( "$STARTEXTURE", values.StarTexture )
|
||||
|
||||
else
|
||||
|
||||
mat:SetInt( "$STARLAYERS", 0 )
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
} )
|
||||
Reference in New Issue
Block a user