## Protection control

Control Module - Protection - Controls protected entities

### Dependencies

utils.global
utils.event
config.protection
expcore.roles

### Events

on_player_mined_protected | When a player mines a protected entity
on_repeat_violation | When a player repeatedly mines protected entities

### Functions

EntityProtection.add_entity(entity) | Add an entity to the protected list
EntityProtection.remove_entity(entity) | Remove an entity from the protected list
EntityProtection.get_entities(surface) | Get all protected entities on a surface
EntityProtection.is_entity_protected(entity) | Check if an entity is protected
EntityProtection.add_area(surface, area) | Add an area to the protected list
EntityProtection.remove_area(surface, area) | Remove an area from the protected list
EntityProtection.get_areas(surface) | Get all protected areas on a surface
EntityProtection.is_position_protected(surface, position) | Check if an entity is protected

### Dependencies

# utils.global
# utils.event
# config.protection
# expcore.roles

### Events

# on_player_mined_protected

  When a player mines a protected entity

  Event Parameters:
  - player_index : (number) the player index of the player who got mined the entity
  - entity : (LuaEntity) the entity which was mined
# on_repeat_violation

  When a player repeatedly mines protected entities

  Event Parameters:
  - player_index : (number) the player index of the player who got mined the entities
  - entity : (LuaEntity) the last entity which was mined

### Functions

# EntityProtection.add_entity(entity)

  Add an entity to the protected list

  Parameters:
  - entity
# EntityProtection.remove_entity(entity)

  Remove an entity from the protected list

  Parameters:
  - entity
# EntityProtection.get_entities(surface)

  Get all protected entities on a surface

  Parameters:
  - surface
# EntityProtection.is_entity_protected(entity)

  Check if an entity is protected

  Parameters:
  - entity
# EntityProtection.add_area(surface, area)

  Add an area to the protected list

  Parameters:
  - surface
  - area
# EntityProtection.remove_area(surface, area)

  Remove an area from the protected list

  Parameters:
  - surface
  - area
# EntityProtection.get_areas(surface)

  Get all protected areas on a surface

  Parameters:
  - surface
# EntityProtection.is_position_protected(surface, position)

  Check if an entity is protected

  Parameters:
  - surface
  - position