Skip to content

Commit

Permalink
Matproxy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
parar020100 committed Jun 20, 2024
1 parent ca6ca7a commit 2691205
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
17 changes: 9 additions & 8 deletions lua/matproxy/matproxy_tardis.lua
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,17 @@ end
local function matproxy_tardis_power_bind(self, mat, ent)
if not IsValid(ent) or not IsValid(ent.exterior) or not ent.TardisPart then return end

local on = ent.exterior:GetPower()
local var = ent.exterior:GetPower() and self.on_var or self.off_var
if not var then return end

if self.last_on ~= on then
self.last_on = on
local value = mat:GetVector(var)

local var = on and self.on_var or self.off_var
if not var then return end

mat:SetVector(self.ResultTo, mat:GetVector(var))
if var ~= self.last_var or value ~= self.last_value then
self.last_var = var
self.last_value = value
mat:SetVector(self.ResultTo, value)
end

end

matproxy.Add({
Expand All @@ -128,7 +129,7 @@ matproxy.Add({
init = function( self, mat, values )
self.ResultTo = values.resultvar
end,

bind = function( self, mat, ent )
if not IsValid(ent) or not ent.TardisPart then return end

Expand Down
6 changes: 3 additions & 3 deletions lua/matproxy/matproxy_tardis_default_int.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ matproxy.Add({
bind = function(self, mat, ent)
if not IsValid(ent) or not ent.TardisPart then return end

local col = ent:GetData("default_int_env_color") or Color(0,200,255)
local col = ent:GetData("default_int_env_color", Color(0,200,255))
local power = ent.exterior and ent.exterior:GetPower()

if self.lastcol ~= col or self.lastpower ~= power then
Expand All @@ -35,7 +35,7 @@ matproxy.Add({
bind = function(self, mat, ent)
if not IsValid(ent) or not ent.TardisPart then return end

local col = ent:GetData("default_int_floor_lights_color") or Color(230,230,210)
local col = ent:GetData("default_int_floor_lights_color", Color(230,230,210))

if self.lastcol ~= col then
self.lastcol = col
Expand All @@ -56,7 +56,7 @@ matproxy.Add({
bind = function(self, mat, ent)
if not IsValid(ent) or not ent.TardisPart then return end

local col = ent:GetData("default_int_rotor_color") or Color(255,255,255)
local col = ent:GetData("default_int_rotor_color", Color(255,255,255))

if self.lastcol ~= col then
self.lastcol = col
Expand Down

0 comments on commit 2691205

Please sign in to comment.