mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 05:43:46 +03:00
Upload
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
--[[
|
||||
| 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 PLUGIN = PLUGIN
|
||||
|
||||
do
|
||||
for _, proxy in pairs(PLUGIN.proxyList) do
|
||||
matproxy.Add( {
|
||||
name = proxy,
|
||||
|
||||
init = function( self, _, 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
|
||||
|
||||
-- SHOULD return a Vector with the items stored-/character's stored hair colour.
|
||||
local clrFallback = Vector( 255 / 255, 255 / 255, 255 / 255 )
|
||||
|
||||
local entColor = ent.GetProxyColors and ent:GetProxyColors() or false
|
||||
|
||||
local ragdollNWVector = ent:GetNWVector(proxy, false)
|
||||
|
||||
local character = ent.GetCharacter and ent:GetCharacter() or false
|
||||
local charProxyColors = character and character.GetProxyColors and character:GetProxyColors() or {}
|
||||
|
||||
local color = entColor and entColor[proxy] or ragdollNWVector or charProxyColors[proxy] or clrFallback
|
||||
|
||||
if istable(color) and color.r then
|
||||
color = Vector(color.r / 255, color.g / 255, color.b / 255)
|
||||
end
|
||||
|
||||
mat:SetVector(self.ResultTo, color)
|
||||
end
|
||||
} )
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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 PLUGIN = PLUGIN
|
||||
|
||||
PLUGIN.proxyList = {
|
||||
"HeadGearColor",
|
||||
"HairColor",
|
||||
"TorsoColor",
|
||||
"ShirtColor",
|
||||
"PantsColor",
|
||||
"ShoesColor"
|
||||
}
|
||||
|
||||
ix.char.RegisterVar("proxyColors", {
|
||||
field = "proxyColors",
|
||||
fieldType = ix.type.text,
|
||||
default = {},
|
||||
bNoDisplay = true
|
||||
})
|
||||
@@ -0,0 +1,32 @@
|
||||
--[[
|
||||
| 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 PLUGIN = PLUGIN
|
||||
|
||||
-- could just call ixPlayer on the ragdoll but then the colors will change on the ragdoll according to what the player is doing
|
||||
-- in their inventory (even if they are dead)
|
||||
|
||||
function PLUGIN:OnCharacterFallover(client, entity, bFallenOver)
|
||||
if (entity == nil or !IsValid(entity)) then return end
|
||||
|
||||
local character = client.GetCharacter and client:GetCharacter()
|
||||
if (!character) then return end
|
||||
|
||||
local colorProxies = character:GetProxyColors() or {}
|
||||
for proxy, vector in pairs(colorProxies) do
|
||||
local color = vector
|
||||
if !isvector(color) and istable(color) and color.r then
|
||||
color = Vector(color.r / 255, color.g / 255, color.b / 255)
|
||||
end
|
||||
|
||||
entity:SetNWVector(proxy, color)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user