Communication

Communication class to handle game communication

Constructor

new Communication()

This class is responsible for managing the communication related to parcel dropping and picking up. It allows setting the dropped parcel's position, value, quantity, and the agent responsible for picking it up. It also manages the distance to the nearest base for the dropped parcel. It provides methods to reset the drop state and set the dropped parcel's details.
Properties
NameTypeDescription
droppedValuenumberThe value of the dropped parcel.
droppedQuantitynumberThe quantity of the dropped parcel.
agentToPickupstringThe ID of the agent responsible for picking up the dropped parcel.
droppedCoordObjectThe coordinates where the parcel is dropped.
droppedBaseDistancenumberThe distance to the nearest base for the dropped parcel.
moveAwayAgentIdstring | nullThe ID of the agent that is moving away from the dropped parcel.

Classes

Communication

Methods

resetDrop()

This method clears the dropped parcel's details and the agent responsible for picking it up. It also resets the coordinates and distance to the nearest base for the dropped parcel.

setDropped(position, value, quantity, agentToPickup, mapStore)

This method updates the state with the details of a dropped parcel and calculates the distance to the nearest base.
Parameters:
NameTypeDescription
positionObjectThe coordinates where the parcel is dropped.
valuenumberThe value of the dropped parcel.
quantitynumberThe quantity of the dropped parcel.
agentToPickupstringThe ID of the agent responsible for picking up the parcel.
mapStoreMapStoreAn instance of MapStore to find the nearest base.