feat(base): 0.R4 - a queue keeps its own count, so every package verb takes only its own state; ludic migrate state --prune
ludic.base's Queue<T> carries a QueueTag (its name and pending count): queue_new(name), q_push(q, v), q_drain(q), q_clear(q) take no BaseState, and core_undrained(tags) names the given queues still holding facts. A reducer on a package's state can now call that package's verbs (wallet_earn(wallet_st, n)). ludic migrate state --prune (ludicc --migrate-prune) takes out each state parameter a function no longer uses, nor anything it calls, and the argument that fills it - including an argument for a parameter the callee has dropped, which is taken out before the call is checked, so a generic's T is told by the argument that says it. A reducer keeps its state. --dry-run now counts the edits it would make. Every package was moved with it: 608 base_st parameters and their arguments, 1889 edits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
8cf4b3fed6
commit
71735b10a2
151 changed files with 58668 additions and 54719 deletions
|
|
@ -4,27 +4,27 @@
|
|||
export const VEHICLE_HAY_MIN: float = 10.0 # a horse with less hay than this will not go
|
||||
|
||||
# this machine's player onto v; false when it is somebody else's, taken, or a hungry horse
|
||||
export function vehicle_mount(base_st: mut BaseState, vehicles_st: mut VehiclesState, v: Vehicle) -> bool {
|
||||
export function vehicle_mount(vehicles_st: mut VehiclesState, v: Vehicle) -> bool {
|
||||
if v == null or v.owner != 0 or v.rider >= 0 or vehicles_st.ve_cur != null { return false }
|
||||
if v.kind == VEHICLE_HORSE and v.food < VEHICLE_HAY_MIN {
|
||||
ve_say(base_st, vehicles_st, VEHICLE_HUNGRY, v, v.food)
|
||||
ve_say(vehicles_st, VEHICLE_HUNGRY, v, v.food)
|
||||
return false
|
||||
}
|
||||
vehicles_st.ve_cur = v
|
||||
v.rider = 0
|
||||
VehicleRider.board(v.x, v.z, v.yaw)
|
||||
ve_say(base_st, vehicles_st, VEHICLE_MOUNTED, v, 0.0)
|
||||
ve_say(vehicles_st, VEHICLE_MOUNTED, v, 0.0)
|
||||
return true
|
||||
}
|
||||
|
||||
# Off, onto the nearest spot a body could stand and walk off: from a boat a wade of up to 1.25 m
|
||||
# within ten metres, from a horse beside its right flank. False (and said) when a boat is too far out.
|
||||
export function vehicle_dismount(base_st: mut BaseState, vehicles_st: mut VehiclesState) -> bool {
|
||||
export function vehicle_dismount(vehicles_st: mut VehiclesState) -> bool {
|
||||
let v = vehicles_st.ve_cur
|
||||
if v == null { return false }
|
||||
if v.kind == VEHICLE_BOAT {
|
||||
if not VehicleRider.safe_spot(v.x, v.z, VehicleWorld.water(v.x, v.z), 1.25) {
|
||||
ve_say(base_st, vehicles_st, VEHICLE_NO_LANDING, v, 0.0)
|
||||
ve_say(vehicles_st, VEHICLE_NO_LANDING, v, 0.0)
|
||||
return false
|
||||
}
|
||||
VehicleRider.step_off(VehicleRider.safe_x(), VehicleRider.safe_z())
|
||||
|
|
@ -40,7 +40,7 @@ export function vehicle_dismount(base_st: mut BaseState, vehicles_st: mut Vehicl
|
|||
vehicles_st.ve_cur = null
|
||||
v.rider = -1
|
||||
v.speed = 0.0
|
||||
ve_say(base_st, vehicles_st, VEHICLE_DISMOUNTED, v, 0.0)
|
||||
ve_say(vehicles_st, VEHICLE_DISMOUNTED, v, 0.0)
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue