Merge branch 'master' into release

This commit is contained in:
PabstMirror 2015-07-26 16:53:07 -05:00
commit 5b2b490434
18 changed files with 357 additions and 0 deletions

View File

@ -106,3 +106,4 @@ Valentin Torikian <valentin.torikian@gmail.com>
VyMajoris(W-Cephei)<vycanismajoriscsa@gmail.com>
Winter <simon@agius-muscat.net>
zGuba
Drill <drill87@gmail.com>

View File

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

View File

@ -0,0 +1,27 @@
class ACE_Settings {
class GVAR(enabled) {
value = 0;
typeName = "BOOL";
displayName = CSTRING(enabled_displayName);
};
class GVAR(maxRange) {
value = 4;
typeName = "SCALAR";
displayName = CSTRING(maxRange_displayName);
description = CSTRING(maxRange_description);
};
class GVAR(indicatorForSelf) {
value = 1;
typeName = "BOOL";
isClientSettable = 1;
displayName = CSTRING(indicatorForSelf_name);
description = CSTRING(indicatorForSelf_description);
};
class GVAR(indicatorColor) {
value[] = {0.83, 0.68, 0.21, 0.75};
typeName = "COLOR";
isClientSettable = 1;
displayName = CSTRING(indicatorColor_name);
description = CSTRING(indicatorColor_description);
};
};

View File

@ -0,0 +1,10 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};

View File

@ -0,0 +1,25 @@
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 enabled {
displayName = CSTRING(enabled_DisplayName);
typeName = "BOOL";
defaultValue = 1;
};
class maxRange {
displayName = CSTRING(maxRange_displayName);
description = CSTRING(maxRange_description);
typeName = "NUMBER";
defaultValue = 4;
};
};
};
};

12
addons/finger/README.md Normal file
View File

@ -0,0 +1,12 @@
ace_finger
===========
Allows players to point and show a virtual spot in the distance to nearby players.
## Maintainers
The people responsible for merging changes to this component or answering potential questions.
- [Drill](https://github.com/TheDrill/)
- [PabstMirror](https://github.com/PabstMirror)

View File

@ -0,0 +1,23 @@
#include "script_component.hpp"
if (!hasInterface) exitWith {};
GVAR(lastFPTime) = -1;
GVAR(fingersHash) = HASH_CREATE;
GVAR(pfeh_id) = -1;
["SettingsInitialized", {
//If not enabled, dont't bother adding keybind or eventhandler
if (!GVAR(enabled)) exitWith {};
[QGVAR(fingered), {_this call FUNC(incomingFinger)}] call EFUNC(common,addEventHandler);
["ACE3 Common",
QGVAR(finger),
[(localize LSTRING(keyComb)), (localize LSTRING(keyComb_description))],
{
_this call FUNC(keyPress);
},
{false},
[41, [true, false, false]], true] call cba_fnc_addKeybind; // Shift + Tilda (hold)
}] call EFUNC(common,addEventHandler);

View File

@ -0,0 +1,10 @@
#include "script_component.hpp"
ADDON = false;
PREP(incomingFinger);
PREP(keyPress);
PREP(moduleSettings);
PREP(perFrameEH);
ADDON = true;

18
addons/finger/config.cpp Normal file
View File

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

View File

@ -0,0 +1,35 @@
/*
* Author: TheDrill, PabstMirror
* Recieve an finger event, adds to the array (or updates if already present) and starts PFEH if not already running
*
* Arguments:
* 0: Source Unit (can be self) <OBJECT>
* 1: Position being pointed at (from positionCameraToWorld) <ARRAY>
*
* Return Value:
* None
*
* Example:
* [bob, [1,2,3]] call ace_finger_fnc_incomingFinger;
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_sourceUnit,_fingerPosPrecise);
private ["_data", "_fingerPos"];
//add some random float to location if it's not our own finger:
_fingerPos = if (_sourceUnit == ACE_player) then {
_fingerPosPrecise
} else {
_fingerPosPrecise vectorAdd [random (2*FP_RANDOMIZATION_X) - FP_RANDOMIZATION_X, random (2*FP_RANDOMIZATION_X) - FP_RANDOMIZATION_X, random (2*FP_RANDOMIZATION_Y) - FP_RANDOMIZATION_Y]
};
_data = [ACE_diagTime, _fingerPos, ([_sourceUnit] call EFUNC(common,getName))];
HASH_SET(GVAR(fingersHash), _sourceUnit, _data);
if (GVAR(pfeh_id) == -1) then {
GVAR(pfeh_id) = [DFUNC(perFrameEH), 0, []] call CBA_fnc_addPerFrameHandler;
};

View File

@ -0,0 +1,61 @@
/*
* Author: TheDrill, PabstMirror
* On keypress, point and send position to nearby players
*
* Arguments:
* None
*
* Return Value:
* Key Handeled <BOOL>
*
* Example:
* [] call ace_finger_fnc_keyPress;
*
* Public: No
*/
#include "script_component.hpp"
private["_fingerPosPrecise", "_playerEyePos", "_sendFingerToPlayers", "_nearbyMen"];
if (!alive ACE_player) exitWith {false};
// Conditions: canInteract
if !([ACE_player, ACE_player, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
//make sure player is dismounted or in a static weapon:
if ((ACE_player != vehicle ACE_player) && {!((vehicle ACE_player) isKindOf "StaticWeapon")}) exitWith {false};
//Check camera view (not in GUNNER)
if !(cameraView in ["INTERNAL", "EXTERNAL"]) exitWith {false};
//Exit if run recently (run every 1 seconds)
if (ACE_diagTime < (GVAR(lastFPTime) + FP_ACTION_TIMEOUT)) exitWith {true};
GVAR(lastFPTime) = ACE_diagTime;
_fingerPosPrecise = positionCameraToWorld [0, 0, FP_DISTANCE];
_playerEyePos = eyePos ACE_player;
_sendFingerToPlayers = [];
_nearbyMen = (ACE_player nearObjects ["CAManBase", (GVAR(maxRange) + 2)]);
{
_nearbyMen append (crew _x);
} forEach (ACE_player nearObjects ["StaticWeapon", (GVAR(maxRange) + 2)]);
{
if ((((eyePos _x) vectorDistance _playerEyePos) < GVAR(maxRange)) &&
{alive _x} &&
{(_x == (vehicle _x)) || {(vehicle _x) isKindOf "StaticWeapon"}} &&
{GVAR(indicatorForSelf) || {_x != ACE_player}} &&
{!(lineIntersects [(eyePos _x), _playerEyePos, ACE_player, _x])} &&
{[_x] call EFUNC(common,isPlayer)}) then {
_sendFingerToPlayers pushBack _x;
};
} forEach _nearbyMen;
TRACE_1("sending finger to",_sendFingerToPlayers);
[QGVAR(fingered), _sendFingerToPlayers, [ACE_player, _fingerPosPrecise]] call EFUNC(common,targetEvent);
ACE_player playActionNow "GestureGo";
true

View File

@ -0,0 +1,21 @@
/*
* 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(enabled), "enabled"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(maxRange), "maxRange"] call EFUNC(common,readSettingFromModule);

View File

@ -0,0 +1,51 @@
/*
* Author: TheDrill, PabstMirror
* The perFrameEventHandler to draw the icons
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* [fromCBA] call ace_finger_fnc_perFrameEH;
*
* Public: No
*/
#include "script_component.hpp"
private["_drawColor", "_fovCorrection", "_iconSize", "_timeLeftToShow", "_cameraOffset"];
if (!alive ACE_player) then {GVAR(fingersHash) = HASH_CREATE;};
// Conditions: canInteract
if !([ACE_player, ACE_player, ["isNotInside"]] call EFUNC(common,canInteractWith)) then {GVAR(fingersHash) = HASH_CREATE;};
//make sure player is dismounted or in a static weapon:
if ((ACE_player != vehicle ACE_player) && {!((vehicle ACE_player) isKindOf "StaticWeapon")}) then {GVAR(fingersHash) = HASH_CREATE;};
_cameraOffset = worldToScreen (positionCameraToWorld [1000, 0, 10000]);
_fovCorrection = 0;
if (count _cameraOffset > 0) then {_fovCorrection = (_cameraOffset select 0) - 0.5;};
_iconSize = BASE_SIZE * _fovCorrection;
{
_data = HASH_GET(GVAR(fingersHash), _x);
EXPLODE_3_PVT(_data,_lastTime,_pos,_name);
_timeLeftToShow = _lastTime + FP_TIMEOUT - ACE_diagTime;
if (_timeLeftToShow <= 0) then {
HASH_REM(GVAR(fingersHash), _x);
} else {
_drawColor = + GVAR(indicatorColor);
//Fade out:
if (_timeLeftToShow < 0.5) then {
_drawColor set [3, ((_drawColor select 3) * (_timeLeftToShow / 0.5))];
};
drawIcon3D [QUOTE(PATHTOF(UI\fp_icon.paa)), _drawColor, _pos, _iconSize, _iconSize, 0, _name, 1, 0.03, "PuristaMedium"];
};
} forEach (GVAR(fingersHash) select 0);
if ((count (GVAR(fingersHash) select 0)) == 0) then {
[GVAR(pfeh_id)] call CBA_fnc_removePerFrameHandler;
GVAR(pfeh_id) = -1;
};

View File

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

View File

@ -0,0 +1,21 @@
#define COMPONENT finger
#include "\z\ace\addons\main\script_mod.hpp"
#ifdef DEBUG_ENABLED_FINGER
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_FINGER
#define DEBUG_SETTINGS DEBUG_SETTINGS_FINGER
#endif
#include "\z\ace\addons\main\script_macros.hpp"
#define BASE_SIZE 44
#define FP_TIMEOUT 2
#define FP_ACTION_TIMEOUT 1
#define FP_DISTANCE 10000
#define FP_RANDOMIZATION_X 350
#define FP_RANDOMIZATION_Y 100

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<Project name="ACE">
<Package name="finger">
<Key ID="STR_ACE_finger_indicatorForSelf_name">
<English>Show finger indicator to self</English>
<Russian>Отображать пальце-индикатор для показывающего игрока</Russian>
</Key>
<Key ID="STR_ACE_finger_indicatorForSelf_description">
<English>Render the indicator for the pointing player. This option doesn't affect whether the other players would see the indicator</English>
<Russian>Отображать индикатор для показывающего игрока. Эта настройка не влияет на то, будутт ли другие игроки видеть индикатор</Russian>
</Key>
<Key ID="STR_ACE_finger_indicatorColor_name">
<English>Finger indicator</English>
<Russian>Пальце-индикатор</Russian>
</Key>
<Key ID="STR_ACE_finger_indicatorColor_description">
<English>Color of the finger-pointing indicator circle</English>
<Russian>Цвет индикатора пальце-указания</Russian>
</Key>
<Key ID="STR_ACE_finger_keyComb">
<English>Action "point a finger at"</English>
<Russian>Действие "показать пальцем на"</Russian>
</Key>
<Key ID="STR_ACE_finger_keyComb_description">
<English>Points, and shows a virtual marker of where you are looking to nearby units. Can be held down.</English>
</Key>
<Key ID="STR_ACE_finger_moduleSettings_displayName">
<English>Finger Settings</English>
</Key>
<Key ID="STR_ACE_finger_enabled_displayName">
<English>Finger Pointing Enabled</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. [default: 4]</English>
</Key>
</Package>
</Project>

Binary file not shown.

Binary file not shown.