more common cleanup

This commit is contained in:
commy2 2015-09-18 16:33:53 +02:00
parent c0fdd80ba4
commit 39786420fa
4 changed files with 54 additions and 37 deletions

View File

@ -1,25 +1,25 @@
/*
* Author: KoffeinFlummi
*
* Returns the Hadamard Product of two vectors.
* (x hadamard y) = [x1*y1, x2*y2, x3*y3]
*
* Arguments:
* 0: Vector 1
* 1: Vector 2
* 0: Vector 1 <ARRAY>
* 1: Vector 2 <ARRAY>
*
* Return Value:
* Hadamard Product
* Hadamard Product <ARRAY>
*
* Public: Yes
*/
#include "script_component.hpp"
PARAMS_2(_vector1,_vector2);
private ["_newVector", "_i"];
params ["_vector1", "_vector2"];
private "_newVector";
_newVector = [];
for "_i" from 0 to (((count _vector1) min (count _vector2)) - 1) do {
for "_i" from 0 to ((count _vector1 min count _vector2) - 1) do {
_newVector pushBack ((_vector1 select _i) * (_vector2 select _i));
};

View File

@ -1,42 +1,49 @@
/**
* fnc_headbugfix.sqf
* @Descr: Fixes animation issues that may get you stuck
* @Author: rocko
/*
* Author: rocko
* Fixes animation issues that may get you stuck
*
* @Arguments:
* @Return: nil
* @PublicAPI: true
* Arguments:
* None
*
* Return Value:
* None
*
* Public: Yes
*
* Note: Has to be spawned not called
*/
#include "script_component.hpp"
private ["_pos","_dir","_anim"];
_anim = animationState ACE_player;
private ["_unit", "_anim", "_pos", "_dir", "_dummy"];
_unit = ACE_player;
_anim = animationState _unit;
["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};
if (_unit != vehicle _unit || {!([_unit, objNull, ["isNotSitting"]] call FUNC(canInteractWith))}) exitWith {false};
_pos = getposATL ACE_player;
_dir = getDir ACE_player;
_pos = getPosATL _unit;
_dir = getDir _unit;
titleCut ["", "BLACK"];
[ACE_Player, "headBugFix"] call FUNC(hideUnit);
[_unit, "headBugFix"] call FUNC(hideUnit);
// create invisible headbug fix vehicle
_ACE_HeadbugFix = "ACE_Headbug_Fix" createVehicleLocal _pos;
_ACE_HeadbugFix setDir _dir;
ACE_player moveInAny _ACE_HeadbugFix;
_dummy = createVehicle ["ACE_Headbug_Fix", _pos, [], 0, "NONE"];
_dummy setDir _dir;
_unit moveInAny _dummy;
sleep 0.1;
unassignVehicle ACE_player;
ACE_player action ["Eject", vehicle ACE_player];
ACE_player setDir _dir;
ACE_player setposATL _pos;
unassignVehicle _unit;
_unit action ["Eject", vehicle _unit];
_unit setDir _dir;
_unit setPosATL _pos;
sleep 1.0;
deleteVehicle _ACE_HeadbugFix;
deleteVehicle _dummy;
[ACE_Player, "headBugFix"] call FUNC(unhideUnit);
[_unit, "headBugFix"] call FUNC(unhideUnit);
titleCut ["", "PLAIN"];
true

View File

@ -14,10 +14,9 @@
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_unit,_reason);
params ["_unit", "_reason"];
if (isNull _unit) exitWith {};
@ -29,6 +28,6 @@ if !(_reason in _setHiddenReasons) then {
_unit setVariable [QGVAR(setHiddenReasons), _setHiddenReasons, true];
};
//if !(isObjectHidden _unit) then { (Uncomment when isObjectHidden hits stable branch)
["hideObjectGlobal",[_unit,true]] call FUNC(serverEvent);
//};
if !(isObjectHidden _unit) then {
["hideObjectGlobal", [_unit, true]] call FUNC(serverEvent);
};

View File

@ -1,4 +1,15 @@
// by commy2
/*
* Author: commy2
* Check if given unit is in a transitional animation
*
* Arguments:
* 0: A soldier <Object>
*
* Return Value:
* <Bool>
*
* Public: Yes
*/
#include "script_component.hpp"
getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> animationState (_this select 0) >> "looped") == 0