| 
 | 1 | +Economy  | 
 | 2 | +=======  | 
 | 3 | + | 
 | 4 | +Resources are mined from deposits, or processed from other resources.  | 
 | 5 | +Producing units or researching upgrades works the same way as recipes.  | 
 | 6 | + | 
 | 7 | +.. tab-set::  | 
 | 8 | +   :sync-group: language  | 
 | 9 | + | 
 | 10 | +   .. tab-item:: Python  | 
 | 11 | +      :sync: python  | 
 | 12 | + | 
 | 13 | +      .. code-block:: python  | 
 | 14 | +
  | 
 | 15 | +          # find closest viable position for miner:  | 
 | 16 | +          p = uw_world.find_construction_placement(DRILL_CONSTRUCTION_ID, home_position, METAL_RECIPE_ID) # recipe id is optional  | 
 | 17 | +          if p == INVALID:  | 
 | 18 | +            return  | 
 | 19 | +
  | 
 | 20 | +          # place construction:  | 
 | 21 | +          uw_commands.place_construction(DRILL_CONSTRUCTION_ID, p, 0, METAL_RECIPE_ID, UwPriorityEnum.Normal) # yaw, recipe, and priority are optional  | 
 | 22 | +            | 
 | 23 | +          # recipe and priority can be changed later:  | 
 | 24 | +          uw_commands.set_recipe(own_id, ANOTHER_RECIPE_ID)  | 
 | 25 | +          uw_commands.set_priority(own_id, UwPriorityEnum.High)  | 
 | 26 | +
  | 
 | 27 | +   .. tab-item:: C#  | 
 | 28 | +      :sync: csharp  | 
 | 29 | + | 
 | 30 | +      .. code-block:: csharp  | 
 | 31 | +
  | 
 | 32 | +          // find closest viable position for miner:  | 
 | 33 | +          uint p = World.FindConstructionPlacement(DRILL_CONSTRUCTION_ID, homePosition, METAL_RECIPE_ID); // recipe id is optional  | 
 | 34 | +          if (p == Entity.Invalid):  | 
 | 35 | +            return;  | 
 | 36 | +
  | 
 | 37 | +          // place construction:  | 
 | 38 | +          Commands.PlaceConstruction(DRILL_CONSTRUCTION_ID, p, 0, METAL_RECIPE_ID, Interop.UwPriorityEnum.Normal); // yaw, recipe, and priority are optional  | 
 | 39 | +            | 
 | 40 | +          // recipe and priority can be changed later:  | 
 | 41 | +          Commands.SetRecipe(own_id, ANOTHER_RECIPE_ID)  | 
 | 42 | +          Commands.SetPriority(own_id, Interop.UwPriorityEnum.High)  | 
 | 43 | +
  | 
 | 44 | +   .. tab-item:: C++  | 
 | 45 | +      :sync: cpp  | 
 | 46 | + | 
 | 47 | +      .. code-block:: cpp  | 
 | 48 | +
  | 
 | 49 | +          // todo  | 
 | 50 | +
  | 
 | 51 | +Logistics  | 
 | 52 | +---------  | 
 | 53 | + | 
 | 54 | +Resources are automatically transported by trucks.  | 
 | 55 | +They will fulfill tasks by their priority, and on first-come-first-serve basis.  | 
 | 56 | + | 
 | 57 | +.. tab-set::  | 
 | 58 | +   :sync-group: language  | 
 | 59 | + | 
 | 60 | +   .. tab-item:: Python  | 
 | 61 | +      :sync: python  | 
 | 62 | + | 
 | 63 | +      .. code-block:: python  | 
 | 64 | +
  | 
 | 65 | +          # percentage of trucks that are idle:  | 
 | 66 | +          100.0 * uw_world.my_force_statistics().logisticsUnitsIdle / uw_world.my_force_statistics().logisticsUnitsTotal  | 
 | 67 | +
  | 
 | 68 | +   .. tab-item:: C#  | 
 | 69 | +      :sync: csharp  | 
 | 70 | + | 
 | 71 | +      .. code-block:: csharp  | 
 | 72 | +
  | 
 | 73 | +          // percentage of trucks that are idle:  | 
 | 74 | +          100.0 * World.MyForceStatistics().logisticsUnitsIdle / World.MyForceStatistics().logisticsUnitsTotal  | 
 | 75 | +
  | 
 | 76 | +   .. tab-item:: C++  | 
 | 77 | +      :sync: cpp  | 
 | 78 | + | 
 | 79 | +      .. code-block:: cpp  | 
 | 80 | +
  | 
 | 81 | +          // nothing  | 
0 commit comments