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

Mounted flamethrowers don't see fuel tanks as ammo #44672

Open
vityav opened this issue Oct 6, 2020 · 5 comments
Open

Mounted flamethrowers don't see fuel tanks as ammo #44672

vityav opened this issue Oct 6, 2020 · 5 comments
Labels
<Bug> This needs to be fixed Vehicles Vehicles, parts, mechanics & interactions

Comments

@vityav
Copy link

vityav commented Oct 6, 2020

Game version:
Experimentals from b545981 through the last month if not more

Operating system:
Arch Linux 5.8.13

Tiles or curses:
Curses

Mods active:
Aftershock
Blaze Industries
C.R.I.T
Stats through skills

Expected behavior

Vehicle-mounted flamethrowers (or mounted RM451 flamethrowers) should see built-in tanks of gasoline/napalm and use them as fuel.

Actual behavior

Flamethrowers think they have no ammo and have no way to be manually loaded and/or fired

Steps to reproduce the behavior

Build a vehicle containing a tank with flammable liquid, turret mount, mounted flamethrower, and optionally a turret control unit. Attempt to fire in any mode/configuration.

@wapcaplet wapcaplet added <Bug> This needs to be fixed Vehicles Vehicles, parts, mechanics & interactions labels Oct 24, 2020
@emptytriangle
Copy link

mounted flamethrowers are still unusable

@andrei8l
Copy link
Contributor

This happens because the flamethrower has a MAGAZINE_WELL instead of a MAGAZINE (like watercannon for example). Here's a hacky fix:

diff --git a/src/turret.cpp b/src/turret.cpp
index f4fa694b1d..e897ce0227 100644
--- a/src/turret.cpp
+++ b/src/turret.cpp
@@ -153,10 +153,17 @@ std::set<itype_id> turret_data::ammo_options() const
     } else {
         for( const auto &e : veh->fuels_left() ) {
             const itype *fuel = item::find_type( e.first );
-            if( fuel->ammo && part->base.ammo_types().count( fuel->ammo->type ) &&
-                e.second >= part->base.ammo_required() ) {
-
-                opts.insert( fuel->get_id() );
+            if( fuel->ammo ) {
+                std::size_t count = 0;
+                const itype_id mag_type = part->base.magazine_default();
+                if( mag_type.is_null() ) {
+                    count = part->base.ammo_types().count( fuel->ammo->type );
+                } else {
+                    count = item( mag_type ).ammo_types().count( fuel->ammo->type );
+                }
+                if( count && e.second >= part->base.ammo_required() ) {
+                    opts.insert( fuel->get_id() );
+                }
             }
         }
     }

However, I'm not sure that this should be allowed. Can our unspecified, unmodified flamethrower feed from an unpressurized tank? IMO a better solution is to remove the USE_TANKS flag from the mounted flamethrower and possibly add a new recipe that produces a flamethrower that can use unpressurized tanks (mechanically, it would produce an item with a MAGAZINE pocket instead of MAGAZINE_WELL)

Any thoughts?

@anothersimulacrum
Copy link
Member

I agree with you that your proposed better solution is a better solution.

@vityav
Copy link
Author

vityav commented Nov 29, 2020

Thanks for the temporary fix. I'd also be good with your proposed solution, though I do appreciate the current distinction between base flamethrower and RM451 flamethrower so perhaps two recipes? Alternately, adding a distinct vehicle mounted pressurized tank that could apply to both flamethrowers and water cannons with a USE_PRESSURIZED_TANKS flag, but then you'd want the whole range of sizes for pressurized tanks too.

@emptytriangle
Copy link

emptytriangle commented Nov 30, 2020

what if we add a fuel pump part that can be installed on a turret using a tiny electric motor that can take fuel from an unpressurized tank to a turret? Or, better yet, https://cdda-trunk.chezzo.com/pump_complex

Bonus points if it can be activated from the vehicle control menu and you can choose which type of fuel to use. Water turrets should be able to shoot any kind of liquid and flamethrowers should only be able to use gasoline and napalm.

We could make the high-pressure pump installed on the same tile as the tank instead of the turret, that would prevent having to make a pressurized tank of each size. If we did it on the tank instead of the turret, we could prevent siphoning of pressurized fuel (napalm, acetalyne) from a vehicle tank to a magazine unless the high-pressure pump is present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bug> This needs to be fixed Vehicles Vehicles, parts, mechanics & interactions
Projects
None yet
Development

No branches or pull requests

5 participants