Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CR]Vehicle<->grid connector #322

Merged
merged 12 commits into from
Feb 5, 2021
Merged

[CR]Vehicle<->grid connector #322

merged 12 commits into from
Feb 5, 2021

Conversation

Coolthulhu
Copy link
Member

@Coolthulhu Coolthulhu commented Jan 17, 2021

A furniture part that connects a vehicle to a non-vehicle power grid.

Current limitations that need to be fixed:

  • Includes a horrible hack regarding positioning. May require some redesigning to fix.
  • No "load balancing" between grid batteries and vehicles
  • Jumper-cable-connected vehicles not supported
  • Vehicles don't "push" excess power to grid
  • Vehicle "finding" code is slow and duplicates existing vehicle::find_vehicle (I wish I checked existing code first - it has exactly what I wanted)
  • Jumper cable connection to the connector is hacky and disables regular "out of possession" cable handling
  • Out-of-bubble processing

@Firestorm01X2
Copy link
Collaborator

@Coolthulhu are you going to enable power grid by default now or sometime later?

@Coolthulhu
Copy link
Member Author

Probably with this PR, but it might take a while to get it to work.
I'm basically connecting "jumper cable grid" and building grid into one system here and it has multiple quirks.

@Coolthulhu
Copy link
Member Author

Alright, this is pretty near completion.
Anyone willing to help with the code quality? I probably made a bunch of questionable decisions in there.

Support option to disable grid again
Grid->veh off-bubble now works
Laser turrets can shoot from grid power
Grids now report stored amount properly
@Coolthulhu Coolthulhu changed the title [WiP][CR]Vehicle<->grid connector [CR]Vehicle<->grid connector Feb 3, 2021
@Coolthulhu
Copy link
Member Author

OK, I fixed all the problems I could find.
Grids are currently rather bare feature-wise, so there may be bugs that will only show later, when real features show up.

I tested it like this:

  • Spawned a bunch of vehicles and connectors, connected them into a long line (long enough to exclude at least one from the bubble)
  • Spawned laser-turret-equipped vehicle and used it to drain the battery
  • Confirmed all vehicles have drained batteries
  • Turned engine on one of the vehicles
  • Waited for a long while
  • Confirmed that batteries and vehicles outside of the bubble got charged

Plus there's some test backing, but less extensive than my manual test. It might be worth adding a long chain test, but this thing is already over 2 weeks old, so I'd rather just get it in and fix it later.

Comments requested, especially code quality hints.

@Coolthulhu
Copy link
Member Author

Experimentally giving it a go

@Coolthulhu Coolthulhu merged commit 6aeafb3 into upload Feb 5, 2021
@Coolthulhu Coolthulhu deleted the vehicle-to-grid branch April 3, 2021 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants