Use lastOnTrack for chaining triggers between blocks
This commit is contained in:
@@ -113,25 +113,24 @@ func GenerateMockShow(numTracks, numCues, numBlocks int) *Show {
|
|||||||
cueTargets = append(cueTargets, TriggerTarget{Block: block.ID, Hook: "START"})
|
cueTargets = append(cueTargets, TriggerTarget{Block: block.ID, Hook: "START"})
|
||||||
placed++
|
placed++
|
||||||
|
|
||||||
prev := block
|
lastOnTrack[trackIdx] = block
|
||||||
chainLen := rng.IntN(3)
|
chainLen := rng.IntN(3)
|
||||||
for range chainLen {
|
for range chainLen {
|
||||||
if placed >= numBlocks {
|
if placed >= numBlocks {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if !prev.hasDefinedTiming() {
|
if !lastOnTrack[trackIdx].hasDefinedTiming() {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
next := randBlock(trackIdx)
|
next := randBlock(trackIdx)
|
||||||
show.Blocks = append(show.Blocks, next)
|
show.Blocks = append(show.Blocks, next)
|
||||||
show.Triggers = append(show.Triggers, &Trigger{
|
show.Triggers = append(show.Triggers, &Trigger{
|
||||||
Source: TriggerSource{Block: prev.ID, Signal: "END"},
|
Source: TriggerSource{Block: lastOnTrack[trackIdx].ID, Signal: "END"},
|
||||||
Targets: []TriggerTarget{{Block: next.ID, Hook: "START"}},
|
Targets: []TriggerTarget{{Block: next.ID, Hook: "START"}},
|
||||||
})
|
})
|
||||||
prev = next
|
lastOnTrack[trackIdx] = next
|
||||||
placed++
|
placed++
|
||||||
}
|
}
|
||||||
lastOnTrack[trackIdx] = prev
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(cueTargets) > 0 {
|
if len(cueTargets) > 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user