Skip to content

Commit f50624d

Browse files
committed
deploy: f56ba27
1 parent 5583f6f commit f50624d

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

+663
-121
lines changed
-228 Bytes
Binary file not shown.

.doctrees/concepts/economy.doctree

3.5 KB
Binary file not shown.
931 Bytes
Binary file not shown.

.doctrees/concepts/map.doctree

48 Bytes
Binary file not shown.
3.61 KB
Binary file not shown.

.doctrees/environment.pickle

2.88 KB
Binary file not shown.

.doctrees/maps/editor.doctree

2.36 KB
Binary file not shown.

.doctrees/maps/index.doctree

19 Bytes
Binary file not shown.

_sources/concepts/callbacks.rst.txt

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Make sure to carefully decode them, as shown in the example below.
4040
index = 0
4141
while index < len(data):
4242
control = uw_events.shooting_control_data(data[index])
43-
if control.type == UwShootingEventEnum.Shooting:
43+
if control.type == ShootingEvent.Shooting:
4444
shooter_id = data[index + 1]
4545
for i in range(1, control.count):
4646
target_id = data[index + i + 1]
@@ -80,22 +80,22 @@ Make sure to carefully decode them, as shown in the example below.
8080
extern "C"
8181
void uwShootingsCallback(const UwShootingsArray *data)
8282
{
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-
}
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+
}
9999
}
100100
101101
Task Completed Callback

_sources/concepts/economy.rst.txt

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
Economy
22
=======
33

4+
Recipes And Constructions
5+
-------------------------
6+
47
Resources are mined from deposits, or processed from other resources.
5-
Producing units or researching upgrades works the same way as recipes.
8+
Producing units and researching upgrades works the same as recipes.
69

710
.. tab-set::
811
:sync-group: language
@@ -15,14 +18,14 @@ Producing units or researching upgrades works the same way as recipes.
1518
# find closest viable position for miner:
1619
p = uw_world.find_construction_placement(DRILL_CONSTRUCTION_ID, home_position, METAL_RECIPE_ID) # recipe id is optional
1720
if p == INVALID:
18-
return
21+
return
1922
2023
# place construction:
21-
uw_commands.place_construction(DRILL_CONSTRUCTION_ID, p, 0, METAL_RECIPE_ID, UwPriorityEnum.Normal) # yaw, recipe, and priority are optional
24+
uw_commands.place_construction(DRILL_CONSTRUCTION_ID, p, 0, METAL_RECIPE_ID, Priority.High) # yaw, recipe, and priority are optional
2225
2326
# recipe and priority can be changed later:
2427
uw_commands.set_recipe(own_id, ANOTHER_RECIPE_ID)
25-
uw_commands.set_priority(own_id, UwPriorityEnum.High)
28+
uw_commands.set_priority(own_id, Priority.Normal)
2629
2730
.. tab-item:: C#
2831
:sync: csharp
@@ -32,14 +35,14 @@ Producing units or researching upgrades works the same way as recipes.
3235
// find closest viable position for miner:
3336
uint p = World.FindConstructionPlacement(DRILL_CONSTRUCTION_ID, homePosition, METAL_RECIPE_ID); // recipe id is optional
3437
if (p == Entity.Invalid):
35-
return;
38+
return;
3639
3740
// place construction:
38-
Commands.PlaceConstruction(DRILL_CONSTRUCTION_ID, p, 0, METAL_RECIPE_ID, Interop.UwPriorityEnum.Normal); // yaw, recipe, and priority are optional
41+
Commands.PlaceConstruction(DRILL_CONSTRUCTION_ID, p, 0, METAL_RECIPE_ID, UwPriorityEnum.High); // yaw, recipe, and priority are optional
3942
4043
// recipe and priority can be changed later:
41-
Commands.SetRecipe(own_id, ANOTHER_RECIPE_ID)
42-
Commands.SetPriority(own_id, Interop.UwPriorityEnum.High)
44+
Commands.SetRecipe(ownId, ANOTHER_RECIPE_ID)
45+
Commands.SetPriority(ownId, UwPriorityEnum.Normal)
4346
4447
.. tab-item:: C++
4548
:sync: cpp
@@ -48,12 +51,21 @@ Producing units or researching upgrades works the same way as recipes.
4851
4952
// todo
5053
54+
Destroyed Buildings
55+
^^^^^^^^^^^^^^^^^^^
56+
57+
When a building is destroyed, same construction is automatically placed in its place.
58+
It has ``disabled`` priority, you just change it when appropriate.
59+
Its previous recipe is also restored.
60+
5161
Logistics
5262
---------
5363

5464
Resources are automatically transported by trucks.
5565
They will fulfill tasks by their priority, and on first-come-first-serve basis.
5666

67+
Priorities apply to both constructions and recipes.
68+
5769
.. tab-set::
5870
:sync-group: language
5971

@@ -73,9 +85,35 @@ They will fulfill tasks by their priority, and on first-come-first-serve basis.
7385
// percentage of trucks that are idle:
7486
100.0 * World.MyForceStatistics().logisticsUnitsIdle / World.MyForceStatistics().logisticsUnitsTotal
7587
88+
Expansion Bases
89+
---------------
90+
91+
Each map contains predefined set of starting positions.
92+
These can have some additional conditions to be used as starting base, eg. actual number of forces in the game.
93+
Anyway, these positions can be used to easily find suitable expansion bases.
94+
95+
.. tab-set::
96+
:sync-group: language
97+
98+
.. tab-item:: Python
99+
:sync: python
100+
101+
.. code-block:: python
102+
103+
# potential expansion bases:
104+
list({p.position for p in uw_map.starting_positions()}) # make the positions unique
105+
106+
.. tab-item:: C#
107+
:sync: csharp
108+
109+
.. code-block:: csharp
110+
111+
// potential expansion bases:
112+
Map.StartingPositions().Select(p => p.position).Distinct().ToList();
113+
76114
.. tab-item:: C++
77115
:sync: cpp
78116

79117
.. code-block:: cpp
80118
81-
// nothing
119+
// todo

0 commit comments

Comments
 (0)