Open pandaro opened 8 years ago
I'm not sure why it would get a nil unit. There is a lot of this kind of paranoia in the code, in some cases justified, in some cases not. It was a long time ago, I have forgotten what was happening to make me add such checks.
I can't now think of any reason a behaviour would have a nil unit. The real danger I can think of is a nil engineUnit (aka, in a behaviour, self.unit:Internal()
). When our own units die, their engineUnit becomes nil. I have written some modules that store behaviours in tables, so it is possible for those stored behaviours to become zombies with no engineUnit.
there is a reason because advanced construction submarine are not in advconlist?
I can't think of any reason that would cause a behaviour to have a nil unit. Would be good to add it to the list though
ohh, now i get it
if i have only a ID of a unit, where can i take a unit(self)? in other word, we have a function: GetunitFromID(id)
yup, game:GetUnitByID( unit_id )
When I was first writing the BA config, I didn't trust Shard's API so I stored a lot of unitIDs instead of Shard unit objects. I'm assuming your question is a result of my bad habit. :-[
why we need this lines for example in taskBuild?
if tskqbhvr.unit == nil then return DummyUnitName end
why tskqbhvr will get nil unit?