Skip to content
This repository has been archived by the owner on Apr 29, 2020. It is now read-only.

Commit

Permalink
Merge pull request #13 from DarkstarProject/master
Browse files Browse the repository at this point in the history
CORE: exposed functions to manipulate aggro types in scripts
  • Loading branch information
korietsu committed Dec 12, 2014
2 parents 6ee35a4 + 63cafa1 commit ef7ecc7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/map/lua/lua_baseentity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9676,6 +9676,28 @@ inline int32 CLuaBaseEntity::getModelId(lua_State* L)
return 1;
}

inline int32 CLuaBaseEntity::setAggroFlag(lua_State* L)
{
DSP_DEBUG_BREAK_IF(m_PBaseEntity == NULL);
DSP_DEBUG_BREAK_IF(m_PBaseEntity->objtype != TYPE_MOB);
DSP_DEBUG_BREAK_IF(lua_isnil(L, 1) || !lua_isnumber(L, 1));

((CMobEntity*)m_PBaseEntity)->m_Aggro |= lua_tointeger(L, -1);

return 0;
}

inline int32 CLuaBaseEntity::unsetAggroFlag(lua_State* L)
{
DSP_DEBUG_BREAK_IF(m_PBaseEntity == NULL);
DSP_DEBUG_BREAK_IF(m_PBaseEntity->objtype != TYPE_MOB);
DSP_DEBUG_BREAK_IF(lua_isnil(L, 1) || !lua_isnumber(L, 1));

((CMobEntity*)m_PBaseEntity)->m_Aggro &= ~lua_tointeger(L, -1);

return 0;
}

//==========================================================//

const int8 CLuaBaseEntity::className[] = "CBaseEntity";
Expand Down Expand Up @@ -10121,5 +10143,7 @@ Lunar<CLuaBaseEntity>::Register_t CLuaBaseEntity::methods[] =
LUNAR_DECLARE_METHOD(CLuaBaseEntity,reloadParty),
LUNAR_DECLARE_METHOD(CLuaBaseEntity,getModelId),
LUNAR_DECLARE_METHOD(CLuaBaseEntity,setModelId),
LUNAR_DECLARE_METHOD(CLuaBaseEntity,setAggroFlag),
LUNAR_DECLARE_METHOD(CLuaBaseEntity,unsetAggroFlag),
{NULL,NULL}
};
2 changes: 2 additions & 0 deletions src/map/lua/lua_baseentity.h
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,8 @@ class CLuaBaseEntity
int32 reloadParty(lua_State* L);
int32 getModelId(lua_State* L);
int32 setModelId(lua_State* L);
int32 setAggroFlag(lua_State* L);
int32 unsetAggroFlag(lua_State* L);
};

#endif

0 comments on commit ef7ecc7

Please sign in to comment.