EarendelDevelopers / factorio-mods

This is a public repository for tracking issues with Earendel's factorio mods.
19 stars 3 forks source link

[Jetpack] all remaining energy in the inventory and remote interfaces #322

Closed yalov closed 11 months ago

yalov commented 1 year ago
  1. Hi, I am trying to get all remaining energy in the inventory, could you make it remote interface if you already calculate it in the mod?

  2. .get_fuels() has unknown (mods' ?) fuels, and therefore this:

    local fuels = remote.call("jetpack", "get_fuels")
    local maininventory = player.get_inventory(defines.inventory.character_main)
    local m = ""
    for i, fuel in pairs(fuels) do
     -- m = m .. " " .. fuel.fuel_name .. " " .. maininventory.get_item_count(fuel.fuel_name)
    end

    has

    Error: Unknown item name: rocket-booster
  3. get_current_fuels() gives me only one item in array, is it expected? How is it different from the get_current_fuel_for_character() ?

Wiwiweb commented 12 months ago
  1. I don't think we do, we just get the info on the spot every fuel load from Factorio.
  2. Yes, we don't verify that all fuel items exist. You can do it with if game.item_prototypes[fuel_name] then ...
  3. get_current_fuels gives the current fuels for all characters, get_current_fuel_for_character is only for 1 character (which is more performant if you only care about that one character)