Capsule launcher


Introduce a turret that fires capsules (slowdown, poison, and combat robots) for strategic base defense.

Content
3 days ago
2.0
409
Combat

b Crashes without Reusable Robots

7 months ago
Failed to load mods: __capsule-launcher__/prototypes/ammo/combat_robot_ammo.lua:53: attempt to index field '?' (a nil value)
stack traceback:
    __capsule-launcher__/prototypes/ammo/combat_robot_ammo.lua:53: in function 'create_all_prototypes'
    ...ies/reusable_robots/prototypes/uranium_defender_ammo.lua:4: in main chunk
    [C]: in function 'require'
    ...ncher__/compatibilities/reusable_robots/data_updates.lua:1: in main chunk
    [C]: in function 'require'
    __capsule-launcher__/data-updates.lua:1: in main chunk

Happens because data.raw["combat-robot"]["uranium-defender"] is nil. That bot is added by the Reusable Robots mod which you have as an optional dependency.

I got the crash to go away by editing uranium_defender_ammo.lua to put the call inside a check:

if data.raw["combat-robot"]["uranium-defender"] ~= nil then
    combat_robot_ammo.create_all_prototypes(depleted_uranium_defender_ammo, "uranium-defender", 1, data.raw["technology"]["uranium-ammo"])
end

Though I don't know if that's the best approach to fix it and I didn't test that with Reusable Robots enabled

7 months ago

Sorry about that, I forgot that lua actually executes code on require. It should be fixed now. Thanks a lot for the crash report.

This thread has been locked.