From 3ecd3cd81c4c119aadd324d69f1a16c4de01825a Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Sat, 8 Nov 2025 18:13:32 +0100 Subject: [PATCH] Docs for the new `notifyWhenAttacked` spawn option and `notifiesWhenAttacked` property --- api/source/Creep.md | 18 +++++++++++++++++ api/source/PowerCreep.md | 18 +++++++++++++++++ api/source/Structure.md | 20 +++++++++++++++++++ api/source/StructureSpawn.md | 33 ++++++++++++++++++------------- api/source/inherited/Structure.md | 19 ++++++++++++++++++ 5 files changed, 94 insertions(+), 14 deletions(-) diff --git a/api/source/Creep.md b/api/source/Creep.md index 58585094..634366f0 100644 --- a/api/source/Creep.md +++ b/api/source/Creep.md @@ -767,6 +767,24 @@ ERR_NOT_FOUND | The creep has no memorized path to reuse. {% endapi_return_codes %} +{% api_method notifiesWhenAttacked A %} + +```javascript +if(creep.notifiesWhenAttacked()) { + // Creep has attack notifications enabled +} +``` + +Returns the attack notification's state for the creep. Turned on by default. + +### Return value + +One of the following codes: +{% api_return_codes %} +boolean | The state of the notification +ERR_NOT_OWNER | You are not the owner of this creep. +ERR_BUSY | The creep is still being spawned. +{% endapi_return_codes %} {% api_method notifyWhenAttacked 'enabled' A %} diff --git a/api/source/PowerCreep.md b/api/source/PowerCreep.md index 7b340f96..d09bad24 100644 --- a/api/source/PowerCreep.md +++ b/api/source/PowerCreep.md @@ -451,6 +451,24 @@ ERR_NOT_FOUND | The creep has no memorized path to reuse. {% endapi_return_codes %} +{% api_method notifiesWhenAttacked A %} + +```javascript +if(powerCreep.notifiesWhenAttacked()) { + // Creep has attack notifications enabled +} +``` + +Returns the attack notification's state for the power creep. Turned on by default. + +### Return value + +One of the following codes: +{% api_return_codes %} +boolean | The state of the notification. +ERR_NOT_OWNER | You are not the owner of this creep. +ERR_BUSY | The creep is still being spawned. +{% endapi_return_codes %} {% api_method notifyWhenAttacked 'enabled' A %} diff --git a/api/source/Structure.md b/api/source/Structure.md index 6c460b65..4398bafa 100644 --- a/api/source/Structure.md +++ b/api/source/Structure.md @@ -67,6 +67,25 @@ Check whether this structure can be used. If room controller level is insufficie A boolean value. +{% api_method notifiesWhenAttacked A %} + +```javascript +if(structure.notifiesWhenAttacked()) { + // Creep has attack notifications enabled +} +``` + +Returns the attack notification's state for the structure. + +### Return value + +One of the following codes: +{% api_return_codes %} +boolean | The state of the notification. +ERR_NOT_OWNER | You are not the owner of this structure. +ERR_INVALID_TARGET | The structure is invalid. +{% endapi_return_codes %} + {% api_method notifyWhenAttacked 'enabled' A %} @@ -85,6 +104,7 @@ One of the following codes: {% api_return_codes %} OK | The operation has been scheduled successfully. ERR_NOT_OWNER | You are not the owner of this structure. +ERR_INVALID_TARGET | The structure is invalid. ERR_INVALID_ARGS | enable argument is not a boolean value. {% endapi_return_codes %} diff --git a/api/source/StructureSpawn.md b/api/source/StructureSpawn.md index 3eca864b..be536712 100644 --- a/api/source/StructureSpawn.md +++ b/api/source/StructureSpawn.md @@ -266,20 +266,25 @@ An object with additional options for the spawning process.
If `dryRun` is true, the operation will only check if it is possible to create a creep.
  • -
    directions
    -
    array
    -
    Set desired directions where the creep should move when spawned. An array with the direction constants: -
      -
    • TOP
    • -
    • TOP_RIGHT
    • -
    • RIGHT
    • -
    • BOTTOM_RIGHT
    • -
    • BOTTOM
    • -
    • BOTTOM_LEFT
    • -
    • LEFT
    • -
    • TOP_LEFT
    • -
    -
  • +
    directions
    +
    array
    +
    Set desired directions where the creep should move when spawned. An array with the direction constants: +
    + +
  • +
    notifyWhenAttacked
    +
    boolean
    +
    Sets the default value for the creep's notifyWhenAttacked property. Defaults to true.
    +
  • {% endapi_method_params %} diff --git a/api/source/inherited/Structure.md b/api/source/inherited/Structure.md index 4cfa6a4f..80c37f76 100644 --- a/api/source/inherited/Structure.md +++ b/api/source/inherited/Structure.md @@ -63,6 +63,25 @@ Check whether this structure can be used. If room controller level is insufficie A boolean value. +{% api_method notifiesWhenAttacked A %} + +```javascript +if(structure.notifiesWhenAttacked()) { + // Creep has attack notifications enabled +} +``` + +Returns the attack notification's state for the structure. + +### Return value + +One of the following codes: +{% api_return_codes %} +boolean | The state of the notification. +ERR_NOT_OWNER | You are not the owner of this structure. +ERR_INVALID_TARGET | The structure is invalid. +{% endapi_return_codes %} + {% api_method Structure:notifyWhenAttacked 'enabled' A %}