@@ -6,7 +6,7 @@ DEFINE_BASECLASS("base_wire_entity")
66
77-- HELPERS
88local function getGate (node )
9- if node .type == " wire" then
9+ if node .type == " wire" then
1010 return GateActions [node .gate ]
1111 elseif node .type == " fpga" then
1212 return FPGAGateActions [node .gate ]
@@ -110,7 +110,7 @@ function ENT:Initialize()
110110 self :PhysicsInit (SOLID_VPHYSICS )
111111 self :SetMoveType (MOVETYPE_VPHYSICS )
112112 self :SetSolid (SOLID_VPHYSICS )
113-
113+
114114 self .Debug = false
115115
116116 self .time = 0
@@ -135,7 +135,7 @@ function ENT:Initialize()
135135
136136 self .Inputs = WireLib .CreateInputs (self , {})
137137 self .Outputs = WireLib .CreateOutputs (self , {})
138-
138+
139139 self .Gates = {}
140140 self .LastGateValues = {}
141141
@@ -165,7 +165,7 @@ function ENT:BuildDupeInfo()
165165end
166166
167167function ENT :Setup (data )
168- if data then
168+ if data then
169169 -- entity was duplicated
170170 self :Upload (data )
171171 end
@@ -225,14 +225,14 @@ function ENT:SynthesizeViewData(data)
225225 if not data .Nodes then return end
226226
227227 local viewData = {}
228-
228+
229229 viewData .Nodes = {}
230230 viewData .Labels = {}
231231 viewData .Edges = {}
232232 for nodeId , node in pairs (data .Nodes ) do
233233 local gate = getGate (node )
234234
235- if not gate then
235+ if not gate then
236236 -- special case, label
237237 if node .type == " editor" and node .visual == " label" then
238238 table.insert (viewData .Labels , {
@@ -331,7 +331,7 @@ function ENT:ValidateData(data)
331331 end
332332
333333 -- type check
334- if getInputType (inGate , inputNum ) != getOutputType (outGate , outputNum ) then
334+ if getInputType (inGate , inputNum ) != getOutputType (outGate , outputNum ) then
335335 return " type mismatch between input and output " .. inGate .name .. " [" .. getInputType (inGate , inputNum ).. " ]" .. " and " .. outGate .name .. " [" .. getOutputType (outGate , outputNum ).. " ]"
336336 end
337337 end
@@ -518,7 +518,7 @@ function ENT:Upload(data)
518518
519519 self .Uploaded = true
520520
521- self :Reset ()
521+ self :Reset ()
522522end
523523
524524
@@ -609,9 +609,9 @@ function ENT:Think()
609609 BaseClass .Think (self )
610610
611611 if not self .Uploaded then return end
612- if self .CompilationError or self .ExecutionError then
612+ if self .CompilationError or self .ExecutionError then
613613 self :UpdateOverlay (false )
614- return
614+ return
615615 end
616616 self :NextThink (CurTime ())
617617
@@ -621,7 +621,7 @@ function ENT:Think()
621621 -- Time benchmarking
622622 self .timebench = self .timebench * 0.98 + (self .time ) * 0.02
623623 self .time = 0
624-
624+
625625 -- Limiting
626626 if self .timebench > fpga_quota_avg then
627627 self :ThrowExecutionError (" exceeded cpu time limit" , " cpu time limit exceeded" )
@@ -661,7 +661,7 @@ function ENT:Think()
661661 table.insert (nodesToRun , nodeId )
662662 end
663663 self .QueuedNodes = {}
664-
664+
665665 if # nodesToRun > 0 then self :RunProtected (nodesToRun ) end
666666
667667 self :UpdateOverlay (false )
@@ -733,7 +733,7 @@ function ENT:Run(changedNodes)
733733 end
734734 for nodeId , active in pairs (activeNodes ) do
735735 local gate = getGate (self .Nodes [nodeId ])
736- if active and gate .neverActive then
736+ if active and gate .neverActive then
737737 activeNodes [nodeId ] = false
738738 end
739739 if gate .alwaysActive then
@@ -763,7 +763,7 @@ function ENT:Run(changedNodes)
763763 -- nodesInQueue = {0, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0}
764764 -- nodesVisited = {}
765765
766- if self .Debug then
766+ if self .Debug then
767767 for nodeId , node in pairs (self .Nodes ) do
768768 print (nodeId .. table .ToString (node , " " , false ))
769769 end
@@ -783,7 +783,7 @@ function ENT:Run(changedNodes)
783783 self :ThrowExecutionError (" stuck in loop for too long" , " stuck in loop" )
784784 return
785785 end
786- if self .Debug then
786+ if self .Debug then
787787 print ()
788788 print (table .ToString (nodeQueue , " nodeQueue" , false ))
789789 print (table .ToString (nodesInQueue , " nodesInQueue" , false ))
@@ -882,7 +882,7 @@ function ENT:Run(changedNodes)
882882 gate .postCycle (self .Gates [nodeId ])
883883 local value = self :CalculateNode (node , nodeId , gate )
884884 self :Propagate (node , value )
885- end
885+ end
886886
887887 -- keep track of time spent this tick
888888 self .LastExecution = bench
0 commit comments