Skip to content

Commit

Permalink
select_target
Browse files Browse the repository at this point in the history
  • Loading branch information
tomara-x committed May 4, 2024
1 parent 0c99a3b commit fc0c68d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,9 @@ some ops make a circle do things to its targets. like `process`, `del_targets`,
- `process`
- this circle will process its targets in the order they appear in the targets array. it doesn't matter what order those targets are. even if they're at order 0 (it's preferable they are at 0 so you don't cause unexpected things). so for every frame a circle with a `process` op is processed, it processes all of its targets in order.
- you can't nest them. so if a process has another process in its targets, that won't process the second one (to avoid blowing up computers)
- `select_target`
- input: `n -> 1`
- select the targets when input is non-zero, deselect them when it's zero
- `open_target`
- inputs: `n -> 1`
- open target white holes when input is non-zero
Expand Down
21 changes: 21 additions & 0 deletions src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,27 @@ pub fn process(
}
}
}
} else if op == "select_target" {
for hole in holes {
if let Ok(wh) = white_hole_query.get(*hole) {
if wh.link_types == (-1, 1) && wh.open {
let n = access.num_query.get(wh.bh_parent).unwrap().0;
if n != 0. {
for t in &access.targets_query.get(*id).unwrap().0 {
if access.vertices_query.contains(*t) {
commands.entity(*t).insert(Selected);
}
}
} else {
for t in &access.targets_query.get(*id).unwrap().0 {
if access.vertices_query.contains(*t) {
commands.entity(*t).remove::<Selected>();
}
}
}
}
}
}
} else if op == "spin_target" {
for hole in holes {
if let Ok(wh) = white_hole_query.get(*hole) {
Expand Down

0 comments on commit fc0c68d

Please sign in to comment.