Page 1 of 1

[Twinsen] Capsule lifetime isn't changed in UI

Posted: Tue Dec 10, 2019 12:28 pm
by Honktown
If one modifies the force.following_robots_lifetime_modifier, it takes effect but doesn't modify the tooltip, unlike damage, firing rate, etc.
defender.png
defender.png (687.79 KiB) Viewed 2906 times

Re: [Twinsen] Capsule lifetime isn't changed in UI

Posted: Tue Dec 10, 2019 1:47 pm
by Honktown
If you want, here's a control.lua to experiment:

Code: Select all

local commands_table = {}

commands_table.follower_lifetime_bonus = {}
commands_table.follower_lifetime_bonus.command = "follower_lifetime_bonus"
commands_table.follower_lifetime_bonus.help = "add or subtract to following_robots_lifetime_bonus. no +/- sets the value, no number prints the value. Value can be decimal"
commands_table.follower_lifetime_bonus.func = function(callback)
  local prm = callback.parameter
  local player_index = callback.player_index
  local value = nil
  local sign = nil

  if prm ~= nil then
--    game.player.print("string passed was " .. prm)
  else
  --  game.player.print("nothing was passed")
  end

  if prm == nil then prm = "" end
  sign = string.match(prm, "^([+-])")
  value = string.match(prm, "^[+-]?([0-9]*%.?[0-9]*)")

  -- the pattern [0-9]*%.?[0-9]* may match none, none, none, producing a successful ""
  if value == nil or value == "" then
    game.player.print("No or invalid value. The current bonus is " .. game.get_player(player_index).force.following_robots_lifetime_modifier)
    return
  end

  --implicitly prm is not nil for this
  if sign == nil then
    game.player.print("setting follower lifetime bonus to " .. value)
    game.get_player(player_index).force.following_robots_lifetime_modifier = tonumber(value)
    game.player.print("Bonus is now: " .. game.get_player(player_index).force.following_robots_lifetime_modifier)
    return
  elseif sign == "+" then
    game.player.print("Adding to bonus")
    game.get_player(player_index).force.following_robots_lifetime_modifier = game.get_player(player_index).force.following_robots_lifetime_modifier + tonumber(value)
    game.player.print("Bonus is now: " .. game.get_player(player_index).force.following_robots_lifetime_modifier)
    return
  elseif sign == "-" then
    game.player.print("Subtracting from bonus")
    game.get_player(player_index).force.following_robots_lifetime_modifier = game.get_player(player_index).force.following_robots_lifetime_modifier - tonumber(value)
    game.player.print("Bonus is now: " .. game.get_player(player_index).force.following_robots_lifetime_modifier)
    return
  end

  -- we should never reach here
  return
end


for _, cmd in pairs(commands_table) do
  commands.add_command(cmd.command, cmd.help, cmd.func)
end

Re: [Twinsen] Capsule lifetime isn't changed in UI

Posted: Wed Dec 11, 2019 10:39 am
by Twinsen
Fixed in Version: 0.18.0.

Thanks for the report.
Let me know if you notice other issues like this.

Re: [Twinsen] Capsule lifetime isn't changed in UI

Posted: Wed Dec 11, 2019 10:42 am
by Honktown
There's a tiny one I noticed, unrelated: (edit: I may not even call it a bug)

Unloading a mod migrates all the items etc, but it doesn't update map data. Not sure if there's a sane way to do it without showing someone an updated version of the map.

The purple/pinkish ore on the left was removed.
themapinquestion.png
themapinquestion.png (37.43 KiB) Viewed 2849 times

Re: [Twinsen] Capsule lifetime isn't changed in UI

Posted: Wed Dec 11, 2019 11:40 am
by Twinsen
We should have a system for re-charting the map when we think something changed, not sure why it's not happening in this case. Please make a separate bug report about it and someone should look at it.