[wheybags][Modded] min_range doesn't seem to work.

Bugs that are actually features.
Post Reply
User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

[wheybags][Modded] min_range doesn't seem to work.

Post by bobingabout »

Two examples:
The Plasma cannons in Bob's vehicle equipment mod (All 6 tiers of the weapon, requires Bob's Logistics for armored trains or Bob's Warfare for Tanks) has a min_range set, yet seems to ignore it.
The Tank Artillery Cannon in Bob's warfare mod (MK2 and MK3 tank) also has a min_range set, yet seems to ignore it.

Perhaps I'm doing it wrong?

Mod links:
https://mods.factorio.com/mods/Bobingab ... eequipment
https://mods.factorio.com/mods/Bobingabout/bobwarfare
https://mods.factorio.com/mods/Bobingabout/boblogistics


Code extracts:

Code: Select all

  {
    type = "gun",
    name = "tank-artillery-1",
    icon = "__bobwarfare__/graphics/icons/tank-artillery.png",
    icon_size = 32,
    flags = {"goes-to-main-inventory", "hidden"},
    subgroup = "gun",
    order = "z[tank]-b[artillery-1]",
    stack_size = 5,
    attack_parameters =
    {
      type = "projectile",
      ammo_category = "artillery-shell",
      cooldown = 225,
      movement_slow_down_factor = 0,
      projectile_creation_distance = 1.6,
      projectile_center = {-0.15625, -0.07812},
      range = 96,
      min_range = 8,
      sound =
      {
        {
          filename = "__base__/sound/fight/tank-cannon.ogg",
          volume = 0.7
        }
      }
    },
  },

  {
    type = "gun",
    name = "tank-artillery-2",
    icon = "__bobwarfare__/graphics/icons/tank-artillery.png",
    icon_size = 32,
    flags = {"goes-to-main-inventory", "hidden"},
    subgroup = "gun",
    order = "z[tank]-b[artillery-2]",
    stack_size = 5,
    attack_parameters =
    {
      type = "projectile",
      ammo_category = "artillery-shell",
      cooldown = 200,
      movement_slow_down_factor = 0,
      projectile_creation_distance = 1.6,
      projectile_center = {-0.15625, -0.07812},
      range = 128,
      min_range = 8,
      damage_modifier = 1.5,
      sound =
      {
        {
          filename = "__base__/sound/fight/tank-cannon.ogg",
          volume = 0.7
        }
      }
    },
  },
The plasma cannon code is a bit harder to quote, as the weapon is created in a function. But the fact that your tank can shoot at itself with it's artillery weapon should be example enough.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

User avatar
wheybags
Former Staff
Former Staff
Posts: 328
Joined: Fri Jun 02, 2017 1:50 pm
Contact:

Re: [wheybags][Modded] min_range doesn't seem to work.

Post by wheybags »

So, to make min_range apply to a weapon, the ammo needs to be target_type= position or direction, and clamp_position must be true on the ammo.
If you do that, the projectile's target position should be clamped to between the weapon's min_range and max_range.

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: [wheybags][Modded] min_range doesn't seem to work.

Post by bobingabout »

wheybags wrote:So, to make min_range apply to a weapon, the ammo needs to be target_type= position or direction, and clamp_position must be true on the ammo.
If you do that, the projectile's target position should be clamped to between the weapon's min_range and max_range.
In theory the ammo should already be set up correctly, since it can shoot the base game artillery ammo, and that ammo has the same issue.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

User avatar
wheybags
Former Staff
Former Staff
Posts: 328
Joined: Fri Jun 02, 2017 1:50 pm
Contact:

Re: [wheybags][Modded] min_range doesn't seem to work.

Post by wheybags »

clamp_position is not set on the base game artillery ammo, as far as I can see? ("artillery-shell")

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: [wheybags][Modded] min_range doesn't seem to work.

Post by bobingabout »

I'll give it a try.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: [wheybags][Modded] min_range doesn't seem to work.

Post by bobingabout »

It works, but it breaks the artillery cannon/wagon
viewtopic.php?f=51&t=54612&start=140#p342138
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

Post Reply

Return to “Not a bug”