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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57namespace 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 Duets.Simulation.Careers.Work
[<RequireQualifiedAccess>]
module WorkCommand =
/// Command that allows the player to start a shift in their work.
let create job =
{ Name = "work"
Description = Command.workDescription job
Handler =
fun _ ->
let result = workShift (State.get ()) job
match result with
| Ok effects ->
Career.workShiftEvent job |> showMessage
wait 5000<millisecond>
Effect.applyMultiple effects
Scene.WorldAfterMovement
| Error AttemptedToWorkDuringClosingTime ->
"The place is currently close, you can't work now!"
|> Styles.error
|> showMessage
Scene.World
| Error AttemptedToWorkOnNonScheduledDay ->
let workDaysText =
match job.CurrentStage.Schedule with
| JobSchedule.Fixed(workDays, workDayMoments, _) ->
let dayNames = workDays |> List.map Generic.dayName
let dayMomentNames =
workDayMoments |> List.map Generic.dayMomentName
let daysText = Generic.listOf dayNames id
let momentsText = Generic.listOf dayMomentNames id
$"{daysText} during {momentsText}"
| JobSchedule.Free _ -> "" // This shouldn't happen but just in case
$"Right now is your free time. Try to work on {workDaysText}"
|> Styles.error
|> showMessage
Scene.World
}