Repository navigation
For mod authors
Reference Keystone.dll, say that you need it, and register:
[assembly: KSPAssemblyDependency("Keystone", 0, 6)]
Mod mod = Kit.Register("Smooth Portraits", "0.1.0", "A line about what the mod does.");
Toggle on = mod.Toggle("on", "Smooth portraits", true, "What the pointer shows when held over it.");
Slider most = mod.Slider("most", "At most", 60f, 10f, 144f, " a second", 0);
Hotkey snap = mod.Hotkey("snap", "Take a picture", KeyCode.P); // with the game's modifier key, unless told otherwise
mod.Status = () => report; // a few words on how it is doing, kept up to date elsewhereA setting takes what was saved for it the moment it is made, and can be read ever after as its Value
(or used directly: a Toggle is a bool, a Slider a float). Changed on a setting, or on the mod,
tells you when the player moves one. There are six kinds: Toggle, Slider (dragged, or a number typed
into the box beside it), Choice (one of a few named things), Tint (a colour: a box that opens a
gradient to click or drag on, with the colour's six hex digits to type), Hotkey (a key the player can
change) and Heading (a line of words between settings).
The window opens on a list of every mod installed. Yours is in the first part, with:
-
a switch: your mod's own
Togglewith the key"on". It is that setting itself, not a second one, so flicking it in the list is flicking it on your page. To use another toggle, or none, setmod.Switch. -
a line under its name:
mod.Status, aFunc<string>asked about once a frame while the list shows (so hand back words kept up to date elsewhere, as a readout already is). Say what the mod is doing ("2 engines are leaving smoke") or why it cannot ("needs Volumetric Explosions 0.4"). Without one, or while it gives nothing, the list says whether the mod's settings are as installed, or how many the player has changed (mod.Changes). -
its page: your settings and
Panel, and under them what the list knows of the mod: from CKAN's record, your.versionfile, your library. Ship a.versionfile (KSP-AVC's form) with aURLfor its copy online and aGITHUBblock, and players who allow it see when a newer version is out.
mod.Hotkey(key, label, KeyCode, modifier = true, hint) is a key the player can change on your page: one
key, alone or with the game's modifier key (Option on a Mac, Alt elsewhere, or whatever the game's own
settings make it). Ask it in Update: Pressed is true in the frame it goes down, Held while it is down.
Neither is ever true while the player is typing (in this window or in one of the game's own boxes) or is
choosing a key. A key bound with the modifier answers only with it held, and one bound without only without,
so K and Option-K can be two things. Shown is the key in words ("Option K"), for your hints; a key that
two settings share is marked on both pages. Saved as modifier+K, K or None.
The number after "Keystone" in the dependency is the least version the mod can do with: 0, 1 for the
window and the settings, 0, 2 for the lens, 0, 3 for boxes that can be typed in and the gradient,
0, 4 for the film, 0, 5 for what engines burn and where their nozzles are, 0, 6 for Status, Switch,
Changes and Hotkey, 0, 7 for the weather. A mod built against an older Keystone loads on a newer one unchanged.
Kit.Register(name, version, about) |
a mod says it is here; gives back its Mod
|
mod.Toggle / Slider / Choice / Tint / Hotkey / Heading |
a setting on its page |
mod.Panel = () => { ... } |
more for the page, drawn by the mod itself with the game's GUILayout
|
mod.Status, mod.Switch, mod.Changes
|
its line and its switch in the list of mods; how many settings the player has changed |
mod.Kept(key), mod.Keep(key, text)
|
other text worth keeping in the same file (a list the mod draws itself) |
mod.Changed, setting.Changed
|
the player changed something |
Host.Swatch, Host.Pick, Host.Mixer, Host.Row, Host.Rich, Host.Small, Host.Plain
|
what the window is drawn with, for a Panel: a patch of colour, one that can be clicked, the gradient a colour is chosen on, a labelled slider, and the window's ways of writing |
Host.Typed(name, text, width, out entered, out mine) |
a box to type in. Give it a name that begins with Host.TypedName, and the game's own keys are held off while it has the keyboard |
Hotkey.Typing |
whether the player is typing anywhere just now |
Reach.Field / Method / Call<T> |
the game's non-public members, looked up once; missing ones are reported in the log once and come back as nothing, so a mod can go without instead of failing every frame |
Kit.Log(who, text) |
a line in the game's log with the mod's name in front |
Lens.Best, Look
|
the lens (see The lens): Lens.Best?.Use(camera, look) every frame while it is wanted, Off() when it is not |
Film.Ask, Grade
|
the film (see The film): Film.Ask("My mod", grade) every frame while it is wanted |
Engines.Burns(engine, partName) |
what a rocket engine is taken as burning (Fuel: kerosene, hydrogen, methane, storable, solid, mono, reactor, or none for jets, ion engines and anything unknown): by a config's ENGINE_FLAMES { ENGINE { part = ...; flame = ... } }, else by its propellants and, for the game's one rocket fuel, by which engine it is |
Engines.Mouth(part, nozzle, all, guess, out radius, out rim) |
where the mouth of one nozzle really is (rim metres along nozzle.forward from its thrust transform, which is not at the bell's rim) and how wide, measured from the part's own model; Engines.Guess(engine, share) is a radius from the thrust where it cannot be measured |
Engines.Running(engine) |
how hard it is burning, 0 to 1: how much it burns of what it could, not how hard it pushes (a vacuum engine in thick air pushes little and burns as much as ever) |
Engines.Flame(fuel, radius) |
how long such a nozzle's flame is at full burn in thick air, metres |
Listing.All, Listed
|
every mod installed, as the list shows it: name, version, maker, addresses, needs, folders, libraries |
Meter.Best, Meter.Loaded
|
what each mod costs (see What each mod costs) |
Weather.At(body, lat, lon, ut), Wind, Cloud, Cells, Shade, Flashed, Recent
|
the weather, as a weather mod (Weather.Provider) says it is: the clouds in three layers (kind, cover, base, top, how wet), rain, snow, storms, fog, dust, how far one can see, the wind and its gusts, the storm cells near a place, the pattern of the clouds at a point, how the clouds dim the sun and the sky (WeatherShade: the sun's direct light that gets through, the sky's light against a clear sky's, how grey it is, and SunDimmed, set where the weather mod dims the sun itself as it draws clouds of its own, so that a light mod counts the dimming but does not apply it twice), and each flash of lightning. Any thread may ask; with no weather mod installed every answer is a still, clear day |