Skip to content

Commit

Permalink
Merge branch 'release'
Browse files Browse the repository at this point in the history
  • Loading branch information
thojkooi committed Jan 5, 2016
2 parents 7eaa55f + 509e142 commit c042703
Show file tree
Hide file tree
Showing 128 changed files with 1,433 additions and 1,008 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

<p align="center">
<a href="https://github.com/acemod/ACE3/releases">
<img src="https://img.shields.io/badge/Version-3.4.1-blue.svg?style=flat-square" alt="ACE3 Version">
<img src="https://img.shields.io/badge/Version-3.4.2-blue.svg?style=flat-square" alt="ACE3 Version">
</a>
<a href="https://github.com/acemod/ACE3/releases/download/v3.4.1/ace3_3.4.1.zip">
<a href="https://github.com/acemod/ACE3/releases/download/v3.4.2/ace3_3.4.2.zip">
<img src="https://img.shields.io/badge/Download-72.6_MB-green.svg?style=flat-square" alt="ACE3 Download">
</a>
<a href="https://github.com/acemod/ACE3/issues">
Expand Down
47 changes: 33 additions & 14 deletions addons/common/XEH_postInit.sqf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ACE - Common
// #define ENABLE_PERFORMANCE_COUNTERS
#include "script_component.hpp"

// #define ENABLE_PERFORMANCE_COUNTERS

//////////////////////////////////////////////////
// PFHs
Expand Down Expand Up @@ -57,6 +57,24 @@
// Eventhandlers
//////////////////////////////////////////////////

//Add a fix for BIS's zeus remoteControl module not reseting variables on DC when RC a unit
//This variable is used for isPlayer checks
if (isServer) then {
addMissionEventHandler ["HandleDisconnect", {
params ["_dcPlayer"];
private _zeusLogic = getAssignedCuratorLogic _dcPlayer;
if ((!isNil "_zeusLogic") && {!isNull _zeusLogic}) then {
{
if ((_x getvariable ["bis_fnc_moduleRemoteControl_owner", objnull]) isEqualTo _dcPlayer) exitWith {
ACE_LOGINFO_3("[%1] DC - Was Zeus [%2] while controlling unit [%3] - manually clearing `bis_fnc_moduleRemoteControl_owner`", [_x] call FUNC(getName), _dcPlayer, _x);
_x setVariable ["bis_fnc_moduleRemoteControl_owner", nil, true];
};
nil
} count (curatorEditableObjects _zeusLogic);
};
}];
};

// Listens for global "SettingChanged" events, to update the force status locally
["SettingChanged", {
params ["_name", "_value", "_force"];
Expand Down Expand Up @@ -293,6 +311,17 @@ enableCamShake true;
// Set up numerous eventhanders for player controlled units
//////////////////////////////////////////////////

//CBA has events for zeus's display onLoad and onUnload (Need to delay a frame for display to be ready)
private _zeusDisplayChangedFNC = {
[{
private _data = !(isNull findDisplay 312);
["zeusDisplayChanged", [ACE_player, _data]] call FUNC(localEvent);
}, []] call FUNC(execNextFrame);
};
["CBA_curatorOpened", _zeusDisplayChangedFNC] call CBA_fnc_addEventHandler;
["CBA_curatorClosed", _zeusDisplayChangedFNC] call CBA_fnc_addEventHandler;


// default variables
GVAR(OldPlayerVehicle) = vehicle objNull;
GVAR(OldPlayerTurret) = [objNull] call FUNC(getTurretIndex);
Expand All @@ -302,7 +331,6 @@ GVAR(OldPlayerVisionMode) = currentVisionMode objNull;
GVAR(OldCameraView) = "";
GVAR(OldVisibleMap) = false;
GVAR(OldInventoryDisplayIsOpen) = nil; //@todo check this
GVAR(OldZeusDisplayIsOpen) = false;
GVAR(OldIsCamera) = false;

// clean up playerChanged eventhandler from preinit and put it in the same PFH as the other events to reduce overhead and guarantee advantageous execution order
Expand All @@ -314,13 +342,11 @@ if (!isNil QGVAR(PreInit_playerChanged_PFHID)) then {
// PFH to raise varios events
[{
BEGIN_COUNTER(stateChecker);
private "_data"; // reuse one variable to reduce number of variables that have to be set to private each frame

// "playerChanged" event
_data = call FUNC(player);
private _data = call FUNC(player); // reuse one variable to reduce number of variables that have to be set to private each frame
if !(_data isEqualTo ACE_player) then {
private "_oldPlayer";
_oldPlayer = ACE_player;
private _oldPlayer = ACE_player;

ACE_player = _data;
uiNamespace setVariable ["ACE_player", _data];
Expand Down Expand Up @@ -393,14 +419,6 @@ if (!isNil QGVAR(PreInit_playerChanged_PFHID)) then {
["inventoryDisplayChanged", [ACE_player, _data]] call FUNC(localEvent);
};

// "zeusDisplayChanged" event
_data = !(isNull findDisplay 312);
if !(_data isEqualTo GVAR(OldZeusDisplayIsOpen)) then {
// Raise ACE event locally
GVAR(OldZeusDisplayIsOpen) = _data;
["zeusDisplayChanged", [ACE_player, _data]] call FUNC(localEvent);
};

// "activeCameraChanged" event
_data = call FUNC(isfeatureCameraActive);
if !(_data isEqualTo GVAR(OldIsCamera)) then {
Expand Down Expand Up @@ -449,6 +467,7 @@ if (!isNil QGVAR(PreInit_playerChanged_PFHID)) then {
{_unit != _target && {vehicle _unit == vehicle _target}}
}] call FUNC(addCanInteractWithCondition);

["isNotInZeus", {isNull curatorCamera}] call FUNC(addCanInteractWithCondition);

//////////////////////////////////////////////////
// Set up PlayerJIP eventhandler
Expand Down
13 changes: 8 additions & 5 deletions addons/common/functions/fnc_getName.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,27 @@
* Arguments:
* 0: Object <OBJECT>
* 1: Use effective commander name when used on vehicles (default: false) <BOOL>
* 2: Get Raw Name (Don't sanatize HTML tags `</>`) (default: false) <BOOL>
*
* Return Value:
* Object Name <STRING>
*
* Example:
* [player, false, true] call ace_common_fnc_getName;
*
* Public: Yes
*/
#include "script_component.hpp"

params ["_unit", ["_showEffective", false]];
params ["_unit", ["_showEffective", false], ["_useRaw", false]];

private "_name";
_name = "";
private _name = "";

if (_unit isKindOf "CAManBase") then {
_name = _unit getVariable ["ACE_Name", localize QUOTE(DOUBLES(STR,GVAR(Unknown)))];
_name = _unit getVariable [(["ACE_Name", "ACE_NameRaw"] select _useRaw), localize QUOTE(DOUBLES(STR,GVAR(Unknown)))];
} else {
if (_showEffective) then {
_name = [effectiveCommander _unit] call FUNC(getName);
_name = [effectiveCommander _unit, false, _useRaw] call FUNC(getName);
} else {
_name = getText (configFile >> "CfgVehicles" >> typeOf _unit >> "displayName");
};
Expand Down
7 changes: 5 additions & 2 deletions addons/common/functions/fnc_isPlayer.sqf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Author: bux578, commy2, akalegman
* Checks if a unit is a player / curator controlled unit.
* Currently returns false for non-local remote controlled zeus units. (Remotes from another zeus machine)
* This now includes both local and non-local remote controlled zeus units. (Remotes from another zeus machine)
*
* Arguments:
* 0: unit to be checked <OBJECT>
Expand All @@ -10,10 +10,13 @@
* Return Value:
* Is unit a player? <BOOL>
*
* Example:
* [cursorTarget, false] call ace_common_fnc_isPlayer;
*
* Public: Yes
*/
#include "script_component.hpp"

params ["_unit", ["_excludeRemoteControlled", false]];

isPlayer _unit || (!_excludeRemoteControlled && {_unit == call FUNC(player)}) // return
(isPlayer _unit) || {(!_excludeRemoteControlled) && {!isNull (_unit getVariable ["bis_fnc_moduleRemoteControl_owner", objNull])}}
4 changes: 2 additions & 2 deletions addons/common/functions/fnc_receiveRequest.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ _requestID = ("ace_recieveRequest_f_id_"+_requestID);
_target setVariable [_requestID, _this];

if (isLocalized _requestMessage) then {
_requestMessage = format [localize _requestMessage, [_caller] call FUNC(getName)];
_requestMessage = format [localize _requestMessage, [_caller, false, true] call FUNC(getName)];
} else {
_requestMessage = format [_requestMessage, [_caller] call FUNC(getName)];
_requestMessage = format [_requestMessage, [_caller, false, true] call FUNC(getName)];
};

hint format ["%1", _requestMessage]; // @todo ?
Expand Down
9 changes: 6 additions & 3 deletions addons/common/functions/fnc_sanitizeString.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
* 1: Remove html tags (default: false) <BOOL>
*
* Return Value:
* Sanitized string
* Sanitized string <STRING>
*
* Example:
* ["<CoolGroup>CoolGuy", true] call ace_common_fnc_sanitizeString;
*
* Public: Yes
*/
Expand All @@ -20,14 +23,14 @@ _array = [];

{
switch _x do {
case 60 : {
case 60 : { // less than symbol: `<`
if (_removeTags) then {
_array append toArray "&lt;";
} else {
_array pushBack _x;
};
};
case 62 : {
case 62 : { // greater than symbol: `>`
if (_removeTags) then {
_array append toArray "&gt;";
} else {
Expand Down
11 changes: 8 additions & 3 deletions addons/common/functions/fnc_serverLog.sqf
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
/*
* Author: esteldunedain
* ?
* Log a RPT messaged on just the server
*
* Arguments:
* ?
* 0: Text to display <STRING>
*
* Return Value:
* None
*
* Example:
* ["x happened"] call ace_common_fnc_serverLog;
*
* Public: no
*/
#include "script_component.hpp"

params [["_msg", "", [""]]];

if (isServer) then {
diag_log _this;
diag_log text _msg;
} else {
[_this, QFUNC(serverLog), 1] call FUNC(execRemoteFnc);
};
12 changes: 9 additions & 3 deletions addons/common/functions/fnc_setName.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ params ["_unit"];
if (isNull _unit || {!alive _unit}) exitWith {};

if (_unit isKindOf "CAManBase") then {
_name = [name _unit, true] call FUNC(sanitizeString);

private _sanitizedName = [name _unit, true] call FUNC(sanitizeString);
private _rawName = [name _unit, false] call FUNC(sanitizeString);

//Debug Testing Code (with html tags):
// private _sanitizedName = ["<TAG>Name", true] call FUNC(sanitizeString);
// private _rawName = ["<TAG>Name", false] call FUNC(sanitizeString);

//if (_name != _unit getVariable ["ACE_Name", ""]) then {
_unit setVariable ["ACE_Name", _name, true];
_unit setVariable ["ACE_Name", _sanitizedName, true];
_unit setVariable ["ACE_NameRaw", _rawName, true];
//};
};
2 changes: 1 addition & 1 deletion addons/disarming/functions/fnc_openDisarmDialog.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ GVAR(disarmTarget) = _target;
_icon = format [DEFUALTPATH, toLower (rank _target)];
if (_icon isEqualTo DEFUALTPATH) then {_icon = ""};
_rankPicture ctrlSetText _icon;
_playerName ctrlSetText ([GVAR(disarmTarget)] call EFUNC(common,getName));
_playerName ctrlSetText ([GVAR(disarmTarget), false, true] call EFUNC(common,getName));

//Clear both inventory lists:
lbClear _groundContainer;
Expand Down
3 changes: 2 additions & 1 deletion addons/fcs/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
Expand All @@ -6,7 +7,7 @@ class Extended_PreInit_EventHandlers {

class Extended_PostInit_EventHandlers {
class ADDON {
clientInit = QUOTE(call COMPILE_FILE(XEH_clientInit));
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};

Expand Down
26 changes: 18 additions & 8 deletions addons/fcs/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class CfgVehicles {
class ACE_SelfActions {
class ResetFCS {
displayName = CSTRING(ResetFCS);
condition = QUOTE(call FUNC(canResetFCS));
condition = QUOTE(_player call FUNC(canResetFCS));
statement = QUOTE([ARR_2(vehicle _player,[_player] call DEFUNC(common,getTurretIndex))] call DFUNC(reset););
showDisabled = 0;
priority = 1;
Expand All @@ -39,7 +39,7 @@ class CfgVehicles {
class ACE_SelfActions {
class ResetFCS {
displayName = CSTRING(ResetFCS);
condition = QUOTE(call FUNC(canResetFCS));
condition = QUOTE(_player call FUNC(canResetFCS));
statement = QUOTE([ARR_2(vehicle _player,[_player] call DEFUNC(common,getTurretIndex))] call DFUNC(reset););
showDisabled = 0;
priority = 1;
Expand Down Expand Up @@ -321,9 +321,13 @@ class CfgVehicles {
discreteDistance[] = {};
discreteDistanceInitIndex = 0;

/*class Turrets: Turrets {
class CommanderOptics: CommanderOptics {};
};*/
class Turrets: Turrets {
class CommanderOptics: CommanderOptics {
GVAR(Enabled) = 1;
discreteDistance[] = {};
discreteDistanceInitIndex = 0;
};
};
};
};
};
Expand All @@ -346,9 +350,13 @@ class CfgVehicles {
discreteDistance[] = {};
discreteDistanceInitIndex = 0;

/*class Turrets: Turrets {
class CommanderOptics: CommanderOptics {};
};*/
class Turrets: Turrets {
class CommanderOptics: CommanderOptics {
GVAR(Enabled) = 1;
discreteDistance[] = {};
discreteDistanceInitIndex = 0;
};
};
};
};
};
Expand All @@ -362,6 +370,8 @@ class CfgVehicles {
class Turrets: Turrets {
class CommanderOptics: CommanderOptics {
GVAR(Enabled) = 1;
discreteDistance[] = {};
discreteDistanceInitIndex = 0;
};
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ if (!hasInterface) exitWith {};
}] call EFUNC(common,addEventHandler);

// Register event for global updates
[QGVAR(forceUpdate), FUNC(onForceUpdate)] call EFUNC(common,addEventHandler);
[QGVAR(forceUpdate), {ACE_player call FUNC(onForceUpdate)}] call EFUNC(common,addEventHandler);
1 change: 1 addition & 0 deletions addons/fcs/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ PREP(onForceUpdate);
PREP(keyDown);
PREP(keyUp);
PREP(reset);
PREP(updateRangeHUD);
PREP(vehicleInit);

ADDON = true;
22 changes: 10 additions & 12 deletions addons/fcs/functions/fnc_adjustRange.sqf
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
/*
* Author: KoffeinFlummi
*
* Adjusts the currently zeroed distance.
*
* Arguments:
* 0: The vehicle in question
* 1: The amount to add to the distance (can be negative)
* 0: The vehicle in question <OBJECT>
* 1: The Turrets that the Vehicle has <ARRAY>
* 2: The amount to add to the distance (can be negative) <NUMMBER>
*
* Return Value:
* None
*
* Public: No
*/

#include "script_component.hpp"

private ["_vehicle", "_turret", "_delta", "_turretConfig", "_min", "_max", "_distance"];
params ["_vehicle", "_turret", "_delta"];

_vehicle = _this select 0;
_turret = _this select 1;
_delta = _this select 2;
private _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath);

_turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath);
private _min = getNumber (_turretConfig >> QGVAR(MinDistance));
private _max = getNumber (_turretConfig >> QGVAR(MaxDistance));

_min = getNumber (_turretConfig >> QGVAR(MinDistance));
_max = getNumber (_turretConfig >> QGVAR(MaxDistance));
_distance = _vehicle getVariable [format ["%1_%2", QGVAR(Distance), _turret], _min];
private _distance = _vehicle getVariable [format ["%1_%2", QGVAR(Distance), _turret], _min];

_distance = _distance + _delta;
_distance = _distance min _max;
Expand Down
Loading

0 comments on commit c042703

Please sign in to comment.