Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions api/source/Creep.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}

Expand Down
18 changes: 18 additions & 0 deletions api/source/PowerCreep.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}

Expand Down
20 changes: 20 additions & 0 deletions api/source/Structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}


Expand All @@ -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 | <code>enable</code> argument is not a boolean value.
{% endapi_return_codes %}

Expand Down
33 changes: 19 additions & 14 deletions api/source/StructureSpawn.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,20 +266,25 @@ An object with additional options for the spawning process.
<div class="api-arg-desc">If `dryRun` is true, the operation will only check if it is possible to create a creep.</div>
</li>
<li>
<div class="api-arg-title">directions</div>
<div class="api-arg-type">array<number></div>
<div class="api-arg-desc">Set desired directions where the creep should move when spawned. An array with the direction constants:
<ul>
<li><code>TOP</code></li>
<li><code>TOP_RIGHT</code></li>
<li><code>RIGHT</code></li>
<li><code>BOTTOM_RIGHT</code></li>
<li><code>BOTTOM</code></li>
<li><code>BOTTOM_LEFT</code></li>
<li><code>LEFT</code></li>
<li><code>TOP_LEFT</code></li>
</ul></div>
</li>
<div class="api-arg-title">directions</div>
<div class="api-arg-type">array<number></div>
<div class="api-arg-desc">Set desired directions where the creep should move when spawned. An array with the direction constants:
<ul>
<li><code>TOP</code></li>
<li><code>TOP_RIGHT</code></li>
<li><code>RIGHT</code></li>
<li><code>BOTTOM_RIGHT</code></li>
<li><code>BOTTOM</code></li>
<li><code>BOTTOM_LEFT</code></li>
<li><code>LEFT</code></li>
<li><code>TOP_LEFT</code></li>
</ul></div>
</li>
<li>
<div class="api-arg-title">notifyWhenAttacked</div>
<div class="api-arg-type">boolean</div>
<div class="api-arg-desc">Sets the default value for the creep's <code>notifyWhenAttacked</code> property. Defaults to <code>true</code>.</div>
</li>
</ul>
{% endapi_method_params %}

Expand Down
19 changes: 19 additions & 0 deletions api/source/inherited/Structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}


Expand Down