Fix continuous-action timing: move CreateActionComponent to a callback class

ActionContinuousBase has no CreateActionComponent() to override (it lives on
ActionContinuousBaseCB). Added YALB_OpenLootboxCB : ActionContinuousBaseCB
overriding CreateActionComponent (CAContinuousTime in seconds), and pointed the
action at it via m_CallbackClass. Resolves the World-module compile error.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
smthspec 2026-06-19 23:49:49 +03:00
parent d28cebd5d6
commit 0dffa77caf

View file

@ -13,10 +13,27 @@ class YALB_OpenLootboxActionData : ActionData
// currently empty - base ActionData carries everything we need
};
// Continuous-action timing lives on the CALLBACK class (ActionContinuousBaseCB),
// not the action - CreateActionComponent() is defined there. The action points
// at this CB via m_CallbackClass. CAContinuousTime takes the channel time in
// SECONDS. Falls back to 5s on the client, where MainConfig is null (config is
// server-only); the server is authoritative on when the channel actually ends.
class YALB_OpenLootboxCB : ActionContinuousBaseCB
{
override void CreateActionComponent()
{
float secs = 5.0;
if (YALB_ConfigLoader.MainConfig && YALB_ConfigLoader.MainConfig.OpenChannelDurationSeconds > 0)
secs = YALB_ConfigLoader.MainConfig.OpenChannelDurationSeconds;
m_ActionData.m_ActionComponent = new CAContinuousTime(secs);
}
};
class YALB_ActionOpenLootbox : ActionContinuousBase
{
void YALB_ActionOpenLootbox()
{
m_CallbackClass = YALB_OpenLootboxCB;
m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ONCE; // generic "use" anim hook
m_FullBody = false;
m_ReloadFinishAnim = false;
@ -57,18 +74,6 @@ class YALB_ActionOpenLootbox : ActionContinuousBase
return true;
}
// Continuous-action duration is set via a CAContinuousTime component (in
// SECONDS), NOT a GetDuration() override - ActionContinuousBase has no such
// method. Falls back to 5s on the client, where MainConfig is null (config
// is server-only); the server is authoritative on when the channel ends.
override void CreateActionComponent()
{
float secs = 5.0;
if (YALB_ConfigLoader.MainConfig && YALB_ConfigLoader.MainConfig.OpenChannelDurationSeconds > 0)
secs = YALB_ConfigLoader.MainConfig.OpenChannelDurationSeconds;
m_ActionData.m_ActionComponent = new CAContinuousTime(secs);
}
// Fired server-side when the channel completes WITHOUT being cancelled.
override void OnFinishProgressServer(ActionData action_data)
{