Mining Drones

by Klonan

Adds mining drones and mining depots

Content
6 months ago
0.17 - 2.0
109K
Mining

b Mining Drone damage scales with phyisical projectile damage

6 months ago
(updated 6 months ago)

While the Drone's attack_parameter.ammo_type.category is set to the correct ammo_category, the attack_parameter.ammo_category is set to "bullet" which makes it scale with the Physical Projectile Damage mods. Setting that category to util.ammo_category("mining-drone") will fix it, I think.

6 months ago

Also, the number of hits required is off by one due to floating point rounding (I think).
As you can see, the number of prints is 1 higher than the number of hits.

Tested by adding the following event on a clean safe without any techs unlocked:

local bugfix_on_entity_damage = function(event)
  if string.sub(event.entity.name, 1, 25) ~= "mining-drone-attack-proxy" then
    return
  end

  game.print(string.format("Damage %s | final amount: %s | final health: %s ", event.original_damage_amount, event.final_damage_amount, event.final_health))
end

And in the mining_drone:make_attack_proxy method adding this line: game.print("Number of hits: " .. number_of_hits).

Setting data.mining_damage to 1 fixes it. But I don't fully understand why the damage is set to 5 in the first place so maybe that has some side effects I'm unaware of and the actual solution is more complicated.

6 months ago
(updated 6 months ago)

Now I'm looking at this line: data.mining_interval = math.floor(26 * 1.5) with the comment --dictated by character mining animation
Why is there a 1.5 multiplier? The animation speed is set to 1, so no need for the multiplier, right? Changing that to just 26 also fixes the off-by-one bug, though only because the floating point precision error is on the other side of the integer. And this does rebalance (nerfs) the number of hits required by a 1.5 multiplier.

New response