1
0

Fixed spacing and doxycomments.

This commit is contained in:
Mike Hunsinger 2014-01-23 19:54:00 -07:00
parent 00d7317746
commit 11948b1d4b
4 changed files with 18 additions and 20 deletions

View File

@ -19,8 +19,8 @@ return
Returns = [[ Returns = [[
If the function returns false or no value, other plugins' callbacks are called and finally MCServer If the function returns false or no value, other plugins' callbacks are called and finally MCServer
creates the pickup for the item and tosses it, using {{cPlayer}}:TossHeldItem, {{cPlayer}}:TossEquippedItem, creates the pickup for the item and tosses it, using {{cPlayer}}:TossHeldItem, {{cPlayer}}:TossEquippedItem,
or {{cPlayer}}:TossPickup. If the function returns true, no other callbacks are called for this event or {{cPlayer}}:TossPickup. If the function returns true, no other callbacks are called for this event
and MCServer doesn't toss the item. and MCServer doesn't toss the item.
]], ]],
}, -- HOOK_PLAYER_TOSSING_ITEM }, -- HOOK_PLAYER_TOSSING_ITEM
} }

View File

@ -1389,8 +1389,8 @@ void cPlayer::TossHeldItem(char a_Amount)
} }
} }
double vX = 0, vY = 0, vZ = 0; double vX = 0, vY = 0, vZ = 0;
EulerToVector(-GetYaw(), GetPitch(), vZ, vX, vY); EulerToVector(-GetYaw(), GetPitch(), vZ, vX, vY);
vY = -vY * 2 + 1.f; vY = -vY * 2 + 1.f;
m_World->SpawnItemPickups(Drops, GetPosX(), GetEyeHeight(), GetPosZ(), vX * 3, vY * 3, vZ * 3, true); // 'true' because created by player m_World->SpawnItemPickups(Drops, GetPosX(), GetEyeHeight(), GetPosZ(), vX * 3, vY * 3, vZ * 3, true); // 'true' because created by player
} }
@ -1402,7 +1402,7 @@ void cPlayer::TossHeldItem(char a_Amount)
void cPlayer::TossPickup(const cItem & a_Item) void cPlayer::TossPickup(const cItem & a_Item)
{ {
cItems Drops; cItems Drops;
Drops.push_back(a_Item); Drops.push_back(a_Item);
double vX = 0, vY = 0, vZ = 0; double vX = 0, vY = 0, vZ = 0;
EulerToVector(-GetYaw(), GetPitch(), vZ, vX, vY); EulerToVector(-GetYaw(), GetPitch(), vZ, vX, vY);

View File

@ -214,13 +214,13 @@ public:
/// Returns the full color code to use for this player, based on their primary group or set in m_Color /// Returns the full color code to use for this player, based on their primary group or set in m_Color
AString GetColor(void) const; AString GetColor(void) const;
// tosses the item in the selected hotbar slot /** tosses the item in the selected hotbar slot */
void TossEquippedItem(char a_Amount = 1); void TossEquippedItem(char a_Amount = 1);
// tosses the item held in hand (when in UI windows) /** tosses the item held in hand (when in UI windows) */
void TossHeldItem(char a_Amount = 1); void TossHeldItem(char a_Amount = 1);
// tosses a pickup newly created from a_Item /** tosses a pickup newly created from a_Item */
void TossPickup(const cItem & a_Item); void TossPickup(const cItem & a_Item);
/// Heals the player by the specified amount of HPs (positive only); sends health update /// Heals the player by the specified amount of HPs (positive only); sends health update

View File

@ -171,7 +171,6 @@ void cWindow::Clicked(
) )
{ {
cPluginManager * PlgMgr = cRoot::Get()->GetPluginManager(); cPluginManager * PlgMgr = cRoot::Get()->GetPluginManager();
if (a_WindowID != m_WindowID) if (a_WindowID != m_WindowID)
{ {
LOGWARNING("%s: Wrong window ID (exp %d, got %d) received from \"%s\"; ignoring click.", __FUNCTION__, m_WindowID, a_WindowID, a_Player.GetName().c_str()); LOGWARNING("%s: Wrong window ID (exp %d, got %d) received from \"%s\"; ignoring click.", __FUNCTION__, m_WindowID, a_WindowID, a_Player.GetName().c_str());
@ -182,16 +181,15 @@ void cWindow::Clicked(
{ {
case caRightClickOutside: case caRightClickOutside:
{ {
if (PlgMgr->CallHookPlayerTossingItem(a_Player)) if (PlgMgr->CallHookPlayerTossingItem(a_Player))
{ {
// A plugin doesn't agree with the tossing. The plugin itself is responsible for handling the consequences (possible inventory mismatch) // A plugin doesn't agree with the tossing. The plugin itself is responsible for handling the consequences (possible inventory mismatch)
return; return;
} }
if (a_Player.IsGameModeCreative())
if (a_Player.IsGameModeCreative()) {
{ a_Player.TossPickup(a_ClickedItem);
a_Player.TossPickup(a_ClickedItem); }
}
// Toss one of the dragged items: // Toss one of the dragged items:
a_Player.TossHeldItem(); a_Player.TossHeldItem();
@ -205,10 +203,10 @@ void cWindow::Clicked(
return; return;
} }
if (a_Player.IsGameModeCreative()) if (a_Player.IsGameModeCreative())
{ {
a_Player.TossPickup(a_ClickedItem); a_Player.TossPickup(a_ClickedItem);
} }
// Toss all dragged items: // Toss all dragged items:
a_Player.TossHeldItem(a_Player.GetDraggingItem().m_ItemCount); a_Player.TossHeldItem(a_Player.GetDraggingItem().m_ItemCount);
@ -288,7 +286,7 @@ bool cWindow::ClosedByPlayer(cPlayer & a_Player, bool a_CanRefuse)
if (a_Player.IsDraggingItem()) if (a_Player.IsDraggingItem())
{ {
LOGD("Player holds item! Dropping it..."); LOGD("Player holds item! Dropping it...");
a_Player.TossHeldItem(a_Player.GetDraggingItem().m_ItemCount); a_Player.TossHeldItem(a_Player.GetDraggingItem().m_ItemCount);
} }
cClientHandle * ClientHandle = a_Player.GetClientHandle(); cClientHandle * ClientHandle = a_Player.GetClientHandle();