# engine.LingYi.entitys.waypoint

View Source

     1# -*- coding:utf-8 -*-
     2
     3from .global_util import *
     4from .operatorbase import DoctrineOperator
     5
     6
     7class Waypoint(DoctrineOperator):
     8    """
     9    航路点类
    10    设置飞机等单元某航路点的条令、高度等
    11    示例：
    12    if air.Navigator["PC"]:
    13        # 飞机已设置航路点
    14        for point in air.Navigator["PC"]:
    15            if "GeoPoint" in point:
    16                point_id = point["GeoPoint"]["ID"]
    17                point_name = point["GeoPoint"]["Name"]
    18                point_lat = point["GeoPoint"]["Lat"]
    19                if point_lat < 12.6:
    20                    air.set_weapoint(point_id, 500, 8000)  # 设置单元航路点速度和高度
    21                    if point_name:
    22                        air.set_waypoint_sensor(point_name, sensor_id=radar_id, radar=False)  # 设置单元航路点雷达关闭
    23                    waypoint = air.get_way_point(point_id, point_name)  # 获取航路点对象
    24                    waypoint.doctrine_weapon_control_status_surface(WeaponControlStatus.Free)  # 设置航路点条令
    25                elif point_lat < 12.95:
    26                    air.set_weapoint(point_id, 600, 3000)  # 设置单元航路点速度和高度
    27                    if point_name:
    28                        air.set_waypoint_sensor(point_name, sensor_id=radar_id, radar=True)  # 设置单元航路点雷达关闭
    29                    waypoint = air.get_way_point(point_id, point_name)  # 获取航路点对象
    30                    waypoint.doctrine_weapon_control_status_subsurface(WeaponControlStatus.Hold)  # 设置航路点条令
    31                self.air_alt_set = True
    32    else:
    33        # 还没有设置航路点
    34        air.plotted_course([(12.4, -88.5, 'A1'), (12.9, -89.6, 'A2'), (14.5, -90.6, 'A3')])  # 设置飞机航路
    35    """
    36    def __init__(self, guid, name, side_name, unit_id, game_server):
    37        sel_category = SelectorCategory.WayPoint
    38        DoctrineOperator.__init__(self, guid, name, side_name, sel_category, ElementType.WayPoint, unit_id)
    39        self.Lon = 0.0  # 航路点纬度
    40        self.Lat = 0.0  # 航路点经度
    41        self._game_server = game_server
    42
    43    def get_summary_info(self):
    44        """
    45        获取精简信息, 提炼信息进行决策
    46        :return: dict
    47        """
    48        info_dict = {
    49            "category": "WayPoint",
    50            "guid": self.ID,
    51            "name": self.Name,
    52            "latitude": self.Lat,
    53            "longitude": self.Lon,
    54        }
    55        return info_dict

class Waypoint(engine.LingYi.entitys.operatorbase.DoctrineOperator): View Source

     8class Waypoint(DoctrineOperator):
     9    """
    10    航路点类
    11    设置飞机等单元某航路点的条令、高度等
    12    示例：
    13    if air.Navigator["PC"]:
    14        # 飞机已设置航路点
    15        for point in air.Navigator["PC"]:
    16            if "GeoPoint" in point:
    17                point_id = point["GeoPoint"]["ID"]
    18                point_name = point["GeoPoint"]["Name"]
    19                point_lat = point["GeoPoint"]["Lat"]
    20                if point_lat < 12.6:
    21                    air.set_weapoint(point_id, 500, 8000)  # 设置单元航路点速度和高度
    22                    if point_name:
    23                        air.set_waypoint_sensor(point_name, sensor_id=radar_id, radar=False)  # 设置单元航路点雷达关闭
    24                    waypoint = air.get_way_point(point_id, point_name)  # 获取航路点对象
    25                    waypoint.doctrine_weapon_control_status_surface(WeaponControlStatus.Free)  # 设置航路点条令
    26                elif point_lat < 12.95:
    27                    air.set_weapoint(point_id, 600, 3000)  # 设置单元航路点速度和高度
    28                    if point_name:
    29                        air.set_waypoint_sensor(point_name, sensor_id=radar_id, radar=True)  # 设置单元航路点雷达关闭
    30                    waypoint = air.get_way_point(point_id, point_name)  # 获取航路点对象
    31                    waypoint.doctrine_weapon_control_status_subsurface(WeaponControlStatus.Hold)  # 设置航路点条令
    32                self.air_alt_set = True
    33    else:
    34        # 还没有设置航路点
    35        air.plotted_course([(12.4, -88.5, 'A1'), (12.9, -89.6, 'A2'), (14.5, -90.6, 'A3')])  # 设置飞机航路
    36    """
    37    def __init__(self, guid, name, side_name, unit_id, game_server):
    38        sel_category = SelectorCategory.WayPoint
    39        DoctrineOperator.__init__(self, guid, name, side_name, sel_category, ElementType.WayPoint, unit_id)
    40        self.Lon = 0.0  # 航路点纬度
    41        self.Lat = 0.0  # 航路点经度
    42        self._game_server = game_server
    43
    44    def get_summary_info(self):
    45        """
    46        获取精简信息, 提炼信息进行决策
    47        :return: dict
    48        """
    49        info_dict = {
    50            "category": "WayPoint",
    51            "guid": self.ID,
    52            "name": self.Name,
    53            "latitude": self.Lat,
    54            "longitude": self.Lon,
    55        }
    56        return info_dict

航路点类
设置飞机等单元某航路点的条令、高度等
示例：
if air.Navigator["PC"]:
# 飞机已设置航路点
for point in air.Navigator["PC"]:
if "GeoPoint" in point:
point_id = point["GeoPoint"]["ID"]
point_name = point["GeoPoint"]["Name"]
point_lat = point["GeoPoint"]["Lat"]
if point_lat < 12.6:
air.set_weapoint(point_id, 500, 8000) # 设置单元航路点速度和高度
if point_name:
air.set_waypoint_sensor(point_name, sensor_id=radar_id, radar=False) # 设置单元航路点雷达关闭
waypoint = air.get_way_point(point_id, point_name) # 获取航路点对象
waypoint.doctrine_weapon_control_status_surface(WeaponControlStatus.Free) # 设置航路点条令
elif point_lat < 12.95:
air.set_weapoint(point_id, 600, 3000) # 设置单元航路点速度和高度
if point_name:
air.set_waypoint_sensor(point_name, sensor_id=radar_id, radar=True) # 设置单元航路点雷达关闭
waypoint = air.get_way_point(point_id, point_name) # 获取航路点对象
waypoint.doctrine_weapon_control_status_subsurface(WeaponControlStatus.Hold) # 设置航路点条令
self.air_alt_set = True
else:
# 还没有设置航路点
air.plotted_course([(12.4, -88.5, 'A1'), (12.9, -89.6, 'A2'), (14.5, -90.6, 'A3')]) # 设置飞机航路

Waypoint(guid, name, side_name, unit_id, game_server) View Source

    37    def __init__(self, guid, name, side_name, unit_id, game_server):
    38        sel_category = SelectorCategory.WayPoint
    39        DoctrineOperator.__init__(self, guid, name, side_name, sel_category, ElementType.WayPoint, unit_id)
    40        self.Lon = 0.0  # 航路点纬度
    41        self.Lat = 0.0  # 航路点经度
    42        self._game_server = game_server

Lon
Lat
def get_summary_info(self): View Source

    44    def get_summary_info(self):
    45        """
    46        获取精简信息, 提炼信息进行决策
    47        :return: dict
    48        """
    49        info_dict = {
    50            "category": "WayPoint",
    51            "guid": self.ID,
    52            "name": self.Name,
    53            "latitude": self.Lat,
    54            "longitude": self.Lon,
    55        }
    56        return info_dict

获取精简信息, 提炼信息进行决策 :return: dict

##### Inherited Members

engine.LingYi.entitys.operatorbase.DoctrineOperator
  Doctrine
  category
  category_str
  doctrine_switch_radar
  doctrine_switch_oecm
  doctrine_switch_sonar
  doctrine_SetEMCON_Inherit
  use_nuclear_weapons
  doctrine_weapon_control_status_air
  doctrine_weapon_control_status_surface
  doctrine_weapon_control_status_subsurface
  doctrine_weapon_control_status_land
  doctrine_ignore_plotted_course
  doctrine_engaging_ambiguous_targets
  doctrine_engage_opportunity_targets
  doctrine_ignore_emcon_under_attack
  torpedoes_kinematic_range
  doctrine_automatic_evasion
  doctrine_refuel
  doctrine_refuel_select
  doctrine_refuel_allied
  doctrine_air_operations_tempo
  doctrine_quick_turnaround
  doctrine_fuel_state_planned
  doctrine_fuel_state_rtb
  doctrine_weapon_state_planned
  doctrine_weapon_state_rtb
  doctrine_gun_strafing
  doctrine_jettison_ordnance
  doctrine_bvr_logic
  use_sams_in_anti_surface_mode
  doctrine_maintain_standoff
  doctrine_navigation_surface_mode
  avoid_contact
  dive_on_threat
  recharge_on_patrol
  recharge_on_attack
  use_aip
  dipping_sonar
  navigation_sub
  navigation_land
  set_weapon_release_authority
  wra_qty_salvo
  wra_shooter_salvo
  wra_firing_range
  wra_self_defence_distance
  withdraw_on_damage
  withdraw_on_fuel
  withdraw_on_attack
  withdraw_on_defence
  deploy_on_damage
  deploy_on_fuel
  deploy_on_attack
  deploy_on_defence
  get_doctrineWRA
engine.LingYi.entitys.element.Element
  ID
  Name
  Side
  ElementType
  delete_sub_object