From da871655e621c898d0ea52e551d8976424cd4c6a Mon Sep 17 00:00:00 2001 From: Dominik Roth Date: Wed, 2 Oct 2024 16:51:57 +0200 Subject: [PATCH] Updated README --- README.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index aa05a34..bd0257e 100644 --- a/README.md +++ b/README.md @@ -55,14 +55,52 @@ The `Nucon` enum contains all available parameters. Each parameter is defined wi - A type (float, int, bool, str, or a custom Enum) - A boolean indicating whether it's writable -Key methods: -- `Nucon.set_base_url(url)`: Set the base URL for the game's API -- `Nucon.set_dummy_mode(bool)`: Enable or disable dummy mode for testing -- `Nucon.get_all()`: Get all parameter values -- `Nucon.get_multiple(params)`: Get values for multiple specified parameters +Parameter properties: +- `Nucon..value`: Get or set the current value of the parameter. Assigning a new value will write it to the game. +- `Nucon..param_type`: Get the type of the parameter +- `Nucon..is_writable`: Check if the parameter is writable +- `Nucon..enum_type`: Get the enum type of the parameter if it's an enum, otherwise None -For a full list of parameters and their details, refer to the `Nucon` enum in the source code. +Parameter methods: +- `Nucon..read()`: Get the current value of the parameter (alias for `value`) +- `Nucon..write(new_value, force=False)`: Write a new value to the parameter. `force` will try to write even if the parameter is known as non-writable. + +Class methods: +- `Nucon.get(parameter)`: Get the value of a specific parameter +- `Nucon.set(parameter, value, force=False)`: Set the value of a specific parameter +- `Nucon.get_all_readable()`: Get a list of all readable parameters (which is all parameters) +- `Nucon.get_all_writable()`: Get a list of all writable parameters +- `Nucon.get_all()`: Get all parameter values as a dictionary +- `Nucon.get_multiple(params)`: Get values for multiple specified parameters +- `Nucon.set_base_url(url)`: Set the base URL for the game's API +- `Nucon.set_dummy_mode(dummy_mode)`: Enable or disable dummy mode for testing + +Custom Enum Types: +- `PumpStatus`: Enum for pump status (INACTIVE, ACTIVE_NO_SPEED_REACHED, ACTIVE_SPEED_REACHED, REQUIRES_MAINTENANCE, NOT_INSTALLED, INSUFFICIENT_ENERGY) +- `PumpDryStatus`: Enum for pump dry status (ACTIVE_WITHOUT_FLUID, INACTIVE_OR_ACTIVE_WITH_FLUID) +- `PumpOverloadStatus`: Enum for pump overload status (ACTIVE_AND_OVERLOAD, INACTIVE_OR_ACTIVE_NO_OVERLOAD) +- `BreakerStatus`: Enum for breaker status (OPEN, CLOSED) + +## Testing + +NuCon includes a test suite to verify its functionality and compatibility with the Nucleares game. + +### Running Tests + +To run the tests: + +1. Ensure the Nucleares game is running and accessible at http://localhost:8080/ (or update the URL in the test setup). +2. Install pytest: `pip install pytest` +3. Run the tests: `pytest test/test.py` + +### Test Coverage + +The tests verify: + +- Parameter types match their definitions in NuCon +- Writable parameters can be written to +- Non-writable parameters cannot be written to, even when force-writing +- Enum parameters and their custom truthy values behave correctly ## Disclaimer - -NuCon is an unofficial tool and is not affiliated with or endorsed by the creators of Nucleares. \ No newline at end of file +NuCon is an unofficial tool and is not affiliated with or endorsed by the creators of Nucleares.