@fnndsc/brasa 0.43.0 → 0.43.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/buildinfo.json +1 -1
- package/dist/builtins/games/trek.d.ts +8 -0
- package/dist/builtins/games/trek.js +50 -0
- package/dist/builtins/games/trek.js.map +1 -0
- package/dist/core/coreCommands.js +1 -1
- package/dist/core/coreCommands.js.map +1 -1
- package/dist/notes.json +1 -1
- package/package.json +3 -3
- package/NOTICE +0 -48
- package/dist/builtins/games/trek/abandon.d.ts +0 -3
- package/dist/builtins/games/trek/abandon.js +0 -159
- package/dist/builtins/games/trek/abandon.js.map +0 -1
- package/dist/builtins/games/trek/attack.d.ts +0 -3
- package/dist/builtins/games/trek/attack.js +0 -185
- package/dist/builtins/games/trek/attack.js.map +0 -1
- package/dist/builtins/games/trek/autover.d.ts +0 -3
- package/dist/builtins/games/trek/autover.js +0 -79
- package/dist/builtins/games/trek/autover.js.map +0 -1
- package/dist/builtins/games/trek/capture.d.ts +0 -3
- package/dist/builtins/games/trek/capture.js +0 -117
- package/dist/builtins/games/trek/capture.js.map +0 -1
- package/dist/builtins/games/trek/check_out.d.ts +0 -3
- package/dist/builtins/games/trek/check_out.js +0 -67
- package/dist/builtins/games/trek/check_out.js.map +0 -1
- package/dist/builtins/games/trek/checkcond.d.ts +0 -3
- package/dist/builtins/games/trek/checkcond.js +0 -101
- package/dist/builtins/games/trek/checkcond.js.map +0 -1
- package/dist/builtins/games/trek/compkl.d.ts +0 -8
- package/dist/builtins/games/trek/compkl.js +0 -66
- package/dist/builtins/games/trek/compkl.js.map +0 -1
- package/dist/builtins/games/trek/computer.d.ts +0 -3
- package/dist/builtins/games/trek/computer.js +0 -310
- package/dist/builtins/games/trek/computer.js.map +0 -1
- package/dist/builtins/games/trek/consts.d.ts +0 -109
- package/dist/builtins/games/trek/consts.js +0 -159
- package/dist/builtins/games/trek/consts.js.map +0 -1
- package/dist/builtins/games/trek/context.d.ts +0 -27
- package/dist/builtins/games/trek/context.js +0 -2
- package/dist/builtins/games/trek/context.js.map +0 -1
- package/dist/builtins/games/trek/damage.d.ts +0 -3
- package/dist/builtins/games/trek/damage.js +0 -87
- package/dist/builtins/games/trek/damage.js.map +0 -1
- package/dist/builtins/games/trek/damaged.d.ts +0 -3
- package/dist/builtins/games/trek/damaged.js +0 -58
- package/dist/builtins/games/trek/damaged.js.map +0 -1
- package/dist/builtins/games/trek/dcrept.d.ts +0 -3
- package/dist/builtins/games/trek/dcrept.js +0 -86
- package/dist/builtins/games/trek/dcrept.js.map +0 -1
- package/dist/builtins/games/trek/destruct.d.ts +0 -3
- package/dist/builtins/games/trek/destruct.js +0 -114
- package/dist/builtins/games/trek/destruct.js.map +0 -1
- package/dist/builtins/games/trek/dock.d.ts +0 -5
- package/dist/builtins/games/trek/dock.js +0 -133
- package/dist/builtins/games/trek/dock.js.map +0 -1
- package/dist/builtins/games/trek/dumpgame.d.ts +0 -15
- package/dist/builtins/games/trek/dumpgame.js +0 -29
- package/dist/builtins/games/trek/dumpgame.js.map +0 -1
- package/dist/builtins/games/trek/dumpme.d.ts +0 -3
- package/dist/builtins/games/trek/dumpme.js +0 -81
- package/dist/builtins/games/trek/dumpme.js.map +0 -1
- package/dist/builtins/games/trek/dumpssradio.d.ts +0 -6
- package/dist/builtins/games/trek/dumpssradio.js +0 -72
- package/dist/builtins/games/trek/dumpssradio.js.map +0 -1
- package/dist/builtins/games/trek/events.d.ts +0 -3
- package/dist/builtins/games/trek/events.js +0 -407
- package/dist/builtins/games/trek/events.js.map +0 -1
- package/dist/builtins/games/trek/getcodi.d.ts +0 -14
- package/dist/builtins/games/trek/getcodi.js +0 -24
- package/dist/builtins/games/trek/getcodi.js.map +0 -1
- package/dist/builtins/games/trek/getpar.d.ts +0 -40
- package/dist/builtins/games/trek/getpar.js +0 -174
- package/dist/builtins/games/trek/getpar.js.map +0 -1
- package/dist/builtins/games/trek/help.d.ts +0 -3
- package/dist/builtins/games/trek/help.js +0 -155
- package/dist/builtins/games/trek/help.js.map +0 -1
- package/dist/builtins/games/trek/impulse.d.ts +0 -6
- package/dist/builtins/games/trek/impulse.js +0 -85
- package/dist/builtins/games/trek/impulse.js.map +0 -1
- package/dist/builtins/games/trek/initquad.d.ts +0 -17
- package/dist/builtins/games/trek/initquad.js +0 -79
- package/dist/builtins/games/trek/initquad.js.map +0 -1
- package/dist/builtins/games/trek/io.d.ts +0 -102
- package/dist/builtins/games/trek/io.js +0 -216
- package/dist/builtins/games/trek/io.js.map +0 -1
- package/dist/builtins/games/trek/kill.d.ts +0 -21
- package/dist/builtins/games/trek/kill.js +0 -194
- package/dist/builtins/games/trek/kill.js.map +0 -1
- package/dist/builtins/games/trek/klmove.d.ts +0 -3
- package/dist/builtins/games/trek/klmove.js +0 -181
- package/dist/builtins/games/trek/klmove.js.map +0 -1
- package/dist/builtins/games/trek/lose.d.ts +0 -9
- package/dist/builtins/games/trek/lose.js +0 -36
- package/dist/builtins/games/trek/lose.js.map +0 -1
- package/dist/builtins/games/trek/lrscan.d.ts +0 -3
- package/dist/builtins/games/trek/lrscan.js +0 -96
- package/dist/builtins/games/trek/lrscan.js.map +0 -1
- package/dist/builtins/games/trek/main.d.ts +0 -24
- package/dist/builtins/games/trek/main.js +0 -37
- package/dist/builtins/games/trek/main.js.map +0 -1
- package/dist/builtins/games/trek/move.d.ts +0 -3
- package/dist/builtins/games/trek/move.js +0 -229
- package/dist/builtins/games/trek/move.js.map +0 -1
- package/dist/builtins/games/trek/nova.d.ts +0 -3
- package/dist/builtins/games/trek/nova.js +0 -135
- package/dist/builtins/games/trek/nova.js.map +0 -1
- package/dist/builtins/games/trek/out.d.ts +0 -3
- package/dist/builtins/games/trek/out.js +0 -52
- package/dist/builtins/games/trek/out.js.map +0 -1
- package/dist/builtins/games/trek/phaser.d.ts +0 -3
- package/dist/builtins/games/trek/phaser.js +0 -341
- package/dist/builtins/games/trek/phaser.js.map +0 -1
- package/dist/builtins/games/trek/play.d.ts +0 -3
- package/dist/builtins/games/trek/play.js +0 -112
- package/dist/builtins/games/trek/play.js.map +0 -1
- package/dist/builtins/games/trek/printf.d.ts +0 -31
- package/dist/builtins/games/trek/printf.js +0 -157
- package/dist/builtins/games/trek/printf.js.map +0 -1
- package/dist/builtins/games/trek/ram.d.ts +0 -3
- package/dist/builtins/games/trek/ram.js +0 -97
- package/dist/builtins/games/trek/ram.js.map +0 -1
- package/dist/builtins/games/trek/rand.d.ts +0 -29
- package/dist/builtins/games/trek/rand.js +0 -109
- package/dist/builtins/games/trek/rand.js.map +0 -1
- package/dist/builtins/games/trek/rest.d.ts +0 -3
- package/dist/builtins/games/trek/rest.js +0 -76
- package/dist/builtins/games/trek/rest.js.map +0 -1
- package/dist/builtins/games/trek/schedule.d.ts +0 -23
- package/dist/builtins/games/trek/schedule.js +0 -55
- package/dist/builtins/games/trek/schedule.js.map +0 -1
- package/dist/builtins/games/trek/score.d.ts +0 -8
- package/dist/builtins/games/trek/score.js +0 -61
- package/dist/builtins/games/trek/score.js.map +0 -1
- package/dist/builtins/games/trek/setup.d.ts +0 -18
- package/dist/builtins/games/trek/setup.js +0 -251
- package/dist/builtins/games/trek/setup.js.map +0 -1
- package/dist/builtins/games/trek/setwarp.d.ts +0 -8
- package/dist/builtins/games/trek/setwarp.js +0 -28
- package/dist/builtins/games/trek/setwarp.js.map +0 -1
- package/dist/builtins/games/trek/shield.d.ts +0 -3
- package/dist/builtins/games/trek/shield.js +0 -139
- package/dist/builtins/games/trek/shield.js.map +0 -1
- package/dist/builtins/games/trek/snova.d.ts +0 -3
- package/dist/builtins/games/trek/snova.js +0 -156
- package/dist/builtins/games/trek/snova.js.map +0 -1
- package/dist/builtins/games/trek/srscan.d.ts +0 -3
- package/dist/builtins/games/trek/srscan.js +0 -176
- package/dist/builtins/games/trek/srscan.js.map +0 -1
- package/dist/builtins/games/trek/state.d.ts +0 -190
- package/dist/builtins/games/trek/state.js +0 -84
- package/dist/builtins/games/trek/state.js.map +0 -1
- package/dist/builtins/games/trek/style.d.ts +0 -7
- package/dist/builtins/games/trek/style.js +0 -93
- package/dist/builtins/games/trek/style.js.map +0 -1
- package/dist/builtins/games/trek/systemname.d.ts +0 -10
- package/dist/builtins/games/trek/systemname.js +0 -12
- package/dist/builtins/games/trek/systemname.js.map +0 -1
- package/dist/builtins/games/trek/torped.d.ts +0 -3
- package/dist/builtins/games/trek/torped.js +0 -232
- package/dist/builtins/games/trek/torped.js.map +0 -1
- package/dist/builtins/games/trek/trek.d.ts +0 -27
- package/dist/builtins/games/trek/trek.js +0 -96
- package/dist/builtins/games/trek/trek.js.map +0 -1
- package/dist/builtins/games/trek/visual.d.ts +0 -3
- package/dist/builtins/games/trek/visual.js +0 -87
- package/dist/builtins/games/trek/visual.js.map +0 -1
- package/dist/builtins/games/trek/warp.d.ts +0 -5
- package/dist/builtins/games/trek/warp.js +0 -173
- package/dist/builtins/games/trek/warp.js.map +0 -1
- package/dist/builtins/games/trek/win.d.ts +0 -12
- package/dist/builtins/games/trek/win.js +0 -34
- package/dist/builtins/games/trek/win.js.map +0 -1
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file trek's constants: the dimensions, the sector glyphs, the devices,
|
|
3
|
-
* the event codes, the ways to lose, and the tables `externs.c` defines.
|
|
4
|
-
*
|
|
5
|
-
* Names are the C names, so a reader can hold this beside trek.h.
|
|
6
|
-
*
|
|
7
|
-
* @module
|
|
8
|
-
*/
|
|
9
|
-
/** Dimensions of a quadrant in sectors. */
|
|
10
|
-
export declare const NSECTS: number;
|
|
11
|
-
/** Dimension of the galaxy in quadrants. */
|
|
12
|
-
export declare const NQUADS: number;
|
|
13
|
-
/** Number of quadrants which are inhabited. */
|
|
14
|
-
export declare const NINHAB: number;
|
|
15
|
-
/** Quad.qsystemname flag: a distress call is out for this quadrant. */
|
|
16
|
-
export declare const Q_DISTRESSED: number;
|
|
17
|
-
/** Quad.qsystemname mask: the starsystem's name index. */
|
|
18
|
-
export declare const Q_SYSTEM: number;
|
|
19
|
-
/** Sector contents. */
|
|
20
|
-
export declare const EMPTY: string;
|
|
21
|
-
export declare const STAR: string;
|
|
22
|
-
export declare const BASE: string;
|
|
23
|
-
export declare const ENTERPRISE: string;
|
|
24
|
-
export declare const QUEENE: string;
|
|
25
|
-
export declare const KLINGON: string;
|
|
26
|
-
export declare const INHABIT: string;
|
|
27
|
-
export declare const HOLE: string;
|
|
28
|
-
/** Max number of devices. */
|
|
29
|
-
export declare const NDEV: number;
|
|
30
|
-
export declare const WARP: number;
|
|
31
|
-
export declare const SRSCAN: number;
|
|
32
|
-
export declare const LRSCAN: number;
|
|
33
|
-
export declare const PHASER: number;
|
|
34
|
-
export declare const TORPED: number;
|
|
35
|
-
export declare const IMPULSE: number;
|
|
36
|
-
export declare const SHIELD: number;
|
|
37
|
-
export declare const COMPUTER: number;
|
|
38
|
-
export declare const SSRADIO: number;
|
|
39
|
-
export declare const LIFESUP: number;
|
|
40
|
-
export declare const SINS: number;
|
|
41
|
-
export declare const CLOAK: number;
|
|
42
|
-
export declare const XPORTER: number;
|
|
43
|
-
export declare const SHUTTLE: number;
|
|
44
|
-
/** Number of different event types. */
|
|
45
|
-
export declare const NEVENTS: number;
|
|
46
|
-
export declare const E_LRTB: number;
|
|
47
|
-
export declare const E_KATSB: number;
|
|
48
|
-
export declare const E_KDESB: number;
|
|
49
|
-
export declare const E_ISSUE: number;
|
|
50
|
-
export declare const E_ENSLV: number;
|
|
51
|
-
export declare const E_REPRO: number;
|
|
52
|
-
export declare const E_FIXDV: number;
|
|
53
|
-
export declare const E_ATTACK: number;
|
|
54
|
-
export declare const E_SNAP: number;
|
|
55
|
-
export declare const E_SNOVA: number;
|
|
56
|
-
export declare const E_GHOST: number;
|
|
57
|
-
export declare const E_HIDDEN: number;
|
|
58
|
-
export declare const E_EVENT: number;
|
|
59
|
-
/** Maximum number of pending events. */
|
|
60
|
-
export declare const MAXEVENTS: number;
|
|
61
|
-
/** Maximum Klingons per quadrant. */
|
|
62
|
-
export declare const MAXKLQUAD: number;
|
|
63
|
-
/** Condition codes. */
|
|
64
|
-
export declare const GREEN: number;
|
|
65
|
-
export declare const DOCKED: number;
|
|
66
|
-
export declare const YELLOW: number;
|
|
67
|
-
export declare const RED: number;
|
|
68
|
-
/** Maximum number of starbases in the galaxy. */
|
|
69
|
-
export declare const MAXBASES: number;
|
|
70
|
-
/** Maximum concurrent distress calls. */
|
|
71
|
-
export declare const MAXDISTR: number;
|
|
72
|
-
/** Number of phaser banks. */
|
|
73
|
-
export declare const NBANKS: number;
|
|
74
|
-
/** Klingon move modes. */
|
|
75
|
-
export declare const KM_OB: number;
|
|
76
|
-
export declare const KM_OA: number;
|
|
77
|
-
export declare const KM_EB: number;
|
|
78
|
-
export declare const KM_EA: number;
|
|
79
|
-
export declare const KM_LB: number;
|
|
80
|
-
export declare const KM_LA: number;
|
|
81
|
-
/** Ways to lose. */
|
|
82
|
-
export declare const L_NOTIME: number;
|
|
83
|
-
export declare const L_NOENGY: number;
|
|
84
|
-
export declare const L_DSTRYD: number;
|
|
85
|
-
export declare const L_NEGENB: number;
|
|
86
|
-
export declare const L_SUICID: number;
|
|
87
|
-
export declare const L_SNOVA: number;
|
|
88
|
-
export declare const L_NOLIFE: number;
|
|
89
|
-
export declare const L_NOHELP: number;
|
|
90
|
-
export declare const L_TOOFAST: number;
|
|
91
|
-
export declare const L_STAR: number;
|
|
92
|
-
export declare const L_DSTRCT: number;
|
|
93
|
-
export declare const L_CAPTURED: number;
|
|
94
|
-
export declare const L_NOCREW: number;
|
|
95
|
-
/** Trace compilation option, kept as in the original. */
|
|
96
|
-
export declare const xTRACE: number;
|
|
97
|
-
/** A number larger than any distance: DBL_MAX / 2. */
|
|
98
|
-
export declare const TOOLARGE: number;
|
|
99
|
-
/** The random source's range, as random() returns: 0 .. RANDOM_MAX. */
|
|
100
|
-
export declare const RANDOM_MAX: number;
|
|
101
|
-
/** A device and the person who fixes it. */
|
|
102
|
-
export interface Device {
|
|
103
|
-
name: string;
|
|
104
|
-
person: string;
|
|
105
|
-
}
|
|
106
|
-
/** The devices, by index (externs.c). */
|
|
107
|
-
export declare const Device: ReadonlyArray<Device>;
|
|
108
|
-
/** The inhabited starsystems' names, by index; 0 is the error entry (externs.c). */
|
|
109
|
-
export declare const Systemname: ReadonlyArray<string>;
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* consts.ts: a TypeScript port of BSD trek(6), from trek.h, externs.c.
|
|
3
|
-
* Ported from NetBSD src/games/trek (trunk 7a9ca154a8f6144307865f23390a3c63b400b801): trek.h 1.19 2024/02/10; externs.c 1.10 2009/05/24.
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) 1980, 1993
|
|
6
|
-
* The Regents of the University of California. All rights reserved.
|
|
7
|
-
*
|
|
8
|
-
* Redistribution and use in source and binary forms, with or without
|
|
9
|
-
* modification, are permitted provided that the following conditions
|
|
10
|
-
* are met:
|
|
11
|
-
* 1. Redistributions of source code must retain the above copyright
|
|
12
|
-
* notice, this list of conditions and the following disclaimer.
|
|
13
|
-
* 2. Redistributions in binary form must reproduce the above copyright
|
|
14
|
-
* notice, this list of conditions and the following disclaimer in the
|
|
15
|
-
* documentation and/or other materials provided with the distribution.
|
|
16
|
-
* 3. Neither the name of the University nor the names of its contributors
|
|
17
|
-
* may be used to endorse or promote products derived from this software
|
|
18
|
-
* without specific prior written permission.
|
|
19
|
-
*
|
|
20
|
-
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
21
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
23
|
-
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
24
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
26
|
-
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
27
|
-
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
28
|
-
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
29
|
-
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
30
|
-
* SUCH DAMAGE.
|
|
31
|
-
*
|
|
32
|
-
*/
|
|
33
|
-
/**
|
|
34
|
-
* @file trek's constants: the dimensions, the sector glyphs, the devices,
|
|
35
|
-
* the event codes, the ways to lose, and the tables `externs.c` defines.
|
|
36
|
-
*
|
|
37
|
-
* Names are the C names, so a reader can hold this beside trek.h.
|
|
38
|
-
*
|
|
39
|
-
* @module
|
|
40
|
-
*/
|
|
41
|
-
/** Dimensions of a quadrant in sectors. */
|
|
42
|
-
export const NSECTS = 10;
|
|
43
|
-
/** Dimension of the galaxy in quadrants. */
|
|
44
|
-
export const NQUADS = 8;
|
|
45
|
-
/** Number of quadrants which are inhabited. */
|
|
46
|
-
export const NINHAB = 32;
|
|
47
|
-
/** Quad.qsystemname flag: a distress call is out for this quadrant. */
|
|
48
|
-
export const Q_DISTRESSED = 0o200;
|
|
49
|
-
/** Quad.qsystemname mask: the starsystem's name index. */
|
|
50
|
-
export const Q_SYSTEM = 0o77;
|
|
51
|
-
/** Sector contents. */
|
|
52
|
-
export const EMPTY = '.';
|
|
53
|
-
export const STAR = '*';
|
|
54
|
-
export const BASE = '#';
|
|
55
|
-
export const ENTERPRISE = 'E';
|
|
56
|
-
export const QUEENE = 'Q';
|
|
57
|
-
export const KLINGON = 'K';
|
|
58
|
-
export const INHABIT = '@';
|
|
59
|
-
export const HOLE = ' ';
|
|
60
|
-
/** Max number of devices. */
|
|
61
|
-
export const NDEV = 16;
|
|
62
|
-
export const WARP = 0;
|
|
63
|
-
export const SRSCAN = 1;
|
|
64
|
-
export const LRSCAN = 2;
|
|
65
|
-
export const PHASER = 3;
|
|
66
|
-
export const TORPED = 4;
|
|
67
|
-
export const IMPULSE = 5;
|
|
68
|
-
export const SHIELD = 6;
|
|
69
|
-
export const COMPUTER = 7;
|
|
70
|
-
export const SSRADIO = 8;
|
|
71
|
-
export const LIFESUP = 9;
|
|
72
|
-
export const SINS = 10;
|
|
73
|
-
export const CLOAK = 11;
|
|
74
|
-
export const XPORTER = 12;
|
|
75
|
-
export const SHUTTLE = 13;
|
|
76
|
-
/** Number of different event types. */
|
|
77
|
-
export const NEVENTS = 12;
|
|
78
|
-
export const E_LRTB = 1;
|
|
79
|
-
export const E_KATSB = 2;
|
|
80
|
-
export const E_KDESB = 3;
|
|
81
|
-
export const E_ISSUE = 4;
|
|
82
|
-
export const E_ENSLV = 5;
|
|
83
|
-
export const E_REPRO = 6;
|
|
84
|
-
export const E_FIXDV = 7;
|
|
85
|
-
export const E_ATTACK = 8;
|
|
86
|
-
export const E_SNAP = 9;
|
|
87
|
-
export const E_SNOVA = 10;
|
|
88
|
-
export const E_GHOST = 0o100;
|
|
89
|
-
export const E_HIDDEN = 0o200;
|
|
90
|
-
export const E_EVENT = 0o77;
|
|
91
|
-
/** Maximum number of pending events. */
|
|
92
|
-
export const MAXEVENTS = 25;
|
|
93
|
-
/** Maximum Klingons per quadrant. */
|
|
94
|
-
export const MAXKLQUAD = 9;
|
|
95
|
-
/** Condition codes. */
|
|
96
|
-
export const GREEN = 0;
|
|
97
|
-
export const DOCKED = 1;
|
|
98
|
-
export const YELLOW = 2;
|
|
99
|
-
export const RED = 3;
|
|
100
|
-
/** Maximum number of starbases in the galaxy. */
|
|
101
|
-
export const MAXBASES = 9;
|
|
102
|
-
/** Maximum concurrent distress calls. */
|
|
103
|
-
export const MAXDISTR = 5;
|
|
104
|
-
/** Number of phaser banks. */
|
|
105
|
-
export const NBANKS = 6;
|
|
106
|
-
/** Klingon move modes. */
|
|
107
|
-
export const KM_OB = 0;
|
|
108
|
-
export const KM_OA = 1;
|
|
109
|
-
export const KM_EB = 2;
|
|
110
|
-
export const KM_EA = 3;
|
|
111
|
-
export const KM_LB = 4;
|
|
112
|
-
export const KM_LA = 5;
|
|
113
|
-
/** Ways to lose. */
|
|
114
|
-
export const L_NOTIME = 1;
|
|
115
|
-
export const L_NOENGY = 2;
|
|
116
|
-
export const L_DSTRYD = 3;
|
|
117
|
-
export const L_NEGENB = 4;
|
|
118
|
-
export const L_SUICID = 5;
|
|
119
|
-
export const L_SNOVA = 6;
|
|
120
|
-
export const L_NOLIFE = 7;
|
|
121
|
-
export const L_NOHELP = 8;
|
|
122
|
-
export const L_TOOFAST = 9;
|
|
123
|
-
export const L_STAR = 10;
|
|
124
|
-
export const L_DSTRCT = 11;
|
|
125
|
-
export const L_CAPTURED = 12;
|
|
126
|
-
export const L_NOCREW = 13;
|
|
127
|
-
/** Trace compilation option, kept as in the original. */
|
|
128
|
-
export const xTRACE = 1;
|
|
129
|
-
/** A number larger than any distance: DBL_MAX / 2. */
|
|
130
|
-
export const TOOLARGE = Number.MAX_VALUE / 2;
|
|
131
|
-
/** The random source's range, as random() returns: 0 .. RANDOM_MAX. */
|
|
132
|
-
export const RANDOM_MAX = 0x7fffffff;
|
|
133
|
-
/** The devices, by index (externs.c). */
|
|
134
|
-
export const Device = [
|
|
135
|
-
{ name: 'warp drive', person: 'Scotty' },
|
|
136
|
-
{ name: 'S.R. scanners', person: 'Scotty' },
|
|
137
|
-
{ name: 'L.R. scanners', person: 'Scotty' },
|
|
138
|
-
{ name: 'phasers', person: 'Sulu' },
|
|
139
|
-
{ name: 'photon tubes', person: 'Sulu' },
|
|
140
|
-
{ name: 'impulse engines', person: 'Scotty' },
|
|
141
|
-
{ name: 'shield control', person: 'Sulu' },
|
|
142
|
-
{ name: 'computer', person: 'Spock' },
|
|
143
|
-
{ name: 'subspace radio', person: 'Uhura' },
|
|
144
|
-
{ name: 'life support', person: 'Scotty' },
|
|
145
|
-
{ name: 'navigation system', person: 'Chekov' },
|
|
146
|
-
{ name: 'cloaking device', person: 'Scotty' },
|
|
147
|
-
{ name: 'transporter', person: 'Scotty' },
|
|
148
|
-
{ name: 'shuttlecraft', person: 'Scotty' },
|
|
149
|
-
{ name: '*ERR 14*', person: 'Nobody' },
|
|
150
|
-
{ name: '*ERR 15*', person: 'Nobody' },
|
|
151
|
-
];
|
|
152
|
-
/** The inhabited starsystems' names, by index; 0 is the error entry (externs.c). */
|
|
153
|
-
export const Systemname = [
|
|
154
|
-
'ERROR', 'Talos IV', 'Rigel III', 'Deneb VII', 'Canopus V', 'Icarus I', 'Prometheus II', 'Omega VII',
|
|
155
|
-
'Elysium I', 'Scalos IV', 'Procyon IV', 'Arachnid I', 'Argo VIII', 'Triad III', 'Echo IV', 'Nimrod III',
|
|
156
|
-
'Nemisis IV', 'Centarurus I', 'Kronos III', 'Spectros V', 'Beta III', 'Gamma Tranguli VI', 'Pyris III', 'Triachus',
|
|
157
|
-
'Marcus XII', 'Kaland', 'Ardana', 'Stratos', 'Eden', 'Arrikis', 'Epsilon Eridani IV', 'Exo III',
|
|
158
|
-
];
|
|
159
|
-
//# sourceMappingURL=consts.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../../../../src/builtins/games/trek/consts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH;;;;;;;GAOG;AAEH,2CAA2C;AAC3C,MAAM,CAAC,MAAM,MAAM,GAAW,EAAE,CAAC;AACjC,4CAA4C;AAC5C,MAAM,CAAC,MAAM,MAAM,GAAW,CAAC,CAAC;AAChC,+CAA+C;AAC/C,MAAM,CAAC,MAAM,MAAM,GAAW,EAAE,CAAC;AAEjC,uEAAuE;AACvE,MAAM,CAAC,M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,SAAS,EAAE,YAAY;IACvG,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,WAAW,EAAE,UAAU;IAClH,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,oBAAoB,EAAE,SAAS;CAChG,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file One game of trek: its state, its terminal and its random source,
|
|
3
|
-
* handed to every routine as `t` (the C kept all three global).
|
|
4
|
-
*
|
|
5
|
-
* @module
|
|
6
|
-
*/
|
|
7
|
-
import type { TrekIO } from './io.js';
|
|
8
|
-
import type { TrekRandom } from './rand.js';
|
|
9
|
-
import type { TrekState } from './state.js';
|
|
10
|
-
/** One game. */
|
|
11
|
-
export interface Trek {
|
|
12
|
-
/** The game's state (the C's globals). */
|
|
13
|
-
s: TrekState;
|
|
14
|
-
/** Its terminal. */
|
|
15
|
-
io: TrekIO;
|
|
16
|
-
/** Its random source. */
|
|
17
|
-
rnd: TrekRandom;
|
|
18
|
-
/** Where `dump` keeps a game for `restart`: the C's trek.dump file, held by the session. */
|
|
19
|
-
dump: TrekDump;
|
|
20
|
-
}
|
|
21
|
-
/** The saved game slot. */
|
|
22
|
-
export interface TrekDump {
|
|
23
|
-
/** The saved game, or null when none was dumped. */
|
|
24
|
-
saved: object | null;
|
|
25
|
-
}
|
|
26
|
-
/** A command routine, as Comtab and the other conversion tables hold them: `void f(int)` in C. */
|
|
27
|
-
export type CmdFun = (t: Trek, v: number) => Promise<void>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/builtins/games/trek/context.ts"],"names":[],"mappings":""}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* damage.ts: a TypeScript port of BSD trek(6), from damage.c.
|
|
3
|
-
* Ported from NetBSD src/games/trek (trunk 7a9ca154a8f6144307865f23390a3c63b400b801): damage.c 1.8 2009/05/24.
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) 1980, 1993
|
|
6
|
-
* The Regents of the University of California. All rights reserved.
|
|
7
|
-
*
|
|
8
|
-
* Redistribution and use in source and binary forms, with or without
|
|
9
|
-
* modification, are permitted provided that the following conditions
|
|
10
|
-
* are met:
|
|
11
|
-
* 1. Redistributions of source code must retain the above copyright
|
|
12
|
-
* notice, this list of conditions and the following disclaimer.
|
|
13
|
-
* 2. Redistributions in binary form must reproduce the above copyright
|
|
14
|
-
* notice, this list of conditions and the following disclaimer in the
|
|
15
|
-
* documentation and/or other materials provided with the distribution.
|
|
16
|
-
* 3. Neither the name of the University nor the names of its contributors
|
|
17
|
-
* may be used to endorse or promote products derived from this software
|
|
18
|
-
* without specific prior written permission.
|
|
19
|
-
*
|
|
20
|
-
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
21
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
23
|
-
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
24
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
26
|
-
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
27
|
-
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
28
|
-
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
29
|
-
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
30
|
-
* SUCH DAMAGE.
|
|
31
|
-
*
|
|
32
|
-
*/
|
|
33
|
-
/**
|
|
34
|
-
* @file Damage to a device: a repair scheduled, or added to the one
|
|
35
|
-
* already waiting.
|
|
36
|
-
*
|
|
37
|
-
* @module
|
|
38
|
-
*/
|
|
39
|
-
import { Device, DOCKED, E_FIXDV, MAXEVENTS } from './consts.js';
|
|
40
|
-
import { damaged } from './damaged.js';
|
|
41
|
-
import { reschedule, schedule } from './schedule.js';
|
|
42
|
-
/*
|
|
43
|
-
** Schedule Ship.damages to a Device
|
|
44
|
-
**
|
|
45
|
-
** Device `dev1' is damaged in an amount `dam'. Dam is measured
|
|
46
|
-
** in stardates, and is an additional amount of damage. It should
|
|
47
|
-
** be the amount to occur in non-docked mode. The adjustment
|
|
48
|
-
** to docked mode occurs automatically if we are docked.
|
|
49
|
-
**
|
|
50
|
-
** Note that the repair of the device occurs on a DATE, meaning
|
|
51
|
-
** that the dock() and undock() have to reschedule the event.
|
|
52
|
-
**
|
|
53
|
-
** dev1 -- device index
|
|
54
|
-
** dam -- time to repair
|
|
55
|
-
*/
|
|
56
|
-
/** Schedule Ship.damages to a Device */
|
|
57
|
-
export async function damage(t, dev1, dam) {
|
|
58
|
-
let e;
|
|
59
|
-
/* ignore zero damages */
|
|
60
|
-
if (dam <= 0.0)
|
|
61
|
-
return;
|
|
62
|
-
const dev = dev1;
|
|
63
|
-
t.io.printf('\t%s damaged\n', Device[dev].name);
|
|
64
|
-
/* find actual length till it will be fixed */
|
|
65
|
-
if (t.s.Ship.cond === DOCKED)
|
|
66
|
-
dam *= t.s.Param.dockfac;
|
|
67
|
-
/* set the damage flag */
|
|
68
|
-
const f = damaged(t, dev);
|
|
69
|
-
if (!f) {
|
|
70
|
-
/* new damages -- schedule a fix */
|
|
71
|
-
schedule(t, E_FIXDV, dam, 0, 0, dev);
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
/* device already damaged -- add to existing damages */
|
|
75
|
-
/* scan for old damages */
|
|
76
|
-
for (let i = 0; i < MAXEVENTS; i++) {
|
|
77
|
-
e = t.s.Event[i];
|
|
78
|
-
if (e.evcode !== E_FIXDV || e.systemname !== dev)
|
|
79
|
-
continue;
|
|
80
|
-
/* got the right one; add on the new damages */
|
|
81
|
-
reschedule(t, i, e.date - t.s.Now.date + dam);
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
t.io.printf('trek: Cannot find old damages %d\n', dev);
|
|
85
|
-
t.io.exit(1);
|
|
86
|
-
}
|
|
87
|
-
//# sourceMappingURL=damage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"damage.js","sourceRoot":"","sources":["../../../../src/builtins/games/trek/damage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH;;;;;GAKG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEjE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGrD;;;;;;;;;;;;;EAaE;AAEF,wCAAwC;AACxC,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,CAAO,EAAE,IAAY,EAAE,GAAW;IAC7D,IAAI,CAAY,CAAC;IAEjB,yBAAyB;IACzB,IAAI,GAAG,IAAI,GAAG;QAAE,OAAO;IACvB,MAAM,GAAG,GAAW,IAAI,CAAC;IAEzB,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,gBAAgB,EAAG,MAAM,CAAC,GAAG,CAAY,CAAC,IAAI,CAAC,CAAC;IAE5D,8CAA8C;IAC9C,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM;QAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;IACvD,yBAAyB;IACzB,MAAM,CAAC,GAAW,OAAO,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAClC,IAAI,CAAC,CAAC,EAAE,CAAC;QACP,mCAAmC;QACnC,QAAQ,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;QACrC,OAAO;IACT,CAAC;IACD,uDAAuD;IACvD,0BAA0B;IAC1B,KAAK,IAAI,CAAC,GAAW,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3C,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAc,CAAC;QAC9B,IAAI,CAAC,CAAC,MAAM,KAAK,OAAO,IAAI,CAAC,CAAC,UAAU,KAAK,GAAG;YAAE,SAAS;QAC3D,+CAA+C;QAC/C,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC;QAC9C,OAAO;IACT,CAAC;IACD,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,oCAAoC,EAAE,GAAG,CAAC,CAAC;IACvD,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* damaged.ts: a TypeScript port of BSD trek(6), from damaged.c.
|
|
3
|
-
* Ported from NetBSD src/games/trek (trunk 7a9ca154a8f6144307865f23390a3c63b400b801): damaged.c 1.8 2009/05/24.
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) 1980, 1993
|
|
6
|
-
* The Regents of the University of California. All rights reserved.
|
|
7
|
-
*
|
|
8
|
-
* Redistribution and use in source and binary forms, with or without
|
|
9
|
-
* modification, are permitted provided that the following conditions
|
|
10
|
-
* are met:
|
|
11
|
-
* 1. Redistributions of source code must retain the above copyright
|
|
12
|
-
* notice, this list of conditions and the following disclaimer.
|
|
13
|
-
* 2. Redistributions in binary form must reproduce the above copyright
|
|
14
|
-
* notice, this list of conditions and the following disclaimer in the
|
|
15
|
-
* documentation and/or other materials provided with the distribution.
|
|
16
|
-
* 3. Neither the name of the University nor the names of its contributors
|
|
17
|
-
* may be used to endorse or promote products derived from this software
|
|
18
|
-
* without specific prior written permission.
|
|
19
|
-
*
|
|
20
|
-
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
21
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
23
|
-
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
24
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
26
|
-
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
27
|
-
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
28
|
-
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
29
|
-
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
30
|
-
* SUCH DAMAGE.
|
|
31
|
-
*
|
|
32
|
-
*/
|
|
33
|
-
/**
|
|
34
|
-
* @file Whether a device is broken: a repair for it is on the event list.
|
|
35
|
-
*
|
|
36
|
-
* @module
|
|
37
|
-
*/
|
|
38
|
-
import { E_FIXDV, MAXEVENTS } from './consts.js';
|
|
39
|
-
/* DAMAGED -- check for device damaged
|
|
40
|
-
**
|
|
41
|
-
** This is a boolean function which returns non-zero if the
|
|
42
|
-
** specified device is broken. It does this by checking the
|
|
43
|
-
** event list for a "device fix" action on that device.
|
|
44
|
-
*/
|
|
45
|
-
/** DAMAGED -- check for device damaged */
|
|
46
|
-
export function damaged(t, dev) {
|
|
47
|
-
const d = dev;
|
|
48
|
-
for (let i = 0; i < MAXEVENTS; i++) {
|
|
49
|
-
const e = t.s.Event[i];
|
|
50
|
-
if (e.evcode !== E_FIXDV)
|
|
51
|
-
continue;
|
|
52
|
-
if (e.systemname === d)
|
|
53
|
-
return 1;
|
|
54
|
-
}
|
|
55
|
-
/* device fix not in event list -- device must not be broken */
|
|
56
|
-
return 0;
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=damaged.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"damaged.js","sourceRoot":"","sources":["../../../../src/builtins/games/trek/damaged.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH;;;;GAIG;AACH,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIjD;;;;;EAKE;AAEF,0CAA0C;AAC1C,MAAM,UAAU,OAAO,CAAC,CAAO,EAAE,GAAW;IAC1C,MAAM,CAAC,GAAW,GAAG,CAAC;IAEtB,KAAK,IAAI,CAAC,GAAW,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3C,MAAM,CAAC,GAAc,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAc,CAAC;QAC/C,IAAI,CAAC,CAAC,MAAM,KAAK,OAAO;YAAE,SAAS;QACnC,IAAI,CAAC,CAAC,UAAU,KAAK,CAAC;YAAE,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,+DAA+D;IAC/D,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* dcrept.ts: a TypeScript port of BSD trek(6), from dcrept.c.
|
|
3
|
-
* Ported from NetBSD src/games/trek (trunk 7a9ca154a8f6144307865f23390a3c63b400b801): dcrept.c 1.11 2022/05/24.
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) 1980, 1993
|
|
6
|
-
* The Regents of the University of California. All rights reserved.
|
|
7
|
-
*
|
|
8
|
-
* Redistribution and use in source and binary forms, with or without
|
|
9
|
-
* modification, are permitted provided that the following conditions
|
|
10
|
-
* are met:
|
|
11
|
-
* 1. Redistributions of source code must retain the above copyright
|
|
12
|
-
* notice, this list of conditions and the following disclaimer.
|
|
13
|
-
* 2. Redistributions in binary form must reproduce the above copyright
|
|
14
|
-
* notice, this list of conditions and the following disclaimer in the
|
|
15
|
-
* documentation and/or other materials provided with the distribution.
|
|
16
|
-
* 3. Neither the name of the University nor the names of its contributors
|
|
17
|
-
* may be used to endorse or promote products derived from this software
|
|
18
|
-
* without specific prior written permission.
|
|
19
|
-
*
|
|
20
|
-
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
21
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
23
|
-
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
24
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
26
|
-
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
27
|
-
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
28
|
-
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
29
|
-
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
30
|
-
* SUCH DAMAGE.
|
|
31
|
-
*
|
|
32
|
-
*/
|
|
33
|
-
/**
|
|
34
|
-
* @file The damage control report: each broken device and its repair
|
|
35
|
-
* time in flight and docked.
|
|
36
|
-
*
|
|
37
|
-
* @module
|
|
38
|
-
*/
|
|
39
|
-
import { Device, DOCKED, E_FIXDV, MAXEVENTS } from './consts.js';
|
|
40
|
-
/*
|
|
41
|
-
** damage control report
|
|
42
|
-
**
|
|
43
|
-
** Print damages and time to fix. This is taken from the event
|
|
44
|
-
** list. A couple of factors are set up, based on whether or not
|
|
45
|
-
** we are docked. (One of these factors will always be 1.0.)
|
|
46
|
-
** The event list is then scanned for damage fix events, the
|
|
47
|
-
** time until they occur is determined, and printed out. The
|
|
48
|
-
** magic number DAMFAC is used to tell how much faster you can
|
|
49
|
-
** fix things if you are docked.
|
|
50
|
-
*/
|
|
51
|
-
/** damage control report */
|
|
52
|
-
export async function dcrept(t, _v) {
|
|
53
|
-
let m1;
|
|
54
|
-
let m2;
|
|
55
|
-
/* set up the magic factors to output the time till fixed */
|
|
56
|
-
if (t.s.Ship.cond === DOCKED) {
|
|
57
|
-
m1 = 1.0 / t.s.Param.dockfac;
|
|
58
|
-
m2 = 1.0;
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
m1 = 1.0;
|
|
62
|
-
m2 = t.s.Param.dockfac;
|
|
63
|
-
}
|
|
64
|
-
t.io.printf('Damage control report:\n');
|
|
65
|
-
let f = 1;
|
|
66
|
-
/* scan for damages */
|
|
67
|
-
for (let i = 0; i < MAXEVENTS; i++) {
|
|
68
|
-
const e = t.s.Event[i];
|
|
69
|
-
if (e.evcode !== E_FIXDV)
|
|
70
|
-
continue;
|
|
71
|
-
/* output the title first time */
|
|
72
|
-
if (f) {
|
|
73
|
-
t.io.printf('\t\t\t repair times\n');
|
|
74
|
-
t.io.printf('device\t\t\tin flight docked\n');
|
|
75
|
-
f = 0;
|
|
76
|
-
}
|
|
77
|
-
/* compute time till fixed, then adjust by the magic factors */
|
|
78
|
-
const x = e.date - t.s.Now.date;
|
|
79
|
-
t.io.printf('%-24s%7.2f %7.2f\n', Device[e.systemname].name, x * m1 + 0.005, x * m2 + 0.005);
|
|
80
|
-
/* do a little consistency checking */
|
|
81
|
-
}
|
|
82
|
-
/* if everything was ok, reassure the nervous captain */
|
|
83
|
-
if (f)
|
|
84
|
-
t.io.printf('All devices functional\n');
|
|
85
|
-
}
|
|
86
|
-
//# sourceMappingURL=dcrept.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dcrept.js","sourceRoot":"","sources":["../../../../src/builtins/games/trek/dcrept.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH;;;;;GAKG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIjE;;;;;;;;;;EAUE;AAEF,4BAA4B;AAC5B,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,CAAO,EAAE,EAAU;IAC9C,IAAI,EAAU,CAAC;IACf,IAAI,EAAU,CAAC;IAEf,4DAA4D;IAC5D,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC7B,EAAE,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;QAC7B,EAAE,GAAG,GAAG,CAAC;IACX,CAAC;SAAM,CAAC;QACN,EAAE,GAAG,GAAG,CAAC;QACT,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;I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