MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / SetNpcPosition

Method SetNpcPosition

ogsr_engine/xrGame/script_game_object2.cpp:372–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

370}
371
372void CScriptGameObject::SetNpcPosition(Fvector pos, bool skipCollisionCorrect)
373{
374 CCustomMonster* obj = smart_cast<CCustomMonster*>(&object());
375 if (obj)
376 {
377 if (skipCollisionCorrect)
378 {
379 Fmatrix F = obj->XFORM();
380 F.c = pos;
381 obj->XFORM().set(F);
382 if (obj->character_physics_support()->movement()->CharacterExist())
383 {
384 obj->character_physics_support()->movement()->SetPosition(F.c);
385 obj->character_physics_support()->movement()->SetVelocity(0.f, 0.f, 0.f);
386 }
387 }
388 else
389 {
390 Fmatrix F = obj->XFORM();
391 F.c = pos;
392 obj->ForceTransform(F);
393 }
394
395 obj->movement().detail().make_inactual();
396 if (obj->animation_movement_controlled())
397 obj->destroy_anim_mov_ctrl();
398
399 }
400 else
401 ai().script_engine().script_log(ScriptStorage::eLuaMessageTypeError, "ScriptGameObject : attempt to call SetNpcPosition method for non-CCustomMonster object");
402}
403
404CHolderCustom* CScriptGameObject::get_current_holder()
405{

Callers

nothing calls this directly

Calls 12

CharacterExistMethod · 0.80
movementMethod · 0.80
script_logMethod · 0.80
objectFunction · 0.50
setMethod · 0.45
SetPositionMethod · 0.45
SetVelocityMethod · 0.45
ForceTransformMethod · 0.45
make_inactualMethod · 0.45
destroy_anim_mov_ctrlMethod · 0.45

Tested by

no test coverage detected