Skip to content

Commit

Permalink
Added more flags to the NPC class
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinW1998 committed Oct 24, 2015
1 parent 66268e4 commit e2b89ac
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 3 deletions.
3 changes: 2 additions & 1 deletion LunaDll/Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

v0.7.2.1 BETA:
* Extended NPC class

v0.7.2 BETA:
* Extended Level class and World class (Overworld)
Expand Down
11 changes: 10 additions & 1 deletion LunaDll/LuaMain/LuaProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,16 @@ namespace LuaProxy {
void setAi4(double ai4, lua_State* L);
double ai5(lua_State* L) const;
void setAi5(double ai5, lua_State* L);

bool drawOnlyMask(lua_State* L) const;
void setDrawOnlyMask(bool drawOnlyMask, lua_State* L);
bool isInvincibleToSword(lua_State* L) const;
void setIsInvincibleToSword(bool isInvincibleToSword, lua_State* L);
bool legacyBoss(lua_State* L);
void setLegacyBoss(bool legacyBoss, lua_State *L);
bool friendly(lua_State* L);
void setFriendly(bool friendly, lua_State* L);
bool dontMove(lua_State* L);
void setDontMove(bool dontMove, lua_State* L);

bool isValid() const;
bool isValid_throw(lua_State *L) const;
Expand Down
71 changes: 71 additions & 0 deletions LunaDll/LuaMain/LuaProxyComponent/LuaProxyNPC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,77 @@ void LuaProxy::NPC::setLayerObj(const LuaProxy::Layer &value, lua_State *L)
thisnpc->layerName = ::Layer::Get(value.layerIndex())->ptLayerName;
}

bool LuaProxy::NPC::drawOnlyMask(lua_State * L) const
{
if (!isValid_throw(L)) return false;

return (bool)::NPC::Get(m_index)->isMaskOnly;
}

void LuaProxy::NPC::setDrawOnlyMask(bool drawOnlyMask, lua_State * L)
{
if (!isValid_throw(L)) return;

::NPC::Get(m_index)->isMaskOnly = COMBOOL(drawOnlyMask);
}

bool LuaProxy::NPC::isInvincibleToSword(lua_State * L) const
{
if (!isValid_throw(L)) return false;

return (bool)::NPC::Get(m_index)->invincibilityToSword;
}

void LuaProxy::NPC::setIsInvincibleToSword(bool isInvincibleToSword, lua_State * L)
{
if (!isValid_throw(L)) return;

::NPC::Get(m_index)->invincibilityToSword = COMBOOL(isInvincibleToSword);
}

bool LuaProxy::NPC::legacyBoss(lua_State * L)
{
if (!isValid_throw(L)) return false;

return (bool)::NPC::Get(m_index)->legacyBoss;
}

void LuaProxy::NPC::setLegacyBoss(bool legacyBoss, lua_State * L)
{
if (!isValid_throw(L)) return;

::NPC::Get(m_index)->legacyBoss = COMBOOL(legacyBoss);
}

bool LuaProxy::NPC::friendly(lua_State * L)
{
if (!isValid_throw(L)) return false;

return (bool)::NPC::Get(m_index)->friendly;
}

void LuaProxy::NPC::setFriendly(bool friendly, lua_State * L)
{
if (!isValid_throw(L)) return;

::NPC::Get(m_index)->friendly = COMBOOL(friendly);
}

bool LuaProxy::NPC::dontMove(lua_State * L)
{
if (!isValid_throw(L)) return false;

return (bool)::NPC::Get(m_index)->dontMove;
}

void LuaProxy::NPC::setDontMove(bool dontMove, lua_State* L)
{
if (!isValid_throw(L)) return;

::NPC::Get(m_index)->dontMove2 = COMBOOL(dontMove);
::NPC::Get(m_index)->dontMove = COMBOOL(dontMove);
}

double LuaProxy::NPC::ai1(lua_State * L) const
{
if (!isValid_throw(L)) return 0.0;
Expand Down
5 changes: 5 additions & 0 deletions LunaDll/LuaMain/LunaLuaMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,11 @@ void CLunaLua::bindAll()
.property("ai3", &LuaProxy::NPC::ai3, &LuaProxy::NPC::setAi3)
.property("ai4", &LuaProxy::NPC::ai4, &LuaProxy::NPC::setAi4)
.property("ai5", &LuaProxy::NPC::ai5, &LuaProxy::NPC::setAi5)
.property("drawOnlyMask", &LuaProxy::NPC::drawOnlyMask, &LuaProxy::NPC::setDrawOnlyMask)
.property("invincibleToSword", &LuaProxy::NPC::isInvincibleToSword, &LuaProxy::NPC::setIsInvincibleToSword)
.property("legacyBoss", &LuaProxy::NPC::legacyBoss, &LuaProxy::NPC::setLegacyBoss)
.property("friendly", &LuaProxy::NPC::friendly, &LuaProxy::NPC::setFriendly)
.property("dontMove", &LuaProxy::NPC::dontMove, &LuaProxy::NPC::setDontMove)
.property("isValid", &LuaProxy::NPC::isValid),


Expand Down
2 changes: 1 addition & 1 deletion LunaDll/SMBXInternal/NPCs.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ struct NPCMOB {
short activated; //+0x44
short friendly; //+0x46
short dontMove; //+0x48
short unknown_4A; //+0x4A
short dontMove2; //+0x4A
VB6StrPtr talkMsg; //+0x4C
short unknown_50; //+0x50
short unknown_52; //+0x52
Expand Down

0 comments on commit e2b89ac

Please sign in to comment.