mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Some Cleanup
This commit is contained in:
parent
5147f9f584
commit
5c556647ab
@ -26,7 +26,7 @@ if ((vehicle ACE_player) != ACE_player) exitWith {};
|
|||||||
systemChat format ["starting %1", diag_tickTime];
|
systemChat format ["starting %1", diag_tickTime];
|
||||||
|
|
||||||
[{
|
[{
|
||||||
private ["_fncStatement", "_player", "_fncCondition", "_variable", "_theHouse", "_statement", "_condition", "_configPath", "_displayName", "_displayNameDefault", "_iconImage", "_position", "_maxDistance", "_helperObject", "_actionOffset", "_memPoint", "_object", "_count", "_helperPos", "_action"];
|
private["_helperObject", "_helperPos", "_houseWasScaned", "_nearBuidlings", "_theHouse"];
|
||||||
PARAMS_2(_args,_pfID);
|
PARAMS_2(_args,_pfID);
|
||||||
EXPLODE_4_PVT(_args,_setPosition,_addedHelpers,_housesScaned,_houseBeingScaned);
|
EXPLODE_4_PVT(_args,_setPosition,_addedHelpers,_housesScaned,_houseBeingScaned);
|
||||||
|
|
||||||
@ -40,10 +40,10 @@ systemChat format ["starting %1", diag_tickTime];
|
|||||||
//If player moved >5 meters from last pos, then rescan
|
//If player moved >5 meters from last pos, then rescan
|
||||||
if (((getPosASL ace_player) distance _setPosition) < 5) exitWith {};
|
if (((getPosASL ace_player) distance _setPosition) < 5) exitWith {};
|
||||||
|
|
||||||
//Make the common case fast (looking at a door):
|
//Make the common case fast (cursorTarget is looking at a door):
|
||||||
if ((!isNull cursorTarget) && {cursorTarget isKindOf "Static"} && {!(cursorTarget in _housesScaned)}) then {
|
if ((!isNull cursorTarget) && {cursorTarget isKindOf "Static"} && {!(cursorTarget in _housesScaned)}) then {
|
||||||
_housesScaned pushBack _houseBeingScaned;
|
_housesScaned pushBack cursorTarget;
|
||||||
if ((isClass (_configPath >> "UserActions")) || {(count (getArray (configFile >> "CfgVehicles" >> (typeOf _theHouse) >> "ladders"))) > 0}) then {
|
if (((count (configFile >> "CfgVehicles" >> (typeOf cursorTarget) >> "UserActions")) > 0) || {(count (getArray (configFile >> "CfgVehicles" >> (typeOf cursorTarget) >> "ladders"))) > 0}) then {
|
||||||
_houseBeingScaned = cursorTarget;
|
_houseBeingScaned = cursorTarget;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -57,8 +57,7 @@ systemChat format ["starting %1", diag_tickTime];
|
|||||||
_houseWasScaned = true;
|
_houseWasScaned = true;
|
||||||
_housesScaned pushBack _x;
|
_housesScaned pushBack _x;
|
||||||
if ((typeOf _theHouse) != "") then {
|
if ((typeOf _theHouse) != "") then {
|
||||||
_configPath = (configFile >> "CfgVehicles" >> (typeOf _theHouse));
|
if (((count (configFile >> "CfgVehicles" >> (typeOf _theHouse) >> "UserActions")) > 0) || {(count (getArray (configFile >> "CfgVehicles" >> (typeOf _theHouse) >> "ladders"))) > 0}) then {
|
||||||
if ((isClass (_configPath >> "UserActions")) || {(count (getArray (configFile >> "CfgVehicles" >> (typeOf _theHouse) >> "ladders"))) > 0}) then {
|
|
||||||
_args set [3, _theHouse];
|
_args set [3, _theHouse];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -68,7 +67,7 @@ systemChat format ["starting %1", diag_tickTime];
|
|||||||
|
|
||||||
//If we finished scanning everything, update position
|
//If we finished scanning everything, update position
|
||||||
if (!_houseWasScaned) then {
|
if (!_houseWasScaned) then {
|
||||||
systemChat format ["Pos Updated (stable): %1", diag_tickTime];
|
systemChat format ["Pos Updated (stable): %1 [count %2]", diag_tickTime, (count _addedHelpers)];
|
||||||
_args set [0, (getPosASL ace_player)];
|
_args set [0, (getPosASL ace_player)];
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
@ -84,12 +83,9 @@ systemChat format ["starting %1", diag_tickTime];
|
|||||||
|
|
||||||
//ASL/ATL bullshit (note: attachTo doesn't work on buildings)
|
//ASL/ATL bullshit (note: attachTo doesn't work on buildings)
|
||||||
_helperPos = _houseBeingScaned modelToWorld (_houseBeingScaned selectionPosition _x);
|
_helperPos = _houseBeingScaned modelToWorld (_houseBeingScaned selectionPosition _x);
|
||||||
if (surfaceIsWater _helperPos) then {
|
_helperObject setPosASL (_helperPos call EFUNC(common,positionToASL));
|
||||||
_helperObject setPosAslw _helperPos;
|
|
||||||
} else {
|
_helperObject hideObject true;
|
||||||
_helperObject setPosAtl _helperPos;
|
|
||||||
};
|
|
||||||
// _helperObject hideObject true;
|
|
||||||
TRACE_3("Making New Helper",_helperObject,_x,_houseBeingScaned);
|
TRACE_3("Making New Helper",_helperObject,_x,_houseBeingScaned);
|
||||||
{
|
{
|
||||||
[_helperObject, 0, [], _x] call EFUNC(interact_menu,addActionToObject);
|
[_helperObject, 0, [], _x] call EFUNC(interact_menu,addActionToObject);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Author: PabstMirror
|
* Author: PabstMirror
|
||||||
* Scans for nearby "Static" objects (buildings) and adds the UserActions to them.
|
* Scans the buidling type for UserActions and Ladder mount points.
|
||||||
* Called when interact_menu starts rendering (from "interact_keyDown" event)
|
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Building Classname <STRING>
|
* 0: Building Classname <STRING>
|
||||||
@ -13,9 +12,10 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
|
||||||
PARAMS_1(_typeOfBuilding);
|
PARAMS_1(_typeOfBuilding);
|
||||||
|
|
||||||
|
private["_action", "_actionDisplayName", "_actionDisplayNameDefault", "_actionMaxDistance", "_actionOffset", "_actionPath", "_actionPosition", "_building", "_configPath", "_endIndex", "_iconImage", "_index", "_ladders", "_memPointIndex", "_memPoints", "_memPointsActions", "_startIndex"];
|
||||||
|
|
||||||
_memPoints = [];
|
_memPoints = [];
|
||||||
_memPointsActions = [];
|
_memPointsActions = [];
|
||||||
|
|
||||||
@ -98,39 +98,41 @@ _fnc_ladder_ladderUp = {
|
|||||||
PARAMS_3(_target,_player,_variable);
|
PARAMS_3(_target,_player,_variable);
|
||||||
EXPLODE_1_PVT(_variable,_ladderIndex);
|
EXPLODE_1_PVT(_variable,_ladderIndex);
|
||||||
_building = _target getVariable [QGVAR(building), objNull];
|
_building = _target getVariable [QGVAR(building), objNull];
|
||||||
ACE_player action ["LadderUp", _building, _ladderIndex, 0];
|
_player action ["LadderUp", _building, _ladderIndex, 0];
|
||||||
};
|
};
|
||||||
_fnc_ladder_ladderDown = {
|
_fnc_ladder_ladderDown = {
|
||||||
PARAMS_3(_target,_player,_variable);
|
PARAMS_3(_target,_player,_variable);
|
||||||
EXPLODE_1_PVT(_variable,_ladderIndex);
|
EXPLODE_1_PVT(_variable,_ladderIndex);
|
||||||
_building = _target getVariable [QGVAR(building), objNull];
|
_building = _target getVariable [QGVAR(building), objNull];
|
||||||
ACE_player action ["LadderUp", _building, (_variable select 0), 1];
|
_player action ["LadderUp", _building, (_variable select 0), 1];
|
||||||
|
};
|
||||||
|
|
||||||
|
_fnc_ladder_conditional = { //Don't show actions if on a ladder
|
||||||
|
((getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState _player) >> "onLadder")) == 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
_ladders = getArray (configFile >> "CfgVehicles" >> _typeOfBuilding >> "ladders");
|
_ladders = getArray (configFile >> "CfgVehicles" >> _typeOfBuilding >> "ladders");
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
EXPLODE_2_PVT(_x,_ladderBottomMemPoint,_ladderTopMemPoint);
|
EXPLODE_2_PVT(_x,_ladderBottomMemPoint,_ladderTopMemPoint);
|
||||||
|
|
||||||
_actionMaxDistance = 2;
|
_actionMaxDistance = 2;
|
||||||
|
|
||||||
_actionDisplayName = "Climb Ladder Up";
|
_actionDisplayName = localize "str_action_ladderup";
|
||||||
_iconImage = "\A3\ui_f\data\igui\cfg\actions\ladderup_ca.paa";
|
_iconImage = "\A3\ui_f\data\igui\cfg\actions\ladderup_ca.paa";
|
||||||
//Ladder Up Action:
|
//Ladder Up Action:
|
||||||
_actionOffset = [_ladderBottomMemPoint] call _fnc_getMemPointOffset;
|
_actionOffset = [_ladderBottomMemPoint] call _fnc_getMemPointOffset;
|
||||||
_actionOffset = _actionOffset vectorAdd [0,0,1];
|
_actionOffset = _actionOffset vectorAdd [0,0,1];
|
||||||
_memPointIndex = _memPoints find _ladderBottomMemPoint;
|
_memPointIndex = _memPoints find _ladderBottomMemPoint;
|
||||||
_action = [format ["LadderUp_%1", _forEachIndex], _actionDisplayName, _iconImage, _fnc_ladder_ladderUp, {true}, {}, [_forEachIndex], _actionOffset, _actionMaxDistance, [false,false,false,false,true]] call EFUNC(interact_menu,createAction);
|
_action = [format ["LadderUp_%1", _forEachIndex], _actionDisplayName, _iconImage, _fnc_ladder_ladderUp, _fnc_ladder_conditional, {}, [_forEachIndex], _actionOffset, _actionMaxDistance, [false,false,false,false,true]] call EFUNC(interact_menu,createAction);
|
||||||
(_memPointsActions select _memPointIndex) pushBack _action;
|
(_memPointsActions select _memPointIndex) pushBack _action;
|
||||||
|
|
||||||
_actionDisplayName = "Climb Ladder Down";
|
_actionDisplayName = localize "str_action_ladderdown";
|
||||||
_iconImage = "\A3\ui_f\data\igui\cfg\actions\ladderdown_ca.paa";
|
_iconImage = "\A3\ui_f\data\igui\cfg\actions\ladderdown_ca.paa";
|
||||||
//Ladder Down Action:
|
//Ladder Down Action:
|
||||||
_actionOffset = [_ladderTopMemPoint] call _fnc_getMemPointOffset;
|
_actionOffset = [_ladderTopMemPoint] call _fnc_getMemPointOffset;
|
||||||
_actionOffset = _actionOffset vectorAdd [0,0,1];
|
_actionOffset = _actionOffset vectorAdd [0,0,0.25];
|
||||||
_memPointIndex = _memPoints find _ladderTopMemPoint;
|
_memPointIndex = _memPoints find _ladderTopMemPoint;
|
||||||
_action = [format ["LadderDown_%1", _forEachIndex], _actionDisplayName, _iconImage, _fnc_ladder_ladderDown, {true}, {}, [_forEachIndex], _actionOffset, _actionMaxDistance, [false,false,false,false,true]] call EFUNC(interact_menu,createAction);
|
_action = [format ["LadderDown_%1", _forEachIndex], _actionDisplayName, _iconImage, _fnc_ladder_ladderDown, _fnc_ladder_conditional, {}, [_forEachIndex], _actionOffset, _actionMaxDistance, [false,false,false,false,true]] call EFUNC(interact_menu,createAction);
|
||||||
(_memPointsActions select _memPointIndex) pushBack _action;
|
(_memPointsActions select _memPointIndex) pushBack _action;
|
||||||
|
|
||||||
} forEach _ladders;
|
} forEach _ladders;
|
||||||
|
Loading…
Reference in New Issue
Block a user