Resolved backwards compatibility issues
This commit is contained in:
parent
a0d2df9327
commit
2189f37c20
@ -63,7 +63,7 @@ public:
|
||||
virtual bool OnHandshake (cClientHandle * a_Client, const AString & a_Username) = 0;
|
||||
virtual bool OnHopperPullingItem (cWorld & a_World, cHopperEntity & a_Hopper, int a_DstSlotNum, cBlockEntityWithItems & a_SrcEntity, int a_SrcSlotNum) = 0;
|
||||
virtual bool OnHopperPushingItem (cWorld & a_World, cHopperEntity & a_Hopper, int a_SrcSlotNum, cBlockEntityWithItems & a_DstEntity, int a_DstSlotNum) = 0;
|
||||
virtual bool OnKilling (cEntity & a_Victim, TakeDamageInfo & a_TDI) = 0;
|
||||
virtual bool OnKilling (cEntity & a_Victim, cEntity * a_Killer, TakeDamageInfo & a_TDI) = 0;
|
||||
virtual bool OnLogin (cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username) = 0;
|
||||
virtual bool OnPlayerAnimation (cPlayer & a_Player, int a_Animation) = 0;
|
||||
virtual bool OnPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) = 0;
|
||||
|
@ -575,14 +575,14 @@ bool cPluginLua::OnHopperPushingItem(cWorld & a_World, cHopperEntity & a_Hopper,
|
||||
|
||||
|
||||
|
||||
bool cPluginLua::OnKilling(cEntity & a_Victim, TakeDamageInfo & a_TDI)
|
||||
bool cPluginLua::OnKilling(cEntity & a_Victim, cEntity * a_Killer, TakeDamageInfo & a_TDI)
|
||||
{
|
||||
cCSLock Lock(m_CriticalSection);
|
||||
bool res = false;
|
||||
cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_KILLING];
|
||||
for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr)
|
||||
{
|
||||
m_LuaState.Call((int)(**itr), &a_Victim, &a_TDI, cLuaState::Return, res);
|
||||
m_LuaState.Call((int)(**itr), &a_Victim, a_Killer, &a_TDI, cLuaState::Return, res);
|
||||
if (res)
|
||||
{
|
||||
return true;
|
||||
|
@ -86,7 +86,7 @@ public:
|
||||
virtual bool OnHandshake (cClientHandle * a_Client, const AString & a_Username) override;
|
||||
virtual bool OnHopperPullingItem (cWorld & a_World, cHopperEntity & a_Hopper, int a_DstSlotNum, cBlockEntityWithItems & a_SrcEntity, int a_SrcSlotNum) override;
|
||||
virtual bool OnHopperPushingItem (cWorld & a_World, cHopperEntity & a_Hopper, int a_SrcSlotNum, cBlockEntityWithItems & a_DstEntity, int a_DstSlotNum) override;
|
||||
virtual bool OnKilling (cEntity & a_Victim, TakeDamageInfo & a_TDI) override;
|
||||
virtual bool OnKilling (cEntity & a_Victim, cEntity * a_Killer, TakeDamageInfo & a_TDI) override;
|
||||
virtual bool OnLogin (cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username) override;
|
||||
virtual bool OnPlayerAnimation (cPlayer & a_Player, int a_Animation) override;
|
||||
virtual bool OnPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
|
||||
|
@ -562,14 +562,14 @@ bool cPluginManager::CallHookHopperPushingItem(cWorld & a_World, cHopperEntity &
|
||||
|
||||
|
||||
|
||||
bool cPluginManager::CallHookKilling(cEntity & a_Victim, TakeDamageInfo & a_TDI)
|
||||
bool cPluginManager::CallHookKilling(cEntity & a_Victim, cEntity * a_Killer, TakeDamageInfo & a_TDI)
|
||||
{
|
||||
FIND_HOOK(HOOK_KILLING);
|
||||
VERIFY_HOOK;
|
||||
|
||||
for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr)
|
||||
{
|
||||
if ((*itr)->OnKilling(a_Victim, a_TDI))
|
||||
if ((*itr)->OnKilling(a_Victim, a_Killer, a_TDI))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ public: // tolua_export
|
||||
bool CallHookHandshake (cClientHandle * a_ClientHandle, const AString & a_Username);
|
||||
bool CallHookHopperPullingItem (cWorld & a_World, cHopperEntity & a_Hopper, int a_DstSlotNum, cBlockEntityWithItems & a_SrcEntity, int a_SrcSlotNum);
|
||||
bool CallHookHopperPushingItem (cWorld & a_World, cHopperEntity & a_Hopper, int a_SrcSlotNum, cBlockEntityWithItems & a_DstEntity, int a_DstSlotNum);
|
||||
bool CallHookKilling (cEntity & a_Victim, TakeDamageInfo & a_TDI);
|
||||
bool CallHookKilling (cEntity & a_Victim, cEntity * a_Killer, TakeDamageInfo & a_TDI);
|
||||
bool CallHookLogin (cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username);
|
||||
bool CallHookPlayerAnimation (cPlayer & a_Player, int a_Animation);
|
||||
bool CallHookPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
|
||||
|
@ -528,7 +528,7 @@ void cEntity::KilledBy(TakeDamageInfo & a_TDI)
|
||||
{
|
||||
m_Health = 0;
|
||||
|
||||
cRoot::Get()->GetPluginManager()->CallHookKilling(*this, a_TDI);
|
||||
cRoot::Get()->GetPluginManager()->CallHookKilling(*this, a_TDI.Attacker, a_TDI);
|
||||
|
||||
if (m_Health > 0)
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ public:
|
||||
|
||||
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
|
||||
|
||||
// Iron golems do not drown
|
||||
// Iron golems do not drown nor float
|
||||
virtual void HandleAir(void) override {}
|
||||
virtual void SetSwimState(cChunk & a_Chunk) override {}
|
||||
} ;
|
||||
|
Loading…
Reference in New Issue
Block a user