ReikaKalseki / Reika_FactorioMods_Issues

The issue tracker for all of my Factorio mods - EndgameCombat, NauvisDay, Geothermal, Oreverhaul, and the rest.
5 stars 1 forks source link

[EndgameCombat 1.18.18] Loading Error #285

Closed Aerospacesmith closed 1 year ago

Aerospacesmith commented 4 years ago

Having this error on load. It started a few weeks ago when I updated to Factorio 1.0. I do have quite a few other mods.

42.442 Mods to disable:Failed to load mods: EndgameCombat/data.lua:3: EndgameCombat/functions.lua:51: attempt to index field '?' (a nil value) stack traceback: EndgameCombat/functions.lua:51: in function 'createDerivedCapsule' EndgameCombat/prototypes/ammo.lua:351: in main chunk [C]: in function 'require' EndgameCombat/data.lua:3: in main chunk stack traceback: [C]: in function 'require' EndgameCombat/data.lua:3: in main chunk

Mods to be disabled: • EndgameCombat (1.18.18)

ReikaKalseki commented 4 years ago

Do you have modded capsules?

Aerospacesmith commented 4 years ago

I have the flare capsule from Clockwork mod. I also have the Bob's Warfare mod which adds a new robot capsule and makes changes to the existing ones. I also have Deadlock stacking which adds stacked versions of the vanilla capsules.

Kuratheris commented 4 years ago

This error is showing up for me with Darkstar Utilities, which just updated. I'll notify them as well.

ReikaKalseki commented 4 years ago

Something in my capsule parser is breaking, and I suspect they have a definition that is missing something I was not even aware was optional.

Aerospacesmith commented 3 years ago

I've been able to pin it down to Bob's Warfare mod. Loading only Endgame Combat and Bob's Warfare (plus dependencies for both) causes this crash.

I think Bob's license allows me to post this code snippet to find what could be causing the issue (If not, I'll remove the below code from comment).

It adds 2 capsules: Napalm capsule and the Laser Robot Capsule. I can't really find any differences to how Bob's handles capsules compared to other mods, but I don't have much experience with Factorio mods.

Napalm Capsule data:extend( { { type = "capsule", name = "fire-capsule", icon = "__bobwarfare__/graphics/icons/fire-capsule.png", icon_size = 32, capsule_action = { type = "throw", attack_parameters = { type = "projectile", ammo_category = "capsule", cooldown = 30, projectile_creation_distance = 0.6, range = 25, ammo_type = { category = "capsule", target_type = "position", action = { type = "direct", action_delivery = { type = "projectile", projectile = "fire-capsule", starting_speed = 0.3 } } } } }, subgroup = "capsule", order = "b[fire-capsule]", stack_size = 100 }, } )

And the laser robot capsule.

{ type = "capsule", name = "bob-laser-robot-capsule", icons = { { icon = "__bobwarfare__/graphics/icons/laser-robot-capsule.png", icon_size = 32 }, { icon = "__bobwarfare__/graphics/icons/laser-robot.png", icon_size = 32, scale = 0.75 } }, capsule_action = { type = "throw", attack_parameters = { type = "projectile", ammo_category = "capsule", cooldown = 30, projectile_creation_distance = 0.6, range = 25, ammo_type = { category = "capsule", target_type = "position", action = { type = "direct", action_delivery = { type = "projectile", projectile = "bob-laser-robot-capsule", starting_speed = 0.3 } } } } }, subgroup = "capsule", order = "g[laser-robot-capsule]", stack_size = 100 }

Kuratheris commented 3 years ago

I have both those mods active and I'm not getting the error. What are your mod settings for both? That might help figure out what it is at least between those two.

bobingabout commented 3 years ago

Looking for differences on capsules in my mod, I see only two capsules with two differences. Robot capsule first. The first I see is the fact that I use a layered icons array instead of icon and icon_size. (note, you need icon_size either outside of the array, like icon OR assigned to the first layer. I opt for the first layer in most cases, where base game tends to opt for outside of the array.)

The second is on the ammo_type action line, I only have a single block opening that then leads straight into type = "direct", where the others having a second action to play a sound, have a block within a block. This is leading more into ammo definitions than capsule definitions, but both methods are completely valid.

Other than those two changes, it seems to be a line for line duplication of any other robot capsule.

The Fire capsule also has the second difference.

ReikaKalseki commented 3 years ago

Oh, you have a fire capsule? That is probably what is going on - EGCombat creates one as a technical item for the basis of the fire-spraying equipment, and it is written to be handled by my parser. Obviously, yours will not be.

I will change the name of mine.

Derpsel commented 3 years ago

Hey, this is broken but the interaction is between Darkstar Utilities and Endgame Combat.

I tested it with every other mod, and these 2 seem to be the cause. factorio_qwl5mjYPbe

qwcane commented 2 years ago

I believe this issue may be happening again

FaePhoenix commented 2 years ago

I am having the same issue. My installed version of factorio is 1.1.61 My installed version of EndgameCombat is 1.105.1 The error message seems mostly identical with those posted here. factorio_error I am playing with a huge list of mods, mostly a copy of the mod-list from this YouTube-Video of martincitopants which includes Endgame Combat.

The thing that is troubling me is that I played with this exact mod-list before without this error. I did update all of my mods recently, so I assume that's the way this error was introduced

FaePhoenix commented 2 years ago

I have tested a bit and found that the error only arises when I have both space Exploration (the main mod) v0.6.78 and endgame Combat v1.105.1 installed. Having the dependencies of both mods installed and only one of both installed does not lead to an error. The code, that yields this error is:

--increase train weights (for more penetrative power in collisions; requires also increasing torque/braking and compensating fuel efficiency to match)
for name,proto in pairs(data.raw.locomotive) do
    local tier = getObjectTier(proto)
    if not tier then tier = 1 end
    local f = math.pow(1.6, tier-1)
    local f2 = HEAVY_TRAIN_FACTOR*f
    proto.energy_per_hit_point = proto.energy_per_hit_point/f2
    proto.weight = proto.weight*f2
    proto.braking_force = proto.braking_force*f2
    --proto.max_power = proto.max_power*f2
    proto.burner.effectivity = proto.burner.effectivity*f2
    Modify_Power(proto, f2)
    addResistance("locomotive", name, "impact", 400, 99)
    log("Increasing train " .. name .. " (detected as tier " .. tier .. ") impact power " .. f2 .. " times.") 
end

The specific line is that yields it, is:

proto.burner.effectivity = proto.burner.effectivity*f2

While I don't quite understand what "data" (the iterable) in this context is, it seems that the error is that it tries to multiply the variable proto.burner.effectivity with some term dependent on the iterable. But it seems like Space exploration writes a nil into this variable. So maybe the error could be solved by doing a nil-check and if found to be nil, the code uses a constant equal to the vanilla default.

FaePhoenix commented 2 years ago

So I found the problem and the solution... Turns out it was already fixed... The last commit of @ReikaKalseki to the source code included a rewrite of the specified line of code to check if the proto.burner "object"? is nil. So if you download the source code and put it in your mods folder or change the line of code yourself you can start the game with no problems...

(mentioned Commit)

ReikaKalseki commented 1 year ago

This fix is being released very very soon. Like today.