Module for setting

This commit is contained in:
PabstMirror 2015-06-09 00:00:00 -05:00
parent 9d914d655a
commit 7d08469df9
12 changed files with 77 additions and 26 deletions

View File

@ -1,18 +1,16 @@
class ACE_Settings { class ACE_Settings {
class GVAR(canFingerEachOther) {
typeName = "BOOL";
value = 1;
};
class GVAR(maxRange) { class GVAR(maxRange) {
typeName = "SCALAR";
value = 4; value = 4;
typeName = "SCALAR";
displayName = CSTRING(maxRange_displayName);
description = CSTRING(maxRange_description);
}; };
class GVAR(indicatorForSelf) { class GVAR(indicatorForSelf) {
value = 1;
typeName = "BOOL";
isClientSettable = 1;
displayName = CSTRING(indicatorForSelf_name); displayName = CSTRING(indicatorForSelf_name);
description = CSTRING(indicatorForSelf_description); description = CSTRING(indicatorForSelf_description);
isClientSettable = 1;
typeName = "BOOL";
value = 1;
}; };
class GVAR(indicatorColor) { class GVAR(indicatorColor) {
value[] = {0.83, 0.68, 0.21, 0.75}; value[] = {0.83, 0.68, 0.21, 0.75};

View File

@ -0,0 +1,20 @@
class CfgVehicles {
class ACE_Module;
class GVAR(moduleSettings): ACE_Module {
scope = 2;
category = "ACE";
displayName = CSTRING(moduleSettings_displayName);
icon = QUOTE(PATHTOF(UI\Icon_Module_finger_ca.paa));
function = QFUNC(moduleSettings);
isGlobal = 0;
author = ECSTRING(common,ACETeam);
class Arguments {
class maxRange {
displayName = CSTRING(maxRange_displayName);
description = CSTRING(maxRange_description);
typeName = "NUMBER";
defaultValue = 4;
};
};
};
};

View File

@ -1,7 +1,5 @@
#include "script_component.hpp" #include "script_component.hpp"
[QGVAR(fingered), {_this call FUNC(incomingFinger)}] call EFUNC(common,addEventHandler);
if (!hasInterface) exitWith {}; if (!hasInterface) exitWith {};
GVAR(lastFPTime) = -1; GVAR(lastFPTime) = -1;
@ -9,8 +7,10 @@ GVAR(fingersHash) = HASH_CREATE;
GVAR(pfeh_id) = -1; GVAR(pfeh_id) = -1;
["SettingsInitialized", { ["SettingsInitialized", {
//If not enabled, dont't bother adding keybind //If not enabled, dont't bother adding keybind or eventhandler
if (!GVAR(canFingerEachOther)) exitWith {}; if (GVAR(maxRange) <= 0) exitWith {};
[QGVAR(fingered), {_this call FUNC(incomingFinger)}] call EFUNC(common,addEventHandler);
["ACE3 Common", ["ACE3 Common",
QGVAR(finger), QGVAR(finger),

View File

@ -4,6 +4,7 @@ ADDON = false;
PREP(incomingFinger); PREP(incomingFinger);
PREP(keyPress); PREP(keyPress);
PREP(moduleSettings);
PREP(perFrameEH); PREP(perFrameEH);
ADDON = true; ADDON = true;

View File

@ -1,18 +1,18 @@
#include "script_component.hpp" #include "script_component.hpp"
#define RECOMPILE 0
class CfgPatches { class CfgPatches {
class ace_finger { class ADDON {
units[]={}; units[] = {QGVAR(moduleSettings)};
weapons[]={}; weapons[] = {};
requiredVersion = REQUIRED_VERSION; requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common"}; requiredAddons[] = {"ace_common"};
author[]= {"Drill"}; author[] = {"Drill"};
authorUrl = "https://github.com/TheDrill/"; authorUrl = "https://github.com/TheDrill/";
VERSION_CONFIG; VERSION_CONFIG;
}; };
}; };
#include "ACE_Settings.hpp" #include "ACE_Settings.hpp"
#include "CfgEventHandlers.hpp" #include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp"

View File

@ -1,5 +1,5 @@
/* /*
* Author: TheDrill * Author: TheDrill, PabstMirror
* On keypress, point and send position to nearby players * On keypress, point and send position to nearby players
* *
* Arguments: * Arguments:

View File

@ -0,0 +1,20 @@
/*
* Author: PabstMirror
* Module for fingering settings
*
* Arguments:
* 0: The module logic <OBJECT>
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_1(_logic);
if !(isServer) exitWith {};
[_logic, QGVAR(maxRange), "maxRange"] call EFUNC(common,readSettingFromModule);

View File

@ -40,7 +40,7 @@ _iconSize = BASE_SIZE * _fovCorrection;
_drawColor set [3, ((_drawColor select 3) * (_timeLeftToShow / 0.5))]; _drawColor set [3, ((_drawColor select 3) * (_timeLeftToShow / 0.5))];
}; };
drawIcon3D [FP_ICON, _drawColor, _pos, _iconSize, _iconSize, 0, _name, 1, 0.03, "PuristaMedium"]; drawIcon3D [QUOTE(PATHTOF(UI\fp_icon.paa)), _drawColor, _pos, _iconSize, _iconSize, 0, _name, 1, 0.03, "PuristaMedium"];
}; };
} forEach (GVAR(fingersHash) select 0); } forEach (GVAR(fingersHash) select 0);

View File

@ -1,5 +1,5 @@
#define COMPONENT finger #define COMPONENT finger
#include "\z\ace\Addons\main\script_mod.hpp" #include "\z\ace\addons\main\script_mod.hpp"
#ifdef DEBUG_ENABLED_FINGER #ifdef DEBUG_ENABLED_FINGER
#define DEBUG_MODE_FULL #define DEBUG_MODE_FULL
@ -9,10 +9,9 @@
#define DEBUG_SETTINGS DEBUG_SETTINGS_FINGER #define DEBUG_SETTINGS DEBUG_SETTINGS_FINGER
#endif #endif
#include "\z\ace\Addons\main\script_macros.hpp" #include "\z\ace\addons\main\script_macros.hpp"
#define BASE_SIZE 44 #define BASE_SIZE 44
#define FP_ICON "\z\ace\addons\finger\img\fp_icon.paa"
#define FP_TIMEOUT 2 #define FP_TIMEOUT 2
#define FP_ACTION_TIMEOUT 1 #define FP_ACTION_TIMEOUT 1

View File

@ -22,7 +22,20 @@
<Russian>Действие "показать пальцем на"</Russian> <Russian>Действие "показать пальцем на"</Russian>
</Key> </Key>
<Key ID="STR_ACE_finger_keyComb_description"> <Key ID="STR_ACE_finger_keyComb_description">
<English>Shows a virtual marker of where you are pointing to nearby units.</English> <English>Points, and shows a virtual marker of where you are looking to nearby units.</English>
</Key>
<Key ID="STR_ACE_finger_moduleSettings_displayName">
<English>Finger Settings</English>
</Key>
<Key ID="STR_ACE_finger_maxRange_displayName">
<English>Finger Max Range</English>
</Key>
<Key ID="STR_ACE_finger_maxRange_description">
<English>How far away players can finger each other. Set to 0 to disable fingering. [default: 4]</English>
</Key>
<Key ID="STR_ACE_finger_indicatorColor_name">
<English>Finger indicator</English>
<Russian>Пальце-индикатор</Russian>
</Key> </Key>
</Package> </Package>
</Project> </Project>

Binary file not shown.