Skip to content

Commit 2ea1cfb

Browse files
committed
deploy: 3445c3a
1 parent 38d0233 commit 2ea1cfb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+650
-575
lines changed

.doctrees/bots/setup.doctree

299 Bytes
Binary file not shown.
3.26 KB
Binary file not shown.

.doctrees/environment.pickle

-469 Bytes
Binary file not shown.

.doctrees/mods/index.doctree

-14 Bytes
Binary file not shown.

.doctrees/scripts/index.doctree

2 Bytes
Binary file not shown.

_sources/bots/setup.rst.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,4 @@ This will show you additional information about any single thing you select in t
5252
For example: unit id, its state, position (both index and 3D coordinates), etc.
5353
It shows at the bottom of the left panel.
5454

55+
Enable *Detailed tooltips* too.

_sources/concepts/callbacks.rst.txt

Lines changed: 73 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,86 @@ This callback is the primary driving point for your program.
1818
Use ``>=`` when waiting for number of ticks to pass.
1919

2020
Shootings Callback
21-
-----------------
21+
------------------
2222
Shootings events are synchronized *asynchronously and unreliably*.
2323
This event is useful for measuring threat.
2424

25+
The data encode multiple events, possibly of different types, mixed together.
26+
Make sure to carefully decode them, as shown in the example below.
27+
2528
.. warning::
2629
The entity id may be expired.
2730

28-
Deaths Callback
29-
---------------
30-
Deaths events are synchronized *asynchronously and unreliably* - some events may be lost, or delivered much later.
31-
Do *not* depend on deaths events for important decisions.
32-
It is useful for measuring threat.
31+
.. tab-set::
32+
:sync-group: language
33+
34+
.. tab-item:: Python
35+
:sync: python
36+
37+
.. code-block:: python
38+
39+
def shootings_callback(data: List[int]) -> None:
40+
index = 0
41+
while index < len(data):
42+
control = uw_events.shooting_control_data(data[index])
43+
if control.type == UwShootingEventEnum.Shooting:
44+
shooter_id = data[index + 1]
45+
for i in range(1, control.count):
46+
target_id = data[index + i + 1]
47+
# handle shooting event
48+
pass
49+
index += control.count + 1
50+
51+
.. tab-item:: C#
52+
:sync: csharp
53+
54+
.. code-block:: csharp
55+
56+
void ShootingsCallback(IReadOnlyList<uint> data)
57+
{
58+
int index = 0;
59+
while (index < data.Count)
60+
{
61+
var control = Events.ShootingControlData(data[index]);
62+
if (control.type == UwShootingEventEnum.Shooting)
63+
{
64+
uint shooterId = data[index + 1];
65+
for (uint i = 1; i < control.count; i++)
66+
{
67+
uint targetId = data[index + i + 1];
68+
// handle data event
69+
}
70+
}
71+
index += control.count + 1;
72+
}
73+
}
74+
75+
.. tab-item:: C++
76+
:sync: cpp
77+
78+
.. code-block:: cpp
79+
80+
extern "C"
81+
void uwShootingsCallback(const UwShootingsArray *data)
82+
{
83+
const auto shooting = uw::makeVector(data);
84+
uint32 index = 0;
85+
while (index < shooting.size())
86+
{
87+
const auto control = uw::shootingControlData(shooting[index]);
88+
if (control.type == UwShootingEventEnum_Shooting)
89+
{
90+
const uint32 shooterId = shooting[index + 1];
91+
for (uint32 i = 1; i < control.count; i++)
92+
{
93+
const uint32 targetId = shooting[index + i + 1];
94+
// handle shooting event
95+
}
96+
}
97+
index += control.count + 1;
98+
}
99+
}
33100
34-
.. warning::
35-
The entity id may be expired.
36101
37102
Task Completed Callback
38103
-----------------------

_sources/mods/index.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Mods
33
Guide on making mods for Unnatural Worlds.
44

55
.. warning::
6-
Making custom mods is not yet fully supported.
6+
Making mods is not yet fully supported.
77

88
A mod is a collection of assets that can modify the look and/or behavior of any moddable map.
99
It may contain :ref:`prototypes <concepts/prototypes:Prototypes>`, :ref:`scripts <scripts/index:Scripts>`, models, sounds, etc.

_sources/scripts/index.rst.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Scripts
22
=======
3-
Guide on making scripts for custom maps for Unnatural Worlds.
3+
Guide on making scripts for custom maps or mods for Unnatural Worlds.
44

55
.. warning::
6-
Making custom scripts is not yet fully supported.
6+
Making scripts is not yet fully supported.
77

88
Scripts are executed within the server.
99
They have access to all data within the game, and may modify all data.

_static/pygments.css

Lines changed: 217 additions & 243 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)