Skip to content

Commit

Permalink
Merge pull request #1994 from acemod/improveHeadbugfix
Browse files Browse the repository at this point in the history
Improve headbugfix
  • Loading branch information
thojkooi committed Aug 4, 2015
2 parents 07845d5 + 8ac98ed commit 1ba4de7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 12 deletions.
7 changes: 7 additions & 0 deletions addons/common/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@
};
}] call FUNC(addEventhandler);


["HeadbugFixUsed", {
PARAMS_2(_profileName,_animation);
diag_log text format ["[ACE] Headbug Used: Name: %1, Animation: %2", _profileName, _animation];
}] call FUNC(addEventHandler);


//~~~~~Get Map Data~~~~~
//Find MGRS zone and 100km grid for current map
[] call FUNC(getMGRSdata);
Expand Down
36 changes: 24 additions & 12 deletions addons/common/functions/fnc_headBugFix.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,33 @@

#include "script_component.hpp"
private ["_pos","_dir","_anim"];
if (player != vehicle player || {(player getvariable ["ace_isUnconscious", false])}) exitWith {};

_anim = animationState ACE_player;
["HeadbugFixUsed", [profileName, _anim]] call FUNC(serverEvent);
["HeadbugFixUsed", [profileName, _anim]] call FUNC(localEvent);

if (ACE_player != vehicle ACE_player || { !([ACE_player, objNull, ["isNotSitting"]] call FUNC(canInteractWith)) } ) exitWith {false};

_pos = getposATL ACE_player;
_dir = getDir ACE_player;

titleCut ["", "BLACK"];
_pos = getposATL player;
_dir = getDir player;
_anim = animationState player;
[ACE_Player, "headBugFix"] call FUNC(hideUnit);

// create invisible headbug fix vehicle
_ACE_HeadbugFix = createVehicle ["ACE_Headbug_Fix", getposATL player, [], 0, "NONE"];
_ACE_HeadbugFix = "ACE_Headbug_Fix" createVehicleLocal _pos;
_ACE_HeadbugFix setDir _dir;
player moveInAny _ACE_HeadbugFix;
sleep 1.0;
unassignVehicle player;
player action ["Eject", vehicle player];
ACE_player moveInAny _ACE_HeadbugFix;
sleep 0.1;

unassignVehicle ACE_player;
ACE_player action ["Eject", vehicle ACE_player];
ACE_player setDir _dir;
ACE_player setposATL _pos;
sleep 1.0;

deleteVehicle _ACE_HeadbugFix;
player setposATL _pos;
player setDir _dir;
titleCut ["", "PLAIN"];

[ACE_Player, "headBugFix"] call FUNC(unhideUnit);
titleCut ["", "PLAIN"];
true

0 comments on commit 1ba4de7

Please sign in to comment.