Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/precomp/conditions/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,24 @@ def visit_Compare(self, node: ast.Compare) -> None:

@conditions.make_result('Python', 'Operation')
def res_python_setup(res: Keyvalues) -> conditions.ResultCallable:
"""Apply a function to a fixup."""
"""Apply a function to a fixup.
* `ResultVar`: Fixup variable to assign the result to.
* `op`: The operation to run.

Fixups can be passed by specifying them as keyvalues with the type as the parameter.

For example:
```keyvalues
// Script command which shuts off the portals of a colour when picked up
"Operation"
{
"ResultVar" "$pickup_func"
"$fire_blue" "str"
"$fire_orange" "str"
"op" "'upgrade(' + fire_blue + ', ' + fire_orange + ')'"
}
```
"""
variables: dict[str, Callable[[str], object]] = {}
variable_order = []
code = None
Expand Down