加入火力打击无人机

This commit is contained in:
2025-10-09 17:55:25 +08:00
parent 76e62a75fa
commit fe83e0bc21
11 changed files with 392 additions and 159 deletions

View File

@@ -15,7 +15,7 @@
processor IADS_CMDR_TASK_MGR WSF_TASK_PROCESSOR
number_of_servers 5
track_update_interval 10.0 sec
track_update_interval 5.0 sec
#script_debug_writes true
#show_state_transitions
@@ -53,24 +53,28 @@ processor IADS_CMDR_TASK_MGR WSF_TASK_PROCESSOR
if (quantity > 0)
{
weaponsAvailable = true;
}
else
{
foreach (WsfPlatform sub in aAssignee.Subordinates())
{
weapon = sub.Weapon(WEAPON_NAME);
if (weapon.IsTurnedOn())
{
quantity = quantity + weapon.QuantityRemaining();
}
}
}
if (quantity > 0) weaponsAvailable = true;
return weaponsAvailable;
end_script
script bool UCAVWeaponsAvailable(WsfPlatform aAssignee)
bool weaponsAvailable = false;
int quantity = 0;
WsfWeapon weapon = aAssignee.Weapon("blue_gps_bomb_1");
if (weapon.IsTurnedOn())
{
quantity = quantity + weapon.QuantityRemaining();
}
if (quantity > 0)
{
weaponsAvailable = true;
}
return weaponsAvailable;
end_script
script void MakeAssignments()
#writeln("MakeAssignments ");
Array<WsfPlatform> filter = Array<WsfPlatform>();
@@ -140,7 +144,7 @@ processor IADS_CMDR_TASK_MGR WSF_TASK_PROCESSOR
{
#writeln("is LARGE_SAM_LAUNCHER");
if (WeaponsAvailable(sub) &&
(TasksAssignedTo(sub) < MAX_ASSIGNMENTS_PER_SAM) &&
(TasksAssignedTo(sub) < MAX_ASSIGNMENTS_PER_SAM) &&
(TasksAssignedTo(sub, TRACK.TrackId()) < 1) &&
(TRACK.WithinZoneOf(sub, "battalion_sector")))
{
@@ -156,12 +160,38 @@ processor IADS_CMDR_TASK_MGR WSF_TASK_PROCESSOR
}
if(!WeaponsAvailable(sub))
{
writeln("*** Adding ", sub.Name(), " to waiter");
waiter.PushBack(sub);
}
}
if (sub.Type() == "UCAV")
{
#writeln("is LARGE_SAM_LAUNCHER");
if (UCAVWeaponsAvailable(sub) &&
(TRACK.WithinZoneOf(sub, "battalion_sector")))
{
#writeln("can fire");
writeln("*** Adding ", sub.Name(), " to firer");
firer.PushBack(sub);
}
if(UCAVWeaponsAvailable(sub) &&
!(TRACK.WithinZoneOf(sub, "battalion_sector")))
{
writeln("*** Adding ", sub.Name(), " to mover");
mover.PushBack(sub);
}
if(!UCAVWeaponsAvailable(sub))
{
writeln("*** Adding ", sub.Name(), " to waiter");
waiter.PushBack(sub);
}
}
}
int i;
int numAssignments = (int)MATH.Min(firer.Size(), MAX_SAMS_PER_TARGET);
for (int i=0; i < numAssignments; i = i + 1)
@@ -182,7 +212,6 @@ processor IADS_CMDR_TASK_MGR WSF_TASK_PROCESSOR
msg.SetAuxData("track",TRACK);
msg.SetAuxData("task","MOVE");
PLATFORM.Comm("sub_net").SendMessage(msg,mover[i].Name(),"cmdr_net");
AssignTask(TRACK, "MOVE", mover[i]);
}
int numWaiter=(int)(waiter.Size());
@@ -192,7 +221,6 @@ processor IADS_CMDR_TASK_MGR WSF_TASK_PROCESSOR
WsfControlMessage msg = WsfControlMessage();
msg.SetAuxData("task","WAIT");
PLATFORM.Comm("sub_net").SendMessage(msg,waiter[i].Name(),"cmdr_net");
AssignTask(TRACK, "WAIT", waiter[i]);
}
end_script
@@ -215,7 +243,6 @@ processor IADS_CMDR_TASK_MGR WSF_TASK_PROCESSOR
next_state DETECTED
if (! IsAssignable())
{
CancelTask(TRACK.TrackId());
return true;
}
#MakeAssignments();

View File

@@ -17,6 +17,10 @@ include_once sensors/radar/ucav_sar.txt
include_once weapons/agm/blue_gps_bomb_2.txt
include_once weapons/agm/blue_gps_bomb_1.txt
include_once weapons/agm/blue_glide_bomb_1$(BLUE_GLIDE_BOMB_1_MODEL).txt
include_once weapons/sam/large_sam.txt
include_once behavior/UCAV_fire.txt
include_once behavior/UCAV_move.txt
include_once behavior/UCAV_wait.txt
platform_type UCAV WSF_PLATFORM
icon UCAV
@@ -25,53 +29,19 @@ platform_type UCAV WSF_PLATFORM
optical_signature UCAV_OPTICAL_SIG
radar_signature UCAV_RADAR_SIG
processor image_proc WSF_IMAGE_PROCESSOR
#debug
end_processor
sensor esm UCAV_ESM
on
# sensor esm UCAV_ESM
# on
# internal_link data_mgr
# ignore_same_side
# end_sensor
comm cmdr_net RED_DATALINK
network_name <local:slave>
internal_link data_mgr
ignore_same_side
end_sensor
sensor sar_left SAR_RADAR
off
yaw -60 deg
pitch -10 deg
aux_data
double min_frequency_band_hz = 8e9
double max_frequency_band_hz = 12e9
double pref_az_aspect1_deg = -50
double pref_az_aspect2_deg = -85
end_aux_data
internal_link image_proc
ignore_same_side
end_sensor
sensor sar_right SAR_RADAR
off
yaw 60 deg
pitch -10 deg
aux_data
double min_frequency_band_hz = 8e9
double max_frequency_band_hz = 12e9
double pref_az_aspect1_deg = 50
double pref_az_aspect2_deg = 85
end_aux_data
internal_link image_proc
ignore_same_side
end_sensor
weapon blue_gps_bomb_2 BLUE_GPS_BOMB_2
quantity 1
end_weapon
weapon blue_gps_bomb_1 BLUE_GPS_BOMB_1
quantity 2
end_weapon
weapon blue_glide_bomb_1 BLUE_GLIDE_BOMB_1
internal_link task_mgr
end_comm
weapon blue_gps_bomb_1 LARGE_SAM
quantity 6
end_weapon
@@ -81,9 +51,23 @@ platform_type UCAV WSF_PLATFORM
end_mover
processor data_mgr WSF_TRACK_PROCESSOR
purge_interval 60.0 sec
purge_interval 60 sec
end_processor
processor task_mgr WSF_TASK_PROCESSOR
processor task_mgr WSF_SCRIPT_PROCESSOR
update_interval 5 sec
advanced_behavior_tree
btt on
selector
behavior_node UCAV_fire
behavior_node UCAV_move
behavior_node UCAV_wait
end_selector
end_advanced_behavior_tree
end_processor
zone battalion_sector
circular maximum_radius 20 nm
end_zone
end_platform_type