parent
66fa015534
commit
562d14e8ec
@ -468,6 +468,20 @@ void cSlotAreaCrafting::OnPlayerRemoved(cPlayer & a_Player)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void cSlotAreaCrafting::SetSlot(int a_SlotNum, cPlayer & a_Player, const cItem & a_Item)
|
||||||
|
{
|
||||||
|
// Update the recipe after setting the slot, if the slot is not the result slot:
|
||||||
|
super::SetSlot(a_SlotNum, a_Player, a_Item);
|
||||||
|
if (a_SlotNum != 0)
|
||||||
|
{
|
||||||
|
UpdateRecipe(a_Player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cSlotAreaCrafting::DistributeStack(cItem & a_ItemStack, cPlayer & a_Player, bool a_ShouldApply, bool a_KeepEmptySlots)
|
void cSlotAreaCrafting::DistributeStack(cItem & a_ItemStack, cPlayer & a_Player, bool a_ShouldApply, bool a_KeepEmptySlots)
|
||||||
{
|
{
|
||||||
UNUSED(a_ItemStack);
|
UNUSED(a_ItemStack);
|
||||||
@ -545,16 +559,20 @@ void cSlotAreaCrafting::ShiftClickedResult(cPlayer & a_Player)
|
|||||||
// Distribute the result, this time for real:
|
// Distribute the result, this time for real:
|
||||||
ResultCopy = Result;
|
ResultCopy = Result;
|
||||||
m_ParentWindow.DistributeStack(ResultCopy, a_Player, this, true);
|
m_ParentWindow.DistributeStack(ResultCopy, a_Player, this, true);
|
||||||
|
|
||||||
// Remove the ingredients from the crafting grid and update the recipe:
|
// Remove the ingredients from the crafting grid and update the recipe:
|
||||||
cCraftingRecipe & Recipe = GetRecipeForPlayer(a_Player);
|
cCraftingRecipe & Recipe = GetRecipeForPlayer(a_Player);
|
||||||
cCraftingGrid Grid(PlayerSlots, m_GridSize, m_GridSize);
|
cCraftingGrid Grid(PlayerSlots, m_GridSize, m_GridSize);
|
||||||
Recipe.ConsumeIngredients(Grid);
|
Recipe.ConsumeIngredients(Grid);
|
||||||
Grid.CopyToItems(PlayerSlots);
|
Grid.CopyToItems(PlayerSlots);
|
||||||
UpdateRecipe(a_Player);
|
UpdateRecipe(a_Player);
|
||||||
|
|
||||||
|
// Broadcast the window, we sometimes move items to different locations than Vanilla, causing needless desyncs:
|
||||||
|
m_ParentWindow.BroadcastWholeWindow();
|
||||||
|
|
||||||
|
// If the recipe has changed, bail out:
|
||||||
if (!Recipe.GetResult().IsEqual(Result))
|
if (!Recipe.GetResult().IsEqual(Result))
|
||||||
{
|
{
|
||||||
// The recipe has changed, bail out
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -232,6 +232,7 @@ public:
|
|||||||
virtual void Clicked (cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem & a_ClickedItem) override;
|
virtual void Clicked (cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem & a_ClickedItem) override;
|
||||||
virtual void DblClicked (cPlayer & a_Player, int a_SlotNum);
|
virtual void DblClicked (cPlayer & a_Player, int a_SlotNum);
|
||||||
virtual void OnPlayerRemoved(cPlayer & a_Player) override;
|
virtual void OnPlayerRemoved(cPlayer & a_Player) override;
|
||||||
|
virtual void SetSlot (int a_SlotNum, cPlayer & a_Player, const cItem & a_Item) override;
|
||||||
|
|
||||||
// Distributing items into this area is completely disabled
|
// Distributing items into this area is completely disabled
|
||||||
virtual void DistributeStack(cItem & a_ItemStack, cPlayer & a_Player, bool a_ShouldApply, bool a_KeepEmptySlots) override;
|
virtual void DistributeStack(cItem & a_ItemStack, cPlayer & a_Player, bool a_ShouldApply, bool a_KeepEmptySlots) override;
|
||||||
|
Loading…
Reference in New Issue
Block a user