VN_ms_fnc_cacheLayer
Revision as of 22:35, 5 January 2021 by Lou Montana (talk | contribs) (Text replacement - " {{Function" to "Category:TODO {{Function")
← back to Functions | Introduced in S.O.G. Prairie Fire v1.00 by Wyqer, veteran29 |
|
Description
/* Author: Wyqer, veteran29 Date: 2019-10-15 Last Update: 2020-10-24 Public: Yes Description: Toggle caching of editor layer. Parameter(s): _layer - Layer name [STRING, defaults to ""] _cached - Caching state [BOOL, defaults to true] Returns: Function reached the end [BOOL] Example(s): ["myEditorLayer", false] call vn_ms_fnc_cacheLayer */ params [ ["_layer", "", [""]], ["_cached", true, [false]] ]; #ifdef VN_DEBUG systemChat format ["[Layer] %1, %2", _layer, _cached]; #endif private _layerData = (getMissionLayerEntities _layer) param [0, []]; if (_layerData isEqualTo []) exitWith { ["Layer '%1' does not contain units, can not (un)cache!", _layer] call BIS_fnc_error; false }; { _x enableSimulationGlobal !_cached; _x hideObjectGlobal _cached; if (_cached) then { _x setVariable ["vn_cache_damageAllowed", isDamageAllowed _x, true]; _x allowDamage false; } else { _x allowDamage (_x getVariable ["vn_cache_damageAllowed", true]); _x setVariable ["vn_cache_damageAllowed", nil, true]; }; } forEach _layerData; private _groups = _layerData apply {group _x}; _groups = _groups arrayIntersect _groups; { // handle dynamic simulation for groups if (_cached && {isNil {_x getVariable "vn_cache_dynSim"}}) then { _x setVariable ["vn_cache_dynSim", dynamicSimulationEnabled _x]; _x enableDynamicSimulation false; } else { if (!_cached) then { _x enableDynamicSimulation (_x getVariable ["vn_cache_dynSim", false]); _x setVariable ["vn_cache_dynSim", nil]; }; }; } forEach _groups; true(Placeholder description extracted from the function header by LM_exportFunctionsToWiki.sqf)
Syntax
- Syntax
- [] call vn_ms_fnc_cacheLayer;
- Return value
- Nothing
Examples
- Example 1
-