PropPlacer
Lets one player place something with their crosshair. Their game shows a preview where they aim, tinted by the rules, and they confirm or cancel. The server checks the confirmed spot again, by the distance and surface rules and all propPlaceConfirm handlers, and with `spawn`, builds a real Prop there. A session has `id`, `player`, `active`, `model`, `end()`, and `veto(vetoed)`, which refuses all spots until cleared. Events are propPlaceMove, with reportMoves, propPlaceConfirm, which can refuse, propPlaceRejected, propPlaceCancel and propPlaceEnd. Client scripts have their own placement on this machine, with the same preview and rules, but reports go to the script, which sends a confirmed pose to the server to build. A client's placement proves nothing to the server.
propPlacer.begin()
PropPlacer.begin(player, options = {})Starts a placement for a player and returns a session, or null if they already have one.
propPlacer.get()
PropPlacer.get(player)The player's running session, or null.
propPlacer.end()
PropPlacer.end()Client only. Stops the placement, returns control to the player and fires `end`. Does nothing if none is active.
propPlacer.isActive()
PropPlacer.isActive()Client only. Whether a placement is running on this machine.
propPlacer.setRefusal()
PropPlacer.setRefusal(vetoed)Client only. Refuses all spots until cleared, for what the rules cannot know, such as what the player can afford or what the server has refused. A click then fires `rejected`.
propPlacer.rotate()
PropPlacer.rotate(degrees)Client only. Turns the preview, as Q and E do while placing.
propPlacer.getPose()
PropPlacer.getPose()Client only. Where the placement is aimed, as { position, rotation, normal, surface, distance, onSurface }, or null with no session or before the first aim. `surface` is currently always ''.
propPlacer.on()
PropPlacer.on(event, handler)Client only. Listens for session events, with handlers called with (pose, valid). `move` fires when the aim moves or the spot flips between accepted and refused, up to ten times per second. `confirm` follows an accepted left click, and is your cue to tell the server. `rejected` follows a refused one. `cancel` follows a right click. `end` always comes last. Both `cancel` and `end` pass a null pose.