Class: GarrisonManager

GarrisonManager()

Manage the garrisonHolders When a unit is ordered to garrison, it must be done through this.garrison() function so that an object in this.holders is created. This object contains an array with the entities in the process of being garrisoned. To have all garrisoned units, we must add those in holder.garrisoned(). Futhermore garrison units have a metadata garrisonType describing its reason (protection, transport, ...)

Constructor

new GarrisonManager()

Source:

Methods

addDecayingStructure()

Garrison units in decaying structures to stop their decay do it only for structures useful for defense, except if we are expanding (justCaptured=true) in which case we also do it for structures useful for unit trainings (TODO only Barracks are done)
Source:

cancelGarrison()

Cancel a pre-garrison state
Source:

garrison()

This is just a pre-garrison state, while the entity walk to the garrison holder
Source:

leaveGarrison()

This is the end of the pre-garrison state, either because the entity is really garrisoned or because it has changed its order (i.e. because the garrisonHolder was destroyed) This function is for internal use inside garrisonManager. From outside, you should also update the holder and then using cancelGarrison should be the preferred solution
Source:

numberOfGarrisonedSlots()

TODO should add the units garrisoned inside garrisoned units
Source:

numberOfGarrisonedUnits()

TODO should add the units garrisoned inside garrisoned units
Source:

registerHolder()

Add this holder in the list managed by the garrisonManager
Source: