mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Fortify - Add map area markers for Fortify objects (#8525)
Co-authored-by: Seb <65898127+Seb105@users.noreply.github.com> Co-authored-by: PabstMirror <pabstmirror@gmail.com>
This commit is contained in:
parent
76524f7c26
commit
715da4d1bd
@ -153,6 +153,7 @@ ruPaladin <happyworm24@rambler.ru>
|
|||||||
Rutger "RedBery" Meijering <c.redbery@gmail.com>
|
Rutger "RedBery" Meijering <c.redbery@gmail.com>
|
||||||
sancron
|
sancron
|
||||||
Schwaggot <tom.ryan@posteo.de>
|
Schwaggot <tom.ryan@posteo.de>
|
||||||
|
Seb <sebsmith90@gmail.com>
|
||||||
shukari
|
shukari
|
||||||
simon84 <badguy360th@gmail.com>
|
simon84 <badguy360th@gmail.com>
|
||||||
Skengman2
|
Skengman2
|
||||||
|
@ -15,3 +15,4 @@ ACEX_PREP(getPlaceableSet);
|
|||||||
ACEX_PREP(modifyAction);
|
ACEX_PREP(modifyAction);
|
||||||
ACEX_PREP(setupModule);
|
ACEX_PREP(setupModule);
|
||||||
ACEX_PREP(buildLocationModule);
|
ACEX_PREP(buildLocationModule);
|
||||||
|
ACEX_PREP(createObjectMarker);
|
||||||
|
@ -7,6 +7,15 @@ if (isServer) then {
|
|||||||
TRACE_3("objectPlaced",_unit,_side,_object);
|
TRACE_3("objectPlaced",_unit,_side,_object);
|
||||||
private _jipID = [QGVAR(addActionToObject), [_side, _object]] call CBA_fnc_globalEventJIP;
|
private _jipID = [QGVAR(addActionToObject), [_side, _object]] call CBA_fnc_globalEventJIP;
|
||||||
[_jipID, _object] call CBA_fnc_removeGlobalEventJIP; // idealy this function should be called on the server
|
[_jipID, _object] call CBA_fnc_removeGlobalEventJIP; // idealy this function should be called on the server
|
||||||
|
|
||||||
|
if (GVAR(markObjectsOnMap) isNotEqualTo 0 && {_object isKindOf "Static"}) then {
|
||||||
|
// Wait ensures correct marker pos/rot as object is moved into position after creation
|
||||||
|
[
|
||||||
|
FUNC(createObjectMarker),
|
||||||
|
[_unit, _object],
|
||||||
|
1
|
||||||
|
] call CBA_fnc_waitAndExecute;
|
||||||
|
};
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
48
addons/fortify/functions/fnc_createObjectMarker.sqf
Normal file
48
addons/fortify/functions/fnc_createObjectMarker.sqf
Normal file
@ -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
|
||||||
|
}];
|
@ -34,7 +34,7 @@ private _newObject = _typeOf createVehicle _posASL;
|
|||||||
_newObject setPosASL _posASL;
|
_newObject setPosASL _posASL;
|
||||||
_newObject setVectorDirAndUp [_vectorDir, _vectorUp];
|
_newObject setVectorDirAndUp [_vectorDir, _vectorUp];
|
||||||
|
|
||||||
// Server will use this event to run the jip compatible QGVAR(addActionToObject) event
|
// Server will use this event to run the jip compatible QGVAR(addActionToObject) event and create the related map marker.
|
||||||
[QXGVAR(objectPlaced), [_unit, _side, _newObject]] call CBA_fnc_globalEvent;
|
[QXGVAR(objectPlaced), [_unit, _side, _newObject]] call CBA_fnc_globalEvent;
|
||||||
|
|
||||||
if (cba_events_control) then {
|
if (cba_events_control) then {
|
||||||
|
@ -9,3 +9,18 @@
|
|||||||
2
|
2
|
||||||
]
|
]
|
||||||
] call CBA_fnc_addSetting;
|
] call CBA_fnc_addSetting;
|
||||||
|
|
||||||
|
[
|
||||||
|
QGVAR(markObjectsOnMap),
|
||||||
|
"LIST",
|
||||||
|
[LLSTRING(markObjectsOnMap), LLSTRING(markObjectsOnMapDesc)],
|
||||||
|
LLSTRING(settingsCategory),
|
||||||
|
[
|
||||||
|
[0, 1, 2],
|
||||||
|
[LLSTRING(markObjectsOnMapNone), LLSTRING(markObjectsOnMapFriendly), LLSTRING(markObjectsOnMapEveryone)],
|
||||||
|
1
|
||||||
|
],
|
||||||
|
true,
|
||||||
|
{},
|
||||||
|
true
|
||||||
|
] call CBA_fnc_addSetting;
|
||||||
|
@ -157,6 +157,47 @@
|
|||||||
<Russian>Показывать всегда</Russian>
|
<Russian>Показывать всегда</Russian>
|
||||||
<Turkish>Her Zaman Göster</Turkish>
|
<Turkish>Her Zaman Göster</Turkish>
|
||||||
</Key>
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Fortify_markObjectsOnMap">
|
||||||
|
<English>Create map markers</English>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Fortify_markObjectsOnMapDesc">
|
||||||
|
<English>Create map markers that look like terrain buildings when static fortifications are placed</English>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Fortify_markObjectsOnMapNone">
|
||||||
|
<English>Never</English>
|
||||||
|
<Czech>Nikdy</Czech>
|
||||||
|
<German>Nie</German>
|
||||||
|
<Russian>Никогда</Russian>
|
||||||
|
<Polish>Nigdy</Polish>
|
||||||
|
<Italian>Mai</Italian>
|
||||||
|
<Spanish>Nunca</Spanish>
|
||||||
|
<French>Jamais</French>
|
||||||
|
<Chinese>永不</Chinese>
|
||||||
|
<Japanese>なし</Japanese>
|
||||||
|
<Korean>항상 안 함</Korean>
|
||||||
|
<Portuguese>Nunca</Portuguese>
|
||||||
|
<Chinesesimp>永不</Chinesesimp>
|
||||||
|
<Turkish>Asla</Turkish>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Fortify_markObjectsOnMapFriendly">
|
||||||
|
<English>For units friendly to the placer</English>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Fortify_markObjectsOnMapEveryone">
|
||||||
|
<English>For everyone</English>
|
||||||
|
<Chinese>所有人</Chinese>
|
||||||
|
<French>Pour tous</French>
|
||||||
|
<Spanish>Para todos</Spanish>
|
||||||
|
<Italian>Per tutti</Italian>
|
||||||
|
<Polish>Dla wszystkich</Polish>
|
||||||
|
<Russian>Для всех</Russian>
|
||||||
|
<German>Für alle</German>
|
||||||
|
<Czech>Pro všechny</Czech>
|
||||||
|
<Portuguese>Para todos</Portuguese>
|
||||||
|
<Korean>모든 사람</Korean>
|
||||||
|
<Chinesesimp>针对每一个人</Chinesesimp>
|
||||||
|
<Japanese>全員に</Japanese>
|
||||||
|
<Turkish>Herkes için</Turkish>
|
||||||
|
</Key>
|
||||||
<Key ID="STR_ACE_Fortify_small">
|
<Key ID="STR_ACE_Fortify_small">
|
||||||
<English>Small</English>
|
<English>Small</English>
|
||||||
<Polish>Małe</Polish>
|
<Polish>Małe</Polish>
|
||||||
|
Loading…
Reference in New Issue
Block a user