@@ -36,7 +36,10 @@ e2function void entity:setColor(r,g,b)
3636 if not IsValid (this ) then return self :throw (" Invalid entity!" , 0 ) end
3737 if not isOwner (self , this ) then return self :throw (" You do not own this entity!" , nil ) end
3838
39- WireLib .SetColor (this , Color (r , g , b , this :GetColor ().a ))
39+ local color = this :GetColor ()
40+ color .r , color .g , color .b = RGBClamp (r , g , b )
41+
42+ WireLib .SetColor (this , color )
4043end
4144
4245e2function void entity :setColor (r ,g ,b ,a )
@@ -50,7 +53,10 @@ e2function void entity:setColor(vector c)
5053 if not IsValid (this ) then return self :throw (" Invalid entity!" , nil ) end
5154 if not isOwner (self , this ) then return self :throw (" You do not own this entity!" , nil ) end
5255
53- WireLib .SetColor (this , Color (c [1 ], c [2 ], c [3 ], this :GetColor ().a ))
56+ local color = this :GetColor ()
57+ color .r , color .g , color .b = RGBClamp (c [1 ], c [2 ], c [3 ])
58+
59+ WireLib .SetColor (this , color )
5460end
5561
5662e2function void entity :setColor (vector c , a )
7076e2function void entity :setAlpha (a )
7177 if not IsValid (this ) then return self :throw (" Invalid entity!" , nil ) end
7278 if not isOwner (self , this ) then return self :throw (" You do not own this entity!" , nil ) end
73-
7479 if this :IsPlayer () then return self :throw (" You cannot set the alpha of a player!" , nil ) end
7580
76- local c = this :GetColor ()
77- WireLib .SetColor (this , Color (c .r , c .g , c .b , a ))
81+ local color = this :GetColor ()
82+ color .a = Clamp (a , 0 , 255 )
83+
84+ WireLib .SetColor (this , color )
7885end
7986
8087e2function void entity :setRenderMode (mode )
0 commit comments