mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Moved no interaction menu support inside the function, made code run selectively on server/clients, fixes #2037, closes #1945
This commit is contained in:
parent
2e386038b7
commit
8b802006a4
@ -6,7 +6,7 @@ class CfgVehicles {
|
|||||||
displayName = CSTRING(DisplayName);
|
displayName = CSTRING(DisplayName);
|
||||||
function = QFUNC(moduleInit);
|
function = QFUNC(moduleInit);
|
||||||
scope = 2;
|
scope = 2;
|
||||||
isGlobal = 0; // Server only
|
isGlobal = 1;
|
||||||
isTriggerActivated = 0;
|
isTriggerActivated = 0;
|
||||||
isDisposable = 0;
|
isDisposable = 0;
|
||||||
icon = QUOTE(PATHTOF(UI\Icon_Module_Slideshow_ca.paa));
|
icon = QUOTE(PATHTOF(UI\Icon_Module_Slideshow_ca.paa));
|
||||||
|
@ -40,15 +40,24 @@ if (count _controllers == 0) then {
|
|||||||
TRACE_4("Information",_objects,_controllers,_images,_names);
|
TRACE_4("Information",_objects,_controllers,_images,_names);
|
||||||
|
|
||||||
// Default images on whiteboards (first image)
|
// Default images on whiteboards (first image)
|
||||||
{
|
if (isServer) then {
|
||||||
_x setObjectTextureGlobal [0, _images select 0];
|
{
|
||||||
} forEach _objects;
|
_x setObjectTextureGlobal [0, _images select 0];
|
||||||
|
} forEach _objects;
|
||||||
|
|
||||||
|
// Number of slideshows (multiple modules support)
|
||||||
|
GVAR(slideshows) = GVAR(slideshows) + 1;
|
||||||
|
};
|
||||||
|
|
||||||
// Number of slideshows (multiple modules support)
|
|
||||||
GVAR(slideshows) = GVAR(slideshows) + 1;
|
|
||||||
private ["_currentSlideshow"];
|
private ["_currentSlideshow"];
|
||||||
_currentSlideshow = GVAR(slideshows); // Local variable in case GVAR gets changed during execution of below code
|
_currentSlideshow = GVAR(slideshows); // Local variable in case GVAR gets changed during execution of below code
|
||||||
|
|
||||||
|
// If interaction menu module is not present, set default duration value
|
||||||
|
if (["ace_interact_menu"] call EFUNC(common,isModLoaded)) then {
|
||||||
|
_duration = 5;
|
||||||
|
diag_log text format ["[ACE]: Slideshow: Interaction Menu module not present, defaulting duration value to %1", _duration];
|
||||||
|
};
|
||||||
|
|
||||||
// Add interactions if automatic transitions are disabled, else setup automatic transitions
|
// Add interactions if automatic transitions are disabled, else setup automatic transitions
|
||||||
if (_duration == 0) then {
|
if (_duration == 0) then {
|
||||||
private ["_actionsObject", "_actionsClass", "_mainAction", "_slidesAction"];
|
private ["_actionsObject", "_actionsClass", "_mainAction", "_slidesAction"];
|
||||||
@ -67,6 +76,8 @@ if (_duration == 0) then {
|
|||||||
[_x, 0, ["ACE_MainActions"], _slidesAction] call EFUNC(interact_menu,addActionToObject);
|
[_x, 0, ["ACE_MainActions"], _slidesAction] call EFUNC(interact_menu,addActionToObject);
|
||||||
} forEach _controllers;
|
} forEach _controllers;
|
||||||
} else {
|
} else {
|
||||||
|
if !(isServer) exitWith {};
|
||||||
|
|
||||||
// Formatted GVAR string (multiple modules support)
|
// Formatted GVAR string (multiple modules support)
|
||||||
private ["_varString"];
|
private ["_varString"];
|
||||||
_varString = format [QGVAR(slideshow%1), _currentSlideshow];
|
_varString = format [QGVAR(slideshow%1), _currentSlideshow];
|
||||||
|
@ -15,7 +15,8 @@
|
|||||||
//#define DEBUG_MODE_FULL
|
//#define DEBUG_MODE_FULL
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
if !(isServer) exitWith {};
|
// Exit on Headless Client
|
||||||
|
if (!hasInterface && !isDedicated) exitWith {};
|
||||||
|
|
||||||
PARAMS_3(_logic,_units,_activated);
|
PARAMS_3(_logic,_units,_activated);
|
||||||
|
|
||||||
@ -33,12 +34,6 @@ _images = [_logic getVariable ["Images", ""], true, false] call FUNC(makeList);
|
|||||||
_names = [_logic getVariable ["Names", ""], true, false] call FUNC(makeList);
|
_names = [_logic getVariable ["Names", ""], true, false] call FUNC(makeList);
|
||||||
_duration = _logic getVariable ["Duration", 0];
|
_duration = _logic getVariable ["Duration", 0];
|
||||||
|
|
||||||
// If interaction menu module is not present, set default duration value
|
|
||||||
if (["ace_interact_menu"] call EFUNC(common,isModLoaded)) then {
|
|
||||||
_duration = 5;
|
|
||||||
diag_log "[ACE]: ace_interact_menu not present, assuming default Slideshow duration value.";
|
|
||||||
};
|
|
||||||
|
|
||||||
// Prepare with actions
|
// Prepare with actions
|
||||||
[_objects, _controllers, _images, _names, _duration] call FUNC(createSlideshow);
|
[_objects, _controllers, _images, _names, _duration] call FUNC(createSlideshow);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user