Open lionkor opened 2 years ago
Im trying to think of a use for this. One that comes up my mind is the modders ability to spawn props, like barriers and props on his server for events. For that either MP.SpawnVehicle() or a editVehicle() function should make it possible for the modder to make the cars player tag invinsible.
Yeah, the prop thing was my main idea for now. Also spawning other cars, all the way up to potentially making ghost cars like your HC - that should all be possible in the future. The "definition of done" for this issue is the prop case working.
May I suggest a slight expansion to this and maybe break it up into a couple of functions:
MP.SpawnDummyVehicle() -- Good for spawning props and vehicles that do not require lua (Engine, Powertrain So on)
MP.SpawnVehicle() -- Good for spawning fully functioning vehicles
MP.SpawnProp() -- This calls the SpawnDummyProp() but is a nice to use wrapper for readability when making scripts for dynamic maps
Just my 2 cents. :)
With regards to the suggestion of a MP.editVehicle
Maybe this can be broken down slightly based on how the client works into:
MP.GetVehicleConfig() -- This gets the JSON Object of the configuration of the vehicle for modification.
MP.SetVehicleConfig() -- This sets the vehicle configuration object.
Alternatively maybe we could do a MP.GetVehicle()
which you can then call getters and setters on? This would be similar to how the object in-game is so that you only need to learn the vehicle object and how it works once for both game and server.
Is your feature request related to a problem? Please describe. It would be very useful to be able to write a Lua Plugin, and spawn specific vehicles from there. We could simply allow the player to specify the path of a vehicle file, and parse & spawn that (not sure how easy that is), under some imaginary player name (with a special name, such as
*<name>
, like*James
, to signify that it's a server-side vehicle).Describe the solution you'd like An API to say
MP.SpawnVehicle(configPath, position, rotation, ...) → table
(made up, could be anything), and some functions to set velocity / position, and similar.Discussion is welcome!