From 47d5395d24c6f209a758a689bff9a44f68d7397b Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sun, 30 Mar 2014 13:44:28 +0200 Subject: Added a blockface parameter to the OnProjectileHitBlock hook. --- src/Bindings/PluginLua.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Bindings/PluginLua.cpp') diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index 7e69e0f4b..9e989a9e1 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -1108,14 +1108,14 @@ bool cPluginLua::OnPreCrafting(const cPlayer * a_Player, const cCraftingGrid * a -bool cPluginLua::OnProjectileHitBlock(cProjectileEntity & a_Projectile) +bool cPluginLua::OnProjectileHitBlock(cProjectileEntity & a_Projectile, eBlockFace a_Face) { cCSLock Lock(m_CriticalSection); bool res = false; cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PROJECTILE_HIT_BLOCK]; for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) { - m_LuaState.Call((int)(**itr), &a_Projectile, cLuaState::Return, res); + m_LuaState.Call((int)(**itr), &a_Projectile, a_Face, cLuaState::Return, res); if (res) { return true; -- cgit v1.2.3 From 66f1bb7b677324dd59265b7b0776490caa661bcc Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sun, 30 Mar 2014 14:04:44 +0200 Subject: Added a BlockHitPos parameter to OnProjectileHitBlock --- src/Bindings/PluginLua.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Bindings/PluginLua.cpp') diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index 9e989a9e1..a89cfc82c 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -1108,14 +1108,14 @@ bool cPluginLua::OnPreCrafting(const cPlayer * a_Player, const cCraftingGrid * a -bool cPluginLua::OnProjectileHitBlock(cProjectileEntity & a_Projectile, eBlockFace a_Face) +bool cPluginLua::OnProjectileHitBlock(cProjectileEntity & a_Projectile, eBlockFace a_Face, Vector3d * a_BlockHitPos) { cCSLock Lock(m_CriticalSection); bool res = false; cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PROJECTILE_HIT_BLOCK]; for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) { - m_LuaState.Call((int)(**itr), &a_Projectile, a_Face, cLuaState::Return, res); + m_LuaState.Call((int)(**itr), &a_Projectile, a_Face, a_BlockHitPos, cLuaState::Return, res); if (res) { return true; -- cgit v1.2.3 From 36e1e57d038eda0c183f616f2b45d2ae4733e27c Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sun, 30 Mar 2014 17:21:13 +0200 Subject: Using recommendations (I think) --- src/Bindings/PluginLua.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Bindings/PluginLua.cpp') diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index a89cfc82c..97f78351b 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -1108,7 +1108,7 @@ bool cPluginLua::OnPreCrafting(const cPlayer * a_Player, const cCraftingGrid * a -bool cPluginLua::OnProjectileHitBlock(cProjectileEntity & a_Projectile, eBlockFace a_Face, Vector3d * a_BlockHitPos) +bool cPluginLua::OnProjectileHitBlock(cProjectileEntity & a_Projectile, eBlockFace a_Face, const Vector3i * a_BlockHitPos) { cCSLock Lock(m_CriticalSection); bool res = false; -- cgit v1.2.3 From 4d704255de1368d7d9912458053c2de14be1b5ac Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 2 May 2014 11:18:02 +0200 Subject: HOOK_DISCONNECT has cClientHandle as its first parameter. Ref.: #655. --- src/Bindings/PluginLua.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Bindings/PluginLua.cpp') diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index cb55715a6..59708bf59 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -400,14 +400,14 @@ bool cPluginLua::OnCraftingNoRecipe(const cPlayer * a_Player, const cCraftingGri -bool cPluginLua::OnDisconnect(cPlayer * a_Player, const AString & a_Reason) +bool cPluginLua::OnDisconnect(cClientHandle & a_Client, const AString & a_Reason) { cCSLock Lock(m_CriticalSection); bool res = false; cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_DISCONNECT]; for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) { - m_LuaState.Call((int)(**itr), a_Player, a_Reason, cLuaState::Return, res); + m_LuaState.Call((int)(**itr), &a_Client, a_Reason, cLuaState::Return, res); if (res) { return true; -- cgit v1.2.3 From d1b23060ada3946d68453e381867861bc768999b Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sat, 31 May 2014 14:14:55 +0200 Subject: Used recommendations --- src/Bindings/PluginLua.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Bindings/PluginLua.cpp') diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index 97f78351b..da98f3f95 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -1108,14 +1108,14 @@ bool cPluginLua::OnPreCrafting(const cPlayer * a_Player, const cCraftingGrid * a -bool cPluginLua::OnProjectileHitBlock(cProjectileEntity & a_Projectile, eBlockFace a_Face, const Vector3i * a_BlockHitPos) +bool cPluginLua::OnProjectileHitBlock(cProjectileEntity & a_Projectile, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Face, const Vector3d * a_BlockHitPos) { cCSLock Lock(m_CriticalSection); bool res = false; cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PROJECTILE_HIT_BLOCK]; for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) { - m_LuaState.Call((int)(**itr), &a_Projectile, a_Face, a_BlockHitPos, cLuaState::Return, res); + m_LuaState.Call((int)(**itr), &a_Projectile, a_BlockX, a_BlockY, a_BlockZ, a_Face, a_BlockHitPos, cLuaState::Return, res); if (res) { return true; -- cgit v1.2.3 From 319169eafbbe5630a311051ea5fdf91e7f482a71 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sun, 1 Jun 2014 14:06:47 +0200 Subject: Made a_BlockHitPos a reference --- src/Bindings/PluginLua.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Bindings/PluginLua.cpp') diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index da98f3f95..46ee7da9e 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -1108,14 +1108,14 @@ bool cPluginLua::OnPreCrafting(const cPlayer * a_Player, const cCraftingGrid * a -bool cPluginLua::OnProjectileHitBlock(cProjectileEntity & a_Projectile, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Face, const Vector3d * a_BlockHitPos) +bool cPluginLua::OnProjectileHitBlock(cProjectileEntity & a_Projectile, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Face, const Vector3d & a_BlockHitPos) { cCSLock Lock(m_CriticalSection); bool res = false; cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PROJECTILE_HIT_BLOCK]; for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) { - m_LuaState.Call((int)(**itr), &a_Projectile, a_BlockX, a_BlockY, a_BlockZ, a_Face, a_BlockHitPos, cLuaState::Return, res); + m_LuaState.Call((int)(**itr), &a_Projectile, a_BlockX, a_BlockY, a_BlockZ, a_Face, &a_BlockHitPos, cLuaState::Return, res); if (res) { return true; -- cgit v1.2.3 From d92520016dab97a12174b1b6229909d66169bac9 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Tue, 3 Jun 2014 19:29:04 +0200 Subject: Fixed OnProjectileHitBlock bindings. Also sorted the various cLuaState::Push() functions. --- src/Bindings/PluginLua.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Bindings/PluginLua.cpp') diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index 625931931..04639da60 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -1120,7 +1120,7 @@ bool cPluginLua::OnProjectileHitBlock(cProjectileEntity & a_Projectile, int a_Bl cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PROJECTILE_HIT_BLOCK]; for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) { - m_LuaState.Call((int)(**itr), &a_Projectile, a_BlockX, a_BlockY, a_BlockZ, a_Face, &a_BlockHitPos, cLuaState::Return, res); + m_LuaState.Call((int)(**itr), &a_Projectile, a_BlockX, a_BlockY, a_BlockZ, a_Face, a_BlockHitPos, cLuaState::Return, res); if (res) { return true; -- cgit v1.2.3 From fa1d85feca6beee9e07cf92f015a883a190c726a Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 13 Jun 2014 12:47:01 +0200 Subject: Added the OnEntityAddEffect hook. --- src/Bindings/PluginLua.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/Bindings/PluginLua.cpp') diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index 04639da60..09ffa6064 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -420,6 +420,26 @@ bool cPluginLua::OnDisconnect(cClientHandle & a_Client, const AString & a_Reason +bool cPluginLua::OnEntityAddEffect(cEntity & a_Entity, int a_EffectType, int a_EffectDurationTicks, int a_EffectIntensity, cEntity * a_Originator, double a_DistanceModifier) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_ENTITY_ADD_EFFECT]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_Entity, a_EffectType, a_EffectDurationTicks, a_EffectIntensity, a_Originator, a_DistanceModifier, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + bool cPluginLua::OnExecuteCommand(cPlayer * a_Player, const AStringVector & a_Split) { cCSLock Lock(m_CriticalSection); @@ -1507,6 +1527,7 @@ const char * cPluginLua::GetHookFnName(int a_HookType) case cPluginManager::HOOK_CRAFTING_NO_RECIPE: return "OnCraftingNoRecipe"; case cPluginManager::HOOK_DISCONNECT: return "OnDisconnect"; case cPluginManager::HOOK_PLAYER_ANIMATION: return "OnPlayerAnimation"; + case cPluginManager::HOOK_ENTITY_ADD_EFFECT: return "OnEntityAddEffect"; case cPluginManager::HOOK_EXECUTE_COMMAND: return "OnExecuteCommand"; case cPluginManager::HOOK_HANDSHAKE: return "OnHandshake"; case cPluginManager::HOOK_KILLING: return "OnKilling"; -- cgit v1.2.3 From e8143de01bff31f9e153949d7ab5b0df82629541 Mon Sep 17 00:00:00 2001 From: archshift Date: Thu, 19 Jun 2014 01:49:56 -0700 Subject: Nullify deleted pointers. --- src/Bindings/PluginLua.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/Bindings/PluginLua.cpp') diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index 04639da60..96c5ccde7 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -1571,6 +1571,7 @@ bool cPluginLua::AddHookRef(int a_HookType, int a_FnRefIdx) LOGWARNING("Plugin %s tried to add a hook %d with bad handler function.", GetName().c_str(), a_HookType); m_LuaState.LogStackTrace(); delete Ref; + Ref = NULL; return false; } -- cgit v1.2.3 From aa753a92c092a4d35b2ff7d08259c3196abecf67 Mon Sep 17 00:00:00 2001 From: Howaner Date: Mon, 30 Jun 2014 15:12:56 +0200 Subject: Add new hook: HOOK_PLAYER_FOOD_LEVEL_CHANGE --- src/Bindings/PluginLua.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/Bindings/PluginLua.cpp') diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index 96c5ccde7..be27340ad 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -715,6 +715,26 @@ bool cPluginLua::OnPlayerEating(cPlayer & a_Player) +bool cPluginLua::OnPlayerFoodLevelChange(cPlayer & a_Player, int & a_NewFoodLevel) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_FOOD_LEVEL_CHANGE]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_Player, a_NewFoodLevel, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + bool cPluginLua::OnPlayerFished(cPlayer & a_Player, const cItems & a_Reward) { cCSLock Lock(m_CriticalSection); -- cgit v1.2.3 From 8e11f7a1f64fd4d20495f1a4467ef168d18db92b Mon Sep 17 00:00:00 2001 From: Howaner Date: Mon, 30 Jun 2014 21:50:40 +0200 Subject: Fixes. --- src/Bindings/PluginLua.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Bindings/PluginLua.cpp') diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index be27340ad..2d485a117 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -722,7 +722,7 @@ bool cPluginLua::OnPlayerFoodLevelChange(cPlayer & a_Player, int & a_NewFoodLeve cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_FOOD_LEVEL_CHANGE]; for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) { - m_LuaState.Call((int)(**itr), &a_Player, a_NewFoodLevel, cLuaState::Return, res); + m_LuaState.Call((int)(**itr), &a_Player, a_NewFoodLevel, cLuaState::Return, res, a_NewFoodLevel); if (res) { return true; -- cgit v1.2.3 From 0dfaad4123bc50202f97fc0e5d9fc5d3a9c8670c Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Tue, 1 Jul 2014 15:46:31 +0200 Subject: Fixed a possibly unused variable. --- src/Bindings/PluginLua.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Bindings/PluginLua.cpp') diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index 96c5ccde7..97366cc4c 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -1714,7 +1714,7 @@ bool cPluginLua::CallbackWindowClosing(int a_FnRef, cWindow & a_Window, cPlayer ASSERT(a_FnRef != LUA_REFNIL); cCSLock Lock(m_CriticalSection); - bool res; + bool res = false; m_LuaState.Call(a_FnRef, &a_Window, &a_Player, a_CanRefuse, cLuaState::Return, res); return res; } -- cgit v1.2.3 From 4a9002045b86406ffd4bb16f67d33ae4060e6bc7 Mon Sep 17 00:00:00 2001 From: Howaner Date: Wed, 2 Jul 2014 14:46:00 +0200 Subject: Removed foodlevel-change possibility. Plugins can cancel the event and use cPlayer:SetFoodLevel() --- src/Bindings/PluginLua.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Bindings/PluginLua.cpp') diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index 2d485a117..542ae3e56 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -715,14 +715,14 @@ bool cPluginLua::OnPlayerEating(cPlayer & a_Player) -bool cPluginLua::OnPlayerFoodLevelChange(cPlayer & a_Player, int & a_NewFoodLevel) +bool cPluginLua::OnPlayerFoodLevelChange(cPlayer & a_Player, int a_NewFoodLevel) { cCSLock Lock(m_CriticalSection); bool res = false; cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_FOOD_LEVEL_CHANGE]; for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) { - m_LuaState.Call((int)(**itr), &a_Player, a_NewFoodLevel, cLuaState::Return, res, a_NewFoodLevel); + m_LuaState.Call((int)(**itr), &a_Player, a_NewFoodLevel, cLuaState::Return, res); if (res) { return true; -- cgit v1.2.3 From 2dbed03cbce873d8a6582bfdc5c4b826b6e7eade Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 3 Jul 2014 17:49:21 +0200 Subject: Changed OnWeatherChanging hook to always read the returned weather. Ref.: http://forum.mc-server.org/showthread.php?tid=1512 --- src/Bindings/PluginLua.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/Bindings/PluginLua.cpp') diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index 344031995..104380ea4 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -1347,18 +1347,15 @@ bool cPluginLua::OnWeatherChanging(cWorld & a_World, eWeather & a_NewWeather) { cCSLock Lock(m_CriticalSection); bool res = false; - int NewWeather = a_NewWeather; cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_WEATHER_CHANGING]; for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) { - m_LuaState.Call((int)(**itr), &a_World, NewWeather, cLuaState::Return, res, NewWeather); + m_LuaState.Call((int)(**itr), &a_World, a_NewWeather, cLuaState::Return, res, a_NewWeather); if (res) { - a_NewWeather = (eWeather)NewWeather; return true; } } - a_NewWeather = (eWeather)NewWeather; return false; } -- cgit v1.2.3 From a0d2df93272a6108f8c568e1eed665a1da5cb7ed Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 4 Jul 2014 10:55:09 +0100 Subject: Tailored death messages --- src/Bindings/PluginLua.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Bindings/PluginLua.cpp') diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index 344031995..078e48111 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -575,14 +575,14 @@ bool cPluginLua::OnHopperPushingItem(cWorld & a_World, cHopperEntity & a_Hopper, -bool cPluginLua::OnKilling(cEntity & a_Victim, cEntity * a_Killer) +bool cPluginLua::OnKilling(cEntity & a_Victim, 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_Killer, cLuaState::Return, res); + m_LuaState.Call((int)(**itr), &a_Victim, &a_TDI, cLuaState::Return, res); if (res) { return true; -- cgit v1.2.3 From 4e6395d6ff9f34edb4dd36dc1f8e845c56b499f4 Mon Sep 17 00:00:00 2001 From: archshift Date: Fri, 11 Jul 2014 17:27:29 -0700 Subject: For now, removed creator member from Entity Effect for pointer safety --- src/Bindings/PluginLua.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Bindings/PluginLua.cpp') diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index e10cca708..a08803189 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -420,14 +420,14 @@ bool cPluginLua::OnDisconnect(cClientHandle & a_Client, const AString & a_Reason -bool cPluginLua::OnEntityAddEffect(cEntity & a_Entity, int a_EffectType, int a_EffectDurationTicks, int a_EffectIntensity, cEntity * a_Originator, double a_DistanceModifier) +bool cPluginLua::OnEntityAddEffect(cEntity & a_Entity, int a_EffectType, int a_EffectDurationTicks, int a_EffectIntensity, double a_DistanceModifier) { cCSLock Lock(m_CriticalSection); bool res = false; cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_ENTITY_ADD_EFFECT]; for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) { - m_LuaState.Call((int)(**itr), &a_Entity, a_EffectType, a_EffectDurationTicks, a_EffectIntensity, a_Originator, a_DistanceModifier, cLuaState::Return, res); + m_LuaState.Call((int)(**itr), &a_Entity, a_EffectType, a_EffectDurationTicks, a_EffectIntensity, a_DistanceModifier, cLuaState::Return, res); if (res) { return true; -- cgit v1.2.3 From 2189f37c20198a5889d5477aa4abcc116437861d Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Wed, 16 Jul 2014 11:38:52 +0100 Subject: Resolved backwards compatibility issues --- src/Bindings/PluginLua.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Bindings/PluginLua.cpp') diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index 078e48111..e65329f23 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -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; -- cgit v1.2.3 From 2423fbf2efa39e28cc348acc11b9269e573dcdef Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 17 Jul 2014 22:15:34 +0200 Subject: Normalized comments. This was mostly done automatically and then visually inspected for obvious errors. All //-style comments should have a 2-space separation from the code, and 1 space after the comment sign. --- src/Bindings/PluginLua.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Bindings/PluginLua.cpp') diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index c36763c38..f69435370 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -25,7 +25,7 @@ extern "C" -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// // cPluginLua: cPluginLua::cPluginLua(const AString & a_PluginDirectory) : @@ -1670,7 +1670,7 @@ AString cPluginLua::HandleWebRequest(const HTTPRequest * a_Request ) sWebPluginTab * Tab = 0; for (TabList::iterator itr = GetTabs().begin(); itr != GetTabs().end(); ++itr) { - if ((*itr)->SafeTitle.compare(SafeTabName) == 0) // This is the one! Rawr + if ((*itr)->SafeTitle.compare(SafeTabName) == 0) // This is the one! Rawr { Tab = *itr; break; -- cgit v1.2.3 From 5e198c673009cf8ca9d92cf59848999bc96bbc37 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 17 Jul 2014 22:50:58 +0200 Subject: Basic style fixes. --- src/Bindings/PluginLua.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/Bindings/PluginLua.cpp') diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index f69435370..5fa8adc66 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -78,7 +78,7 @@ bool cPluginLua::Initialize(void) { cCSLock Lock(m_CriticalSection); if (!m_LuaState.IsValid()) - { + { m_LuaState.Create(); m_LuaState.RegisterAPILibs(); @@ -1015,7 +1015,7 @@ bool cPluginLua::OnPlayerUsedBlock(cPlayer & a_Player, int a_BlockX, int a_Block -bool cPluginLua::OnPlayerUsedItem(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) +bool cPluginLua::OnPlayerUsedItem(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) { cCSLock Lock(m_CriticalSection); bool res = false; @@ -1294,8 +1294,8 @@ bool cPluginLua::OnTakeDamage(cEntity & a_Receiver, TakeDamageInfo & a_TDI) bool cPluginLua::OnUpdatedSign( - cWorld * a_World, - int a_BlockX, int a_BlockY, int a_BlockZ, + cWorld * a_World, + int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player ) @@ -1319,8 +1319,8 @@ bool cPluginLua::OnUpdatedSign( bool cPluginLua::OnUpdatingSign( - cWorld * a_World, - int a_BlockX, int a_BlockY, int a_BlockZ, + cWorld * a_World, + int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4, cPlayer * a_Player ) @@ -1517,7 +1517,7 @@ bool cPluginLua::CanAddOldStyleHook(int a_HookType) return true; } - LOGWARNING("Plugin %s wants to add a hook (%d), but it doesn't provide the callback function \"%s\" for it. The plugin need not work properly.", + LOGWARNING("Plugin %s wants to add a hook (%d), but it doesn't provide the callback function \"%s\" for it. The plugin need not work properly.", GetName().c_str(), a_HookType, FnName ); m_LuaState.LogStackTrace(); -- cgit v1.2.3 From 93d29555e58df172bafba530afbc593c16ec66a3 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 21 Jul 2014 15:19:48 +0200 Subject: Style: Normalized to no spaces before closing parenthesis. --- src/Bindings/PluginLua.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Bindings/PluginLua.cpp') diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index 5fa8adc66..0f3f25d75 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -1655,7 +1655,7 @@ int cPluginLua::CallFunctionFromForeignState( -AString cPluginLua::HandleWebRequest(const HTTPRequest * a_Request ) +AString cPluginLua::HandleWebRequest(const HTTPRequest * a_Request) { cCSLock Lock(m_CriticalSection); std::string RetVal = ""; -- cgit v1.2.3