2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-13 18:17:49 -04:00

Expose to python

This commit is contained in:
2013-01-25 22:22:49 -05:00
parent af1db55f67
commit 07ddec2f79
5 changed files with 63 additions and 34 deletions

View File

@ -65,9 +65,15 @@ void pyNetLinkingMgr::SetEnabled( bool b ) const
plNetLinkingMgr::GetInstance()->SetEnabled( b );
}
void pyNetLinkingMgr::LinkToAge( pyAgeLinkStruct & link, const char* linkAnim )
void pyNetLinkingMgr::LinkToAge( pyAgeLinkStruct & link, const char* linkAnim, bool linkInSfx, bool linkOutSfx )
{
plNetLinkingMgr::GetInstance()->LinkToAge( link.GetAgeLink(), linkAnim );
uint32_t sfx = plNetLinkingMgr::kPlayNone;
if (linkInSfx)
hsSetBits(sfx, plNetLinkingMgr::kPlayLinkIn);
if (linkOutSfx)
hsSetBits(sfx, plNetLinkingMgr::kPlayLinkOut);
plNetLinkingMgr::GetInstance()->LinkToAge( link.GetAgeLink(), linkAnim, (plNetLinkingMgr::LinkSfx)sfx );
}
void pyNetLinkingMgr::LinkToMyPersonalAge()

View File

@ -80,7 +80,7 @@ public:
void SetEnabled( bool b ) const;
// Link to a public instance. PLS will load balance.
void LinkToAge( pyAgeLinkStruct & link, const char* linkAnim );
void LinkToAge( pyAgeLinkStruct & link, const char* linkAnim, bool linkInSfx, bool linkOutSfx );
// Link to my Personal Age
void LinkToMyPersonalAge();
// link to my personal age with the YeehsaBook

View File

@ -79,11 +79,13 @@ PYTHON_METHOD_DEFINITION(ptNetLinkingMgr, setEnabled, args)
PYTHON_RETURN_NONE;
}
PYTHON_METHOD_DEFINITION(ptNetLinkingMgr, linkToAge, args)
PYTHON_METHOD_DEFINITION_WKEY(ptNetLinkingMgr, linkToAge, args, kwargs)
{
char* kwlist[] = { "ageLink", "anim", "linkInSfx", "linkOutSfx", nullptr };
PyObject* ageLinkObj = NULL;
char* linkAnim = NULL;
if (!PyArg_ParseTuple(args, "O|s", &ageLinkObj, &linkAnim))
bool linkInSfx, linkOutSfx = true;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|sbb", kwlist, &ageLinkObj, &linkAnim, &linkInSfx, &linkOutSfx))
{
PyErr_SetString(PyExc_TypeError, "linkToAge expects a ptAgeLinkStruct and an optional link anim name");
PYTHON_RETURN_ERROR;
@ -94,7 +96,7 @@ PYTHON_METHOD_DEFINITION(ptNetLinkingMgr, linkToAge, args)
PYTHON_RETURN_ERROR;
}
pyAgeLinkStruct* ageLink = pyAgeLinkStruct::ConvertFrom(ageLinkObj);
self->fThis->LinkToAge(*ageLink, linkAnim);
self->fThis->LinkToAge(*ageLink, linkAnim, linkInSfx, linkOutSfx);
PYTHON_RETURN_NONE;
}
@ -158,7 +160,7 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptNetLinkingMgr, getPrevAgeLink)
PYTHON_START_METHODS_TABLE(ptNetLinkingMgr)
PYTHON_METHOD_NOARGS(ptNetLinkingMgr, isEnabled, "True if linking is enabled."),
PYTHON_METHOD(ptNetLinkingMgr, setEnabled, "Params: enable\nEnable/Disable linking."),
PYTHON_METHOD(ptNetLinkingMgr, linkToAge, "Params: ageLink, linkAnim\nLinks to ageLink (ptAgeLinkStruct, string)"),
PYTHON_METHOD_WKEY(ptNetLinkingMgr, linkToAge, "Params: ageLink, linkAnim\nLinks to ageLink (ptAgeLinkStruct, string)"),
PYTHON_BASIC_METHOD(ptNetLinkingMgr, linkToMyPersonalAge, "Link to my Personal Age"),
PYTHON_BASIC_METHOD(ptNetLinkingMgr, linkToMyPersonalAgeWithYeeshaBook, "Link to my Personal Age with the YeeshaBook"),
PYTHON_BASIC_METHOD(ptNetLinkingMgr, linkToMyNeighborhoodAge, "Link to my Neighborhood Age"),