Add Marker Flags (#8696)

* add marker flags

* minor cleanup

* use pictures for actions

* check canDig

* review changes

* Update fnc_placeFlag.sqf

* fix hiddenSelectionsTextures

* Update addons/marker_flags/functions/fnc_pickUpFlag.sqf

Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com>

* Cache flag list at pre-start

* Add model for flag pole

* Pass item name to pickUpFlag via action

* Update addons/marker_flags/stringtable.xml

Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com>

Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com>
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com>
This commit is contained in:
Brett 2022-05-09 19:28:10 -06:00 committed by GitHub
parent 27c5464654
commit 6851183e1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 515 additions and 0 deletions

View File

@ -0,0 +1 @@
z\ace\addons\marker_flags

View File

@ -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));
};
};

View File

@ -0,0 +1,51 @@
class CfgVehicles {
class Man;
class CAManBase: Man {
class ACE_SelfActions {
class ACE_Equipment {
class ADDON {
displayName = CSTRING(ActionPlace);
condition = QUOTE(_player call FUNC(canPlace));
insertChildren = QUOTE(_this call FUNC(addActions));
};
};
};
};
class FlagMarker_01_F;
class GVAR(white): FlagMarker_01_F {
scope = 2;
scopeCurator = 2;
author = ECSTRING(common,ACETeam);
displayName = CSTRING(white);
hiddenSelectionsTextures[] = {"#(argb,8,8,3)color(1,1,1,1,co)"};
};
class GVAR(black): GVAR(white) {
displayName = CSTRING(black);
hiddenSelectionsTextures[] = {"#(argb,8,8,3)color(0,0,0,1,co)"};
};
class GVAR(red): GVAR(white) {
displayName = CSTRING(red);
hiddenSelectionsTextures[] = {"#(argb,8,8,3)color(1,0,0,1,co)"};
};
class GVAR(green): GVAR(white) {
displayName = CSTRING(green);
hiddenSelectionsTextures[] = {"#(argb,8,8,3)color(0,1,0,1,co)"};
};
class GVAR(blue): GVAR(white) {
displayName = CSTRING(blue);
hiddenSelectionsTextures[] = {"#(argb,8,8,3)color(0,0,1,1,co)"};
};
class GVAR(yellow): GVAR(white) {
displayName = CSTRING(yellow);
hiddenSelectionsTextures[] = {"#(argb,8,8,3)color(1,1,0,1,co)"};
};
class GVAR(orange): GVAR(white) {
displayName = CSTRING(orange);
hiddenSelectionsTextures[] = {"#(argb,8,8,3)color(1,0.5,0,1,co)"};
};
class GVAR(purple): GVAR(white) {
displayName = CSTRING(purple);
hiddenSelectionsTextures[] = {"#(argb,8,8,3)color(0.5,0,0.5,1,co)"};
};
};

View File

@ -0,0 +1,55 @@
class CfgWeapons {
class ACE_ItemCore;
class CBA_MiscItem_ItemInfo;
class GVAR(white): ACE_ItemCore {
GVAR(vehicle) = GVAR(white);
author = ECSTRING(common,ACETeam);
scope = 2;
displayName = CSTRING(white);
model = QPATHTOF(data\ace_markerpole.p3d);
picture = QPATHTOF(ui\white_ca.paa);
icon = "iconObject_1x10";
mapSize = 0.2;
class ItemInfo: CBA_MiscItem_ItemInfo {
mass = 1;
};
};
class GVAR(black): GVAR(white) {
GVAR(vehicle) = GVAR(black);
displayName = CSTRING(black);
picture = QPATHTOF(ui\black_ca.paa);
};
class GVAR(red): GVAR(white) {
GVAR(vehicle) = GVAR(red);
displayName = CSTRING(red);
picture = QPATHTOF(ui\red_ca.paa);
};
class GVAR(green): GVAR(white) {
GVAR(vehicle) = GVAR(green);
displayName = CSTRING(green);
picture = QPATHTOF(ui\green_ca.paa);
};
class GVAR(blue): GVAR(white) {
GVAR(vehicle) = GVAR(blue);
displayName = CSTRING(blue);
picture = QPATHTOF(ui\blue_ca.paa);
};
class GVAR(yellow): GVAR(white) {
GVAR(vehicle) = GVAR(yellow);
displayName = CSTRING(yellow);
picture = QPATHTOF(ui\yellow_ca.paa);
};
class GVAR(orange): GVAR(white) {
GVAR(vehicle) = GVAR(orange);
displayName = CSTRING(orange);
picture = QPATHTOF(ui\orange_ca.paa);
};
class GVAR(purple): GVAR(white) {
GVAR(vehicle) = GVAR(purple);
displayName = CSTRING(purple);
picture = QPATHTOF(ui\purple_ca.paa);
};
};

View File

@ -0,0 +1,5 @@
PREP(addActions);
PREP(canPlace);
PREP(getFlags);
PREP(pickUpFlag);
PREP(placeFlag);

View File

@ -0,0 +1,22 @@
#include "script_component.hpp"
if (!hasInterface) exitWith {};
private _weapons = (call (uiNamespace getVariable [QGVAR(flagItems), {[]}])) apply {configFile >> "CfgWeapons" >> _x};
{
private _name = configName _x;
private _vehicle = getText (_x >> QGVAR(vehicle));
GVAR(flagCache) set [_name, _vehicle];
private _action = [
QGVAR(pickup),
LLSTRING(ActionPickUp),
"",
{call FUNC(pickUpFlag)},
{[_player, _target, []] call EFUNC(common,canInteractWith)},
{},
[_name]
] call EFUNC(interact_menu,createAction);
[_vehicle, 0, ["ACE_MainActions"], _action] call EFUNC(interact_menu,addActionToClass);
} forEach _weapons;

View File

@ -0,0 +1,13 @@
#include "script_component.hpp"
ADDON = false;
PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;
#include "initSettings.sqf"
GVAR(flagCache) = createHashMap;
ADDON = true;

View File

@ -0,0 +1,6 @@
#include "script_component.hpp"
#include "XEH_PREP.hpp"
private _weapons = (configProperties [configfile >> "CfgWeapons", QUOTE(isClass _x && (isText (_x >> QQGVAR(vehicle)))), true]) apply {configName _x};
uiNamespace setVariable [QGVAR(flagItems), compileFinal str _weapons];

View File

@ -0,0 +1,37 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
units[] = {
QGVAR(white),
QGVAR(black),
QGVAR(red),
QGVAR(green),
QGVAR(blue),
QGVAR(yellow),
QGVAR(orange),
QGVAR(purple)
};
weapons[] = {
QGVAR(white),
QGVAR(black),
QGVAR(red),
QGVAR(green),
QGVAR(blue),
QGVAR(yellow),
QGVAR(orange),
QGVAR(purple)
};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_interact_menu"};
author = ECSTRING(common,ACETeam);
authors[] = {"Brett Mayson"};
url = ECSTRING(main,URL);
VERSION_CONFIG;
};
};
#include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp"
#include "CfgWeapons.hpp"

View File

@ -0,0 +1,79 @@
ambient[]={1,1,1,1};
diffuse[]={1,1,1,1};
forcedDiffuse[]={0,0,0,0};
emmisive[]={0,0,0,1};
specular[]={0.01,0.01,0.01,1}; //amount of glossiness - the higher the number, the higher the glossiness
specularPower=500; //area of glossiness - the higher the number, the smaller the area
PixelShaderID="Super";
VertexShaderID="Super";
class Stage1 {
texture="#(rgb,1,1,1)color(0.5,0.5,1,1)";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage2 {
texture="#(argb,8,8,3)color(0.5,0.5,0.5,1,dt)";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage3 {
texture="#(argb,8,8,3)color(0,0,0,0,mc)";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage4 {
texture="#(argb,8,8,3)color(1,1,1,1,as)";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,1};
pos[]={0,0,1};
};
};
class Stage5 {
texture="#(rgb,1,1,1)color(0.2,0.2,1,1)";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage6 {
texture="#(ai,64,64,1)fresnel(4.7,1.2)";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,1};
pos[]={0,0,0};
};
};
class Stage7 {
texture="a3\data_f\env_land_ca.paa";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,1};
pos[]={0,0,0};
};
};

Binary file not shown.

View File

@ -0,0 +1,39 @@
#include "script_component.hpp"
/*
* Author: Brett Mayson
* Adds the child actions for placing flags.
*
* Arguments:
* 0: Player <OBJECT>
*
* Return Value:
* Actions <ARRAY>
*
* Example:
* [player] call ace_marker_flags_fnc_addActions
*
* Public: No
*/
params ["_unit"];
private _actions = [];
{
private _config = configFile >> "CfgWeapons" >> _x;
_actions pushBack [
[
_x,
getText (_config >> "displayName"),
getText (_config >> "picture"),
{[_this select 0, _this select 2] call FUNC(placeFlag)},
{true},
{},
_x
] call EFUNC(interact_menu,createAction),
[],
_unit
];
} forEach ([_unit] call FUNC(getFlags));
_actions

View File

@ -0,0 +1,20 @@
#include "script_component.hpp"
/*
* Authors: Brett Mayson
* Checks if a flag can be placed by a unit.
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* Can place <BOOL>
*
* Example:
* player call ace_marker_flags_fnc_canPlace
*
* Public: No
*/
params ["_unit"];
GVAR(placeAnywhere) || {_unit call EFUNC(common,canDig)}

View File

@ -0,0 +1,20 @@
#include "script_component.hpp"
/*
* Authors: Brett Mayson
* Get the placeable flags in the unit's inventory.
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* flags <ARRAY>
*
* Example:
* [_unit] call ace_marker_flags_fnc_getFlags
*
* Public: No
*/
params ["_unit"];
(_unit call EFUNC(common,uniqueItems)) arrayIntersect keys GVAR(flagCache)

View File

@ -0,0 +1,28 @@
#include "script_component.hpp"
/*
* Author: Brett Mayson
* Places a flag in front of the unit.
*
* Arguments:
* 0: Flag <OBJECT>
* 1: Unit <OBJECT>
* 2: Action Args <ARRAY>
*
* Return Value:
* Nothing
*
* Example:
* [_flag,player,"x"] call ace_marker_flags_fnc_pickupFlag
*
* Public: No
*/
params [["_flag", objNull, [objNull]], ["_unit", objNull, [objNull]], ["_args", [""], [[]]]];
private _itemName = _args # 0;
TRACE_3("pickupFlag",_unit,_flag,_itemName);
if (isNull _flag) exitWith {};
[_unit, "PutDown"] call EFUNC(common,doGesture);
deleteVehicle _flag;
[_unit, _itemName] call EFUNC(common,addToInventory);

View File

@ -0,0 +1,27 @@
#include "script_component.hpp"
/*
* Author: Brett Mayson
* Places a flag in front of the unit.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Flag <STRING>
*
* Return Value:
* Flag <OBJECT>
*
* Example:
* [player, "ace_marker_flags_white"] call ace_marker_flags_fnc_placeFlag
*
* Public: No
*/
params [["_unit", objNull, [objNull]], ["_flag", QGVAR(white), [""]]];
_unit removeItem _flag;
_flag = GVAR(flagCache) get _flag; // convert to vehicle type
private _pos = _unit modelToWorld [0, 1, 0];
private _flag = _flag createVehicle _pos;
_flag setPos _pos;
[QGVAR(placed), [_unit, _flag]] call CBA_fnc_localEvent;
[_unit, "PutDown"] call EFUNC(common,doGesture);

View File

@ -0,0 +1 @@
#include "\z\ace\addons\marker_flags\script_component.hpp"

View File

@ -0,0 +1,9 @@
private _category = [LELSTRING(common,categoryUncategorized), LLSTRING(DisplayName_Settings)];
[
QGVAR(placeAnywhere), "CHECKBOX",
[LSTRING(PlaceAnywhere_DisplayName), LSTRING(PlaceAnywhere_Description)],
_category,
false, // default value
true // isGlobal
] call CBA_fnc_addSetting;

View File

@ -0,0 +1,17 @@
#define COMPONENT marker_flags
#define COMPONENT_BEAUTIFIED Marker Flags
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_MARKER_FLAGS
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_ENABLED_MARKER_FLAGS
#define DEBUG_SETTINGS DEBUG_ENABLED_MARKER_FLAGS
#endif
#include "\z\ace\addons\main\script_macros.hpp"

View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<Project name="ACE">
<Package name="Marker_Flags">
<Key ID="STR_ACE_Marker_Flags_DisplayName_Settings">
<English>Marker Flags</English>
<German>Markierungsfahnen</German>
</Key>
<Key ID="STR_ACE_Marker_Flags_PlaceAnywhere_DisplayName">
<English>Place Anywhere</English>
<German>Überall platzieren</German>
</Key>
<Key ID="STR_ACE_Marker_Flags_PlaceAnywhere_Description">
<English>Place marker flag anywhere regardless of surface.</English>
</Key>
<Key ID="STR_ACE_Marker_Flags_ActionPlace">
<English>Place Flag</English>
<German>Flagge platzieren</German>
</Key>
<Key ID="STR_ACE_Marker_Flags_ActionPickUp">
<English>Pick Up</English>
<Chinese>提取點</Chinese>
<French>Récupérer</French>
<Spanish>Recoger</Spanish>
<Italian>Recupera</Italian>
<Polish>Podnieś</Polish>
<Russian>Подобрать</Russian>
<Czech>Vyzvednutí</Czech>
<Portuguese>Pegar</Portuguese>
<Korean>확보</Korean>
<Chinesesimp>提取点</Chinesesimp>
<Japanese>受け取り</Japanese>
<Turkish>Al</Turkish>
<German>Aufheben</German>
</Key>
<Key ID="STR_ACE_Marker_Flags_white">
<English>Marker Flag (White)</English>
<German>Markierungsfahne (Weiß)</German>
</Key>
<Key ID="STR_ACE_Marker_Flags_black">
<English>Marker Flag (Black)</English>
<German>Markierungsfahne (Schwarz)</German>
</Key>
<Key ID="STR_ACE_Marker_Flags_red">
<English>Marker Flag (Red)</English>
<German>Markierungsfahne (Rot)</German>
</Key>
<Key ID="STR_ACE_Marker_Flags_green">
<English>Marker Flag (Green)</English>
<German>Markierungsfahne (Grün)</German>
</Key>
<Key ID="STR_ACE_Marker_Flags_blue">
<English>Marker Flag (Blue)</English>
<German>Markierungsfahne (Blau)</German>
</Key>
<Key ID="STR_ACE_Marker_Flags_yellow">
<English>Marker Flag (Yellow)</English>
<German>Markierungsfahne (Gelb)</German>
</Key>
<Key ID="STR_ACE_Marker_Flags_orange">
<English>Marker Flag (Orange)</English>
<German>Markierungsfahne (Orange)</German>
</Key>
<Key ID="STR_ACE_Marker_Flags_purple">
<English>Marker Flag (Purple)</English>
<German>Markierungsfahne (Lila)</German>
</Key>
</Package>
</Project>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.