blob: 8927b3ef3a89fa53a6397a951192437bfdab91c3 (
plain)
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
|
## Hacking
Hacking minigames are played by jacking into terminal objects. Terminals are YAML objects that are registered in Go's `terminalDefs` map.
### Terminal Object YAML
```yaml
id: terminal_basic
name: basic terminal
color: "40"
description: "A battered terminal with a cracked screen. {40}[Level 1 Hacking]{/}"
inroom_description: "A {40}basic terminal{/} hums quietly against the wall."
```
- `id` must match a key in `terminalDefs` (Go code in `internal/game/hacking.go`)
- `name` is used for matching in the `jack` command
- `color` controls the display color
- `description` is shown when examining the terminal
- `inroom_description` is shown in room listings
- No `behavior` field — terminals are registered in Go, not YAML behaviors
### Adding a New Terminal
1. Create an object YAML file in `data/objects/terminal_<name>.yaml`
2. Add an entry to `terminalDefs` in `internal/game/hacking.go`
3. Optionally create a new minigame implementation in `internal/game/hacking_<name>.go`
4. Place the terminal object in a room's `objects:` list
### Adding a New Minigame
New minigames implement the `HackingMinigame` interface:
```go
type HackingMinigame interface {
Init(level int) string
HandleInput(input string) (output string, done bool, won bool)
Name() string
}
```
Optionally implement `XPBonuser` for bonus XP:
```go
type XPBonuser interface {
BonusXP() int
}
```
|