Skip to content

Commit

Permalink
Implement TeamSpen210#210: Add OnFinished output to comp_numeric_tran…
Browse files Browse the repository at this point in the history
…sition.
  • Loading branch information
TeamSpen210 committed Mar 27, 2023
1 parent ba8d856 commit 075b544
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* Prevent automatically packing models specified only as Hammer previews in various entities.
* Fix propcombine sometimes removing collisions entirely from component props.
* Add an option to allow the sources for compiled models to be preserved.
* #210: Add `OnFinished` output to `comp_numeric_transition`.

--------------------

Expand Down
2 changes: 2 additions & 0 deletions fgd/point/comp/comp_numeric_transition.fgd
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,6 @@
"sine" : "Sinusoidal"
// "overshoot" : "Overshoot"
]

output OnFinished(void) : "Fired once the transition has completed."
]
6 changes: 6 additions & 0 deletions transforms/comp_numeric_transition.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ def compute_point(x: float) -> float:
# Directly sets the location at every point.
result = map(compute_point, points)

# Add the duration so the output fires after the transition finishes.
for out in ent.outputs:
if out.output.casefold() == 'onfinished':
out.output = 'OnTrigger'
out.delay += duration

last_inp = None
for i, point in enumerate(result):
if io_type == 'kv':
Expand Down

0 comments on commit 075b544

Please sign in to comment.