mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Attach Stuff
This commit is contained in:
parent
3f9d96abd3
commit
8ceb2aabc1
@ -69,7 +69,7 @@ if (_unit == _attachToVehicle) then { //Self Attachment
|
|||||||
private "_player";
|
private "_player";
|
||||||
_player = ACE_player;
|
_player = ACE_player;
|
||||||
//Stop if player switch or player gets to far from vehicle
|
//Stop if player switch or player gets to far from vehicle
|
||||||
if ((GVAR(placer) != _player) || ((_player distance GVAR(SetupAttachVehicle)) > 9)) exitWith {
|
if ((GVAR(placer) != _player) || {(_player distance GVAR(SetupAttachVehicle)) > 7}) exitWith {
|
||||||
call FUNC(placeCancel);
|
call FUNC(placeCancel);
|
||||||
};
|
};
|
||||||
GVAR(pfeh_running) = true;
|
GVAR(pfeh_running) = true;
|
||||||
@ -77,8 +77,9 @@ if (_unit == _attachToVehicle) then { //Self Attachment
|
|||||||
GVAR(setupObject) setPosATL _pos;
|
GVAR(setupObject) setPosATL _pos;
|
||||||
}] call BIS_fnc_addStackedEventHandler;
|
}] call BIS_fnc_addStackedEventHandler;
|
||||||
|
|
||||||
//had to spawn the mouseHint, not sure why
|
//had to delay the mouseHint, not sure why
|
||||||
[localize "STR_ACE_Attach_PlaceAction", localize "STR_ACE_Attach_CancelAction"] spawn EFUNC(interaction,showMouseHint);
|
[{[localize "STR_ACE_Attach_PlaceAction", localize "STR_ACE_Attach_CancelAction"] call EFUNC(interaction,showMouseHint)}, [], 0, 0] call EFUNC(common,waitAndExecute);
|
||||||
|
|
||||||
_unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {GVAR(pfeh_running) AND !isNull (GVAR(setupObject))}, {call FUNC(placeApprove);}] call EFUNC(common,AddActionEventHandler)];
|
_unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {GVAR(pfeh_running) AND !isNull (GVAR(setupObject))}, {call FUNC(placeApprove);}] call EFUNC(common,AddActionEventHandler)];
|
||||||
_unit setVariable [QGVAR(cancelActionEH), [_unit, "MenuBack", {GVAR(pfeh_running) AND !isNull (GVAR(setupObject))}, {call FUNC(placeCancel);}] call EFUNC(common,AddActionEventHandler)];
|
_unit setVariable [QGVAR(cancelActionEH), [_unit, "MenuBack", {GVAR(pfeh_running) AND !isNull (GVAR(setupObject))}, {call FUNC(placeCancel);}] call EFUNC(common,AddActionEventHandler)];
|
||||||
};
|
};
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
0: OBJECT - unit
|
0: OBJECT - unit
|
||||||
0: OBJECT - target
|
1: OBJECT - target
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Nothing
|
Nothing
|
||||||
|
@ -56,7 +56,7 @@ _closeInDistance = 0;
|
|||||||
while {_keepGoingCloser} do {
|
while {_keepGoingCloser} do {
|
||||||
if (_closeInDistance >= _distanceFromCenter) exitWith {};
|
if (_closeInDistance >= _distanceFromCenter) exitWith {};
|
||||||
|
|
||||||
_closeInDistance = _closeInDistance + 0.01; //10mm
|
_closeInDistance = _closeInDistance + 0.01; //10mm each step
|
||||||
_endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance);
|
_endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance);
|
||||||
_endPosTestOffset set [2, (_startingOffset select 2)];
|
_endPosTestOffset set [2, (_startingOffset select 2)];
|
||||||
_endPosTest = _attachToVehicle modelToWorld _endPosTestOffset;
|
_endPosTest = _attachToVehicle modelToWorld _endPosTestOffset;
|
||||||
@ -80,8 +80,10 @@ while {_keepGoingCloser} do {
|
|||||||
deleteVehicle _setupObject;
|
deleteVehicle _setupObject;
|
||||||
|
|
||||||
//Checks
|
//Checks
|
||||||
if (_closeInDistance >= _distanceFromCenter) exitWith {ERROR("no valid spot found")};
|
if ((_closeInDistance >= _distanceFromCenter) || (!([_placer,_attachToVehicle,_itemClassname] call FUNC(canAttach)))) exitWith {
|
||||||
if (!([_placer,_attachToVehicle,_itemClassname] call FUNC(canAttach))) exitWith {ERROR("canAttach failed")};
|
TRACE_2("no valid spot found",_closeInDistance,_distanceFromCenter);
|
||||||
|
[localize "STR_ACE_Attach_Failed"] call EFUNC(common,displayTextStructured);
|
||||||
|
};
|
||||||
|
|
||||||
//Move it out slightly, for visability sake (better to look a little funny than be embedded//sunk in the hull)
|
//Move it out slightly, for visability sake (better to look a little funny than be embedded//sunk in the hull)
|
||||||
_closeInDistance = (_closeInDistance - 0.0085);
|
_closeInDistance = (_closeInDistance - 0.0085);
|
||||||
|
@ -29,10 +29,7 @@ GVAR(SetupPlacmentItem) = "";
|
|||||||
GVAR(SetupPlacmentText) = "";
|
GVAR(SetupPlacmentText) = "";
|
||||||
GVAR(setupObject) = objNull;
|
GVAR(setupObject) = objNull;
|
||||||
GVAR(SetupAttachVehicle) = objNull;
|
GVAR(SetupAttachVehicle) = objNull;
|
||||||
if (isNil QGVAR(placer)) then {
|
|
||||||
ERROR("Nil placer?");
|
|
||||||
GVAR(placer) = objNull;
|
|
||||||
};
|
|
||||||
|
|
||||||
[GVAR(placer), QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus);
|
[GVAR(placer), QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus);
|
||||||
call EFUNC(interaction,hideMouseHint);
|
call EFUNC(interaction,hideMouseHint);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- Edited with tabler - 2014-12-12 -->
|
<!-- Edited with tabler - 2015-01-31 -->
|
||||||
<Project name="ACE">
|
<Project name="ACE">
|
||||||
<Package name="Attach">
|
<Package name="Attach">
|
||||||
<Key ID="STR_ACE_Attach_AttachDetach">
|
<Key ID="STR_ACE_Attach_AttachDetach">
|
||||||
@ -168,5 +168,12 @@
|
|||||||
<Italian>Annulla</Italian>
|
<Italian>Annulla</Italian>
|
||||||
<Hungarian>Mégse</Hungarian>
|
<Hungarian>Mégse</Hungarian>
|
||||||
</Key>
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Attach_Failed">
|
||||||
|
<English>Attach Failed</English>
|
||||||
|
<French>Échec du Attacher</French>
|
||||||
|
<German>Befestigen Fehlgeschlagen</German>
|
||||||
|
<Russian>Присоединить Ошибка</Russian>
|
||||||
|
<Spanish>Error en Acoplar</Spanish>
|
||||||
|
</Key>
|
||||||
</Package>
|
</Package>
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in New Issue
Block a user