LuaAI context: swapped arguments for the ai.attack() function,
...to correspond to the wiki definition
This commit is contained in:
parent
bdc8138c3b
commit
ee4d0b5800
1 changed files with 4 additions and 4 deletions
|
@ -213,15 +213,15 @@ static int cfun_ai_execute_attack(lua_State *L)
|
|||
|
||||
int attacker_weapon = -1;//-1 means 'select what is best'
|
||||
double aggression = context.get_aggression();//use the aggression from the context
|
||||
|
||||
if (!lua_isnoneornil(L, index) && attacker_weapon != -1) {
|
||||
attacker_weapon = lua_tointeger(L, index) - 1; // Done for consistency of the Lua style
|
||||
}
|
||||
|
||||
if (!lua_isnoneornil(L, index+1) && lua_isnumber(L,index+1)) {
|
||||
aggression = lua_tonumber(L, index+1);
|
||||
}
|
||||
|
||||
if (!lua_isnoneornil(L, index) && attacker_weapon != -1) {
|
||||
attacker_weapon = lua_tointeger(L, index) - 1; // Done for consistency of the Lua style
|
||||
}
|
||||
|
||||
ai::attack_result_ptr attack_result = ai::actions::execute_attack_action(side,true,attacker,defender,attacker_weapon,aggression);
|
||||
return transform_ai_action(L,attack_result);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue