Dragging - Add new dragging animations (#7950)

* New custom animation added

* Adjusted CfgMoves and the script components

* New drop animation and key handler

* CBA settings and new ManActions added

* Adjustments to the drop animation

* Added translations and fixed some stuff

* Update CfgMovesBasic.hpp

* Fix translations

Co-authored-by: Elgin675 <elgin675@hotmail.com>
Co-authored-by: Blutze <37950828+Blutze@users.noreply.github.com>

* Use the same key to drop object

* Update addons/dragging/stringtable.xml

Co-authored-by: Jo David <github@jonathandavid.de>

* Fix French translation

Co-authored-by: Elgin675 <elgin675@hotmail.com>

* Lower the weapon accuracy of the drag animations

* Removed auto-switch to handgun

* Update fnc_startDrag.sqf

 - Holding a launcher breaks the firing animation.
 - Now the unit has to hold either a primary weapon or handgun.

* Handle the unit's current weapon

Co-authored-by: BaerMitUmlaut <BaerMitUmlaut@users.noreply.github.com>

* Update addons/dragging/functions/fnc_handlePlayerWeaponChanged.sqf

Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com>

* Update addons/dragging/initSettings.sqf

Co-authored-by: Elgin675 <elgin675@hotmail.com>
Co-authored-by: Blutze <37950828+Blutze@users.noreply.github.com>
Co-authored-by: Jo David <github@jonathandavid.de>
Co-authored-by: BaerMitUmlaut <BaerMitUmlaut@users.noreply.github.com>
Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com>
Co-authored-by: jonpas <jonpas33@gmail.com>
This commit is contained in:
Dániel Boros 2021-04-20 13:33:58 +02:00 committed by PabstMirror
parent c7d4981329
commit 026b94903e
13 changed files with 258 additions and 25 deletions

View File

@ -1,8 +1,56 @@
class CfgMovesBasic { class CfgMovesBasic {
class ManActions {
ACE_dragWithPistol = "ace_dragging";
ACE_dragWithRifle = "AmovPercMstpSlowWrflDnon_AcinPknlMwlkSlowWrflDb_2";
};
class Actions { class Actions {
class MoveWithInjuredManDragger; class MoveWithInjuredManDragger;
class MoveWithInjuredManDraggerRfl: MoveWithInjuredManDragger { class MoveWithInjuredManDraggerRfl: MoveWithInjuredManDragger {
Up = "amovpercmstpsraswrfldnon"; Up = "amovpercmstpsraswrfldnon";
}; };
class MoveWithInjuredManDraggerPst;
class ACE_MoveWithInjuredManDraggerPst: MoveWithInjuredManDraggerPst {
Default = "ace_dragging_static";
FastB = "ace_dragging";
FastLB = "ace_dragging";
FastRB = "ace_dragging";
grabDrag = "ace_dragging_static";
grabCarry = "Helper_SwitchToCarrynon_pst";
HandGunOn = "ace_dragging_static";
PlayerSlowB = "ace_dragging";
PlayerSlowLB = "ace_dragging";
PlayerSlowRB = "ace_dragging";
PlayerTactB = "AmovPknlMtacSrasWpstDb";
PlayerTactF = "AmovPknlMtacSrasWpstDf";
PlayerTactL = "AmovPknlMtacSrasWpstDl";
PlayerTactLB = "AmovPknlMtacSrasWpstDbl";
PlayerTactLF = "AmovPknlMtacSrasWpstDfl";
PlayerTactR = "AmovPknlMtacSrasWpstDr";
PlayerTactRB = "AmovPknlMtacSrasWpstDbr";
PlayerTactRF = "AmovPknlMtacSrasWpstDfr";
PlayerWalkB = "ace_dragging";
PlayerWalkLB = "ace_dragging";
PlayerWalkRB = "ace_dragging";
released = "ace_dragging_drop";
SlowB = "ace_dragging";
SlowLB = "ace_dragging";
SlowRB = "ace_dragging";
Stop = "ace_dragging_static";
StopRelaxed = "ace_dragging_static";
TactB = "AmovPknlMtacSrasWpstDb";
TactF = "AmovPknlMtacSrasWpstDf";
TactL = "AmovPknlMtacSrasWpstDl";
TactLB = "AmovPknlMtacSrasWpstDbl";
TactLF = "AmovPknlMtacSrasWpstDfl";
TactR = "AmovPknlMtacSrasWpstDr";
TactRB = "AmovPknlMtacSrasWpstDbr";
TactRF = "AmovPknlMtacSrasWpstDfr";
Up = "ace_dragging_static";
WalkB = "ace_dragging";
WalkLB = "ace_dragging";
WalkRB = "ace_dragging";
};
}; };
}; };

View File

@ -1,13 +1,127 @@
class CfgMovesMaleSdr: CfgMovesBasic { class CfgMovesMaleSdr: CfgMovesBasic {
class InjuredMovedBase; class InjuredMovedBase;
class AgonyBaseRfl; class AgonyBaseRfl;
class StandBase;
class AmovPercMstpSlowWrflDnon_AcinPknlMwlkSlowWrflDb_1;
class DraggerBase;
class States { class States {
class AcinPknlMstpSnonWnonDnon_AcinPercMrunSnonWnonDnon: InjuredMovedBase { class AcinPknlMstpSnonWnonDnon_AcinPercMrunSnonWnonDnon: InjuredMovedBase {
speed = -10; // 1/10 speed = -10; // 1/10
}; };
class AinjPfalMstpSnonWrflDnon_carried_Up: AgonyBaseRfl { class AinjPfalMstpSnonWrflDnon_carried_Up: AgonyBaseRfl {
speed = -10; // 1/10 speed = -10; // 1/10
}; };
class AmovPercMstpSrasWpstDnon: StandBase {
ConnectTo[] = {
"AmovPercMstpSrasWpstDnon",
0.02,
"AovrPercMstpSrasWpstDf",
0.025,
"AmovPercMstpSrasWpstDnon_AidlPercMstpSlowWpstDnon",
0.0099999998,
"PistolMagazineReloadStand",
0.1,
"AmovPercMstpSrasWpstDnon_AmovPercMstpSlowWpstDnon",
0.02,
"AmovPercMstpSrasWpstDnon_AmovPercMstpSrasWrflDnon",
0.02,
"AmovPercMstpSrasWpstDnon_AwopPercMstpSoptWbinDnon",
0.02,
"AmovPercMstpSrasWpstDnon_AmovPercMstpSnonWnonDnon",
0.02,
"AmovPercMstpSrasWpstDnon_SaluteIn",
0.02,
"AwopPercMstpSgthWpstDnon_Part1",
0.1,
"AmovPercMstpSrasWpstDnon_AinvPknlMstpSnonWnonDnon",
0.02,
"AmovPercMstpSrasWpstDnon_AmovPercMstpSrasWlnrDnon",
0.02,
"AmovPercMstpSrasWpstDnon_AadjPercMstpSrasWpstDup",
0.02,
"AmovPercMstpSrasWpstDnon_AadjPercMstpSrasWpstDdown",
0.02,
"AmovPercMstpSrasWpstDnon_AadjPercMstpSrasWpstDleft",
0.02,
"AmovPercMstpSrasWpstDnon_AadjPercMstpSrasWpstDright",
0.02,
"AmovPercMstpSrasWpstDnon_AmovPercMstpSrasWpstDnon_gear",
0.02,
"Acts_starterPistol_in",
0.001,
"Acts_PistolRaisedStand_Default",
1,
"ace_dragging",
0.1
};
};
class AmovPercMstpSlowWrflDnon_AcinPknlMwlkSlowWrflDb_2: AmovPercMstpSlowWrflDnon_AcinPknlMwlkSlowWrflDb_1 {
aiming = "aimingDefault";
aimingBody = "aimingUpDefault";
aimPrecision = 5; // default: 1
};
class ace_dragging: DraggerBase {
actions = "ace_MoveWithInjuredManDraggerPst";
aiming = "aimingPistol";
aimingBody = "aimingPistol";
aimPrecision = 2; // default: 1
canPullTrigger = 1;
canReload = 0;
ConnectTo[] = {
"ace_dragging",
0.1,
"ace_dragging_drop",
0.2
};
disableWeapons = 0;
duty = 0.6;
enableBinocular = 0;
file = QPATHTO_T(anim\ace_dragging.rtm);
InterpolateTo[] = {
"ace_dragging_static",
0.1
};
interpolationSpeed = 5;
limitGunMovement = 0.2;
looped = 1;
showHandGun = 1;
turnSpeed = 0.5;
};
class ace_dragging_static: ace_dragging {
ConnectTo[] = {
"ace_dragging",
0.1,
"ace_dragging_drop",
0.2
};
InterpolateTo[] = {
"ace_dragging",
0.1,
"ace_dragging_drop",
0.2
};
looped = 1;
speed = 0;
};
class ace_dragging_drop: ace_dragging {
ConnectTo[] = {
"AmovPknlMstpSrasWpstDnon",
0.1
};
file = QPATHTO_T(anim\ace_dragging_drop.rtm);
InterpolateTo[] = {
"Unconscious",
0.02
};
interpolationSpeed = 5;
looped = 0;
};
}; };
}; };

View File

@ -6,4 +6,6 @@ PREP_RECOMPILE_START;
#include "XEH_PREP.hpp" #include "XEH_PREP.hpp"
PREP_RECOMPILE_END; PREP_RECOMPILE_END;
#include "initSettings.sqf"
ADDON = true; ADDON = true;

Binary file not shown.

Binary file not shown.

View File

@ -8,7 +8,7 @@ class CfgPatches {
requiredVersion = REQUIRED_VERSION; requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_interaction"}; requiredAddons[] = {"ace_interaction"};
author = ECSTRING(common,ACETeam); author = ECSTRING(common,ACETeam);
authors[] = {"Garth 'L-H' de Wet", "commy2", "PiZZADOX"}; authors[] = {"Garth 'L-H' de Wet", "commy2", "PiZZADOX", "Malbryn"};
url = ECSTRING(main,URL); url = ECSTRING(main,URL);
VERSION_CONFIG; VERSION_CONFIG;
}; };

View File

@ -1,6 +1,6 @@
#include "script_component.hpp" #include "script_component.hpp"
/* /*
* Author: commy2 * Author: commy2, Malbryn
* Drag an object. Called from ace_dragging_fnc_startDrag * Drag an object. Called from ace_dragging_fnc_startDrag
* *
* Arguments: * Arguments:
@ -43,18 +43,27 @@ _unit setVariable [QGVAR(isDragging), true, true];
_unit setVariable [QGVAR(draggedObject), _target, true]; _unit setVariable [QGVAR(draggedObject), _target, true];
// add drop action // add drop action
_unit setVariable [QGVAR(ReleaseActionID), [ GVAR(unit) = _unit;
_unit, "DefaultAction",
{!isNull ((_this select 0) getVariable [QGVAR(draggedObject), objNull])}, GVAR(releaseActionID) = [0xF1, [false, false, false], {
{[_this select 0, (_this select 0) getVariable [QGVAR(draggedObject), objNull]] call FUNC(dropObject)} [GVAR(unit), GVAR(unit) getVariable [QGVAR(draggedObject), objNull]] call FUNC(dropObject);
] call EFUNC(common,addActionEventHandler)]; }, "keydown", "", false, 0] call CBA_fnc_addKeyHandler;
// show mouse hint
["", localize LSTRING(Drop)] call EFUNC(interaction,showMouseHint);
// block firing
if !(GVAR(dragAndFire)) then {
_unit setVariable [QGVAR(blockFire), [
_unit, "DefaultAction",
{true},
{}
] call EFUNC(common,addActionEventHandler)];
};
// add anim changed EH // add anim changed EH
[_unit, "AnimChanged", FUNC(handleAnimChanged), [_unit]] call CBA_fnc_addBISEventHandler; [_unit, "AnimChanged", FUNC(handleAnimChanged), [_unit]] call CBA_fnc_addBISEventHandler;
// show mouse hint
[localize LSTRING(Drop), ""] call EFUNC(interaction,showMouseHint);
// check everything // check everything
[FUNC(dragObjectPFH), 0.5, [_unit, _target, CBA_missionTime]] call CBA_fnc_addPerFrameHandler; [FUNC(dragObjectPFH), 0.5, [_unit, _target, CBA_missionTime]] call CBA_fnc_addPerFrameHandler;

View File

@ -1,6 +1,6 @@
#include "script_component.hpp" #include "script_component.hpp"
/* /*
* Author: commy2 * Author: commy2, Malbryn
* Drop a dragged object. * Drop a dragged object.
* *
* Arguments: * Arguments:
@ -20,7 +20,12 @@ params ["_unit", "_target"];
TRACE_2("params",_unit,_target); TRACE_2("params",_unit,_target);
// remove drop action // remove drop action
[_unit, "DefaultAction", _unit getVariable [QGVAR(ReleaseActionID), -1]] call EFUNC(common,removeActionEventHandler); [QGVAR(releaseActionID), "keydown"] call CBA_fnc_removeKeyHandler;
// stop blocking
if !(GVAR(dragAndFire)) then {
[_unit, "DefaultAction", _unit getVariable [QGVAR(blockFire), -1]] call EFUNC(common,removeActionEventHandler);
};
private _inBuilding = [_unit] call FUNC(isObjectOnObject); private _inBuilding = [_unit] call FUNC(isObjectOnObject);

View File

@ -21,8 +21,8 @@ TRACE_2("params",_unit,_weapon);
if (_unit getVariable [QGVAR(isDragging), false]) then { if (_unit getVariable [QGVAR(isDragging), false]) then {
// drop dragged object when selecting a non-primary weapon // drop dragged object when changing weapon
if (_weapon != primaryWeapon _unit) then { if (_weapon != _unit getVariable [QGVAR(currentWeapon), ""]) then {
private _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull]; private _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
[_unit, _draggedObject] call FUNC(dropObject); [_unit, _draggedObject] call FUNC(dropObject);

View File

@ -1,6 +1,6 @@
#include "script_component.hpp" #include "script_component.hpp"
/* /*
* Author: commy2, PiZZADOX * Author: commy2, PiZZADOX, Malbryn
* Start the dragging process. * Start the dragging process.
* *
* Arguments: * Arguments:
@ -28,14 +28,34 @@ if (!GETVAR(_target,GVAR(ignoreWeightDrag),false) && {
[localize LSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured); [localize LSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured);
}; };
// add a primary weapon if the unit has none. // Add a primary weapon if the unit has none
// @todo prevent opening inventory when equipped with a fake weapon if !(GVAR(dragAndFire)) then {
if (primaryWeapon _unit isEqualto "") then { if (primaryWeapon _unit isEqualto "") then {
_unit addWeapon "ACE_FakePrimaryWeapon"; _unit addWeapon "ACE_FakePrimaryWeapon";
_unit selectWeapon primaryWeapon _unit;
} else {
_unit selectWeapon primaryWeapon _unit;
};
} else { // Making sure the unit is holding a primary weapon or handgun
if !(currentWeapon _unit in [primaryWeapon _unit, handgunWeapon _unit]) then {
if (primaryWeapon _unit != "") then {
// Use primary if possible
_unit selectWeapon primaryWeapon _unit;
} else {
if (handgunWeapon _unit != "") then {
// Use pistol if unit has no primary
_unit selectWeapon handgunWeapon _unit;
} else {
// Add fake weapon if no weapons besides launcher are available
_unit addWeapon "ACE_FakePrimaryWeapon";
_unit selectWeapon primaryWeapon _unit;
};
};
};
}; };
// select primary, otherwise the drag animation actions don't work. // Save the weapon so we can monitor if it changes
_unit selectWeapon primaryWeapon _unit; _unit setVariable [QGVAR(currentWeapon), currentWeapon _unit];
[_unit, "blockThrow", "ACE_dragging", true] call EFUNC(common,statusEffect_set); [_unit, "blockThrow", "ACE_dragging", true] call EFUNC(common,statusEffect_set);
@ -45,7 +65,13 @@ _unit selectWeapon primaryWeapon _unit;
// can't play action that depends on weapon if it was added the same frame // can't play action that depends on weapon if it was added the same frame
if !(_unit call EFUNC(common,isSwimming)) then { if !(_unit call EFUNC(common,isSwimming)) then {
[{ [{
[_this, "grabDrag"] call EFUNC(common,doGesture); private _unitWeapon = _this getVariable [QGVAR(currentWeapon), ""];
if (_unitWeapon isKindOf ["Pistol", configFile >> "CfgWeapons"]) then {
[_this, "ACE_dragWithPistol"] call EFUNC(common,doGesture);
} else {
[_this, "ACE_dragWithRifle"] call EFUNC(common,doGesture);
};
}, _unit] call CBA_fnc_execNextFrame; }, _unit] call CBA_fnc_execNextFrame;
}; };

View File

@ -0,0 +1,8 @@
[
QGVAR(dragAndFire),
"CHECKBOX",
[LSTRING(DragAndFire_DisplayName), LSTRING(DragAndFire_Description)],
localize LSTRING(SettingsName),
true,
false
] call CBA_fnc_addSetting;

View File

@ -16,5 +16,5 @@
#include "\z\ace\addons\main\script_macros.hpp" #include "\z\ace\addons\main\script_macros.hpp"
#define DRAG_ANIMATIONS ["amovpercmstpslowwrfldnon_acinpknlmwlkslowwrfldb_2", "amovpercmstpsraswpstdnon_acinpknlmwlksnonwpstdb_2", "amovpercmstpsnonwnondnon_acinpknlmwlksnonwnondb_2", "acinpknlmstpsraswrfldnon", "acinpknlmstpsnonwpstdnon", "acinpknlmstpsnonwnondnon", "acinpknlmwlksraswrfldb", "acinpknlmwlksnonwnondb"] #define DRAG_ANIMATIONS ["amovpercmstpslowwrfldnon_acinpknlmwlkslowwrfldb_2", "amovpercmstpsraswpstdnon_acinpknlmwlksnonwpstdb_2", "amovpercmstpsnonwnondnon_acinpknlmwlksnonwnondb_2", "acinpknlmstpsraswrfldnon", "acinpknlmstpsnonwpstdnon", "acinpknlmstpsnonwnondnon", "acinpknlmwlksraswrfldb", "acinpknlmwlksnonwnondb", "ace_dragging", "ace_dragging_static", "ace_dragging_drop"]
#define CARRY_ANIMATIONS ["acinpercmstpsnonwnondnon", "acinpknlmstpsnonwnondnon_acinpercmrunsnonwnondnon"] #define CARRY_ANIMATIONS ["acinpercmstpsnonwnondnon", "acinpknlmstpsnonwnondnon_acinpercmrunsnonwnondnon"]

View File

@ -104,5 +104,26 @@
<Polish>Wyżej/niżej | (Ctrl + Kółko myszy) obracanie</Polish> <Polish>Wyżej/niżej | (Ctrl + Kółko myszy) obracanie</Polish>
<Turkish>Yükselt/Alçalt | (Ctrl + Tekerlek) Döndür</Turkish> <Turkish>Yükselt/Alçalt | (Ctrl + Tekerlek) Döndür</Turkish>
</Key> </Key>
<Key ID="STR_ACE_Dragging_SettingsName">
<English>ACE Dragging</English>
<French>ACE Traînage d'objets et d'unités</French>
<German>ACE Ziehen</German>
<Hungarian>ACE Húzás</Hungarian>
<Russian>ACE Перетаскивание</Russian>
</Key>
<Key ID="STR_ACE_Dragging_DragAndFire_DisplayName">
<English>Allow firing while dragging</English>
<French>Arme utilisable durant le traînage</French>
<German>Schießen während des Ziehens erlauben</German>
<Hungarian>Húzás közbeni tüzelés engedélyezése</Hungarian>
<Russian>Стрельба во время перетаскивания</Russian>
</Key>
<Key ID="STR_ACE_Dragging_DragAndFire_Description">
<English>Allow the player to fire their gun while dragging.</English>
<French>Cette option permet aux joueurs de faire usage de leur arme pendant qu'ils traînent un objet ou une unité.\nL'arme secondaire est utilisée si le joueur en est équipé.</French>
<German>Erlaubt dem Spieler während des Ziehens das Abfeuern der Waffe.</German>
<Hungarian>Húzás közben a játékos elsütheti a fegyverét.</Hungarian>
<Russian>Позволяет игроку стрелять во время перетаскивания</Russian>
</Key>
</Package> </Package>
</Project> </Project>