Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* DGF_fnc_SwitchObjectsHiddenInTriggerArea
- Switch all objects in a trigger's area to a specified-hidden state.
- PARAMS:
- 0: Triggers Affected [OBJECT.TRIGGER]
- 1: Apply restrictions [BOOL] (Optional, Default: true)
- -Vehicles with units in them won't be hidden
- -Units won't be hidden
- 2: Hidden switch type [SCALAR] (Optional, Default: 2)
- 0: hide all objects within trigger
- 1: un-hide all objects within trigger
- 2: auto-switch - if an object is hidden, unhide it; if not - hide it; per-object.
- by Doggifast
- */
- if !(isServer) exitWith {};
- params ["_triggers", "_applyRestrictions", "_typeSwitch"];
- private _triggers = param [0, [], [[]], []];
- private _applyRestrictions = param [1, true, [true]];
- private _typeSwitch = param [2, 2, [2]];
- private _appropriateObjects0 = (63 allObjects 0);
- private _appropriateObjects1 = (63 allObjects 1);
- {
- private _arrayIncompatibleObjects = [];
- private _appropriateObjects = [];
- if (_applyRestrictions) then
- {
- _appropriateObjects = (((_appropriateObjects0 + _appropriateObjects1) - [_x]) - AllUnits) inAreaArray _x;
- {
- if !((crew _x) isEqualTo []) then //if vehicle holds crew...
- {
- _arrayIncompatibleObjects pushBack _x;
- };
- } forEach _appropriateObjects;
- _appropriateObjects = (_appropriateObjects - _arrayIncompatibleObjects);
- } else
- {
- _appropriateObjects = (((_appropriateObjects0 + _appropriateObjects1) - [_x]) inAreaArray _x);
- };
- switch (_typeSwitch) do
- {
- case 0: {
- {_x hideObjectGlobal true;} forEach _appropriateObjects;
- };
- case 1: {
- {_x hideObjectGlobal false;} forEach _appropriateObjects;
- };
- case 2:
- {
- {
- if (isObjectHidden _x) then
- {
- _x hideObjectGlobal false;
- }
- else
- {
- _x hideObjectGlobal true;
- };
- } forEach _appropriateObjects;
- };
- };
- } forEach _triggers;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement