|
9 | 9 | #include "../ComponentManager.hpp" |
10 | 10 | #include <Server/Components/NPCs/npcs.hpp> |
11 | 11 |
|
12 | | -OMP_CAPI(NPC_Create, objectPtr(const char* name)) |
| 12 | +OMP_CAPI(NPC_Create, objectPtr(StringCharPtr name, int* id)) |
13 | 13 | { |
14 | 14 | COMPONENT_CHECK_RET(npcs, nullptr); |
15 | 15 | if (name) |
16 | 16 | { |
17 | 17 | auto npc = npcs->create(name); |
18 | 18 | if (npc) |
19 | 19 | { |
| 20 | + *id = npc->getID(); |
20 | 21 | return npc; |
21 | 22 | } |
22 | 23 | } |
@@ -48,6 +49,12 @@ OMP_CAPI(NPC_IsValid, bool(objectPtr npc)) |
48 | 49 | return npcs->get(npc_->getID()) != nullptr; |
49 | 50 | } |
50 | 51 |
|
| 52 | +OMP_CAPI(NPC_GetPlayer, objectPtr(objectPtr npc)) |
| 53 | +{ |
| 54 | + POOL_ENTITY_RET(npcs, INPC, npc, npc_, nullptr); |
| 55 | + return npc_->getPlayer(); |
| 56 | +} |
| 57 | + |
51 | 58 | OMP_CAPI(NPC_Spawn, bool(objectPtr npc)) |
52 | 59 | { |
53 | 60 | POOL_ENTITY_RET(npcs, INPC, npc, npc_, false); |
@@ -782,7 +789,7 @@ OMP_CAPI(NPC_GetAnimation, bool(objectPtr npc, int* animationId, float* delta, b |
782 | 789 | return true; |
783 | 790 | } |
784 | 791 |
|
785 | | -OMP_CAPI(NPC_ApplyAnimation, bool(objectPtr npc, const char* animlib, const char* animname, float delta, bool loop, bool lockX, bool lockY, bool freeze, int time)) |
| 792 | +OMP_CAPI(NPC_ApplyAnimation, bool(objectPtr npc, StringCharPtr animlib, StringCharPtr animname, float delta, bool loop, bool lockX, bool lockY, bool freeze, int time)) |
786 | 793 | { |
787 | 794 | POOL_ENTITY_RET(npcs, INPC, npc, npc_, false); |
788 | 795 | if (!animlib || !animname) |
@@ -814,7 +821,7 @@ OMP_CAPI(NPC_GetSpecialAction, int(objectPtr npc)) |
814 | 821 | return npc_->getSpecialAction(); |
815 | 822 | } |
816 | 823 |
|
817 | | -OMP_CAPI(NPC_StartPlayback, bool(objectPtr npc, const char* recordName, bool autoUnload, float startPosX, float startPosY, float startPosZ, float startRotX, float startRotY, float startRotZ)) |
| 824 | +OMP_CAPI(NPC_StartPlayback, bool(objectPtr npc, StringCharPtr recordName, bool autoUnload, float startPosX, float startPosY, float startPosZ, float startRotX, float startRotY, float startRotZ)) |
818 | 825 | { |
819 | 826 | POOL_ENTITY_RET(npcs, INPC, npc, npc_, false); |
820 | 827 | if (!recordName) |
@@ -856,7 +863,7 @@ OMP_CAPI(NPC_IsPlaybackPaused, bool(objectPtr npc)) |
856 | 863 | return npc_->isPlaybackPaused(); |
857 | 864 | } |
858 | 865 |
|
859 | | -OMP_CAPI(NPC_LoadRecord, int(const char* filePath)) |
| 866 | +OMP_CAPI(NPC_LoadRecord, int(StringCharPtr filePath)) |
860 | 867 | { |
861 | 868 | COMPONENT_CHECK_RET(npcs, -1); |
862 | 869 | if (filePath) |
|
0 commit comments