Moved no interaction menu support inside the function, made code run selectively on server/clients, fixes #2037, closes #1945

This commit is contained in:
jonpas 2015-08-07 00:32:12 +02:00
parent 2e386038b7
commit 8b802006a4
3 changed files with 19 additions and 13 deletions

View File

@ -6,7 +6,7 @@ class CfgVehicles {
displayName = CSTRING(DisplayName);
function = QFUNC(moduleInit);
scope = 2;
isGlobal = 0; // Server only
isGlobal = 1;
isTriggerActivated = 0;
isDisposable = 0;
icon = QUOTE(PATHTOF(UI\Icon_Module_Slideshow_ca.paa));

View File

@ -40,15 +40,24 @@ if (count _controllers == 0) then {
TRACE_4("Information",_objects,_controllers,_images,_names);
// Default images on whiteboards (first image)
{
_x setObjectTextureGlobal [0, _images select 0];
} forEach _objects;
if (isServer) then {
{
_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"];
_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
if (_duration == 0) then {
private ["_actionsObject", "_actionsClass", "_mainAction", "_slidesAction"];
@ -67,6 +76,8 @@ if (_duration == 0) then {
[_x, 0, ["ACE_MainActions"], _slidesAction] call EFUNC(interact_menu,addActionToObject);
} forEach _controllers;
} else {
if !(isServer) exitWith {};
// Formatted GVAR string (multiple modules support)
private ["_varString"];
_varString = format [QGVAR(slideshow%1), _currentSlideshow];

View File

@ -15,7 +15,8 @@
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
if !(isServer) exitWith {};
// Exit on Headless Client
if (!hasInterface && !isDedicated) exitWith {};
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);
_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
[_objects, _controllers, _images, _names, _duration] call FUNC(createSlideshow);