This commit is contained in:
lifestorm
2024-08-05 18:40:29 +03:00
parent 9f505a0646
commit c6d9b6f580
8044 changed files with 1853472 additions and 21 deletions

View 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
} )