mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 02:27:40 -04:00
add PtGetNPCByID function for Python
This function returns the real SceneObject of the NPC, so it can be customized by Python.
This commit is contained in:
@ -960,7 +960,23 @@ PyObject* cyMisc::GetLocalPlayer()
|
|||||||
0.0 );
|
0.0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Function : GetNPC
|
||||||
|
// PARAMETERS : npcID - is the ID of an NPC
|
||||||
|
//
|
||||||
|
// PURPOSE : Returns a pySceneobject of an NPC
|
||||||
|
//
|
||||||
|
PyObject* cyMisc::GetNPC(int npcID)
|
||||||
|
{
|
||||||
|
plSceneObject *so = plSceneObject::ConvertNoRef(plNetClientMgr::GetInstance()->GetNPC(npcID));
|
||||||
|
if ( so )
|
||||||
|
return pySceneObject::New(so->GetKey());
|
||||||
|
|
||||||
|
char* errmsg = "NPC not found";
|
||||||
|
PyErr_SetString(PyExc_NameError, errmsg);
|
||||||
|
PYTHON_RETURN_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
#include "plStatusLog/plStatusLog.h"
|
#include "plStatusLog/plStatusLog.h"
|
||||||
|
@ -439,6 +439,15 @@ public:
|
|||||||
static uint32_t GetMaxListenListSize();
|
static uint32_t GetMaxListenListSize();
|
||||||
static float GetMaxListenDistSq();
|
static float GetMaxListenDistSq();
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Function : GetNPC
|
||||||
|
// PARAMETERS : npcID - is the ID of a NPC
|
||||||
|
//
|
||||||
|
// PURPOSE : Returns a pySceneobject of a NPC
|
||||||
|
//
|
||||||
|
static PyObject* GetNPC(int npcID);
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Function : SendRTChat
|
// Function : SendRTChat
|
||||||
|
@ -188,6 +188,18 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtGetClientIDFromAvatarKey, args, "Params: avata
|
|||||||
return PyInt_FromLong(cyMisc::GetClientIDFromAvatarKey(*key));
|
return PyInt_FromLong(cyMisc::GetClientIDFromAvatarKey(*key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PYTHON_GLOBAL_METHOD_DEFINITION(PtGetNPCByID, args, "This will return the NPC with a specific ID")
|
||||||
|
{
|
||||||
|
int npcID;
|
||||||
|
if (!PyArg_ParseTuple(args, "i", &npcID))
|
||||||
|
{
|
||||||
|
PyErr_SetString(PyExc_TypeError, "PtGetNPCByID expects an integer");
|
||||||
|
PYTHON_RETURN_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return cyMisc::GetNPC(npcID);
|
||||||
|
}
|
||||||
|
|
||||||
PYTHON_GLOBAL_METHOD_DEFINITION_NOARGS(PtGetNumRemotePlayers, "Returns the number of remote players in this Age with you.")
|
PYTHON_GLOBAL_METHOD_DEFINITION_NOARGS(PtGetNumRemotePlayers, "Returns the number of remote players in this Age with you.")
|
||||||
{
|
{
|
||||||
return PyInt_FromLong(cyMisc::GetNumRemotePlayers());
|
return PyInt_FromLong(cyMisc::GetNumRemotePlayers());
|
||||||
@ -507,6 +519,7 @@ void cyMisc::AddPlasmaMethods(std::vector<PyMethodDef> &methods)
|
|||||||
PYTHON_GLOBAL_METHOD_NOARGS(methods, PtMaxListenDistSq);
|
PYTHON_GLOBAL_METHOD_NOARGS(methods, PtMaxListenDistSq);
|
||||||
PYTHON_GLOBAL_METHOD(methods, PtGetAvatarKeyFromClientID);
|
PYTHON_GLOBAL_METHOD(methods, PtGetAvatarKeyFromClientID);
|
||||||
PYTHON_GLOBAL_METHOD(methods, PtGetClientIDFromAvatarKey);
|
PYTHON_GLOBAL_METHOD(methods, PtGetClientIDFromAvatarKey);
|
||||||
|
PYTHON_GLOBAL_METHOD(methods, PtGetNPCByID);
|
||||||
PYTHON_GLOBAL_METHOD_NOARGS(methods, PtGetNumRemotePlayers);
|
PYTHON_GLOBAL_METHOD_NOARGS(methods, PtGetNumRemotePlayers);
|
||||||
|
|
||||||
PYTHON_GLOBAL_METHOD(methods, PtValidateKey);
|
PYTHON_GLOBAL_METHOD(methods, PtValidateKey);
|
||||||
|
Reference in New Issue
Block a user