Class AttachmentManager

java.lang.Object
VASSAL.build.module.AttachmentManager

public class AttachmentManager extends Object
Maintains a list of pieces with attachment traits
  • Constructor Details

    • AttachmentManager

      public AttachmentManager()
  • Method Details

    • clearAll

      public void clearAll()
      New game starting, clean all attachment info
    • pieceAdded

      public void pieceAdded(GamePiece piece)
    • addPiece

      public void addPiece(GamePiece piece)
      A piece has been added to the game. 1. If it has as Auto-attach, attach all other Attachments with same name to it. 2. Tell all other Auto-attach traits with same name to attach to it.

      Create the self attachment if required

      Parameters:
      piece - Piece moved or added
    • pieceRemoved

      public void pieceRemoved(GamePiece piece)
    • removePiece

      public void removePiece(GamePiece piece)
      A piece has been removed from a Map. If it contains any Attachments, tell all other auto-attachments to that Attachment to forget this piece
    • removeAttachments

      public Command removeAttachments(GamePiece piece)
      A piece is being removed by a Delete or Replace Command. Undo any attachments to or from any non-auto-attach Attachment traits it has Auto-attach traits will be cleaned up locally by the client when the piece is removed from the GameState
      Parameters:
      piece - Piece to clean up Attachments for.
      Returns:
      Command to undo attachments.
    • getAttachmentList

      public Set<String> getAttachmentList()
    • getAttachmentList

      public Set<Attachment> getAttachmentList(String attachName)
    • addPendingAttachment

      public void addPendingAttachment(Attachment attachnent, String target)
      Record an Attachment that must be resolved later, the target piece has not been loaded yet.
      Parameters:
      attachnent - Attachment Trait
      target - Id of target piece
    • resolvePendingAttachments

      public void resolvePendingAttachments()
      Callback from AttachmentManager aftet end of game load to add Attachments to pieces that had not yet been loaded.