Fix Ladders - Add User Setting

This commit is contained in:
PabstMirror 2015-05-29 13:00:04 -05:00
parent 08aeda11df
commit b0bfb7dd43
4 changed files with 28 additions and 26 deletions

View File

@ -4,7 +4,7 @@ class ACE_Settings {
typeName = "BOOL";
isClientSettable = 1;
displayName = "$STR_ACE_Interact_Menu_AlwaysUseCursorSelfInteraction";
};
};
class GVAR(cursorKeepCentered) {
value = 0;
typeName = "BOOL";
@ -54,7 +54,7 @@ class ACE_Settings {
isClientSettable = 1;
displayName = "$STR_ACE_Interact_textSize";
values[] = {"$str_very_small", "$str_small", "$str_medium", "$str_large", "$str_very_large"};
};
};
class GVAR(shadowSetting) {
value = 2;
typeName = "SCALAR";
@ -69,4 +69,11 @@ class ACE_Settings {
isClientSettable = 1;
displayName = "$STR_ACE_Interact_Menu_ActionOnKeyRelease";
};
class GVAR(addBuildingActions) {
value = 0;
typeName = "BOOL";
isClientSettable = 1;
displayName = "$STR_ACE_Interact_Menu_addBuildingActions";
description = "$STR_ACE_Interact_Menu_addBuildingActionsDescription";
};
};

View File

@ -18,6 +18,8 @@
PARAMS_1(_interactionType);
//Ignore if not enabled:
if (!GVAR(addBuildingActions)) exitWith {};
//Ignore self-interaction menu:
if (_interactionType != 0) exitWith {};
//Ignore when mounted:
@ -75,7 +77,7 @@ if ((vehicle ACE_player) != ACE_player) exitWith {};
_actionSet = [_typeOfHouse] call FUNC(userActions_getHouseActions);
EXPLODE_2_PVT(_actionSet,_memPoints,_memPointsActions);
systemChat format ["Add Actions for [%1] (count %2) @ %3", _typeOfHouse, (count _memPoints), diag_tickTime];
// systemChat format ["Add Actions for [%1] (count %2) @ %3", _typeOfHouse, (count _memPoints), diag_tickTime];
{
_helperPos = (_houseBeingScaned modelToWorld (_houseBeingScaned selectionPosition _x)) call EFUNC(common,positionToASL);
_helperObject = "Sign_Sphere25cm_F" createVehicleLocal _helperPos;

View File

@ -31,7 +31,7 @@ _fnc_getMemPointOffset = {
_memPoints pushBack _memoryPoint;
_memPointsActions pushBack [];
} else {
_actionOffset set [2, 0.05 * (count (_memPointsActions select _memPointIndex))];
_actionOffset set [2, 0.0254 * (count (_memPointsActions select _memPointIndex))];
};
_actionOffset
};
@ -47,6 +47,7 @@ _fnc_userAction_Condition = {
PARAMS_3(_target,_player,_variable);
EXPLODE_2_PVT(_variable,_actionStatement,_actionCondition);
this = _target getVariable [QGVAR(building), objNull];
if (isNull this) exitWith {false};
call _actionCondition;
};
@ -71,27 +72,9 @@ for "_index" from 0 to ((count _configPath) - 1) do {
_actionMaxDistance = _actionMaxDistance + 0.1; //increase range slightly
_iconImage = "";
/*
if (_actionDisplayNameDefault != "") then {
//something like: "<img image='\A3\Ui_f\data\IGUI\Cfg\Actions\open_door_ca.paa' size='2.5' />";
//find the end [.paa']
_endIndex = _actionDisplayNameDefault find ".paa'";
if (_endIndex == -1) exitWith {};
_startIndex = _endIndex - 1;
_endIndex = _endIndex + 4;
//work backwards to find the starting [']
while {(_startIndex > 0) && {_iconImage == ""}} do {
if ((_actionDisplayNameDefault select [_startIndex, 1]) == "'") then {
_startIndex = _startIndex + 1;
_iconImage = _actionDisplayNameDefault select [_startIndex, (_endIndex - _startIndex)];
};
_startIndex = _startIndex - 1;
};
}; */
//extension ~4x as fast:
_iconImage = "ace_parse_imagepath" callExtension _actionDisplayNameDefault;
_actionOffset = [_actionPosition] call _fnc_getMemPointOffset;
_memPointIndex = _memPoints find _actionPosition;
@ -104,24 +87,28 @@ _fnc_ladder_ladderUp = {
PARAMS_3(_target,_player,_variable);
EXPLODE_1_PVT(_variable,_ladderIndex);
_building = _target getVariable [QGVAR(building), objNull];
TRACE_3("Ladder Action - UP",_player,_building,_ladderIndex);
_player action ["LadderUp", _building, _ladderIndex, 0];
};
_fnc_ladder_ladderDown = {
PARAMS_3(_target,_player,_variable);
EXPLODE_1_PVT(_variable,_ladderIndex);
_building = _target getVariable [QGVAR(building), objNull];
_player action ["LadderUp", _building, (_variable select 0), 1];
TRACE_3("Ladder Action - Down",_player,_building,_ladderIndex);
_player action ["LadderDown", _building, _ladderIndex, 1];
};
_fnc_ladder_conditional = { //Don't show actions if on a ladder
((getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState _player) >> "onLadder")) == 0)
_fnc_ladder_conditional = {
PARAMS_2(_target,_player);
//(Check distance < 2) and (Don't show actions if on a ladder)
((_target distance _player) < 2) && {((getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState _player) >> "onLadder")) == 0)}
};
_ladders = getArray (configFile >> "CfgVehicles" >> _typeOfBuilding >> "ladders");
{
EXPLODE_2_PVT(_x,_ladderBottomMemPoint,_ladderTopMemPoint);
_actionMaxDistance = 2;
_actionMaxDistance = 3; //interact_menu will check head -> target's offset; leave this high and do a precice distance check in condition
_actionDisplayName = localize "str_action_ladderup";
_iconImage = "\A3\ui_f\data\igui\cfg\actions\ladderup_ca.paa";

View File

@ -217,5 +217,11 @@
<Hungarian>Körvonal</Hungarian>
<Italian>Contorno</Italian>
</Key>
<Key ID="STR_ACE_Interact_Menu_addBuildingActions">
<English>Show actions for buildings</English>
</Key>
<Key ID="STR_ACE_Interact_Menu_addBuildingActionsDescription">
<English>Adds interaction actions for opening doors and mounting ladders on buildings.</English>
</Key>
</Package>
</Project>