BeamMP / BeamMP-Server

Server for the multiplayer mod BeamMP for BeamNG.drive
https://beammp.com
GNU Affero General Public License v3.0
127 stars 53 forks source link

Lua API to access vehicle data on the server #347

Open JotaFaD opened 3 months ago

JotaFaD commented 3 months ago

Is your feature request related to a problem? Please describe. I'm writing a mod that requires the server to save the player's position to a database periodically.

Currently, I have a timer on the client side mod that sends the position of the player to the server through events.

It works as expected, but I consider the extra event usage wasteful, as the server already must receive this data to transmit it to other clients (from my understanding, through MPGameNetwork), but a lua API to access this data (position, rotation, electrics...) doesn't seem to exist.

Describe the solution you'd like Something like MP.getPlayerData(playerId).position to access the last position a specific client sent to the server.

Describe alternatives you've considered Using events and transmitting the information through my own code.

Additional context None.

Mack29446 commented 3 months ago

Hey, this already mostly exists - see MP.GetPositionRaw 🙂 - although not including electrics