feat(packages): ludic.vehicles - each player's boat and horse: called to four berths or four bays, made the first time and fetched after, owner and rider, mounting (a hungry horse will not go), riding a horse on stamina and a boat on the wind with steering by signed speed, the swell at the edge, getting off onto the rider's own safe spot, a player leaving; the world and the rider through ports; mounted, dismounted, no landing, moved, swell and hunger as facts; this player's own saved by kind
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
fdf9866e88
commit
6e2212de7b
13 changed files with 877 additions and 0 deletions
38
packages/ludic.vehicles/system.ludic
Normal file
38
packages/ludic.vehicles/system.ludic
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# system.ludic - vehicles as a system: a reset, and this player's own saved by kind (hired or not,
|
||||
# and the horse's hay); where they lie is not saved - they are called again. The idle boats' bob is
|
||||
# vehicles_tick, which the game calls where the world is run
|
||||
export function vehicles_reset() -> void {
|
||||
ve_list = new []Vehicle
|
||||
ve_cur = null
|
||||
ve_have_dock = false
|
||||
ve_swell_said = 0.0
|
||||
ve_kept_horse = false
|
||||
ve_kept_boat = false
|
||||
ve_kept_food = 40.0
|
||||
q_clear(vehicle_facts())
|
||||
}
|
||||
|
||||
export function vehicles_save() -> Val {
|
||||
let v = Value.object()
|
||||
let h = vehicle_find(VEHICLE_HORSE)
|
||||
let b = vehicle_find(VEHICLE_BOAT)
|
||||
if h != null {
|
||||
sv_put_bool(v, "horse_own", h.owned)
|
||||
sv_put_float(v, "horse_food", h.food)
|
||||
}
|
||||
if b != null { sv_put_bool(v, "boat_own", b.owned) }
|
||||
return v
|
||||
}
|
||||
|
||||
export function vehicles_load(v: Val, version: int) -> void {
|
||||
vehicle_drop()
|
||||
vehicle_restore(VEHICLE_HORSE, sv_bool(v, "horse_own", false), sv_float(v, "horse_food", 40.0))
|
||||
vehicle_restore(VEHICLE_BOAT, sv_bool(v, "boat_own", false), 0.0)
|
||||
}
|
||||
|
||||
export function vehicles_system() -> System {
|
||||
let s = system_new("vehicles", PH_SIMULATE)
|
||||
s.save = fn vehicles_save
|
||||
s.load = fn vehicles_load
|
||||
return s
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue