diff --git a/Api/Manage.lua b/Api/Manage.lua index ccdc401..305286c 100644 --- a/Api/Manage.lua +++ b/Api/Manage.lua @@ -12,8 +12,10 @@ g_Hooks = { ["OnAreaChanged"] = {}, -- Signature: function(a_AffectedAreaCuboid, a_Player, a_World, a_Operation) ["OnAreaCopied"] = {}, -- Signature: function(a_Player, a_World, a_CopiedAreaCuboid) ["OnAreaCopying"] = {}, -- Signature: function(a_Player, a_World, a_CopiedAreaCuboid) - ["OnPlayerSelectionChanging"] = {}, -- Signature: function(a_Player, a_PosX, a_PosY, a_PosZ, a_PointNr) - ["OnPlayerSelectionChanged"] = {}, -- Signature: function(a_Player, a_PosX, a_PosY, a_PosZ, a_PointNr) + ["OnPlayerSelectionChanged"] = {}, -- Signature: function(a_Player, a_Cuboid, a_PointNr) a_PointNr is nil if the entire selection changed. + + -- Not implemented + ["OnPlayerSelectionChanging"] = {}, -- Signature: function(a_Player, a_Cuboid, a_PointNr) a_PointNr is nil if the entire selection changed. } diff --git a/Classes/PlayerSelection.lua b/Classes/PlayerSelection.lua index 4e269e4..03f5d3c 100644 --- a/Classes/PlayerSelection.lua +++ b/Classes/PlayerSelection.lua @@ -334,7 +334,14 @@ end -- a_PointChanged is optional, assigned to the point that has just changed -- If nil, the entire selection is assumed changed function cPlayerSelection:NotifySelectionChanged(a_PointChanged) - -- TODO: Call the registered callbacks + -- TODO: Call the OnPlayerSelectionChangING callback to prevent selection changes. + + -- Call the player selection changed callback to notify other plugins of the selection change. + self.PlayerState:DoWithPlayer(function(a_Player) + local cuboid = cCuboid() + cuboid:Assign(self.Cuboid) + CallHook("OnPlayerSelectionChanged", a_Player, cuboid, a_PointChanged) + end); -- Set the player's WECUI, if present: if (self.PlayerState.IsWECUIActivated) then