The mapZoom registry
How far the map zooms on this player's game: the scale of each of the map's zoom levels. A look, not a rule: the server has no map screen. Client-authored: each player's own game applies it after a restart; it is never sent to a server or compared when a player joins. Not checked in a real game yet. Since 0.2.0-dev.32.2.
Schema version 0.1.0, experimental (KILNX031: may change in any release until it is marked stable). C# entry type Kiln.Registry.MapZoomEntry. What registries are, the stages, the conflict rules and how ids are made: README.
Edits per call: 4,096. One OnRegistry callback (one phase of one entry point) or one Registries.Change takes at most this many edits of this registry; a call with more is refused whole, with the reason in kiln.log and registry.json, and nothing of it applies (the other calls do). The default for a registry whose schema declares none (4,096).
Ids
- Game entries:
game:map_zoom. Mod entries:(none: one entry). All ids are lower case. The mod idsgameandkilnare reserved: no mod's entries use them. - One entry, game:map_zoom: the map's zoom levels on this player's game.
- Names:
DisplayName(never empty; display names) is the registry's name as words ("Map Zoom"): its one entry is no game thing with a name of its own.
Fields
Applies: now = takes effect at the next use; worldLoad = takes effect when a world loads; restart = takes effect after a game restart. Ops: number = a value or the relative operations (mul, add, min, max, raiseOnly, lowerOnly); set = a value; list = clear, append, remove, replace; indexed = a list of fixed length, edited one element at a time (xpPerLevel[2]) with a value or a number operation. A field of a list's elements is named with [] in this table and with the element's index in an edit (entries[3].chance, or [*] for every element). Mapping: whether this Kiln maps the field onto the game; an unproven or unmapped field is refused per entry, with the reason, until a Kiln update maps it. Joined client: when a joined Kiln client consumes a server edit; see README.
| Field | Type | Applies | Ops | Since | Mapping | Joined client | About |
|---|---|---|---|---|---|---|---|
levels |
list of entries | restart | list | 0.1.0 | mapped | localOnly | The map's zoom levels in the game's order (five on this build), each with its scale. Written in place: the number of levels cannot change (an edit that adds or removes one is refused), and each level's other settings stay the game's. The map menu's zoom steps come from the first four; the map's drawing reads every level. Since 0.2.0-dev.32.2. Read by game clients only. |
levels[].scale |
float -3.4028234663852886e+38..3.4028234663852886e+38 | restart | number | 0.1.0 | mapped | localOnly | The level's zoom scale (16, 8, 4, 2 and 0.7 on this build, in order). Since 0.2.0-dev.32.2. Read by game clients only. |
Entries
- Add (stage add, id
<your mod id>:<name>): no. The map has one set of zoom levels: a mod changes their scales, it cannot add another set. - Remove: no. The map needs its zoom levels: they cannot be removed.
- Raw game paths in edits (the Advanced tier): allowed.
Edit it from a data pack
This registry has one entry, game:map_zoom: the map's zoom levels on the player's own game. Its display name is Map Zoom.
levels is the list of the map's zoom levels in the game's order, five on this build, each with its scale (16, 8, 4, 2 and 0.7).
It is a look, not a rule: the server has no map screen.
- One level:
"field": "levels[3].scale", "op": 1.5. A relative edit works too:"field": "levels[*].scale", "op": {"mul": 2}doubles every level's scale. - The levels are written in place: the number of levels cannot change. An edit that appends, removes or replaces levels with a list of another length is refused at the start (kiln.log and registry.json say why); each level's other settings (the map's contour lines at that level) stay the game's.
- The map menu takes its zoom steps from the first four levels; the map's drawing reads every level, the fifth too.
The scale's range is the storage's full range (a 32-bit float): Kiln adds no limits of its own. Every field applies after a
restart of the player's game, and only from GameStart.
Edit it from C#
[RegistryEntryPoints(RegistryEntryPoint.GameStart)]
public sealed class WiderMap : Mod
{
public override void OnRegistry(RegistryContext context)
{
if (!Kiln.Registry.Registries.Available) return;
Kiln.Registry.Registries.For(context).Alter(stage =>
{
var levels = stage.MapZoom.Levels;
for (var i = 0; i < levels.Count; i++)
levels[i].Scale = levels[i].Scale * 2; // the value below this mod
});
}
}
RegistryStage.MapZoom is the one MapZoomEntry; Levels is a list of MapZoomLevel (Scale, a double). On a dedicated
server the stage skips these edits with an informational line (client-only field: it applies on each player's own game): the
server has no map screen.
Views
RegistryViews.Find("mapZoom") is the stable view of the one entry and the levels the stage composed on this player's game.
Worked example
Every level twice as far out, the closest one a little closer in:
{
"format": 1,
"registry": {
"alter": [
{ "registry": "mapZoom", "select": "game:map_zoom", "field": "levels[*].scale", "op": { "mul": 2 } },
{ "registry": "mapZoom", "select": "game:map_zoom", "field": "levels[4].scale", "op": 1 }
]
}
}
A pack of these edits alone is a look each player chooses for their own game: give it "side": "client". The server needs
nothing.
In multiplayer
The values are client-authored: each player's game composes its own zoom levels from the mods it has, at its own start. They
are never sent to a server, never received from one and never compared when a player joins (joinedClient: localOnly; they
are not part of the join's registry values). A server cannot change a player's map, and one player's zoom changes nobody else's.
In a mod that runs on both sides ("side": "both"), the dedicated server skips these edits (an informational line in kiln.log
and registry.json skipped, never a refusal) and applies its shared ones.
Known limits
- Not checked in a real game yet: the native tests write a level's scale into a copy of the map's data with Kiln's real boot writer (only that level's four bytes change), and Kiln's offline client proof, run with the release, reads, writes and reverts it on a copy of the client's own data; a map that zooms differently has not been seen.
- The number of levels cannot change (written in place).
- Which scale reads as closer or farther, and how far the map then shows, is the game's: a scale far outside the game's own may draw the map oddly; not tried.