ludic.clock: clock_hhmm reads a table of the day's times made with the state; ludic.minimap: minimap_pin past the end is one kept empty mark; ludic.ui: ev_text's memo miss is its own declared function
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
bad7c4a255
commit
ac8c7b0c0b
5 changed files with 25 additions and 7 deletions
|
|
@ -12,13 +12,24 @@ export function clock_hours_in(clock_st: ClockState, dt: float) -> float { retur
|
|||
|
||||
export function clock_is_night(clock_st: ClockState) -> bool { return clock_st.ck_hours > clock_st.ck_night_from or clock_st.ck_hours < clock_st.ck_night_to }
|
||||
|
||||
# "07:05"
|
||||
# "07:05", from the table the state was made with
|
||||
export function clock_hhmm(clock_st: ClockState) -> string {
|
||||
let h = int(Math.floor(clock_st.ck_hours))
|
||||
let m = int(Math.floor((clock_st.ck_hours - float(h)) * 60.0))
|
||||
var hs = `{h}`
|
||||
var ms = `{m}`
|
||||
if h < 10 { hs = `0{h}` }
|
||||
if m < 10 { ms = `0{m}` }
|
||||
return hs + ":" + ms
|
||||
return clock_st.ck_hhmm_tab[Math.clamp(h, 0, 23) * 60 + Math.clamp(m, 0, 59)]
|
||||
}
|
||||
|
||||
@alloc_ok("once: the day's 1440 times, made with the state")
|
||||
function ck_hhmm_table() -> []string {
|
||||
let out = new []string
|
||||
for t in 0 .. 1440 {
|
||||
let h = t / 60
|
||||
let m = t % 60
|
||||
var hs = `{h}`
|
||||
var ms = `{m}`
|
||||
if h < 10 { hs = `0{h}` }
|
||||
if m < 10 { ms = `0{m}` }
|
||||
push(out, hs + ":" + ms)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ export property DayTurned {
|
|||
}
|
||||
|
||||
export state ClockState {
|
||||
ck_hhmm_tab: []string = ck_hhmm_table() # "00:00" .. "23:59", made with the state: asked every frame
|
||||
cal_month_days: int = 30
|
||||
cal_year_months: int = 12
|
||||
cal_season: []int = null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue