forked from acemod/ACE3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fortify - Add map area markers for Fortify objects (acemod#8525)
Co-authored-by: Seb <65898127+Seb105@users.noreply.github.com> Co-authored-by: PabstMirror <pabstmirror@gmail.com>
- Loading branch information
1 parent
00e0980
commit 67b857f
Showing
7 changed files
with
116 additions
and
1 deletion.
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
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#include "script_component.hpp" | ||
/* | ||
* Author: Seb | ||
* Creates a map marker for a created static object but only for sides friendly to the creator side. | ||
* | ||
* Arguments: | ||
* 0: Unit placing <OBJECT> | ||
* 1: Created fortify object <OBJECT> | ||
* | ||
* Return Value: | ||
* None | ||
* | ||
* Example: | ||
* [player, cursorObject] call ace_fortify_fnc_createObjectMarker | ||
* | ||
* Public: No | ||
*/ | ||
|
||
params ["_unit", "_object"]; | ||
TRACE_2("createObjectMarker",_unit,_object); | ||
|
||
// Get Object size and direction | ||
private _bbr = 0 boundingBoxReal _object; | ||
private _p1 = _bbr select 0; | ||
private _p2 = _bbr select 1; | ||
private _maxWidth = abs ((_p2 select 0) - (_p1 select 0)); | ||
private _maxLength = abs ((_p2 select 1) - (_p1 select 1)); | ||
private _direction = getDir _object; | ||
|
||
// Marker name unique to this object | ||
private _markerNameStr = format [QGVAR(marker_%1), hashValue _object]; | ||
private _channel = if (GVAR(markObjectsOnMap) == 2) then { 0 } else { 1 }; | ||
|
||
private _marker = createMarkerLocal [_markerNameStr, _object, _channel, _unit]; | ||
TRACE_2("created",_marker,_channel); | ||
_marker setMarkerShapeLocal "RECTANGLE"; | ||
_marker setMarkerBrushLocal "SolidFull"; | ||
_marker setMarkerSizeLocal [(_maxWidth / 2),(_maxLength / 2)]; | ||
_marker setMarkerDirLocal _direction; | ||
_marker setMarkerColor "ColorGrey"; | ||
_object setVariable [QGVAR(mapMarker), _marker, false]; | ||
|
||
_object addEventHandler ["Deleted", { | ||
params ["_object"]; | ||
private _marker = _object getVariable QGVAR(mapMarker); | ||
TRACE_2("cleaning up marker",_object,_marker); | ||
deleteMarker _marker | ||
}]; |
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
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