DonBruce64 / MinecraftTransportSimulator

A Minecraft mod that adds planes and automobiles with realistic physics!
Other
111 stars 60 forks source link

[Suggestion] "Kill switch" to remove (mostly) all functionally from a vehicle. #1622

Open Tim3Game opened 1 year ago

Tim3Game commented 1 year ago

Hey, So the idea of this "kill switch" would be, that it would remove all the functionality from the vehicle affected, so it would make the vehicle act like a prop, stuck in one place. This could be useful for people that want to have for instance parking lots full of cars but can't because they cause too much lag and is heavy on server performance. I know that some packs offer "vehicle props", but this would allow players to use whatever vehicle they want with whatever parts they add to them, in any position they place it.

Use: Place the vehicle of your choice, customize it, activate lights/blinkers, position it how you want and then click on it with the proposed "kill switch". The vehicle wouldn't change from the outside, but would change to a "static vehicle", which would allow players to interact with it but would be free of all the unnecessary code behind it (mostly talking about the movement,"gravitational" and hitbox calculations) - basically like the NoAI property in vanilla Minecraft for mobs. There could be an option to make it a normal vehicle again, so "bring it back to life".

boot2big commented 1 year ago

I could've sworn this was poised as a feature before, and +1 on this ticket

Perhaps vehicles that are parked/locked automatically enter this state until they're towed? (Which would obviously require the connection point code to continue running, but would probably still be a lot less to run through than connections + physics + etc)

DonBruce64 commented 1 year ago

This poses a few comments and questions:

  1. I would perfer to have vehicles do this automatically, since most folks keep their cars in a garage, where they rightfully should be props until they are used. My thoughts are if the vehicle isn't moving, and the wheels are on the ground, and the engine is off, it stops doing physics with the sole exception being checking for blocks below it?
  2. When you say "disable hitboxes", does that mean the player doesn't collide with the vehicle? Or rather the vehicle doesn't collide with the world?
Tim3Game commented 1 year ago
  1. Yes, definitely a better idea, combined with the idea from @boot2big about it being able to be towed (without needing to access the vehicles (if easily possible)). Basically "turn off/disable" as much of the stuff that's not needed when it's off/"a prop" (saying it like that because I don't know what all kind of stuff it's doing behind the scenes). But then there is the problem of "gliding vehicles" where they slightly move even if stopped (at least for the ones inexperienced in fully stopping the vehicles in place), so not sure how it would deal with that.
  2. It was mostly meant for when the vehicle would be "static" it wouldn't check if it was pushed or not by blocks and stuff. But yeah, it should still check for player to vehicle collision, and probably vehicle to vehicle, but, at least not so often, maybe every second or more, for world collision, so it still would response but just not instantly like it would in the normal operating state.
DonBruce64 commented 1 year ago

Gliding vehicles are just syncing. They'll stop on their own eventually and they don't really do too much all considered. But I'll see what I can do to make vehicles go into an "idle" state when they're not moving. For sure there are TPS improvements to be made.