rework modifier key, cleanup sandbags, tripod, ladder, fix #2590

This commit is contained in:
commy2
2015-09-26 03:16:55 +02:00
parent 5f7c30dd7c
commit 2fe142032e
69 changed files with 849 additions and 461 deletions

View File

@ -86,6 +86,7 @@
if (isServer) then {
["hideObjectGlobal", {(_this select 0) hideObjectGlobal (_this select 1)}] call FUNC(addEventHandler);
["enableSimulationGlobal", {(_this select 0) enableSimulationGlobal (_this select 1)}] call FUNC(addEventHandler);
};
@ -94,8 +95,8 @@ if (isServer) then {
//////////////////////////////////////////////////
// ACE events
"ACEg" addPublicVariableEventHandler { _this call FUNC(_handleNetEvent); };
"ACEc" addPublicVariableEventHandler { _this call FUNC(_handleNetEvent); };
"ACEg" addPublicVariableEventHandler {_this call FUNC(_handleNetEvent)};
"ACEc" addPublicVariableEventHandler {_this call FUNC(_handleNetEvent)};
// Synced ACE events
// Handle JIP scenario
@ -219,8 +220,29 @@ call FUNC(assignedItemFix);
GVAR(ScrollWheelFrame) = diag_frameno;
addMissionEventHandler ["Loaded", {call FUNC(handleScrollWheelInit)}];
call FUNC(handleScrollWheelInit);
["mainDisplayLoaded", {
call FUNC(handleScrollWheelInit);
[{
call FUNC(handleModifierKeyInit);
}, [], 0.1] call FUNC(waitAndExecute); // needs delay, otherwise doesn't work without pressing "RESTART" in editor once. Tested in 1.52RC
}] call FUNC(addEventHandler);
// add PFH to execute event that fires when the main display (46) is created
private "_fnc_initMainDisplayCheck";
_fnc_initMainDisplayCheck = {
[{
if !(isNull findDisplay 46) then {
// Raise ACE event locally
["mainDisplayLoaded", [findDisplay 46]] call FUNC(localEvent);
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
}, 0, []] call CBA_fnc_addPerFrameHandler;
};
call _fnc_initMainDisplayCheck;
// repeat this every time a savegame is loaded
addMissionEventHandler ["Loaded", _fnc_initMainDisplayCheck];
// @todo remove?
enableCamShake true;

View File

@ -91,6 +91,9 @@ PREP(getWindDirection);
PREP(getZoom);
PREP(goKneeling);
PREP(hadamardProduct);
PREP(handleModifierKey);
PREP(handleModifierKeyUp);
PREP(handleModifierKeyInit);
PREP(handleScrollWheel);
PREP(handleScrollWheelInit);
PREP(hasItem);
@ -204,6 +207,7 @@ PREP(getReflectorsWithSelections);
PREP(getLightProperties);
PREP(getLightPropertiesWeapon);
PREP(getVehicleCrew);
PREP(getVehicleUAVCrew);
// turrets
PREP(getTurrets);

View File

@ -18,4 +18,12 @@ ACE_DEPRECATED("ace_common_fnc_getHitPoints","3.5.0","getAllHitPointsDamage");
params ["_vehicle"];
(getAllHitPointsDamage _vehicle select 0) - [""]
private "_hitPointsWithSelections";
_hitPointsWithSelections = getAllHitPointsDamage _vehicle;
// get correct format on vehicles without any hitpoints
if (_hitPointsWithSelections isEqualTo []) then {
_hitPointsWithSelections = [[],[],[]];
};
(_hitPointsWithSelections select 0) - [""]

View File

@ -22,6 +22,11 @@ params ["_vehicle"];
private "_hitPointsWithSelections";
_hitPointsWithSelections = getAllHitPointsDamage _vehicle;
// get correct format on vehicles without any hitpoints
if (_hitPointsWithSelections isEqualTo []) then {
_hitPointsWithSelections = [[],[],[]];
};
_hitPointsWithSelections resize 2;
_hitPointsWithSelections

View File

@ -0,0 +1,17 @@
/*
* Author: commy2
* Returns array of uav dummy ais.
*
* Arguments:
* 0: Vehicle <OBJECT>
*
* Return Value:
* UAV Dummy Crew <ARRAY>
*
* Public: Yes
*/
#include "script_component.hpp"
params ["_vehicle"];
[crew _vehicle, {getText (configFile >> "CfgVehicles" >> typeOf _this >> "simulation") == "UAVPilot"}] call FUNC(filter) // return

View File

@ -0,0 +1,17 @@
/*
* Author: commy2
* Handles key down event for modifier key.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Public : No
*/
#include "script_component.hpp"
if (_this select 3) then {ACE_modifier = 1};
false

View File

@ -0,0 +1,16 @@
/*
* Author: commy2
* Initializes the modifier key handler.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Public : No
*/
#include "script_component.hpp"
(findDisplay 46) displayAddEventHandler ["KeyDown", FUNC(handleModifierKey)];
(findDisplay 46) displayAddEventHandler ["KeyUp", FUNC(handleModifierKeyUp)];

View File

@ -0,0 +1,17 @@
/*
* Author: commy2
* Handles key up event for modifier key.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Public : No
*/
#include "script_component.hpp"
ACE_modifier = 0;
false