Skip to content

Commit

Permalink
Check fail condition for tracked missions faster
Browse files Browse the repository at this point in the history
  • Loading branch information
Kvel2D committed Nov 20, 2024
1 parent bac5fa0 commit de4e0ad
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/missions/mission_manager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,22 @@ func _check_missions_for_fail():

for mission in mission_list:
mission.check_for_fail()


# NOTE: need to check fails for tracked missions more often so that there's
# not a large visual delay between doing a fail condition and tracking turning to FAILED
func _on_fast_fail_check_timer_timeout():
var mission_list: Array = _mission_list.duplicate()

var tracked_mission_list: Array = []

for mission in mission_list:
var mission_id: int = mission.get_id()
var mission_is_tracked: bool = MissionTracking.get_mission_is_tracked(mission_id)

if mission_is_tracked:
tracked_mission_list.append(mission)

for mission in tracked_mission_list:
mission.check_for_fail()

5 changes: 5 additions & 0 deletions src/missions/mission_manager.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ script = ExtResource("2_6cnfp")
wait_time = 10.0
autostart = true

[node name="FastFailCheckTimer" type="Node" parent="."]
script = ExtResource("2_6cnfp")
autostart = true

[connection signal="timeout" from="FailCheckTimer" to="." method="_on_fail_check_timer_timeout"]
[connection signal="timeout" from="FastFailCheckTimer" to="." method="_on_fast_fail_check_timer_timeout"]

0 comments on commit de4e0ad

Please sign in to comment.