Reputation: 443
How can I access how many unique agents a specific unit of a resource pool has interacted with? For context, I would like to trigger an event when a certain resource unit has interacted with 17 unique agents.
Upvotes: 0
Views: 55
Reputation: 2213
Start by creating a resource type.
Add a collection to that agent.
Then, in the on seize resource pool block, write the following code:
unit.seizedAgents.add(agent);
And then, in the on release field write:
if( unit.seizedAgents.stream().distinct().count() == 17 ) {
<action >;
}
Of course, make sure to set the resource pool type to the right one.
Upvotes: 2