21.12.2023, 15:14
This is a simplified example, as not all objects automatically trigger threads. I will explain my usage in more detail. First, I check if the event-triggering object contains a specific tag, such as ZONE_1. If so, I start the function zone:run() in a new thread. At the end of zone:run(), the instruction zone:run_units() is executed. This instruction initiates several threads containing the function unit:run(). Within these threads, there may be calls to copas.sleep().