Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign up[CR] Diesel engines. #7151
Conversation
desrik
added some commits
Apr 9, 2014
This comment has been minimized.
This comment has been minimized.
ghost
commented
Apr 10, 2014
|
For flavour, I'd love to see this be a straight-6 instead a V6/V8. "Virtually every heavy duty over-the-road truck employs an inline-six diesel engine, as well as most medium duty and many light duty diesel trucks. Its virtues are superior low-end torque, very long service life, smooth operation and dependability. On-highway vehicle operators look for straight-six diesels, which are smooth-operating and quiet." https://en.wikipedia.org/wiki/Straight-six_engine#Straight-six_diesel_engines |
This comment has been minimized.
This comment has been minimized.
|
This seems about ready for testing so I'll include it in my FrankenMod. |
This comment has been minimized.
This comment has been minimized.
ghost
commented
Apr 10, 2014
|
Also, I noticed you set the epower for this engine to -200. Note that using a negative epower on combustion engines is used to simulate the power drain of the ignition system (e.g. spark plugs). However, diesel engines don't use spark plugs, and don't necessarily need any electricity to run at all. (Though modern diesels have electronics...) |
This comment has been minimized.
This comment has been minimized.
|
@belenos- I didn't really know what that was for... is it a one time draw or is it constant? diesels do need electricity to start though... they dont have spark plugs they have glow plugs @Wishbringer EDIT:: I also really need to figure out this biodiesel issue... How do guns have multiple accepted ammo types? |
This comment has been minimized.
This comment has been minimized.
|
PR: #7064 |
This comment has been minimized.
This comment has been minimized.
|
I see what you mean. Changed it. |
This comment has been minimized.
This comment has been minimized.
ghost
commented
Apr 10, 2014
|
@desrik regarding l6 vs v6/v8, note that most diesel pickup trucks also use I6 diesels, not just heavy trucks. (But anyway, I'll stop pestering you on this :) ) Regarding negative epower on engines, it's a constant draw, but I just checked the code and only fuel_type_gasoline engines are checked for a epower draw, so it actually doesn't really matter what you set this to unless you want to changes to vehicle::power_parts(). Regarding engine start-up epower draw, this is handled separately in vehicle::start_engine(). Current start-up epower draw is set to 1/10th the engine power (to simulate the starter motor), but currently only for fuel_type_gasoline engines. You probably will want to add a case for fuel_type_diesel here as well, since diesel engines also use a starter motor. (I suggest an epower draw 1/8 engine power for diesel, since diesel engines need relatively heavier starter motors, plus have the glow plug draw you mentioned.) Also, you probably want to check the vehicle class for any checks for 'fuel_type_gasoline' and see if you there also be a check made for fuel_type_diesel. I looked through the code quick, and you probably want to make changes in the following places: |
desrik
added some commits
Apr 10, 2014
ghost
reviewed
Apr 11, 2014
| @@ -2398,7 +2401,7 @@ void vehicle::power_parts ()//TODO: more categories of powered part! | |||
| // Gas engines require epower to run for ignition system, ECU, etc. | |||
| for( size_t p = 0; p < engines.size(); ++p ) { | |||
| if(parts[engines[p]].hp > 0 && | |||
| part_info(engines[p]).fuel_type == fuel_type_gasoline) { | |||
| (part_info(engines[p]).fuel_type == fuel_type_gasoline || part_info(engines[p]).fuel_type == fuel_type_gasoline)) { | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
desrik
added some commits
Apr 11, 2014
This comment has been minimized.
This comment has been minimized.
|
As far as I can tell this is done... If anyone has any thoughts on what the values should be on the engines as far as balancing let me know... I just kinda guessed. |
desrik
changed the title
[CR] [WIP] Diesel engines. ( Rework of PR #5182 - Biodiesel engine )
[CR] Diesel engines.
Apr 11, 2014
This comment has been minimized.
This comment has been minimized.
ghost
commented
Apr 11, 2014
|
Were you planning to add/modify any vehicles to use diesel as part of the PR? If so, according to wikipedia the Humvee uses a v8 diesel, so that could be an easy one to change. Minor thing: a straight-6 engine can be abreviated as 'l6' or 'L6' if you want to keep the id strings short. |
Wishbringer
reviewed
Apr 11, 2014
| }, | ||
| { | ||
| "type":"VAR_VEH_PART", | ||
| "id": "straigt_6_diesel", |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@belenos- Damn sure forgot to do that :P It's done now. Straight-6 is now the I6 and used by the Schoolbus. The Semi Truck uses the V6. The Humvee, Military Cargo Truck, and the Armored Personnel Carrier use the V8. |
This comment has been minimized.
This comment has been minimized.
|
So to be clear: buses and trucks now use diesel engines, but diesel's only in 1 of every 6 pumps and isn't craftable. Uh, that's a pretty big nerf to big vehicles, I think. Holding on biodiesel. |
This comment has been minimized.
This comment has been minimized.
|
@KA101 the one_in() can be changed... Would 1:4 be better? I was kind of aiming towards not having diesel available at every station generated, but I'm open for suggestions. As for biodiesel... That's out of this PR. Tured out to be a bigger headache thatn I had originally planned, plus I met some resistance in IRC. It was suggested that the recipe for biodiesel could simply return regular diesel, but thats not really what I'm going for... I try to avoid "magic" functions... If you have any ideas on a way to implement biodiesel I'm all ears. That was the original reason for adding diesel to begin with. |
This comment has been minimized.
This comment has been minimized.
|
1:4 seems better, yeah. Ideally there'd be a guaranteed pump at every station, and then the 1:6 or maybe 1:5 could kick in for additional pumps. Issue is that there have to be enough diesel pumps that you could actually believe diesel vehicles were routinely operating pre-Cataclysm. (So, alternatively, military bunkers/outposts could have a diesel pump or two for humvees and miltrucks. Schools might have one around the back for the buses. Not sure whether that's a better solution: just an idea.) |
This comment has been minimized.
This comment has been minimized.
|
Or possibly a truck stop? Big 2x2 store with gas pumps in the front and diesel in the back. Have a possibility for part of the store to be a fast food place. I can see the outpost, but i can't see a bunker having a diesel pump. |
kevingranade
reviewed
Apr 13, 2014
| @@ -1335,6 +1335,27 @@ void game::activity_on_turn_refill_vehicle() | |||
| break; | |||
| } | |||
| } | |||
| } else if(m.ter(u.posx + i, u.posy + j) == t_diesel_pump) { | |||
This comment has been minimized.
This comment has been minimized.
kevingranade
Apr 13, 2014
Member
You should be able to just have a few lines of code at the start that populate a std::string fuel_type with either "gasoline" or "disel", then use it where appropriate. There's no need to duplicate all this code.
kevingranade
reviewed
Apr 13, 2014
| @@ -10049,6 +10076,46 @@ bool game::handle_liquid(item &liquid, bool from_ground, bool infinite, item *so | |||
| // infinite: always handled all, to prevent loops | |||
| return infinite || liquid.charges == 0; | |||
| } | |||
| else if ((liquid.type->id == "diesel" && vehicle_near() && query_yn(_("Refill vehicle?")))) { | |||
This comment has been minimized.
This comment has been minimized.
kevingranade
Apr 13, 2014
Member
Same comment as above x100, we do not want to duplicate code when we add stuff like this, it makes the code fragile because if we have to fix or change it later, we have to try and remember to do it in both places in the future.
kevingranade
reviewed
Apr 13, 2014
| @@ -34,8 +34,8 @@ const std::string legacy_mon_id[126] = {"mon_null", "mon_squirrel", "mon_rabbit" | |||
| "mon_turkey", "mon_raccoon", "mon_opossum", "mon_rattlesnake", "mon_giant_crayfish" | |||
|
|
|||
| }; | |||
| const int num_legacy_ter = 174; | |||
| const std::string legacy_ter_id[174] = {"t_null", "t_hole", "t_dirt", "t_sand", "t_dirtmound", | |||
| const int num_legacy_ter = 176; | |||
This comment has been minimized.
This comment has been minimized.
kevingranade
Apr 13, 2014
Member
No need to update these, they're for loading legacy saves, and hopefully we can get rid of them eventually.
This comment has been minimized.
This comment has been minimized.
We don't bother to differentiate between grades of gasoline, or if it's E85 either. I don't see why it's an issue to call all forms of diesel the same here. |
desrik commentedApr 10, 2014
( One in six chance of replacing a normal gas pump with diesel. )
( Both through the vehicle GUI and by activating the rubber hose item )