Доработка изменения цвета своей цели на зеленый

This commit is contained in:
MaD_CaT
2025-12-10 13:15:47 +03:00
parent c8e67775a0
commit c9304134ca
3 changed files with 28 additions and 3 deletions

View File

@@ -206,8 +206,6 @@ common/enable_object_picking=false
[rendering]
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"
shader_compiler/shader_cache/strip_debug=true
quality/driver/fallback_to_gles2=true

View File

@@ -305,7 +305,10 @@ func map_threat_to_bip(th: threats.Threat, bip: Control) -> bool:
func on_threat_update(th: threats.Threat):
var bip = get_node('%d' % th.id)
bip.update(th.tick_rx)
bip.set_bip_color(Color.CORAL if th.proto else Color.WHITE)
if th.gos:
bip.set_bip_color(Color.GREEN)
else:
bip.set_bip_color(Color.CORAL if th.proto else Color.WHITE)
bip.visible = map_threat_to_bip(th, bip)

View File

@@ -2,6 +2,8 @@ extends Node
## Работа с целями.
var gos_flag = true ## Флаг работать по своим целям
var gos_protocols: PackedStringArray ## Список протоколов своих целей
## Цель
class Threat:
@@ -31,6 +33,7 @@ class Threat:
var emit_state: int = 0 ## 0 - подавление не назначено, 1 - назначено, 2 - выполняется
var nmfs: int ## Индекс модуля ФС, в зону действия которого попала цель
var priority: int ## Приоритет опасности цели
var gos: bool = false ## Своя или чужая цель
func _init(): clear_fflags()
func _to_string() -> String: return 'номер: %d пеленг: %0.1f частота: %0.1f МГц' % [id, aoa, freq]
@@ -69,6 +72,8 @@ func _ready() -> void:
signaller.connect('rto_threat_unsel_all', Callable(self, 'on_rto_threat_unsel_all').bind(threats))
signaller.connect('threat_selected', Callable(self, 'on_threat_selected').bind(threats))
signaller.connect('interfer_init', Callable(self, 'on_interfer_init').bind(threats))
ProjectSettings.connect('settings_changed', on_settings_changed.bind(threats))
## Периодически удаляет устаревшие цели.
@@ -148,12 +153,31 @@ func on_data_capsrpb_received(unit: capsrpb.CapsRpb, threats: Dictionary):
th.priority = 1
else:
th.priority = 0
set_gos(th)
call_deferred('emit_signal', 'threat_update', th)
else:
var th: = Threat.new()
th.set_from_dic(dic_th)
threats[id] = th
th.tick_rx = unit.tick
set_gos(th)
call_deferred('emit_signal', 'threat_new', th)
if sz != threats.size():
call_deferred('emit_signal', 'threats_resized', threats)
func on_settings_changed(ths):
gos_flag = ProjectSettings.get_setting('application/config/Включить работу по своим целям', true)
var protocols: String = ProjectSettings.get_setting('application/config/Список своих протоколов', '')
gos_protocols = protocols.split(",", true)
for th in ths.values():
set_gos(th)
func set_gos(th: Threat):
if gos_flag:
th.gos = false
elif (th.proto in gos_protocols) and th.fflags.proto:
th.gos = true