Skip to main content

__point

Attribute Macro __point 

#[__point]
Expand description

#[point(side = "server" | "client" | "both", name = "…", table = "…", raw, free, mirror(…))] on a function: an injection point (#589), a slot the launcher fills at load for the mods that listen there. The staging pass that builds the prebuilt game (and the launcher’s source builds) puts it on every function [point_shape::eligible] admits; the source tree carries none. Its head checks the slot (one atomic load and a branch while nothing listens). An API listener, native or wasm, gets the side’s host (on a Game method) and a record holding a copy of every parameter as an API value (an engine type mirror(…) names as its mod_api mirror): the function runs with the record’s by-value and &T values, and a &mut T parameter’s place gets the record’s value back. A raw listener (raw, native only) gets the receiver and a &mut to every parameter itself. Its return does the same with the value returned; a value that borrows reaches only raw listeners, as itself. free marks a free function, whose body moves to a sibling function. table names the slot table the point is in: the game’s mod_points by default, or a mod crate’s own generated table for a mod point (#2339). A replace listener (mod_points::replace!) owns the head’s outcome: it runs after the other API listeners, and on a point with both forms the head keeps its value and cancel through the raw listeners after it.