packages: the registry text a game fills is keys (Maroon Lake's phase 26.4) - ThingKind.name, GearKind blurb/howto/names, HintCard's words, JobDef title/text/how, NpcLine and NpcChoice text, WeatherKind.name are @Text Key fields (a compiled row that leaves one out takes its derived key, the English is the game's en.po); what a package hands back as text is the key's marked text, "" for none; NpcName.name, NpcChoice.line and SettingDef.text are not text and lose @Text; ludic.i18n's tr/trf/trn/key_text say @alloc_ok (tr is a cast); the packages' tests with key literals (built, not run); changes/text-keys-data.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-30 00:29:03 +03:00
parent 86146782f7
commit 86644e6533
21 changed files with 81 additions and 54 deletions

View file

@ -28,7 +28,9 @@ export function weather_cold(weather_st: WeatherState) -> float {
export function weather_name(weather_st: WeatherState, k: int) -> string {
if k < 0 or k >= weather_kind_count(weather_st) { return "" }
return weather_st.wx_kinds[k].name
if weather_st.wx_kinds[k].name == null { return "" }
@alloc_ok("a cast: a key's marked text, nothing is made")
return string(weather_st.wx_kinds[k].name)
}
# the half hour after a front goes through, when the air is glass-clear

View file

@ -28,7 +28,7 @@ export const WEATHER_WANT_CLEAR: int = 3 # clear the sky and keep it clear
# one kind of weather; its place in the list the game hands in is its number
export property WeatherKind {
@Text name: string = ""
@Text name: Key = null
clear: bool = false # the kind a sky eases out to: nothing falls, amount goes to 0
wet: bool = false # rain or snow is falling (weather_wet)
@Range(0, 1) soak: float = 0.0 # how wet the ground gets under it, 0..1

View file

@ -30,7 +30,7 @@ program WeatherTest {
return w
}
function kind(name: string, wet: bool, thunder: bool, odds: []float) -> WeatherKind {
function kind(name: Key, wet: bool, thunder: bool, odds: []float) -> WeatherKind {
let k = new WeatherKind
k.name = name
k.clear = not wet
@ -65,9 +65,9 @@ program WeatherTest {
weather_test_st.bias = WEATHER_NO_BIAS
weather_test_st.lean = null
let ks = new []WeatherKind
push(ks, kind("clear", false, false, odds3(0.0, 1.0, 0.0)))
push(ks, kind("rain", true, false, odds3(0.0, 0.0, 1.0)))
push(ks, kind("storm", true, true, odds3(1.0, 0.0, 0.0)))
push(ks, kind(k"weather.clear", false, false, odds3(0.0, 1.0, 0.0)))
push(ks, kind(k"weather.rain", true, false, odds3(0.0, 0.0, 1.0)))
push(ks, kind(k"weather.storm", true, true, odds3(1.0, 0.0, 0.0)))
weather_kinds(weather_st, ks)
weather_config_wind(weather_st, 0.5, 2.5, 10.0, 19.0)
weather_reset(weather_st)