From 4c29bb3d32c60e7e23df71b8a5fb4537a0d04865 Mon Sep 17 00:00:00 2001 From: ElectrocutedMan <98556236+Endernice61@users.noreply.github.com> Date: Wed, 25 Jun 2025 15:34:22 -0600 Subject: [PATCH] Document Python a bit better --- src/precomp/conditions/python.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/precomp/conditions/python.py b/src/precomp/conditions/python.py index f6d530d0a..4b9655b71 100644 --- a/src/precomp/conditions/python.py +++ b/src/precomp/conditions/python.py @@ -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