Gizmos Car Keys (improved)

by Pi-C

Tired of running to your vehicle? Then let it come to you! This mod is based on "Gizmos Car Keys" by aodgizmo. It works with most modded car and spider-vehicle prototypes -- not just vanilla cars.

Content
8 months ago
0.17 - 2.0
15.9K
Transportation

i [TODO] Vehicles per planet

21 days ago

I have one car per planet and I want to click to teleport that car without having to own a planet's vehicle every time. A cars ownership could optionally be dependent on the planet it is on. There could be a key in the inventory, like the mod used to do a long time ago, and that key item could have an associated vehicle. I like the latter solution since player inventory has to stay on the planet with the associated vehicle.

19 days ago
(updated 19 days ago)

Thanks for your suggestions! I may consider them for the future, but it will probably take a while until I get it done. The problem is that I've never played a game with SA yet, so I'm familiar only with things I've read in the Lua API documentation.

I have one car per planet and I want to click to teleport that car without having to own a planet's vehicle every time. A cars ownership could optionally be dependent on the planet it is on.

As far as I can see, each planet can have one or more surfaces associated to it. It seems when the player is using the car keys to claim a vehicle, we should mark the vehicle to be owned by the player on LuaPlayer::surface.planet. So, each player could own several vehicles, but only one per planet. If the player is using the keys to summon a vehicle, we must check which planet the player's current surface is associated with, and get the vehicle that is marked as owned by the player on that planet (even if it is on another surface than the player).

There could be a key in the inventory, like the mod used to do a long time ago, and that key item could have an associated vehicle.

Associating keys (inventory items) with a particular vehicle is bound to cause problems: what if you've lost the key? If you've dropped it on the ground, or put it in a chest that is not accessible (e.g. because it has been destroyed, or you don't remember its location), you couldn't summon the vehicle anymore. That's why I've agreed to get rid of the physical key items and use the shortcut instead.

I believe it would be possible to keep the shortcut if we stored the planet with the vehicle data. However, that would be a major change requiring restructuring of the mod's storage table, and ascertaining compatibility with other mods. Additionally, I wouldn't want the mod to depend on SA – players without it should still be able to use GCKI, so I'd have to add compatibility code for that as well. It's not impossible to do that, but it will mean a lot of time spent on planning, rewriting, and testing. That's definitely a long-term project, not something I could finish in a month or two! :-)

I like the latter solution since player inventory has to stay on the planet with the associated vehicle.

Really? How does that work exactly? Do you lose all items in your inventory when you enter/leave a space ship (LuaSpacePlatform)?

19 days ago
(updated 19 days ago)

Associating keys (inventory items) with a particular vehicle is bound to cause problems: what if you've lost the key? If you've dropped it on the ground, or put it in a chest that is not accessible (e.g. because it has been destroyed, or you don't remember its location), you couldn't summon the vehicle anymore.

Are vehicles and associated keys have only one owner? If so, you could try storing the owner with both, and the owner could create as many keys as needed at any time. I think you'd need only to check if they already own the vehicle or if it's free to own.

Really? How does that work exactly? Do you lose all items in your inventory when you enter/leave a space ship (LuaSpacePlatform)?

Entering a rocket is only possible when one has no inventory.

New response