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";
|
||||
_player = ACE_player;
|
||||
//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);
|
||||
};
|
||||
GVAR(pfeh_running) = true;
|
||||
@ -77,8 +77,9 @@ if (_unit == _attachToVehicle) then { //Self Attachment
|
||||
GVAR(setupObject) setPosATL _pos;
|
||||
}] call BIS_fnc_addStackedEventHandler;
|
||||
|
||||
//had to spawn the mouseHint, not sure why
|
||||
[localize "STR_ACE_Attach_PlaceAction", localize "STR_ACE_Attach_CancelAction"] spawn EFUNC(interaction,showMouseHint);
|
||||
//had to delay the mouseHint, not sure why
|
||||
[{[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(cancelActionEH), [_unit, "MenuBack", {GVAR(pfeh_running) AND !isNull (GVAR(setupObject))}, {call FUNC(placeCancel);}] call EFUNC(common,AddActionEventHandler)];
|
||||
};
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
Parameters:
|
||||
0: OBJECT - unit
|
||||
0: OBJECT - target
|
||||
1: OBJECT - target
|
||||
|
||||
Returns:
|
||||
Nothing
|
||||
|
@ -56,7 +56,7 @@ _closeInDistance = 0;
|
||||
while {_keepGoingCloser} do {
|
||||
if (_closeInDistance >= _distanceFromCenter) exitWith {};
|
||||
|
||||
_closeInDistance = _closeInDistance + 0.01; //10mm
|
||||
_closeInDistance = _closeInDistance + 0.01; //10mm each step
|
||||
_endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance);
|
||||
_endPosTestOffset set [2, (_startingOffset select 2)];
|
||||
_endPosTest = _attachToVehicle modelToWorld _endPosTestOffset;
|
||||
@ -80,8 +80,10 @@ while {_keepGoingCloser} do {
|
||||
deleteVehicle _setupObject;
|
||||
|
||||
//Checks
|
||||
if (_closeInDistance >= _distanceFromCenter) exitWith {ERROR("no valid spot found")};
|
||||
if (!([_placer,_attachToVehicle,_itemClassname] call FUNC(canAttach))) exitWith {ERROR("canAttach failed")};
|
||||
if ((_closeInDistance >= _distanceFromCenter) || (!([_placer,_attachToVehicle,_itemClassname] call FUNC(canAttach)))) exitWith {
|
||||
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)
|
||||
_closeInDistance = (_closeInDistance - 0.0085);
|
||||
|
@ -29,10 +29,7 @@ GVAR(SetupPlacmentItem) = "";
|
||||
GVAR(SetupPlacmentText) = "";
|
||||
GVAR(setupObject) = objNull;
|
||||
GVAR(SetupAttachVehicle) = objNull;
|
||||
if (isNil QGVAR(placer)) then {
|
||||
ERROR("Nil placer?");
|
||||
GVAR(placer) = objNull;
|
||||
};
|
||||
|
||||
|
||||
[GVAR(placer), QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus);
|
||||
call EFUNC(interaction,hideMouseHint);
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Edited with tabler - 2014-12-12 -->
|
||||
<!-- Edited with tabler - 2015-01-31 -->
|
||||
<Project name="ACE">
|
||||
<Package name="Attach">
|
||||
<Key ID="STR_ACE_Attach_AttachDetach">
|
||||
@ -168,5 +168,12 @@
|
||||
<Italian>Annulla</Italian>
|
||||
<Hungarian>Mégse</Hungarian>
|
||||
</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>
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user