eronoobos / BABAR-The-Shardifant

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

taskqueue functions always need access to the taskqueuebehaviour that calls them #38

Closed eronoobos closed 7 years ago

eronoobos commented 8 years ago

Every taskqueue function needs to take a taskqueuebehaviour as an argument, and pass that behaviour all the way down its chain of functions, so that any time ai is used, it can instead use the behaviour.ai. It's a pain, and I've been trying to think of another, less ugly and less tedious way to do it. Hence https://github.com/eronoobos/BABAR-The-Shardifant/issues/20 .

Note: some taskqueue functions already do take a taskqueuebehaviour as an argument, but it's really inconsistent.

pandaro commented 8 years ago

Note: some taskqueue functions already do take a taskqueuebehaviour as an argument, but it's really inconsistent.

can you link me 2 example? one for functions that take a taskqueuebehaviour as an argument one for function that don't do this sorry but i understand better with concrete example at moment

eronoobos commented 8 years ago

the taskqueuebehaviour gets passed by this line https://github.com/eronoobos/BABAR-The-Shardifant/blob/5f0c408a13f11d18e401d8851569af273dc92c47/taskqueuebehaviour.lua#L706-L709 if the function takes the argument

function that takes taskqueuebehaviour as an argument: https://github.com/eronoobos/BABAR-The-Shardifant/blob/5f0c408a13f11d18e401d8851569af273dc92c47/taskqueues.lua#L327

the argument shouldn't be named self, because that makes it seem as if we're still inside a TaskqueueBehaviour:Function()

function that takes no argument https://github.com/eronoobos/BABAR-The-Shardifant/blob/5f0c408a13f11d18e401d8851569af273dc92c47/taskBot.lua#L14

i'm about to address this in a lazy way, commit forthcoming

BTW I think using ai. is fine. We discovered that the global ai was not the problem with multiple Lua AI teams.

eronoobos commented 8 years ago

my lazy solution https://github.com/eronoobos/BABAR-The-Shardifant/commit/cf8af90b8645bc662a971d58acb97f7d28339c12

pandaro commented 7 years ago

for now is ok so i suggest to close atm