Drag Body is working!!! Next steps clean up code

This commit is contained in:
2020-03-04 01:23:23 -07:00
parent 75b1a5719d
commit 033a55a311
4 changed files with 66 additions and 20 deletions

View File

@ -8,3 +8,9 @@ class H8_fnc_detach
allowedTargets = 0;
jip = 0;
};
class H8_takeCorpse
{
allowedTargets = 0;
jip = 0;
};

View File

@ -5,25 +5,62 @@
Modified by Zepheris to work with A3 Epoch's Dyna Menu System
*/
H8_CorpseDrag = {
params ["_corpse","_epochID"];
_output = format ["[dragBody] Debug: CorpseDrag - %1, %2, %3",player,_corpse,_epochID];
diag_log _output;
H8_DragAction = {
_unit = (_this select 0);
_epochID = (_this select 1);
if (local _corpse) then {
_output = format ["[dragBody] Debug: Corpse is Local - %1, %2, %3",player,_corpse,_epochID];
diag_log _output;
[_corpse,player,_epochID] call H8_DragAction;
}
else {
_output = format ["[dragBody] Debug: Corpse is *NOT* Local - %1, %2, %3",player,_corpse,_epochID];
diag_log _output;
[_corpse,player,_epochID] remoteexec ["H8_takeOwnCorpse",2];
};
};
H8_takeOwnCorpse = {
_corpse = _this select 0;
_player = _this select 1;
_epochID = _this select 2;
_corpse setowner (owner _player);
_code = {
_corpse = _this select 0;
_player = _this select 1;
_epochID = _this select 2;
_start = diag_ticktime;
waituntil {diag_ticktime - _start > 5 || local (_this select 0)};
if (local (_this select 0)) then {
[_corpse, _player,_epochID] call H8_DragAction;
};
};
_output = format ["[dragBody] Debug: Corpse: %1 - Code %2",_corpse, _code];
diag_log _output;
[[_corpse,_player,_epochID],_code] remoteexec ['BIS_fnc_spawn',_player];
};
H8_dragAction = {
_corpse = (_this select 0);
_player = (_this select 1);
_epochID = (_this select 2);
_output = format ["[dragBody] Debug: Drag Action - %1",_epochID];
diag_log _output;
//[[_unit, vehicle player,_unitID],"H8_fnc_attach",true] call BIS_fnc_MP;
[_unit, vehicle player, _epochID] remoteExec ["H8_fnc_attach",2];
_unit attachTo [player,[0,1,0]];
[_corpse, _player, _epochID] remoteExec ["H8_fnc_attach",2];
_corpse attachTo [_player,[0,1,0]];
player playAction "grabDrag";
player forceWalk true;
_player playAction "grabDrag";
_player forceWalk true;
};
H8_fnc_attach = {
_unit = (_this select 0);
_corpse = (_this select 0);
_player = (_this select 1);
_epochID = (_this select 2);
@ -31,30 +68,28 @@ H8_fnc_attach = {
diag_log _output;
//_id = format ["h8EF%1",_epochID];
[_epochID, "onEachFrame", "H8_fnc_moveBody",[_unit,_player]] call BIS_fnc_addStackedEventHandler;
[_epochID, "onEachFrame", "H8_fnc_moveBody",[_corpse,_player]] call BIS_fnc_addStackedEventHandler;
};
H8_fnc_moveBody = {
_unit = (_this select 0);
_corpse = (_this select 0);
_player = (_this select 1);
// CREDIT TOO Das Attorney FOR CODE
_pos = _player modelToWorld [0,1,0];
//Try changing these following commands to remoteExec
_unit setPos _pos;
_unit setDir 180;
_unit switchMove "AinjPpneMrunSnonWnonDb";
//diag_log "[dragBody] Debug: fnc_MoveBody";
_corpse setPos _pos;
_corpse setDir 180;
_corpse switchMove "AinjPpneMrunSnonWnonDb";
};
H8_dropAction = {
_unit = (_this select 0);
_corpse = (_this select 0);
_epochID = (_this select 1);
_output = format ["[dragBody] Debug: Drop Action - %1",_epochID];
diag_log _output;
[_unit, vehicle player, _epochID] remoteExec ["H8_fnc_detach",2];
detach _unit;
[_corpse, vehicle player, _epochID] remoteExec ["H8_fnc_detach",2];
detach _corpse;
// CLIENT SIDE
player playMove "amovpknlmstpsraswrfldnon";

View File

@ -34,7 +34,7 @@ class drag_Stuff
class drag_body
{
condition = "if (!(isNull dyna_cursorTarget) && !(alive dyna_cursorTarget)) then {true} else {false}";
action = "[dyna_cursorTarget,Epoch_personalToken] call H8_dragAction;";
action = "[dyna_cursorTarget,Epoch_personalToken] call H8_CorpseDrag;";
icon = "x\addons\a3_epoch_code\Data\UI\buttons\epoch_brownkey.paa";
tooltip = "Grab Test";
};

View File

@ -376,6 +376,11 @@ class CfgRemoteExec
allowedTargets = 0;
jip = 0;
};
class H8_takeOwnCorpse
{
allowedTargets = 0;
jip =0;
};
};
class Commands
{