From 9b5a4d94cf35177d920670b59ae698f3f320d73e Mon Sep 17 00:00:00 2001 From: Nuno Date: Tue, 2 Feb 2021 16:32:27 +0100 Subject: [PATCH] Merge branch 'new_features' --- ryzom/server/src/ai_service/nf_grp.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/ryzom/server/src/ai_service/nf_grp.cpp b/ryzom/server/src/ai_service/nf_grp.cpp index f3f6b1bdc..2e3197714 100644 --- a/ryzom/server/src/ai_service/nf_grp.cpp +++ b/ryzom/server/src/ai_service/nf_grp.cpp @@ -1828,6 +1828,25 @@ void addHP_f_(CStateInstance* entity, CScriptStack& stack) } } +void giveHP_f_(CStateInstance* entity, CScriptStack& stack) +{ + float addHP = stack.top(); + stack.pop(); + + CChangeCreatureHPMsg& msgList = CAIS::instance().getCreatureChangeHP(); + + FOREACH(bot, CCont, entity->getGroup()->bots()) + { + if (!bot->isSpawned()) + continue; + + CSpawnBot* const sbot = bot->getSpawnObj(); + + msgList.Entities.push_back(sbot->dataSetRow()); + msgList.DeltaHp.push_back((sint32)(addHP)); + } +} + //---------------------------------------------------------------------------- /** @page code @@ -4797,6 +4816,7 @@ std::map nfGetGroupNativeFunctions() REGISTER_NATIVE_FUNC(functions, downScaleHP_f_); REGISTER_NATIVE_FUNC(functions, upScaleHP_f_); REGISTER_NATIVE_FUNC(functions, addHP_f_); + REGISTER_NATIVE_FUNC(functions, giveHP_f_); REGISTER_NATIVE_FUNC(functions, aiAction_s_); REGISTER_NATIVE_FUNC(functions, aiActionSelf_s_); REGISTER_NATIVE_FUNC(functions, addProfileParameter_s_);