diff --git a/scripts/4_World/YALootBoxes_ActionOpen.c b/scripts/4_World/YALootBoxes_ActionOpen.c index bc0e4df..b494db7 100644 --- a/scripts/4_World/YALootBoxes_ActionOpen.c +++ b/scripts/4_World/YALootBoxes_ActionOpen.c @@ -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) {