MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / OnHealthChanged

Method OnHealthChanged

Sources/Jazz2/Scripting/ScriptActorWrapper.cpp:285–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283 }
284
285 void ScriptActorWrapper::OnHealthChanged(ActorBase* collider)
286 {
287 if (_onHealthChanged == nullptr || _isDead->Get()) {
288 return;
289 }
290
291 asIScriptEngine* engine = _obj->GetEngine();
292 asIScriptContext* ctx = engine->RequestContext();
293
294 ctx->Prepare(_onHealthChanged);
295 ctx->SetObject(_obj);
296 std::int32_t r = ctx->Execute();
297 if (r == asEXECUTION_EXCEPTION) {
298 LOGE("An exception \"{}\" occurred in \"{}\". Please correct the code and try again.",
299 ctx->GetExceptionString(), ctx->GetExceptionFunction()->GetDeclaration());
300 }
301
302 engine->ReturnContext(ctx);
303 }
304
305 bool ScriptActorWrapper::OnPerish(ActorBase* collider)
306 {

Callers

nothing calls this directly

Calls 3

GetEngineMethod · 0.80
ExecuteMethod · 0.80
GetMethod · 0.45

Tested by

no test coverage detected