๐Ÿ“ฆ sleepyfran / duets

๐Ÿ“„ PassSecurity.Command.fs ยท 37 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37namespace Duets.Cli.Components.Commands

open Duets.Agents
open Duets.Cli
open Duets.Cli.Components
open Duets.Cli.SceneIndex
open Duets.Cli.Text
open Duets.Entities
open Microsoft.FSharp.Data.UnitSystems.SI.UnitNames
open Duets.Simulation.Flights.Airport

[<RequireQualifiedAccess>]
module PassSecurityCommand =
    /// Command that allows the user to pass the security check in the airport.
    let get =
        { Name = "pass security check"
          Description = Command.passSecurityCheckDescription
          Handler =
            fun _ ->
                showProgressBarSync [ Travel.passingSecurityCheck ] 5<second>

                let effects = passSecurityCheck (State.get ())
                Effect.applyMultiple effects

                let takenItemsEffect =
                    effects
                    |> List.filter (function
                        | ItemRemovedFromCharacterInventory _ -> true
                        | _ -> false)

                match takenItemsEffect with
                | eff when eff.Length > 0 ->
                    Travel.itemsTakenBySecurity |> showMessage
                | _ -> ()

                Scene.WorldAfterMovement }