(svn r16113) -Feature [NoAI]: Add UseAsRandomAI as function in info.nut. When an AI returns false, it'll never be chosen as random AI.
This commit is contained in:
@@ -66,6 +66,12 @@ AILibrary::~AILibrary()
|
||||
} else {
|
||||
info->min_loadable_version = info->GetVersion();
|
||||
}
|
||||
/* When there is an UseAsRandomAI function, call it. */
|
||||
if (info->engine->MethodExists(*info->SQ_instance, "UseAsRandomAI")) {
|
||||
if (!info->engine->CallBoolMethod(*info->SQ_instance, "UseAsRandomAI", &info->use_as_random)) return SQ_ERROR;
|
||||
} else {
|
||||
info->use_as_random = true;
|
||||
}
|
||||
|
||||
/* Remove the link to the real instance, else it might get deleted by RegisterAI() */
|
||||
sq_setinstanceup(vm, 2, NULL);
|
||||
|
Reference in New Issue
Block a user