Merge branch 'ark'

feature/prepare-cross-merge
Nuno 4 years ago committed by kaetemi
parent 438cce1323
commit c8ba121b88
No known key found for this signature in database
GPG Key ID: 9873C4D40BB479BC

@ -3207,6 +3207,54 @@ Arguments: f(NbrBots), f(spawnBot) s(Sheet), s(Name), s(Look), f(x), f(y), f(ori
*/
// CGroup
void spawnGroup_ffsssffff_c(CStateInstance* entity, CScriptStack& stack)
{
double dispersionRadius = (double)(float)stack.top();
stack.pop();
double orientation = (double)(float)stack.top();
stack.pop();
double y = (double)(float)stack.top();
stack.pop();
double x = (double)(float)stack.top();
stack.pop();
string look = (string)stack.top();
stack.pop();
string name = (string)stack.top();
stack.pop();
CSheetId sheetId((string)stack.top());
stack.pop();
bool spawn = (float&)stack.top()!=0.0f;
stack.pop();
uint nbBots = (uint)(float)stack.top();
stack.pop();
IManagerParent* const managerParent = entity->getGroup()->getOwner()->getOwner();
CAIInstance* const aiInstance = dynamic_cast<CAIInstance*>(managerParent);
if (!aiInstance)
return;
CGroupNpc* grp = dynamic_cast<CGroupNpc*>(entity->getGroup());
if (grp)
{
CSpawnGroupNpc* spawnGroup = grp->getSpawnObj();
CGroupNpc* npcGroup;
if (spawnGroup)
npcGroup = aiInstance->eventCreateNpcGroup(nbBots, sheetId, CAIVector(x, y), dispersionRadius, spawn, orientation, name, look, spawnGroup->getCell());
else
npcGroup = aiInstance->eventCreateNpcGroup(nbBots, sheetId, CAIVector(x, y), dispersionRadius, spawn, orientation, name, look);
if (npcGroup)
stack.push(npcGroup->getPersistentStateInstance());
}
}
void spawnGroup_ffsssffff_(CStateInstance* entity, CScriptStack& stack)
{
double dispersionRadius = (double)(float)stack.top();
@ -3245,10 +3293,11 @@ void spawnGroup_ffsssffff_(CStateInstance* entity, CScriptStack& stack)
if (grp)
{
CSpawnGroupNpc* spawnGroup = grp->getSpawnObj();
CGroupNpc* npcGroup;
if (spawnGroup)
aiInstance->eventCreateNpcGroup(nbBots, sheetId, CAIVector(x, y), dispersionRadius, spawn, orientation, name, look, spawnGroup->getCell());
npcGroup = aiInstance->eventCreateNpcGroup(nbBots, sheetId, CAIVector(x, y), dispersionRadius, spawn, orientation, name, look, spawnGroup->getCell());
else
aiInstance->eventCreateNpcGroup(nbBots, sheetId, CAIVector(x, y), dispersionRadius, spawn, orientation, name, look);
npcGroup = aiInstance->eventCreateNpcGroup(nbBots, sheetId, CAIVector(x, y), dispersionRadius, spawn, orientation, name, look);
}
}
@ -3327,6 +3376,7 @@ std::map<std::string, FScrptNativeFunc> nfGetNpcGroupNativeFunctions()
REGISTER_NATIVE_FUNC(functions, setCustomLoot_s_);
REGISTER_NATIVE_FUNC(functions, spawnGroup_ffsssffff_);
REGISTER_NATIVE_FUNC(functions, spawnGroup_ffsssffff_c);
// REGISTER_NATIVE_FUNC(functions, hideMissionStepIcon_b_);
// REGISTER_NATIVE_FUNC(functions, hideMissionGiverIcon_b_);

@ -1234,6 +1234,21 @@ void context__c(CStateInstance* entity, CScriptStack& stack)
stack.push(entity);
}
void context_s_c(CStateInstance* entity, CScriptStack& stack)
{
string groupName = stack.top();
std::vector<CGroup*> grps;
entity->getGroup()->getAIInstance()->findGroup(grps, groupName);
if (grps.size() > 0)
{
CGroup* group = grps.back();
CGroupNpc* npcGroup = NLMISC::safe_cast<CGroupNpc*>(group);
if (npcGroup)
stack.push(npcGroup->getPersistentStateInstance());
}
}
//----------------------------------------------------------------------------
// setActivityVa
// Arguments: v(Activity,...) ->
@ -1367,6 +1382,7 @@ std::map<std::string, FScrptNativeFunc> nfGetStaticNativeFunctions()
REGISTER_NATIVE_FUNC(functions, break__);
REGISTER_NATIVE_FUNC(functions, getName_c_s);
REGISTER_NATIVE_FUNC(functions, context__c);
REGISTER_NATIVE_FUNC(functions, context_s_c);
REGISTER_NATIVE_FUNC(functions, warning_s_);
REGISTER_NATIVE_FUNC(functions, info_s_);
REGISTER_NATIVE_FUNC(functions, debug_s_);

Loading…
Cancel
Save