make states numbers instead of booleans

This commit is contained in:
Redo0
2021-05-29 13:13:26 -05:00
parent ebc9a7f108
commit 8bb4ff4421
6 changed files with 31 additions and 45 deletions

View File

@@ -21,7 +21,7 @@ function Port.new(type, direction, position, causeupdate, idx)
direction = direction,
position = position,
causeupdate = causeupdate,
state = false,
state = 0,
gate = nil,
group = nil,
idx = idx,
@@ -35,17 +35,11 @@ function Port.getconnectionposition(port)
end
function Port.isrising(port)
if port.group == nil then
return false
end
return port.group.state and (port.group.update_tick == GSim.current_tick)
return port.group.state==1 and (port.group.update_tick == GSim.current_tick)
end
function Port.isfalling(port)
if port.group == nil then
return false
end
return port.group.state == false and (port.group.update_tick == GSim.current_tick)
return port.group.state==0 and (port.group.update_tick == GSim.current_tick)
end
function Port.getgate(port)