-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into move-camera-to-selection-cqb
- Loading branch information
Showing
62 changed files
with
1,316 additions
and
219 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
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 @@ | ||
x\zen\addons\building_markers |
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,17 @@ | ||
class Extended_PreStart_EventHandlers { | ||
class ADDON { | ||
init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); | ||
}; | ||
}; | ||
|
||
class Extended_PreInit_EventHandlers { | ||
class ADDON { | ||
init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); | ||
}; | ||
}; | ||
|
||
class Extended_PostInit_EventHandlers { | ||
class ADDON { | ||
init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); | ||
}; | ||
}; |
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,3 @@ | ||
PREP(handleObjectEdited); | ||
PREP(handleObjectPlaced); | ||
PREP(set); |
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,15 @@ | ||
#include "script_component.hpp" | ||
|
||
if (isServer) then { | ||
[QGVAR(set), LINKFUNC(set)] call CBA_fnc_addEventHandler; | ||
}; | ||
|
||
if (hasInterface) then { | ||
EGVAR(area_markers,blacklist) pushBack QUOTE(ADDON); | ||
|
||
[QEGVAR(placement,done), { | ||
params ["_object"]; | ||
|
||
[nil, _object] call FUNC(handleObjectPlaced); | ||
}] call CBA_fnc_addEventHandler; | ||
}; |
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,18 @@ | ||
#include "script_component.hpp" | ||
|
||
ADDON = false; | ||
|
||
PREP_RECOMPILE_START; | ||
#include "XEH_PREP.hpp" | ||
PREP_RECOMPILE_END; | ||
|
||
#include "initSettings.sqf" | ||
|
||
["ModuleCurator_F", "Init", { | ||
params ["_logic"]; | ||
|
||
_logic addEventHandler ["CuratorObjectPlaced", {call FUNC(handleObjectPlaced)}]; | ||
_logic addEventHandler ["CuratorObjectEdited", {call FUNC(handleObjectEdited)}]; | ||
}, true, [], true] call CBA_fnc_addClassEventHandler; | ||
|
||
ADDON = true; |
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,3 @@ | ||
#include "script_component.hpp" | ||
|
||
#include "XEH_PREP.hpp" |
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,19 @@ | ||
#include "script_component.hpp" | ||
|
||
class CfgPatches { | ||
class ADDON { | ||
name = COMPONENT_NAME; | ||
units[] = {}; | ||
weapons[] = {}; | ||
requiredVersion = REQUIRED_VERSION; | ||
requiredAddons[] = {"zen_common"}; | ||
author = ECSTRING(main,Author); | ||
authors[] = {"Ampersand"}; | ||
url = ECSTRING(main,URL); | ||
VERSION_CONFIG; | ||
}; | ||
}; | ||
|
||
PRELOAD_ADDONS; | ||
|
||
#include "CfgEventHandlers.hpp" |
25 changes: 25 additions & 0 deletions
25
addons/building_markers/functions/fnc_handleObjectEdited.sqf
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,25 @@ | ||
#include "script_component.hpp" | ||
/* | ||
* Author: Ampersand | ||
* Handles editing of an object by Zeus. | ||
* | ||
* Arguments: | ||
* 0: Curator (not used) <OBJECT> | ||
* 1: Edited Object <OBJECT> | ||
* | ||
* Return Value: | ||
* None | ||
* | ||
* Example: | ||
* [_curator, _object] call zen_building_markers_fnc_handleObjectEdited | ||
* | ||
* Public: No | ||
*/ | ||
|
||
params ["", "_object"]; | ||
|
||
private _marker = _object getVariable [QGVAR(marker), ""]; | ||
|
||
if (_marker != "") then { | ||
[QGVAR(set), [_object, true]] call CBA_fnc_serverEvent; | ||
}; |
23 changes: 23 additions & 0 deletions
23
addons/building_markers/functions/fnc_handleObjectPlaced.sqf
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,23 @@ | ||
#include "script_component.hpp" | ||
/* | ||
* Author: Ampersand | ||
* Handles placement of an object by Zeus. | ||
* | ||
* Arguments: | ||
* 0: Curator (not used) <OBJECT> | ||
* 1: Placed Object <OBJECT> | ||
* | ||
* Return Value: | ||
* None | ||
* | ||
* Example: | ||
* [_curator, _object] call zen_building_markers_fnc_handleObjectPlaced | ||
* | ||
* Public: No | ||
*/ | ||
|
||
params ["", "_object"]; | ||
|
||
if (GVAR(enabled) && {_object isKindOf "Building"}) then { | ||
[QGVAR(set), [_object, true]] call CBA_fnc_serverEvent; | ||
}; |
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,79 @@ | ||
#include "script_component.hpp" | ||
/* | ||
* Author: Ampersand | ||
* Creates or deletes the given object's building marker. | ||
* | ||
* Building markers are grey rectangle area markers for the object's bounding box | ||
* that mimic those of terrain buildings. | ||
* | ||
* When called in create mode for an object that already has a building marker, | ||
* the object's marker is updated to reflect its current position and direction. | ||
* | ||
* The marker is automatically updated if the object is edited by Zeus and | ||
* deleted when the object is deleted. However, the marker will not update if the | ||
* object is edited by some other means (e.g., through script). | ||
* | ||
* Arguments: | ||
* 0: Object(s) <OBJECT|ARRAY> | ||
* 1: Set (create or delete) <BOOL> | ||
* | ||
* Return Value: | ||
* None | ||
* | ||
* Example: | ||
* [_object, true] call zen_building_markers_fnc_set | ||
* | ||
* Public: No | ||
*/ | ||
|
||
if (!isServer) exitWith { | ||
[QGVAR(set), _this] call CBA_fnc_serverEvent; | ||
}; | ||
|
||
params [["_object", objNull, [objNull, []]], ["_set", true, [true]]]; | ||
|
||
if (_object isEqualType []) exitWith { | ||
{ | ||
[_x, _set] call FUNC(set); | ||
} forEach _object; | ||
}; | ||
|
||
if (isNull _object) exitWith {}; | ||
|
||
private _marker = _object getVariable [QGVAR(marker), ""]; | ||
|
||
if (_set) then { | ||
// Only update marker if it already exists | ||
if (_marker != "") exitWith { | ||
_marker setMarkerPosLocal getPos _object; | ||
_marker setMarkerDir getDir _object; | ||
}; | ||
|
||
// Create marker for the given object | ||
0 boundingBoxReal _object params ["_p0", "_p1"]; | ||
private _size = _p1 vectorDiff _p0 vectorMultiply 0.5 select [0, 2]; | ||
|
||
_marker = createMarker [format [QGVAR(%1), _object call BIS_fnc_netId], _object]; | ||
_marker setMarkerShapeLocal "RECTANGLE"; | ||
_marker setMarkerColorLocal "ColorGrey"; | ||
_marker setMarkerBrushLocal "SolidFull"; | ||
_marker setMarkerSizeLocal _size; | ||
_marker setMarkerDir getDir _object; | ||
_object setVariable [QGVAR(marker), _marker, true]; | ||
|
||
// Delete marker when the object is deleted | ||
private _eventID = _object addEventHandler ["Deleted", { | ||
params ["_object"]; | ||
|
||
deleteMarker (_object getVariable [QGVAR(marker), ""]); | ||
}]; | ||
|
||
_object setVariable [QGVAR(eventID), _eventID]; | ||
} else { | ||
if (_marker == "") exitWith {}; | ||
|
||
private _eventID = _object getVariable [QGVAR(eventID), -1]; | ||
_object removeEventHandler ["Deleted", _eventID]; | ||
_object setVariable [QGVAR(marker), nil, true]; | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "\x\zen\addons\building_markers\script_component.hpp" |
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,8 @@ | ||
[ | ||
QGVAR(enabled), | ||
"CHECKBOX", | ||
[LSTRING(Enabled), LSTRING(Enabled_Description)], | ||
[ELSTRING(main,DisplayName), LSTRING(DisplayName)], | ||
false, | ||
false | ||
] call CBA_fnc_addSetting; |
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,17 @@ | ||
#define COMPONENT building_markers | ||
#define COMPONENT_BEAUTIFIED Building Markers | ||
#include "\x\zen\addons\main\script_mod.hpp" | ||
|
||
// #define DEBUG_MODE_FULL | ||
// #define DISABLE_COMPILE_CACHE | ||
// #define ENABLE_PERFORMANCE_COUNTERS | ||
|
||
#ifdef DEBUG_ENABLED_EDITOR | ||
#define DEBUG_MODE_FULL | ||
#endif | ||
|
||
#ifdef DEBUG_SETTINGS_EDITOR | ||
#define DEBUG_SETTINGS DEBUG_SETTINGS_EDITOR | ||
#endif | ||
|
||
#include "\x\zen\addons\main\script_macros.hpp" |
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,20 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project name="ZEN"> | ||
<Package name="Building_Markers"> | ||
<Key ID="STR_ZEN_Building_Markers_DisplayName"> | ||
<English>Building Markers</English> | ||
</Key> | ||
<Key ID="STR_ZEN_Building_Markers_Enabled"> | ||
<English>Enable Automatic Building Markers</English> | ||
</Key> | ||
<Key ID="STR_ZEN_Building_Markers_Enabled_Description"> | ||
<English>Enables automatically creating grey rectangle area markers (similarly to terrain structures) for buildings placed through Zeus.</English> | ||
</Key> | ||
<Key ID="STR_ZEN_Building_Markers_BuildingMarker"> | ||
<English>Building Marker</English> | ||
</Key> | ||
<Key ID="STR_ZEN_Building_Markers_BuildingMarker_Tooltip"> | ||
<English>Adds a grey rectangle area marker for the building, similarly to terrain structures.</English> | ||
</Key> | ||
</Package> | ||
</Project> |
Oops, something went wrong.