make groups only update update-causing ports
This commit is contained in:
@@ -122,28 +122,28 @@ function Simulation.removewire(self, objref)
|
||||
self.wires[objref] = nil
|
||||
|
||||
local bounds = Wire.getbounds(wire)
|
||||
|
||||
|
||||
for x = bounds[1]+1, bounds[4]-1, 2 do
|
||||
for z = bounds[3]+1, bounds[6]-1, 2 do
|
||||
self[x][bounds[2]][z][wire] = nil
|
||||
self[x][bounds[5]][z][wire] = nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
for y = bounds[2]+1, bounds[5]-1, 2 do
|
||||
for z = bounds[3]+1, bounds[6]-1, 2 do
|
||||
self[bounds[1]][y][z][wire] = nil
|
||||
self[bounds[4]][y][z][wire] = nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
for x = bounds[1]+1, bounds[4]-1, 2 do
|
||||
for y = bounds[2]+1, bounds[5]-1, 2 do
|
||||
self[x][y][bounds[3]][wire] = nil
|
||||
self[x][y][bounds[6]][wire] = nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
self.nwires = self.nwires - 1
|
||||
Group.removewire(Wire.getgroup(wire), wire)
|
||||
end
|
||||
@@ -156,7 +156,7 @@ function Simulation.removegate(self, objref)
|
||||
local pos = Port.getconnectionposition(port)
|
||||
self[pos[1]][pos[2]][pos[3]][port] = nil
|
||||
Group.removeport(Port.getgroup(port), port)
|
||||
|
||||
|
||||
if Port.gettype(port) == PortTypes.input then
|
||||
self.ninports = self.ninports - 1
|
||||
elseif Port.gettype(port) == PortTypes.output then
|
||||
@@ -164,7 +164,8 @@ function Simulation.removegate(self, objref)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Simulation.dequeuegate(self, gate)
|
||||
self.gates[objref] = nil
|
||||
self.ngates = self.ngates - 1
|
||||
end
|
||||
@@ -240,7 +241,7 @@ function Simulation.queuegatelater(self, gate, delay)
|
||||
if self.tickqueue[tick] == nil then
|
||||
self.tickqueue[tick] = {}
|
||||
end
|
||||
table.insert(self.tickqueue[tick], gate)
|
||||
self.tickqueue[tick][gate] = gate
|
||||
end
|
||||
|
||||
function Simulation.queuegateinput(self, gate, argv)
|
||||
@@ -256,6 +257,20 @@ function Simulation.queuegroup(self, group)
|
||||
self.groupqueue[group] = group
|
||||
end
|
||||
|
||||
function Simulation.dequeuegroup(self, group)
|
||||
self.groupqueue[group] = nil
|
||||
self.groupfxqueue[group] = nil
|
||||
end
|
||||
|
||||
function Simulation.dequeuegate(self, gate)
|
||||
self.gatequeue[gate] = nil
|
||||
self.initqueue[gate] = nil
|
||||
self.inputqueue[gate] = nil
|
||||
for tick, tickq in pairs(self.tickqueue) do
|
||||
tickq[gate] = nil
|
||||
end
|
||||
end
|
||||
|
||||
function Simulation.queuegroupfx(self, group)
|
||||
self.groupfxqueue[group] = group
|
||||
end
|
||||
@@ -283,7 +298,7 @@ function Simulation.tick(self)
|
||||
self.inputqueue = {}
|
||||
|
||||
if self.tickqueue[self.currenttick] ~= nil then
|
||||
for i, gate in ipairs(self.tickqueue[self.currenttick]) do
|
||||
for i, gate in pairs(self.tickqueue[self.currenttick]) do
|
||||
Simulation.queuegate(self, gate)
|
||||
end
|
||||
self.tickqueue[self.currenttick] = nil
|
||||
|
||||
Reference in New Issue
Block a user