Skip to content

Commit fb8971e

Browse files
committed
doc: Document API changes for nyan data API v0.6.0.
doc: Document API changes for ApplyEffect. doc: Document API changes for Task nodes. doc: Document API changes for Ranged property. doc: Document API changes for NextCommand condition.
1 parent 927f547 commit fb8971e

File tree

2 files changed

+178
-59
lines changed

2 files changed

+178
-59
lines changed

doc/nyan/api_reference/reference_ability.md

Lines changed: 20 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,26 @@ If the lock pool
127127

128128
the ability with this property cannot become active.
129129

130+
## ability.property.type.Ranged
131+
132+
```python
133+
Ranged(AbilityProperty):
134+
min_range : float
135+
max_range : float
136+
```
137+
138+
Abilities with this property can only be used within a specified range around the game entity. The property mostly affects abilities that are *targeted*, i.e. that are used on other game entities or locations in the game world.
139+
140+
If the target of the ability is another game entity and said game entity has a `Collision` ability, the range check factors in the `Hitbox` boundaries of the targeted game entity when calculating the distance.
141+
142+
Without this property, abilities behave as if `min_range` and `max_range` are `0.0`.
143+
144+
**min_range**
145+
Minimum distance to the target of the ability.
146+
147+
**max_range**
148+
Maximum distance to the target of the ability.
149+
130150
## ability.type.ActiveTransformTo
131151

132152
```python
@@ -327,16 +347,12 @@ Alters the abilities and modifiers of a game entity after the despawn condition
327347

328348
```python
329349
DetectCloak(Ability):
330-
range : float
331350
allowed_types : set(children(GameEntityType))
332351
blacklisted_entities : set(GameEntity)
333352
```
334353

335354
Enables the game entity to decloak other game entities which use the `Cloak` ability.
336355

337-
**range**
338-
Range around the game entity in which other game entities will be decloaked.
339-
340356
**allowed_types**
341357
Whitelist of game entity types that can be decloaked.
342358

@@ -543,17 +559,13 @@ Determines whether the resource spot is harvestable when it is created. If `True
543559

544560
```python
545561
Herd(Ability):
546-
range : float
547562
strength : int
548563
allowed_types : set(children(GameEntityType))
549564
blacklisted_entities : set(GameEntity)
550565
```
551566

552567
Allows a game entity to change the ownership of other game entities with the `Herdable` ability.
553568

554-
**range**
555-
Minimum distance to a herdable game entity to make it change ownership.
556-
557569
**strength**
558570
Comparison value for situations when the game entity competes with other game entities for a herdable. The game entity with the highest `strength` value will always be prefered, even if other game entities fulfill the condition set by `mode` in `Herdable` better.
559571

@@ -787,38 +799,6 @@ RallyPoint(Ability):
787799

788800
Allows a game entity to set a rally point on the map. Game entities spawned by the `Create` ability or ejected from a container will move to the rally point location. The rally point can be placed on another game entity. In that case, the game entities moving there will try to use an appropriate ability on it.
789801

790-
## ability.type.RangedContinuousEffect
791-
792-
```python
793-
RangedContinuousEffect(ApplyContinuousEffect):
794-
min_range : int
795-
max_range : int
796-
```
797-
798-
Applies continuous effects on another game entity. This specialization of `ApplyContinuousEffect` allows ranged application.
799-
800-
**min_range**
801-
Minimum distance to target.
802-
803-
**max_range**
804-
Maximum distance to the target.
805-
806-
## ability.type.RangedDiscreteEffect
807-
808-
```python
809-
RangedDiscreteEffect(ApplyDiscreteEffect):
810-
min_range : int
811-
max_range : int
812-
```
813-
814-
Applies batches of discrete effects on another game entity. This specialization of `ApplyDiscreteEffect` allows ranged application.
815-
816-
**min_range**
817-
Minimum distance to target.
818-
819-
**max_range**
820-
Maximum distance to the target.
821-
822802
## ability.type.RegenerateAttribute
823803

824804
```python
@@ -966,8 +946,6 @@ ShootProjectile(Ability):
966946
projectiles : orderedset(GameEntity)
967947
min_projectiles : int
968948
max_projectiles : int
969-
min_range : int
970-
max_range : int
971949
reload_time : float
972950
spawn_delay : float
973951
projectile_delay : float
@@ -994,12 +972,6 @@ Minimum amount of projectiles spawned.
994972
**max_projectiles**
995973
Maximum amount of projectiles spawned.
996974

997-
**min_range**
998-
Minimum distance to the targeted game entity.
999-
1000-
**max_range**
1001-
Maximum distance to the targeted game entity.
1002-
1003975
**reload_time**
1004976
Time until the ability can be used again in seconds. The timer starts after the *last* projectile has been fired.
1005977

doc/nyan/api_reference/reference_util.md

Lines changed: 158 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,32 +54,54 @@ Generalization object for conditions that can be used in `XORGate` nodes.
5454
**node**
5555
Node that is visited when the condition is true.
5656

57+
## util.activity.condition.type.AbilityUsable
58+
59+
```python
60+
AbilityUsable(Condition):
61+
ability : abstract(Ability)
62+
```
63+
64+
Is true when an ability can be used by the game entity when the node is visited.
65+
66+
**ability**
67+
Ability definition used for the usability check. This can reference a specific ability of the game entity or an abstract API object from the `engine.ability.type` namespace. If a specific ability is referenced, the ability must be assigned to the game entity **and** be enabled for the check to pass. If an API object is referenced, at least one ability of the same type must be enabled for the check to pass.
68+
5769
## util.activity.condition.type.CommandInQueue
5870

5971
```python
6072
CommandInQueue(Condition):
6173
pass
6274
```
6375

64-
Is true when the command queue is not empty when the node is visited.
76+
Is true when the game entity's command queue is not empty when the node is visited.
6577

66-
## util.activity.condition.type.NextCommandIdle
78+
## util.activity.condition.type.NextCommand
6779

6880
```python
69-
NextCommandIdle(Condition):
70-
pass
81+
NextCommand(Condition):
82+
command : children(Command)
7183
```
7284

73-
Is true when the next command in the queue is of type `Idle`.
85+
Is true when the next command in the game entity's command queue is of a specific type.
7486

75-
## util.activity.condition.type.NextCommandMove
87+
**command**
88+
Command type checked by the condition.
89+
90+
## util.activity.condition.type.TargetInRange
7691

7792
```python
78-
NextCommandMove(Condition):
79-
pass
93+
TargetInRange(Condition):
94+
ability : abstract(Ability)
8095
```
8196

82-
Is true when the next command in the queue is of type `Move`.
97+
Is true when the target of the next command in the game entity's command queue is in range of an ability.
98+
99+
**ability**
100+
Ability definition used for the range check.
101+
102+
This can reference a specific ability of the game entity or an abstract API object from the `engine.ability.type` namespace. If a specific ability is referenced, the ability must be assigned to the game entity and must be enabled. Otherwise, the range check fails. If an API object is referenced, the first active ability with the same type as the API object is executed.
103+
104+
If the ability has the property `Ranged`, the attributes of this property are utilized for the range check calculations. If the ability does not have a `Ranged` property, the condition is only true when the game entity is at the same position as the target.
83105

84106
## util.activity.event.Event
85107

@@ -149,7 +171,7 @@ Next node in the activity graph.
149171
**ability**
150172
Ability that is executed.
151173

152-
This can reference a specific ability of the game entity or an abstract API object from the `engine.ability.type` namespace. If a specific ability is referenced, the ability must be assigned to the game entity and must not be disabled. Otherwise, the ability is not executed. If an API object is referenced, the first active ability with the same type as the API object is executed.
174+
This can reference a specific ability of the game entity or an abstract API object from the `engine.ability.type` namespace. If a specific ability is referenced, the ability must be assigned to the game entity and must be enabled. Otherwise, the ability is not executed. If an API object is referenced, the first active ability with the same type as the API object is executed.
153175

154176
## util.activity.node.type.End
155177

@@ -172,6 +194,22 @@ Start of an activity. Does nothing but pointing to the next node.
172194
**next**
173195
Next node in the activity graph.
174196

197+
## util.activity.node.type.Task
198+
199+
```python
200+
Task(Node):
201+
next : Node
202+
task : children(Task)
203+
```
204+
205+
Executes a task on the game entity when the node is visited.
206+
207+
**next**
208+
Next node in the activity graph.
209+
210+
**task**
211+
Task that is executed.
212+
175213
## util.activity.node.type.XOREventGate
176214

177215
```python
@@ -195,11 +233,84 @@ XORGate(Node):
195233
Gateway that branches the activity graph depending on the result of conditional queries. Queries are executed immediately when the node is visited.
196234

197235
**next**
198-
Mapping of conditional queries to the next node in the activity graph. The first query that evaluates to true is used to determine the next node. If no query evaluates to true, the `default` node is used.
236+
Mapping of conditional queries to the next node in the activity graph. The first query that evaluates to true is used to determine the next node. If no query evaluates to true, the `default` node is used as fallback.
199237

200238
**default**
201239
Default node that is used if no query evaluates to true.
202240

241+
## util.activity.node.type.XORSwitchGate
242+
243+
```python
244+
XORSwitchGate(Node):
245+
switch : children(SwitchCondition)
246+
default : Node
247+
```
248+
249+
Gateway that branches the activity graph depending on the value of a runtime parameter. In comparison to `XORGate`, only one conditional query is done based on the value (similar to the behaviour of a [switch statement](https://en.wikipedia.org/wiki/Switch_statement)). The query is executed immediately when the node is visited.
250+
251+
**switch**
252+
Defines which runtime parameter is checked as well as the mapping of parameter value to the next node in the activity graph. If a value is encountered at query execution time that is not associated with a node, the `default` node is used as fallback.
253+
254+
**default**
255+
Default node that is used if a value does not have an associated node.
256+
257+
## util.activity.switch_condition.SwitchCondition
258+
259+
```python
260+
SwitchCondition(Object):
261+
pass
262+
```
263+
264+
Generalization object for conditions that can be used in `XORSwitchGate` nodes.
265+
266+
## util.activity.switch_condition.type.NextCommand
267+
268+
```python
269+
NextCommand(SwitchCondition):
270+
next : dict(children(Command), Node)
271+
```
272+
273+
Switches branches based on the type of command that is in the queue of the game entity.
274+
275+
**next**
276+
Mapping of command types to the next node in the activity graph.
277+
278+
## util.activity.task.Task
279+
280+
```python
281+
Task(Object):
282+
pass
283+
```
284+
285+
Generalization object for tasks that can be used in `Task` nodes.
286+
287+
## util.activity.task.type.ClearCommandQueue
288+
289+
```python
290+
ClearCommandQueue(Task):
291+
pass
292+
```
293+
294+
Clear the command queue of the game entity executing the activity.
295+
296+
## util.activity.task.type.MoveToTarget
297+
298+
```python
299+
MoveToTarget(Task):
300+
pass
301+
```
302+
303+
Move to the current target of the game entity. The target may be a position or another game entity. If the game entity has no target at time of execution, the task is skipped.
304+
305+
## util.activity.task.type.PopCommandQueue
306+
307+
```python
308+
PopCommandQueue(Task):
309+
pass
310+
```
311+
312+
Pop the front command from the command queue of the game entity executing the activity.
313+
203314
## util.animation_override.AnimationOverride
204315

205316
```python
@@ -420,6 +531,42 @@ The activation message that has to be typed into the chat console.
420531
**changes**
421532
Changes to API objects.
422533

534+
## util.command.Command
535+
536+
```python
537+
Command(Object):
538+
pass
539+
```
540+
541+
Generalization object for commands of a game entity.
542+
543+
## util.command.type.ApplyEffect
544+
545+
```python
546+
ApplyEffect(Command):
547+
pass
548+
```
549+
550+
Game entity command for using the `ApplyEffect` ability.
551+
552+
## util.command.type.Idle
553+
554+
```python
555+
Idle(Command):
556+
pass
557+
```
558+
559+
Game entity command for using the `Idle` ability.
560+
561+
## util.command.type.Move
562+
563+
```python
564+
Move(Command):
565+
pass
566+
```
567+
568+
Game entity command for using the `Move` ability.
569+
423570
## util.container_type.SendToContainerType
424571

425572
```python

0 commit comments

Comments
 (0)