-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib_crew.ks
More file actions
37 lines (30 loc) · 757 Bytes
/
lib_crew.ks
File metadata and controls
37 lines (30 loc) · 757 Bytes
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
@LAZYGLOBAL OFF. // #include init
GLOBAL CREW_SIZE IS 0.
GLOBAL CREW_FN IS "cs.ks".
resume(CREW_FN).
FUNCTION storeLastCrewCount {
SET CREW_SIZE TO crewCount().
store("SET CREW_SIZE TO " + CREW_SIZE + ".", CREW_FN, 50).
}
FUNCTION lastCrewCount {
RETURN CREW_SIZE.
}
FUNCTION crewCount {
PARAMETER c IS SHIP.
RETURN c:CREW():LENGTH.
}
FUNCTION crewSpaces {
PARAMETER c IS SHIP.
RETURN c:CREWCAPACITY - crewCount(c).
}
FUNCTION pCrew {
PARAMETER c IS SHIP.
pOut("Crew details:").
IF crewCount(c) < 1 { pOut("NONE"). }
FOR kerb IN c:CREW() {
LOCAL role IS "Tourist".
IF NOT kerb:TOURIST { SET role TO kerb:TRAIT. }
pOut(role + " " + kerb:NAME + " in " + kerb:PART:TITLE).
}
pOut("Vacant seats: " + crewSpaces()).
}