eronoobos / BABAR-The-Shardifant

Balanced Annihilation & Balanced Annilhation Reloaded configuration for Shard
2 stars 1 forks source link

reloading AI after building a factory results in AI-fatal error #17

Open eronoobos opened 8 years ago

eronoobos commented 8 years ago

[f=0002309] Error: LuaRules::RunCallIn: error = 2, Initialize, [Internal Lua error: Call failure] error = 2, LuaRules/gadgets.lua, [string "luarules/gadgets/ai/BA/factoryregisterbehav..."]:128: attempt to perform arithmetic on field '?' (a nil value) relevant lines from factoryregisterbehaviour:

    local mtype = factoryMobilities[self.name][1]
    local network = ai.maphandler:MobilityNetworkHere(mtype,self.position)
    ai.factoryBuilded[mtype][network] = ai.factoryBuilded[mtype][network] + self.level

it's only annoying for us, because probably players won't be reloading the AI all the time

eronoobos commented 8 years ago

quick fix:

    local mtype = factoryMobilities[self.name][1]
    local network = ai.maphandler:MobilityNetworkHere(mtype,self.position) or 0
    ai.factoryBuilded[mtype][network] = (ai.factoryBuilded[mtype][network] or 0) + self.level

Probably does bad things though. The real issue is: why does MobilityNetworkHere return no network?