From 5414adc8d850b96da29f7fd00f9fd7ee177b8174 Mon Sep 17 00:00:00 2001 From: smiki Date: Wed, 17 Sep 2025 09:26:34 +0200 Subject: [PATCH] [Added] `PLAYERTASK:CanJoinTask` Override function in order to implement custom logic if a player can join a task or not. --- Moose Development/Moose/Ops/PlayerTask.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Moose Development/Moose/Ops/PlayerTask.lua b/Moose Development/Moose/Ops/PlayerTask.lua index 77516f752..9a7679936 100644 --- a/Moose Development/Moose/Ops/PlayerTask.lua +++ b/Moose Development/Moose/Ops/PlayerTask.lua @@ -387,6 +387,14 @@ function PLAYERTASK:_CheckCaptureOpsZoneSuccess(OpsZone, CaptureSquadGroupNamePr return OpsZone:GetOwner() == Coalition and isClientInZone and isCaptureGroupInZone end +--- [User] Override this function in order to implement custom logic if a player can join a task or not. +-- @param #PLAYERTASK self +-- @param Wrapper.Group#GROUP Group +-- @param Wrapper.Client#CLIENT Client +-- @return #boolean Outcome True if player can join the task, false if not +function PLAYERTASK:CanJoinTask(Group, Client) + return true +end --- [Internal] Add a PLAYERTASKCONTROLLER for this task -- @param #PLAYERTASK self @@ -3555,6 +3563,10 @@ function PLAYERTASKCONTROLLER:_JoinTask(Task, Force, Group, Client) return self end + if not Task:CanJoinTask(Group, Client) then + return self + end + local force = false if type(Force) == "boolean" then force = Force