> For the complete documentation index, see [llms.txt](https://k0ssek-scripts.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://k0ssek-scripts.gitbook.io/docs/scripts/squash/courts-and-scoreboards.md).

# Courts & Scoreboards

The included courts, adding your own in game, and hanging scoreboards.

## The included courts

The script comes with four courts. `kossek_squash_assets` turns the handball courts at Vespucci Beach, next to the outdoor gym, into a squash venue with walls, painted lines, glass back walls with doors, lights at night and a scoreboard per court. They are the four `vespucci_` lines in `Config.Courts` and need nothing else.

{% hint style="info" %}
The venue streams edited copies of nine of the game's own files for that block. Another map resource that changes the same spot at Vespucci Beach will clash with it: run only one of the two, see [Running without kossek\_squash\_assets](#running-without-kossek_squash_assets).
{% endhint %}

## Adding your own courts

A court always has the size of an official singles court, 9.75 x 6.40 m. It can be a room of that size in an MLO, or any flat spot: the script can draw the walls and lines itself.

{% stepper %}
{% step %}

### Stand in the middle

Stand on the T of your court (the middle, where the short line meets the line down the middle) and face the front wall.

In a room you don't have to stand exactly. Be about on the T and roughly face the front wall, within 30 degrees. The command finds the walls around you and lines the court up with them.
{% endstep %}

{% step %}

### Run /squashcourt add

It creates a temporary court there, which you can play on at once, and prints a ready config line to your F8 console. In a room, F8 also shows what was measured: the distance to the front wall and the width and length of the room, so you can see whether the room is the size of a court.

Run it on foot, standing still. The server only accepts a spot close to where it sees you itself.
{% endstep %}

{% step %}

### Paste the line into the config

Paste it into `Config.Courts` in `config/shared.lua`, and give it a unique `id` (letters, digits, underscore) and a `label`. Without that the court is gone after a restart.
{% endstep %}
{% endstepper %}

### Court commands

All of them are for admins (`Config.AdminGroup`).

| Command               | What it does                                                                |
| --------------------- | --------------------------------------------------------------------------- |
| `/squashcourt add`    | Creates a temporary court where you stand and prints its config line to F8. |
| `/squashcourt remove` | Removes the nearest temporary court within 15 m that nobody is playing on.  |
| `/squashcourt list`   | Shows the ids of all courts.                                                |
| `/squashcourt board`  | Hangs or moves the scoreboard of the nearest court, see below.              |

### Options of a court line

```lua
Config.Courts = {
    { id = 'my_court', label = 'My Court', center = vec3(0.0, 0.0, 0.0), heading = 0.0,
        walls = true, lines = true },
}
```

| Option     | Description                                                                                                  |
| ---------- | ------------------------------------------------------------------------------------------------------------ |
| `id`       | Unique name of the court: letters, digits and underscore.                                                    |
| `label`    | Name shown to players.                                                                                       |
| `center`   | The middle of the court floor.                                                                               |
| `heading`  | The direction a player faces when looking at the front wall.                                                 |
| `walls`    | `true` draws see-through walls. Leave it out when the map has real walls.                                    |
| `lines`    | `true` draws the court lines on the floor and the walls. Leave it out when the map has them painted on.      |
| `board`    | Where the scoreboard of this court hangs, as `vec4(x, y, z, heading)`. Leave it out for a court without one. |
| `resource` | The map resource this court is built in, see below.                                                          |

`walls` and `lines` work on their own: both for a flat spot without an interior, only `lines` for a room with real walls and nothing painted on them, neither for a map that has its own lines, like the Vespucci courts.

### Courts that belong to a map

A court built in a map resource of its own, an MLO for example, can name it:

```lua
{ id = 'club_1', label = 'Squash Club 1', center = vec3(0.0, 0.0, 0.0), heading = 0.0,
    resource = 'my_squash_mlo' },
```

The court then exists only while that resource is started, whichever of the two starts first. Without the map the court is left out, and the server console says so about ten seconds after `kossek_squash` starts.

## Scoreboards

A court can have a scoreboard in the world: a screen that shows whether the court is free, who is waiting for an opponent, the rally of a practice, the score of a match and, for a while after the court is free again, its result. The four Vespucci courts already have theirs.

The board is a model of `kossek_squash_assets`, which has to be started.

{% stepper %}
{% step %}

### Run /squashcourt board

Stand near the court. The command takes the court nearest to you, within 60 m.
{% endstep %}

{% step %}

### Look at the wall

The board lies flat on the wall you look at, its screen towards you. The arrow keys move it up and down and turn it, and Shift makes that faster. Where you look at no wall it floats 6 m ahead of you, turned to you.
{% endstep %}

{% step %}

### Place it and save the line

Enter places it for everybody and prints a `board = vec4(...)` line to your F8 console. Add that to the court's line in `Config.Courts`, or the board is gone after a restart. Backspace cancels. Running the command again moves a board.
{% endstep %}
{% endstepper %}

A board hangs within 60 m of the middle of its court and shows as far as the court itself (`Config.RenderDistance`). Eight boards can show at the same time. `Config.Board.enabled = false` switches the boards off, and `Config.Board.resultTime` sets how long a result stays on them.

### Scoreboards and bystanders

Bystanders at a court whose board shows read the score there and get nothing on their screen. At a court without a board they get the scoreboard and the results on their screen, as players do.

`Config.Ui.spectateWithBoard = true` puts them on screen at every court. Use it when a board hangs where the people watching cannot see it.

## Running without kossek\_squash\_assets

The script also runs alone, for example when another map already uses that spot at Vespucci Beach. Then:

* **The four Vespucci courts are left out by themselves.** Their lines in `Config.Courts` name the resource they are built in, and shortly after the start the server console says which courts were left out. The lines can stay: add courts of your own next to them.
* **Players get the game's tennis ball and tennis racket.** The squash ones are part of the assets, and the script falls back by itself. There is nothing to change in the config.
* **There are no scoreboards in the world.** Players still have the scoreboard on their screen, and so do bystanders.
