diff --git a/addons/flags/$PBOPREFIX$ b/addons/flags/$PBOPREFIX$ new file mode 100644 index 0000000000..3206270d9f --- /dev/null +++ b/addons/flags/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\flags \ No newline at end of file diff --git a/addons/flags/CfgEventHandlers.hpp b/addons/flags/CfgEventHandlers.hpp new file mode 100644 index 0000000000..b468b9e8b5 --- /dev/null +++ b/addons/flags/CfgEventHandlers.hpp @@ -0,0 +1,23 @@ +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)); + }; +}; + +class Extended_DisplayLoad_EventHandlers { + class RscDisplayMission { + ADDON = QUOTE(_this call COMPILE_SCRIPT(XEH_missionDisplayLoad)); + }; +}; diff --git a/addons/flags/CfgVehicles.hpp b/addons/flags/CfgVehicles.hpp new file mode 100644 index 0000000000..d04eae2265 --- /dev/null +++ b/addons/flags/CfgVehicles.hpp @@ -0,0 +1,20 @@ +class CfgVehicles { + class Man; + class CAManBase: Man { + class ACE_SelfActions { + class ACE_Equipment { + class ADDON { + displayName = CSTRING(action); + condition = QUOTE(_player call FUNC(hasFlag)); + insertChildren = QUOTE(_this call FUNC(addActions)); + + class GVAR(furlFlag) { + displayName = CSTRING(furlFlag); + condition = QUOTE(_player call FUNC(carriesFlag)); + statement = QUOTE(_player call FUNC(furlFlag)); + }; + }; + }; + }; + }; +}; diff --git a/addons/flags/CfgWeapons.hpp b/addons/flags/CfgWeapons.hpp new file mode 100644 index 0000000000..8e73c1cd87 --- /dev/null +++ b/addons/flags/CfgWeapons.hpp @@ -0,0 +1,53 @@ +class CfgWeapons { + class ACE_ItemCore; + class CBA_MiscItem_ItemInfo; + + class GVAR(white): ACE_ItemCore { + scope = 2; + author = ECSTRING(common,ACETeam); + descriptionShort = CSTRING(description); + descriptionUse = CSTRING(description); + displayName = CSTRING(white); + picture = QPATHTOF(data\ui\flags\red_item_icon.paa); + + GVAR(texture) = "\a3\data_f\flags\flag_white_co.paa"; + GVAR(actionIconPlace) = QPATHTOF(data\ui\flags\white_icon.paa); + GVAR(actionIconCarry) = QPATHTOF(data\ui\flags\white_carry_icon.paa); + + class ItemInfo: CBA_MiscItem_ItemInfo { + mass = 3; + }; + }; + class GVAR(red): GVAR(white) { + displayName = CSTRING(red); + picture = QPATHTOF(data\ui\flags\red_item_icon.paa); + + GVAR(texture) = "\a3\data_f\flags\flag_red_co.paa"; + GVAR(actionIconPlace) = QPATHTOF(data\ui\flags\red_place_icon.paa); + GVAR(actionIconCarry) = QPATHTOF(data\ui\flags\red_carry_icon.paa); + }; + class GVAR(blue): GVAR(white) { + displayName = CSTRING(blue); + picture = QPATHTOF(data\ui\flags\blue_item_icon.paa); + + GVAR(texture) = "\a3\data_f\flags\Flag_blue_co.paa"; + GVAR(actionIconPlace) = QPATHTOF(data\ui\flags\blue_place_icon.paa); + GVAR(actionIconCarry) = QPATHTOF(data\ui\flags\blue_carry_icon.paa); + }; + class GVAR(green): GVAR(white) { + displayName = CSTRING(green); + picture = QPATHTOF(data\ui\flags\green_item_icon.paa); + + GVAR(texture) = "\a3\data_f\flags\flag_green_co.paa"; + GVAR(actionIconPlace) = QPATHTOF(data\ui\flags\green_place_icon.paa); + GVAR(actionIconCarry) = QPATHTOF(data\ui\flags\green_carry_icon.paa); + }; + class GVAR(yellow): GVAR(white) { + displayName = CSTRING(yellow); + picture = QPATHTOF(data\ui\flags\yellow_item_icon.paa); + + GVAR(texture) = QPATHTOF(data\Flag_yellow_co.paa); + GVAR(actionIconPlace) = QPATHTOF(data\ui\flags\yellow_place_icon.paa); + GVAR(actionIconCarry) = QPATHTOF(data\ui\flags\yellow_carry_icon.paa); + }; +}; diff --git a/addons/flags/README.md b/addons/flags/README.md new file mode 100644 index 0000000000..b06c5bdee6 --- /dev/null +++ b/addons/flags/README.md @@ -0,0 +1,4 @@ +ace_flags +=================== + +Adds flags feature. diff --git a/addons/flags/XEH_PREP.hpp b/addons/flags/XEH_PREP.hpp new file mode 100644 index 0000000000..df3a939c76 --- /dev/null +++ b/addons/flags/XEH_PREP.hpp @@ -0,0 +1,8 @@ +PREP(addActions); +PREP(carriesFlag); +PREP(carryFlag); +PREP(furlFlag); +PREP(getFlags); +PREP(handleScrollWheel); +PREP(pickupFlag); +PREP(placeFlag); diff --git a/addons/flags/XEH_missionDisplayLoad.sqf b/addons/flags/XEH_missionDisplayLoad.sqf new file mode 100644 index 0000000000..fc336ad799 --- /dev/null +++ b/addons/flags/XEH_missionDisplayLoad.sqf @@ -0,0 +1,17 @@ +#include "script_component.hpp" + +if (!hasInterface) exitWith {}; + +params ["_display"]; + +_display displayAddEventHandler ["MouseZChanged", { + params ["", "_scroll"]; + [_scroll] call FUNC(handleScrollWheel); +}]; + +_display displayAddEventHandler ["MouseButtonDown", { + params ["", "_button"]; + if (GVAR(isPlacing) isNotEqualTo PLACE_WAITING) exitWith {false}; + if (_button isNotEqualTo 1) exitWith {false}; // 1 = Left mouse button + GVAR(isPlacing) = PLACE_CANCEL; +}]; diff --git a/addons/flags/XEH_postInit.sqf b/addons/flags/XEH_postInit.sqf new file mode 100644 index 0000000000..64978b95e6 --- /dev/null +++ b/addons/flags/XEH_postInit.sqf @@ -0,0 +1,41 @@ +#include "script_component.hpp" + +if (!hasinterface) exitWith {}; + +GVAR(isPlacing) = PLACE_CANCEL; +["ace_interactMenuOpened", {GVAR(isPlacing) = PLACE_CANCEL;}] call CBA_fnc_addEventHandler; + +[QGVAR(flagPlaced), { + params ["_unit", "_item", "_flag"]; + + (GVAR(cache) get _item) params ["_displayName"]; + + private _pickupFlag = [ + QGVAR(pickup), + format [LLSTRING(pickup), _displayName], + QPATHTOF(data\ui\flags\pickup_icon.paa), + { + params ["_flag", "_unit", "_args"]; + _args params ["_item"]; + + [_unit, _item, _flag] call FUNC(pickupFlag); + }, + {true}, + {}, + [_item], + [0, 0, 0], + PICKUP_RADIUS + ] call ace_interact_menu_fnc_createAction; + [_flag, 0, [], _pickupFlag] call ace_interact_menu_fnc_addActionToObject; +}] call CBA_fnc_addEventHandler; + +private _flagItems = (call (uiNamespace getVariable [QGVAR(allFlagItems), {[]}])) apply {configFile >> "CfgWeapons" >> _x}; +{ + private _name = configName _x; + private _displayName = getText (_x >> "displayName"); + private _texture = getText (_x >> QGVAR(texture)); + private _actionIconPlace = getText (_x >> QGVAR(actionIconPlace)); + private _actionIconCarry = getText (_x >> QGVAR(actionIconCarry)); + + GVAR(flagItemCache) set [_name, [_displayName, _texture, _actionIconPlace, _actionIconCarry]]; +} forEach _flagItems; diff --git a/addons/flags/XEH_preInit.sqf b/addons/flags/XEH_preInit.sqf new file mode 100644 index 0000000000..e5ad22884a --- /dev/null +++ b/addons/flags/XEH_preInit.sqf @@ -0,0 +1,11 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP_RECOMPILE_START; +#include "XEH_PREP.hpp" +PREP_RECOMPILE_END; + +ADDON = true; + +GVAR(cache) = createHashMap; diff --git a/addons/flags/XEH_preStart.sqf b/addons/flags/XEH_preStart.sqf new file mode 100644 index 0000000000..f6cd54734c --- /dev/null +++ b/addons/flags/XEH_preStart.sqf @@ -0,0 +1,6 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" + +private _flagItems = (configProperties [configfile >> "CfgWeapons", QUOTE(isClass _x && (isText (_x >> QQGVAR(texture)))), true]) apply {configName _x}; +uiNamespace setVariable [QGVAR(allFlagItems), compileFinal str _flagItems]; diff --git a/addons/flags/config.cpp b/addons/flags/config.cpp new file mode 100644 index 0000000000..a6c8084e86 --- /dev/null +++ b/addons/flags/config.cpp @@ -0,0 +1,25 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = { + QGVAR(white), + QGVAR(red), + QGVAR(blue), + QGVAR(green), + QGVAR(yellow) + }; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common", "ace_interact_menu", "ace_interaction"}; + author = ECSTRING(common,ACETeam); + authors[] = {"Timi007"}; + url = ECSTRING(main,URL); + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" +#include "CfgWeapons.hpp" diff --git a/addons/flags/data/Flag_yellow_co.paa b/addons/flags/data/Flag_yellow_co.paa new file mode 100644 index 0000000000..758ca6086f Binary files /dev/null and b/addons/flags/data/Flag_yellow_co.paa differ diff --git a/addons/flags/data/ui/flags/blue_carry_icon.paa b/addons/flags/data/ui/flags/blue_carry_icon.paa new file mode 100644 index 0000000000..3e70a5e20b Binary files /dev/null and b/addons/flags/data/ui/flags/blue_carry_icon.paa differ diff --git a/addons/flags/data/ui/flags/blue_item_icon.paa b/addons/flags/data/ui/flags/blue_item_icon.paa new file mode 100644 index 0000000000..9bb3312aea Binary files /dev/null and b/addons/flags/data/ui/flags/blue_item_icon.paa differ diff --git a/addons/flags/data/ui/flags/blue_place_icon.paa b/addons/flags/data/ui/flags/blue_place_icon.paa new file mode 100644 index 0000000000..0d2a4b7261 Binary files /dev/null and b/addons/flags/data/ui/flags/blue_place_icon.paa differ diff --git a/addons/flags/data/ui/flags/furl_icon.paa b/addons/flags/data/ui/flags/furl_icon.paa new file mode 100644 index 0000000000..0688e0aac2 Binary files /dev/null and b/addons/flags/data/ui/flags/furl_icon.paa differ diff --git a/addons/flags/data/ui/flags/green_carry_icon.paa b/addons/flags/data/ui/flags/green_carry_icon.paa new file mode 100644 index 0000000000..9a362a0bba Binary files /dev/null and b/addons/flags/data/ui/flags/green_carry_icon.paa differ diff --git a/addons/flags/data/ui/flags/green_item_icon.paa b/addons/flags/data/ui/flags/green_item_icon.paa new file mode 100644 index 0000000000..eb8e2f9b92 Binary files /dev/null and b/addons/flags/data/ui/flags/green_item_icon.paa differ diff --git a/addons/flags/data/ui/flags/green_place_icon.paa b/addons/flags/data/ui/flags/green_place_icon.paa new file mode 100644 index 0000000000..d63d577e1a Binary files /dev/null and b/addons/flags/data/ui/flags/green_place_icon.paa differ diff --git a/addons/flags/data/ui/flags/pickup_icon.paa b/addons/flags/data/ui/flags/pickup_icon.paa new file mode 100644 index 0000000000..271beeab26 Binary files /dev/null and b/addons/flags/data/ui/flags/pickup_icon.paa differ diff --git a/addons/flags/data/ui/flags/red_carry_icon.paa b/addons/flags/data/ui/flags/red_carry_icon.paa new file mode 100644 index 0000000000..72629cb3d7 Binary files /dev/null and b/addons/flags/data/ui/flags/red_carry_icon.paa differ diff --git a/addons/flags/data/ui/flags/red_item_icon.paa b/addons/flags/data/ui/flags/red_item_icon.paa new file mode 100644 index 0000000000..9b5fafa7f0 Binary files /dev/null and b/addons/flags/data/ui/flags/red_item_icon.paa differ diff --git a/addons/flags/data/ui/flags/red_place_icon.paa b/addons/flags/data/ui/flags/red_place_icon.paa new file mode 100644 index 0000000000..bb2ad11a22 Binary files /dev/null and b/addons/flags/data/ui/flags/red_place_icon.paa differ diff --git a/addons/flags/data/ui/flags/white_icon.paa b/addons/flags/data/ui/flags/white_icon.paa new file mode 100644 index 0000000000..f6797160b3 Binary files /dev/null and b/addons/flags/data/ui/flags/white_icon.paa differ diff --git a/addons/flags/data/ui/flags/yellow_carry_icon.paa b/addons/flags/data/ui/flags/yellow_carry_icon.paa new file mode 100644 index 0000000000..3791cd16ee Binary files /dev/null and b/addons/flags/data/ui/flags/yellow_carry_icon.paa differ diff --git a/addons/flags/data/ui/flags/yellow_item_icon.paa b/addons/flags/data/ui/flags/yellow_item_icon.paa new file mode 100644 index 0000000000..8343dc07eb Binary files /dev/null and b/addons/flags/data/ui/flags/yellow_item_icon.paa differ diff --git a/addons/flags/data/ui/flags/yellow_place_icon.paa b/addons/flags/data/ui/flags/yellow_place_icon.paa new file mode 100644 index 0000000000..b51711e34d Binary files /dev/null and b/addons/flags/data/ui/flags/yellow_place_icon.paa differ diff --git a/addons/flags/functions/fnc_addActions.sqf b/addons/flags/functions/fnc_addActions.sqf new file mode 100644 index 0000000000..e40c1f0631 --- /dev/null +++ b/addons/flags/functions/fnc_addActions.sqf @@ -0,0 +1,56 @@ +#include "script_component.hpp" +/* + * Author: Timi007 + * Adds the child actions for placing and carring flags. + * + * Arguments: + * 0: Player + * + * Return Value: + * Actions + * + * Example: + * [player] call ace_flags_fnc_addActions + * + * Public: No + */ + +params ["_player"]; + +private _actions = []; + +{ + (GVAR(flagItemCache) get _x) params ["_displayName", "_texture", "_actionIconPlace", "_actionIconCarry"]; + + // Place flag + _actions pushBack [ + [ + "place_" + _x, + format [LSTRING(place), _displayName], + _actionIconPlace, + {[_this select 0, _this select 2] call FUNC(placeFlag)}, + {true}, + {}, + _x + ] call EFUNC(interact_menu,createAction), + [], + _player + ]; + + // Carry flag + _actions pushBack [ + [ + "carry_" + _x, + format [LSTRING(carry), _displayName], + _actionIconCarry, + {[_this select 0, _this select 2] call FUNC(carryFlag)}, + {!([_this select 1] call FUNC(carriesFlag))}, // Should not carry flag already + {}, + _x + ] call EFUNC(interact_menu,createAction), + [], + _player + ]; +} forEach ([_player] call FUNC(getFlags)); + +_actions diff --git a/addons/flags/functions/fnc_carriesFlag.sqf b/addons/flags/functions/fnc_carriesFlag.sqf new file mode 100644 index 0000000000..a82397515c --- /dev/null +++ b/addons/flags/functions/fnc_carriesFlag.sqf @@ -0,0 +1,21 @@ +#include "script_component.hpp" +/* + * Author: Timi007 + * Checks if the unit is carrying a flag. + * + * Arguments: + * 0: Unit + * + * Return Value: + * True if unit is carrying a flag; otherwise flase + * + * Example: + * [player] call ace_flags_fnc_carriesFlag + * + * Public: No + */ + +params ["_unit"]; + +(_unit getVariable [QGVAR(carryingFlag), ""] isNotEqualTo "") && +{(getForcedFlagTexture _unit) isNotEqualTo ""} diff --git a/addons/flags/functions/fnc_carryFlag.sqf b/addons/flags/functions/fnc_carryFlag.sqf new file mode 100644 index 0000000000..f66030a9ca --- /dev/null +++ b/addons/flags/functions/fnc_carryFlag.sqf @@ -0,0 +1,37 @@ +#include "script_component.hpp" +/* + * Author: Timi007 + * Attaches flag to the back of the unit and removes his flag item. + * + * Arguments: + * 0: Unit + * 1: Flag item + * + * Return Value: + * Nothing + * + * Example: + * [player, "ace_flags_white"] call ace_flags_fnc_carryFlag + * + * Public: No + */ + +params ["_unit", "_item"]; + +// Arma needs a flag proxy and some modded uniforms don't have them. +// If we temporarily change the uniform to a vanilla one we can work around this problem. +private _loadout = getUnitLoadout _unit; +_unit forceAddUniform "U_B_CombatUniform_mcam"; + +private _texture = (GVAR(flagItemCache) get _item) param [1, ""]; +_unit forceFlagTexture _texture; + +// We need to change loadout in the next frame otherwise it will not work +[{ + params ["_unit", "_item", "_loadout"]; + + _unit setUnitLoadout _loadout; + + _unit setVariable [QGVAR(carryingFlag), _item, true]; + _unit removeItem _item; +}, [_unit, _item, _loadout]] call CBA_fnc_execNextFrame; diff --git a/addons/flags/functions/fnc_furlFlag.sqf b/addons/flags/functions/fnc_furlFlag.sqf new file mode 100644 index 0000000000..2325a03f26 --- /dev/null +++ b/addons/flags/functions/fnc_furlFlag.sqf @@ -0,0 +1,26 @@ +#include "script_component.hpp" +/* + * Author: Timi007 + * Stops carrying flag and add flag item to unit. + * + * Arguments: + * 0: Unit + * + * Return Value: + * Nothing + * + * Example: + * [player] call ace_flags_fnc_furlFlag + * + * Public: No + */ + +params ["_unit"]; + +// Stop carrying flag and add flag item to unit. +_item = _unit getVariable [QGVAR(carryingFlag), ""]; +_unit setVariable [QGVAR(carryingFlag), nil, true]; + +_unit forceFlagTexture ""; // Remove flag + +[_unit, _item] call EFUNC(common,addToInventory); diff --git a/addons/flags/functions/fnc_getFlags.sqf b/addons/flags/functions/fnc_getFlags.sqf new file mode 100644 index 0000000000..b43966bb3d --- /dev/null +++ b/addons/flags/functions/fnc_getFlags.sqf @@ -0,0 +1,20 @@ +#include "script_component.hpp" +/* + * Author: Timi007 + * Get the placeable and carryable flags in the unit's inventory. + * + * Arguments: + * 0: Unit + * + * Return Value: + * Flag items + * + * Example: + * [player] call ace_flags_fnc_getFlags + * + * Public: No + */ + +params ["_unit"]; + +(_unit call EFUNC(common,uniqueItems)) arrayIntersect keys GVAR(flagItemCache) diff --git a/addons/flags/functions/fnc_handleScrollWheel.sqf b/addons/flags/functions/fnc_handleScrollWheel.sqf new file mode 100644 index 0000000000..b5ff1afbea --- /dev/null +++ b/addons/flags/functions/fnc_handleScrollWheel.sqf @@ -0,0 +1,33 @@ +#include "script_component.hpp" +/* + * Author: Timi007 + * Handles the flag object height. + * + * Arguments: + * 0: Scroll amount + * + * Return Value: + * Handled + * + * Example: + * [5] call ace_flags_fnc_handleScrollWheel + * + * Public: No + */ + +params ["_scrollAmount"]; + +if (GVAR(isPlacing) isNotEqualTo PLACE_WAITING) exitWith {false}; + +// Move object height 10cm per scroll +GVAR(objectHeight) = GVAR(objectHeight) + (_scrollAmount * 0.1); + +if (GVAR(objectHeight) < MIN_HEIGHT) then { + GVAR(objectHeight) = MIN_HEIGHT; +}; + +if (GVAR(objectHeight) > MAX_HEIGHT) then { + GVAR(objectHeight) = MAX_HEIGHT; +}; + +true diff --git a/addons/flags/functions/fnc_pickupFlag.sqf b/addons/flags/functions/fnc_pickupFlag.sqf new file mode 100644 index 0000000000..84677b7580 --- /dev/null +++ b/addons/flags/functions/fnc_pickupFlag.sqf @@ -0,0 +1,30 @@ +#include "script_component.hpp" +/* + * Author: Timi007 + * Picks up flag and adds item to unit. + * + * Arguments: + * 0: Unit + * 1: Flag item + * 2: Flag pole (gets deleted later) + * + * Return Value: + * Nothing + * + * Example: + * [player] call ace_flags_fnc_pickupFlag + * + * Public: No + */ + +params ["_unit", "_item", "_flag"]; + +[_unit, "PutDown"] call EFUNC(common,doGesture); + +[{((animationState _unit) select [25,7]) isEqualTo "putdown"}, { + params ["_unit", "_item", "_flag"]; + + [_unit, _item] call EFUNC(common,addToInventory); + + deleteVehicle _flag; +}, _this] call CBA_fnc_waitUntilAndExecute; diff --git a/addons/flags/functions/fnc_placeFlag.sqf b/addons/flags/functions/fnc_placeFlag.sqf new file mode 100644 index 0000000000..d3b7124e41 --- /dev/null +++ b/addons/flags/functions/fnc_placeFlag.sqf @@ -0,0 +1,80 @@ +#include "script_component.hpp" +/* + * Author: Timi007 + * Starts the placing process of the flag for the player. + * Flags can be placed with the special flag items. + * + * Arguments: + * 0: Player + * 1: Flag item + * + * Return Value: + * Nothing + * + * Example: + * [player, "ace_flags_white"] call ace_flags_fnc_pickupFlag + * + * Public: No + */ + +params ["_player", "_item"]; + +// Create local object +private _flag = "FlagChecked_F" createVehicle [0, 0, 0]; + +// Set object start height +GVAR(objectHeight) = MIN_HEIGHT; + +GVAR(isPlacing) = PLACE_WAITING; + +(GVAR(flagItemCache) get _x) params ["_flagName"]; + +// Add info dialog for the player which show the controls +private _placeFlagText = format [LLSTRING(place), _flagName]; +[_placeFlagText, LLSTRING(cancel), LLSTRING(adjustHeight)] call EFUNC(interaction,showMouseHint); + +private _mouseClickID = [_player, "DefaultAction", { + GVAR(isPlacing) isEqualTo PLACE_WAITING +}, { + GVAR(isPlacing) = PLACE_APPROVE +}] call EFUNC(common,addActionEventHandler); + +[{ // Start of PFH + params ["_args", "_handle"]; + _args params ["_player", "_item", "_flag", "_mouseClickID"]; + + if (isNull _flag || {!([_player, _flag] call EFUNC(common,canInteractWith))}) then { + GVAR(isPlacing) = PLACE_CANCEL; + }; + + if (GVAR(isPlacing) isNotEqualTo PLACE_WAITING) exitWith { + [_handle] call CBA_fnc_removePerFrameHandler; + call ace_interaction_fnc_hideMouseHint; + [_player, "DefaultAction", _mouseClickID] call EFUNC(common,removeActionEventHandler); + + if (GVAR(isPlacing) isEqualTo PLACE_APPROVE) then { + // End position of the object + + GVAR(isPlacing) = PLACE_CANCEL; + + [_player, "PutDown"] call EFUNC(common,doGesture); + + [{(animationState _player select [25, 7]) isEqualTo "putdown"}, { + params ["_player", "_item", "_flag"]; + + [QGVAR(flagPlaced), [_player, _item, _flag]] call CBA_fnc_globalEventJIP; + [QGVAR(flagPlaced), _flag] call CBA_fnc_removeGlobalEventJIP; + }, [_player, _item, _flag]] call CBA_fnc_waitUntilAndExecute; + } else { + // Action is canceled + deleteVehicle _flag; + }; + }; + + private _pos = ((eyePos _player) vectorAdd ((getCameraViewDirection _player) vectorMultiply FLAG_PLACING_DISTANCE)); + // Adjust height of flag with the scroll wheel + _pos set [2, ((getPosWorld _player) select 2) + GVAR(objectHeight)]; + + _flag setPosWorld _pos; + _flag setDir (getDir _player); +}, 0, [_player, _item, _flag, _mouseClickID]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/flags/functions/script_component.hpp b/addons/flags/functions/script_component.hpp new file mode 100644 index 0000000000..bd6430d339 --- /dev/null +++ b/addons/flags/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\flags\script_component.hpp" diff --git a/addons/flags/script_component.hpp b/addons/flags/script_component.hpp new file mode 100644 index 0000000000..99d6b04d49 --- /dev/null +++ b/addons/flags/script_component.hpp @@ -0,0 +1,28 @@ +#define COMPONENT flags +#define COMPONENT_BEAUTIFIED Flags +#include "\z\ace\addons\main\script_mod.hpp" + +#define DEBUG_MODE_FULL +#define DISABLE_COMPILE_CACHE +// #define ENABLE_PERFORMANCE_COUNTERS + +#ifdef DEBUG_ENABLED_FLAGS + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_FLAGS + #define DEBUG_SETTINGS DEBUG_SETTINGS_FLAGS +#endif + +#include "\z\ace\addons\main\script_macros.hpp" + +#define PLACE_WAITING -1 +#define PLACE_CANCEL 0 +#define PLACE_APPROVE 1 + +#define MIN_HEIGHT -0.5 +#define MAX_HEIGHT 2 + +#define FLAG_PLACING_DISTANCE 2 + +#define PICKUP_RADIUS 2 diff --git a/addons/flags/stringtable.xml b/addons/flags/stringtable.xml new file mode 100644 index 0000000000..ae659ebaa8 --- /dev/null +++ b/addons/flags/stringtable.xml @@ -0,0 +1,61 @@ + + + + + + Flag (White) + Flagge (Weiß) + + + Flag (Red) + Flagge (Rot) + + + Flag (Blue) + Flagge (Blau) + + + Flag (Green) + Flagge (Grün) + + + Flag (Yellow) + Flagge (Gelb) + + + Can be carried or placed. Flags are used to mark a specific point in terrain or units. + Kann getragen oder platziert werden. Flaggen werden zur Kennzeichnung von bestimmten Geländepunkte oder Einheiten eingesetzt. + + + + + Flags + Flaggen + + + Carry %1 + %1 tragen + + + Furl Flag + Flagge einrollen + + + Place %1 + %1 platzieren + + + Pickup %1 + %1 aufnehmen + + + Cancel + Abbrechen + + + Adjust height + Höhe anpassen + + + +