-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved and made staging check system more reliable and added the ab…
…ility to have shaped zones (#1075) * Improved the staging zone system * Added better handling of staging zones and allow for shaped zones
- Loading branch information
1 parent
933c5f7
commit 7b6619a
Showing
4 changed files
with
84 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,81 @@ | ||
#include "..\script_component.hpp"; | ||
/* | ||
* Author: CPL.Brostrom.A | ||
* This function adds a given object or marker to the missionNamespace listing staging zones. | ||
* This function creates a staging zone and saves it to a mission name space. | ||
* The zone can be OBJECT, MARKER or POSITION ARRAY | ||
* | ||
* Arguments: | ||
* 0: Zone <OBJECT/STRING> | ||
* 1: Zone Size <NUMBER> (Optional) [Default; 12] | ||
* 0: Zone <OBJECT/STRING/ARRAY> | ||
* 1: Zone Size <NUMBER/STRING> (Optional) [Default; 12] | ||
* | ||
* Return: | ||
* Nothing | ||
* | ||
* Example: | ||
* [this] call cScripts_fnc_addStagingZone | ||
* [bob, 2] call cScripts_fnc_addStagingZone | ||
* [TruckMcTruckFace, 12] call cScripts_fnc_addStagingZone | ||
* [this, 3] call cScripts_fnc_addStagingZone | ||
* ["zone_staging", 12] call cScripts_fnc_addStagingZone | ||
* ["respawn_west", 12] call cScripts_fnc_addStagingZone | ||
* [[10,25,0], 12] call cScripts_fnc_addStagingZone | ||
* ["ShapedZoneMarker", "RECTANGLE"] call cScripts_fnc_addStagingZone | ||
* ["ShapedZoneMarker", "ELLIPSE"] call cScripts_fnc_addStagingZone | ||
* | ||
* Public: Yes | ||
*/ | ||
|
||
params [ | ||
["_zone", objNull, [objNull, ""]], | ||
["_size", 12, [0]] | ||
["_zone", objNull, [objNull, "", []]], | ||
["_size", 12, [0, ""]] | ||
]; | ||
|
||
private _stagingZones = GETMVAR(EGVAR(Staging,Zones), []); | ||
|
||
// Check if zone is marker | ||
if (_zone isEqualType "") then { | ||
private _markerPos = getMarkerPos _zone; | ||
_zone = "UserTexture1m_F" createVehicle _markerPos; | ||
// Position or Icon zone | ||
if (_zone isEqualType []) exitWith { | ||
INFO("Staging", "Creating postion type staging zone (Icon marker or Set position)"); | ||
private _zoneSize = if (_size isEqualType 0) then {[_size, _size]} else {SHOW_CHAT_WARNING("Staging", "Zone size <STRING> not valid for position type zones. Setting zone size to 12");[12, 12]}; | ||
private _zonePos = _zone; | ||
private _zoneType = []; | ||
|
||
private _stagingZone = createMarkerLocal [format["cScripts_staging_zone_%1", count _stagingZones], _zonePos]; | ||
_stagingZone setMarkerShapeLocal "ELLIPSE"; | ||
_stagingZone setMarkerSizeLocal _zoneSize; | ||
_stagingZone setMarkerBrushLocal "Border"; | ||
_stagingZone setMarkerColorLocal "ColorOrange"; | ||
|
||
_stagingZones append [[_stagingZone, _zoneSize, _zoneType]]; | ||
SETMVAR(EGVAR(Staging,Zones), _stagingZones); | ||
}; | ||
|
||
_stagingZones pushBack [_zone, _size]; | ||
// Shape marker zone | ||
if (_zone isEqualType "") exitWith { | ||
INFO("Staging", "Creating shape marker type staging zone"); | ||
private _zoneSize = if (_size isEqualType 0) then {[_size, _size]} else {getMarkerSize _zone}; | ||
private _zoneShape = _size; | ||
private _zonePos = markerPos _zone; | ||
private _zoneDir = markerDir _zone; | ||
private _zoneType = ""; | ||
|
||
SETMVAR(EGVAR(Staging,Zones), _stagingZones); | ||
private _stagingZone = createMarkerLocal [format["cScripts_staging_zone_%1", count _stagingZones], _zonePos]; | ||
_stagingZone setMarkerShapeLocal _zoneShape; | ||
_stagingZone setMarkerSizeLocal _zoneSize; | ||
_stagingZone setMarkerDirLocal _zoneDir; | ||
_stagingZone setMarkerBrushLocal "Border"; | ||
_stagingZone setMarkerColorLocal "ColorOrange"; | ||
|
||
INFO_2("Staging", "Staging zone %1 (%2) created.", count _stagingZones, _zone); | ||
_stagingZones append [[_stagingZone, _zoneSize, _zoneType]]; | ||
SETMVAR(EGVAR(Staging,Zones), _stagingZones); | ||
}; | ||
|
||
// Vehicles dont paint out the zone | ||
if (_zone isKindOf "AllVehicles") exitWith {}; | ||
INFO_2("Staging", "Revlealing staging zone %1 (%2)", count _stagingZones, _zone); | ||
// Object type zone | ||
if (_zone isEqualType objNull) exitWith { | ||
INFO("Staging", "Creating vehicle type staging zone"); | ||
private _zoneSize = if (_size isEqualType 0) then {[_size, _size]} else {SHOW_CHAT_WARNING("Staging", "Zone size <STRING> not valid for position type zones. Setting zone size to 12");[12, 12]}; | ||
private _zoneType = objNull; | ||
private _stagingZone = _zone; | ||
|
||
_stagingZones append [[_stagingZone, _zoneSize, _zoneType]]; | ||
SETMVAR(EGVAR(Staging,Zones), _stagingZones); | ||
}; | ||
|
||
private _visibleZone = createMarkerLocal [format["VisibleStadgeingMarker_%1", count _stagingZones], _zone]; | ||
_visibleZone setMarkerShapeLocal "ELLIPSE"; | ||
_visibleZone setMarkerSizeLocal [_size, _size]; | ||
_visibleZone setMarkerBrushLocal "Border"; | ||
_visibleZone setMarkerColorLocal "ColorYellow"; | ||
if (isNil{_stagingZone}) exitWith {ERROR_1("Staging", "Staging zone %1 not created.", _zone);}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters