Cataclysm-dda: Hijack vehicles (the code that is) to make furniture/terrain power grids

Created on 20 Feb 2019  路  16Comments  路  Source: CleverRaven/Cataclysm-DDA

Is your feature request related to a problem? Please describe.
We have the code to make power grids, plumbing, gas lines, etc - in vehicles.
Although we can build power grids for cars, we can't build them for our bases. This leads to a couple weird things:

  1. People make their bases using the vehicle code, which is a solution, but not a very elegant one,
  2. Furniture elements that we'd like to have don't get implemented because they wouldn't fit in vehicles, like full sized fridges and freezers, and
  3. Furniture elements that shouldn't be readily installed in vehicles are made, because there's no other way to get them - the forge being a key example.
    Allowing furniture and terrain to do the work of vehicles is also a major step in making stationary bases better. Being able to have a row of 500 liter fridges and freezers is already a pretty good argument for having a home base! So is being able to plug in some kind of weaponry to your central grid.

Describe the solution you'd like
"pseudovehicle" furniture and terrain, that leverages the vehicle code to allow transmission of power and liquids through that terrain to other furniture and terrain that needs power.

Existing walls would need to have versions with copper pipes and wires in the recipe (ideally pvc pipe would also be added as an option), and perhaps an option to upgrade them with it. Eventually this would necessitate a big revisit of existing maps to add wiring to the walls as well. For now, t_wall could just have a chance to yield these items at random and that would give us a start.

Describe alternatives you've considered
I had this clever algorithm worked out where we could do power transmission with a whole new code system and Kevin was like "why dude there's already a system for it".

Additional context
This is just a code infrastructure thing for the most part. Here are some ongoing projects that would be good to do once this was in place:

  • We'd still need to work out how to plug appliances into an outlet. I suspect it'd be a lot like a UPS charging station, you put it on the tile and voila.
  • Once plug-in appliances exist, it would be good to remove some of the battery powered ones that don't make a lot of sense, or at least make battery powered versions a mod of the outlet-powered kind
  • We'd have to modify existing furniture like fridges to be able to connect to the power grid, and add furniture versions of a lot of power creating terrain and things.
  • There should be a third furniture dismantling option besides "dismantle" and "bash": "disconnect" creates an item version of furniture that can then be loaded into a vehicle and moved.
(P3 - Medium) <Suggestion / Discussion> Crafting / Construction / Recipes Fields / Furniture / Terrain / Traps

Most helpful comment

I think managing cables is the sort of micromanagement we could really live without...

Full sized freezers and lockers, or even forges in the back of vehicles, should be possible - but those sort of 'fills the whole back of the truck' things aren't really well simulated yet.

All 16 comments

This has certainly been suggested multiple times in the past (and therefore there exists at least one duplicate). It was shot down due to the complexity of vehicle code involved.

I seem to recall a refactor of vehicle code recently though, maybe the situation improved?

Neither Kevin nor mlangsdorf seemed to think that this would be particularly difficult

Furniture elements that shouldn't be readily installed in vehicles are made, because there's no other way to get them - the forge being a key example.

I can't speak for the forge but full-size freezers and lockers should exist for vehicles, after all container trucks, tankers and freezer trucks are a thing. They would have to come with hefty penalties in aerodynamics and curve handling though due to the increased height.

We'd still need to work out how to plug appliances into an outlet. I suspect it'd be a lot like a UPS charging station, you put it on the tile and voila.

Either that or jumper cables, I'm not sure whether the jury-rigged charm would outweigh the tedium of having to actually plug things in and manage cables though.

I think managing cables is the sort of micromanagement we could really live without...

Full sized freezers and lockers, or even forges in the back of vehicles, should be possible - but those sort of 'fills the whole back of the truck' things aren't really well simulated yet.

Full sized freezers and lockers, or even forges in the back of vehicles, should be possible - but those sort of 'fills the whole back of the truck' things aren't really well simulated yet.

I was thinking of a single-tile container, either a full-size locker or an abstraction of a shipping container which is assumed to be plated on the sides. The main point is not the size of the footprint but the height of the container where trunks assume sedan-style construction (2 trunk tile "Car" 320l, Ford Mondeo 530l) and cargo carriers are meant to simulate the fairly low (I've seen <50cm) wall height of pickup trucks or trailers.

Brief outline of how it works:
Add a vehicle flag "APPLIANCE".
Add code to vehicle interaction menu to bail out when the APPLIANCE flag is present and possibly redirect to an iexamine.
Add construction recipes that spawn an appropriate appliance-like vehicle (e.g. refrigerator, generator, lamp) and apply the APPLIANCE flag.

Existing walls would need to have versions with copper pipes and wires in the recipe (ideally pvc pipe would also be added as an option), and perhaps an option to upgrade them with it.

Could wires be a piece of non-blocking floor furniture or attached to the wall from the outside (but not part of it)?

This issue has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there:

https://discourse.cataclysmdda.org/t/add-functionality-for-the-stuff-in-lmoe-shelters/23260/4

So will there be a Rimworld style power system?

Oh, I would love to be able to come to closest power plant, fix it and power the whole city.

That's a long way from what we're talking about here

I just want to run a heavy-cable from the solar cell on my starting evac shelter to power an oven and fridge/freezer, coffee maker, etc. Or have pre-existing wall-outlet power which is run from solar panel + inverter (new item!), or generator.

As things currently exist (0.E-2), I have to knock out a large section of wall and construct an adjoining "vehicle" with RV galley, FOODCO, mini-fridge, mini-freezer, solar panel, storage battery(/ies), etc.

I'm okay with this waiting for 0.G as I think it will require some fairly extensive testing in Experimental and I want to play, soon, in a Stable with nested containers.

It's a thing we all really really want, it will happen at some point. It's just been slowed a little while F has been barreling along quickly.

Great! So, question: With the move to JSON-ing all-the-things over the last few releases, is it better/easier to retrofit existing buildings with a (unpowered) power grid, or will it still require editing the pieces used to construct the building?

Nothing about the code that made re-using the vehicle code for this the right approach has changed.

Ok. That's good because I can't program myself out of a sci-fi garbage compactor, especially if I also have to deal with a tentacle monster, but I can read+write JSON at almost A2 proficiency. (CEFR is used to measure code language proficiency, too, right?)

Was this page helpful?
0 / 5 - 0 ratings