refactor(packages): 0.R5 - the shop's week is rolled by its tick and asking reads it; needs start filled and vehicles start with their list; character, physics, vehicles and nativeecho's lazy starts are defaults; --tighten over all four
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
67d8079c47
commit
87259f989d
31 changed files with 104 additions and 111 deletions
|
|
@ -2,12 +2,11 @@
|
|||
# from, and the facts
|
||||
const ve_pi: float = 3.14159265
|
||||
|
||||
export function vehicle_facts(vehicles_st: mut VehiclesState) -> Queue<VehicleFact> {
|
||||
if vehicles_st.ve_fact_q == null { vehicles_st.ve_fact_q = queue_new("vehicles.facts") }
|
||||
export function vehicle_facts(vehicles_st: VehiclesState) -> Queue<VehicleFact> {
|
||||
return vehicles_st.ve_fact_q
|
||||
}
|
||||
|
||||
function ve_say(vehicles_st: mut VehiclesState, what: int, v: Vehicle, n: float) -> void {
|
||||
function ve_say(vehicles_st: VehiclesState, what: int, v: Vehicle, n: float) -> void {
|
||||
let f = new VehicleFact
|
||||
f.what = what
|
||||
f.nid = v.nid
|
||||
|
|
@ -19,13 +18,10 @@ function ve_say(vehicles_st: mut VehiclesState, what: int, v: Vehicle, n: float)
|
|||
q_push(vehicle_facts(vehicles_st), f)
|
||||
}
|
||||
|
||||
function ve_all(vehicles_st: mut VehiclesState) -> []Vehicle {
|
||||
if vehicles_st.ve_list == null { vehicles_st.ve_list = new []Vehicle }
|
||||
return vehicles_st.ve_list
|
||||
}
|
||||
function ve_all(vehicles_st: VehiclesState) -> []Vehicle { return vehicles_st.ve_list }
|
||||
|
||||
# every vehicle in the valley, to draw and to aim at (change one only through the verbs)
|
||||
export function vehicles_all(vehicles_st: mut VehiclesState) -> []Vehicle { return ve_all(vehicles_st) }
|
||||
export function vehicles_all(vehicles_st: VehiclesState) -> []Vehicle { return ve_all(vehicles_st) }
|
||||
|
||||
# the kind this machine's player is riding, 0 none
|
||||
export function vehicle_ride_kind(vehicles_st: VehiclesState) -> int {
|
||||
|
|
@ -35,17 +31,17 @@ export function vehicle_ride_kind(vehicles_st: VehiclesState) -> int {
|
|||
|
||||
export function vehicle_current(vehicles_st: VehiclesState) -> Vehicle { return vehicles_st.ve_cur }
|
||||
|
||||
export function vehicle_of(vehicles_st: mut VehiclesState, pid: int, kind: int) -> Vehicle {
|
||||
export function vehicle_of(vehicles_st: VehiclesState, pid: int, kind: int) -> Vehicle {
|
||||
let l = ve_all(vehicles_st)
|
||||
for i in 0 .. len(l) { if l[i].kind == kind and l[i].owner == pid { return l[i] } }
|
||||
return null
|
||||
}
|
||||
|
||||
# this player's own boat or horse
|
||||
export function vehicle_find(vehicles_st: mut VehiclesState, kind: int) -> Vehicle { return vehicle_of(vehicles_st, 0, kind) }
|
||||
export function vehicle_find(vehicles_st: VehiclesState, kind: int) -> Vehicle { return vehicle_of(vehicles_st, 0, kind) }
|
||||
|
||||
# the nearest vehicle nobody is on within `reach` of (x, z); nothing while riding
|
||||
export function vehicle_nearest(vehicles_st: mut VehiclesState, x: float, z: float, reach: float) -> Vehicle {
|
||||
export function vehicle_nearest(vehicles_st: VehiclesState, x: float, z: float, reach: float) -> Vehicle {
|
||||
if vehicles_st.ve_cur != null { return null }
|
||||
var best: Vehicle = null
|
||||
var bd = reach
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue