2015-04-13 05:23:00 +00:00
|
|
|
// by commy2 and esteldunedain
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
ACE_Modifier = 0;
|
|
|
|
|
2016-05-25 18:23:53 +00:00
|
|
|
[QGVAR(pardon), {(_this select 0) addRating -rating (_this select 0)}] call CBA_fnc_addEventHandler;
|
2015-04-13 05:46:45 +00:00
|
|
|
|
2016-05-25 18:23:53 +00:00
|
|
|
[QGVAR(getDown), {
|
2015-09-28 15:11:53 +00:00
|
|
|
params ["_target"];
|
|
|
|
|
|
|
|
_target setUnitPos "DOWN";
|
2016-05-22 15:29:05 +00:00
|
|
|
}] call CBA_fnc_addEventHandler;
|
2015-08-11 03:08:13 +00:00
|
|
|
|
2016-05-25 18:23:53 +00:00
|
|
|
[QGVAR(sendAway), {
|
2015-09-28 15:11:53 +00:00
|
|
|
params ["_unit", "_position"];
|
|
|
|
|
|
|
|
_unit setUnitPos "AUTO";
|
|
|
|
_unit doMove _position;
|
2016-05-22 15:29:05 +00:00
|
|
|
}] call CBA_fnc_addEventHandler;
|
2015-08-11 03:08:13 +00:00
|
|
|
|
2018-02-26 18:23:47 +00:00
|
|
|
[QGVAR(flip), {
|
|
|
|
params ["_vehicle"];
|
|
|
|
private _position = getPosATL _vehicle;
|
|
|
|
_vehicle setVectorUp surfaceNormal _position;
|
|
|
|
_vehicle setPosATL _position;
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
|
2018-08-17 01:52:13 +00:00
|
|
|
[QGVAR(setLight), {
|
|
|
|
params ["_lamp", "_state"];
|
|
|
|
private _hitpoints = _lamp call EFUNC(common,getReflectorsWithSelections) select 1;
|
|
|
|
{
|
|
|
|
private _damage = _lamp getHit _x;
|
|
|
|
if (_state) then {
|
|
|
|
if (_damage == DISABLED_LAMP_DAMAGE) then {
|
|
|
|
_lamp setHit [_x, 0];
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
if (_damage < DISABLED_LAMP_DAMAGE) then {
|
|
|
|
_lamp setHit [_x, DISABLED_LAMP_DAMAGE];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
} forEach _hitpoints;
|
|
|
|
_lamp setVariable [QGVAR(isLightOn), _state, true];
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
|
2018-02-26 18:12:21 +00:00
|
|
|
[QGVAR(setCollisionLight), {
|
|
|
|
(_this select 0) setCollisionLight (_this select 1);
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
|
2017-05-31 21:21:44 +00:00
|
|
|
// Zeus action events
|
|
|
|
[QGVAR(zeusStance),{
|
|
|
|
{ _x setUnitPos (_this select 0); } forEach (_this select 1);
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
|
|
|
|
// The following 3 events handle both waypoints and groups
|
|
|
|
[QGVAR(zeusBehaviour),{
|
|
|
|
if (param [2,false]) then {
|
|
|
|
{ _x setWaypointBehaviour (_this select 0); } forEach (_this select 1);
|
|
|
|
} else {
|
|
|
|
{ _x setBehaviour (_this select 0); } forEach (_this select 1);
|
|
|
|
};
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
|
|
|
|
[QGVAR(zeusSpeed),{
|
|
|
|
if (param [2,false]) then {
|
|
|
|
{ _x setWaypointSpeed (_this select 0); } forEach (_this select 1);
|
|
|
|
} else {
|
|
|
|
{ _x setSpeedMode (_this select 0); } forEach (_this select 1);
|
|
|
|
};
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
|
|
|
|
[QGVAR(zeusFormation),{
|
|
|
|
if (param [2,false]) then {
|
|
|
|
{ _x setWaypointFormation (_this select 0); } forEach (_this select 1);
|
|
|
|
} else {
|
|
|
|
{ _x setFormation (_this select 0); } forEach (_this select 1);
|
|
|
|
};
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
|
2021-10-12 19:36:33 +00:00
|
|
|
if (isServer) then {
|
|
|
|
[QGVAR(replaceTerrainObject), FUNC(replaceTerrainObject)] call CBA_fnc_addEventHandler;
|
|
|
|
};
|
|
|
|
|
2015-04-13 05:23:00 +00:00
|
|
|
if (!hasInterface) exitWith {};
|
|
|
|
|
|
|
|
GVAR(isOpeningDoor) = false;
|
|
|
|
|
2021-10-12 19:36:33 +00:00
|
|
|
[QEGVAR(interact_menu,renderNearbyActions), {
|
|
|
|
if (!GVAR(interactWithTerrainObjects)) exitWith {};
|
|
|
|
{
|
|
|
|
if (
|
2021-10-30 21:42:03 +00:00
|
|
|
isObjectHidden _x // after hiding on server
|
2021-10-12 19:36:33 +00:00
|
|
|
|| {_x getVariable [QGVAR(terrainObjectReplaced), false]} // after checking but before hiding
|
|
|
|
|| {typeOf _x isNotEqualTo ""}
|
|
|
|
) then {continue};
|
|
|
|
private _model = getModelInfo _x select 1;
|
|
|
|
private _class = GVAR(replaceTerrainModels) get _model;
|
|
|
|
if (isNil "_class") then {continue};
|
|
|
|
_x setVariable [QGVAR(terrainObjectReplaced), true];
|
|
|
|
[QGVAR(replaceTerrainObject), [_x, _class]] call CBA_fnc_serverEvent;
|
|
|
|
} forEach nearestTerrainObjects [ACE_player, [], 5, false];
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
|
2016-05-25 18:23:53 +00:00
|
|
|
[QGVAR(tapShoulder), {
|
2015-09-28 15:11:53 +00:00
|
|
|
params ["_unit", "_shoulderNum"];
|
|
|
|
|
|
|
|
if (_unit == ACE_player) then {
|
|
|
|
addCamShake [4, 0.5, 5];
|
2015-11-24 17:25:56 +00:00
|
|
|
private _message = parseText format ([["%1 >", localize LSTRING(YouWereTappedRight)], ["< %1", localize LSTRING(YouWereTappedLeft)]] select (_shoulderNum == 1));
|
|
|
|
[_message] call EFUNC(common,displayTextStructured);
|
2015-09-28 15:11:53 +00:00
|
|
|
};
|
2016-05-22 15:29:05 +00:00
|
|
|
}] call CBA_fnc_addEventHandler;
|
2015-09-28 15:11:53 +00:00
|
|
|
|
2015-09-28 12:35:05 +00:00
|
|
|
// add keybinds
|
|
|
|
["ACE3 Common", QGVAR(openDoor), localize LSTRING(OpenDoor), {
|
2015-04-13 05:23:00 +00:00
|
|
|
// Conditions: canInteract
|
|
|
|
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
|
|
|
// Conditions: specific
|
2015-08-30 09:13:26 +00:00
|
|
|
if (GVAR(isOpeningDoor) || {[MACRO_DOOR_REACH_DISTANCE] call FUNC(getDoor) select 1 == ''}) exitWith {false};
|
2015-04-13 05:23:00 +00:00
|
|
|
|
|
|
|
// Statement
|
|
|
|
call EFUNC(interaction,openDoor);
|
|
|
|
true
|
2015-09-28 12:35:05 +00:00
|
|
|
}, {
|
2017-09-11 22:33:58 +00:00
|
|
|
//Probably don't want any conditions here, so variable never gets locked down
|
2015-04-13 05:23:00 +00:00
|
|
|
// Statement
|
|
|
|
GVAR(isOpeningDoor) = false;
|
|
|
|
true
|
|
|
|
},
|
2015-09-28 12:35:05 +00:00
|
|
|
[57, [false, true, false]], false] call CBA_fnc_addKeybind; //Key CTRL+Space
|
2015-04-13 05:23:00 +00:00
|
|
|
|
2015-09-28 12:35:05 +00:00
|
|
|
["ACE3 Common", QGVAR(tapShoulder), localize LSTRING(TapShoulder), {
|
2015-04-13 05:23:00 +00:00
|
|
|
// Conditions: canInteract
|
|
|
|
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
|
|
|
// Conditions: specific
|
|
|
|
if !([ACE_player, cursorTarget] call FUNC(canTapShoulder)) exitWith {false};
|
|
|
|
|
2015-11-24 17:25:56 +00:00
|
|
|
//Tap whichever shoulder is closest
|
|
|
|
private _shoulderNum = [0, 1] select (([cursorTarget, ACE_player] call BIS_fnc_relativeDirTo) > 180);
|
2016-02-05 03:26:54 +00:00
|
|
|
|
2015-04-13 05:23:00 +00:00
|
|
|
// Statement
|
2015-11-24 17:25:56 +00:00
|
|
|
[ACE_player, cursorTarget, _shoulderNum] call FUNC(tapShoulder);
|
2015-04-13 05:23:00 +00:00
|
|
|
true
|
|
|
|
},
|
|
|
|
{false},
|
2015-09-28 12:35:05 +00:00
|
|
|
[20, [true, false, false]], false] call CBA_fnc_addKeybind;
|
2015-04-13 05:23:00 +00:00
|
|
|
|
2017-10-01 18:38:11 +00:00
|
|
|
["isNotSwimming", {!(_this call EFUNC(common,isSwimming))}] call EFUNC(common,addCanInteractWithCondition);
|
2015-08-30 20:03:45 +00:00
|
|
|
["isNotOnLadder", {getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> animationState (_this select 0) >> "ACE_isLadder") != 1}] call EFUNC(common,addCanInteractWithCondition);
|
2017-09-07 17:38:26 +00:00
|
|
|
|
2021-10-11 20:48:30 +00:00
|
|
|
["CBA_settingsInitialized", {
|
2017-09-07 17:38:26 +00:00
|
|
|
if (GVAR(disableNegativeRating)) then {
|
|
|
|
player addEventHandler ["HandleRating", {
|
|
|
|
(_this select 1) max 0
|
|
|
|
}];
|
|
|
|
};
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
2021-03-04 17:43:11 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
[_x, {
|
|
|
|
[QGVAR(clearWeaponAttachmentsActionsCache)] call CBA_fnc_localEvent;
|
|
|
|
}] call CBA_fnc_addPlayerEventHandler;
|
|
|
|
} forEach ["loadout", "weapon"];
|