more common code cleanup

This commit is contained in:
commy2 2015-09-20 16:56:35 +02:00
parent e62683a0c4
commit 0a01bbdc76
8 changed files with 46 additions and 32 deletions

View File

@ -1,6 +1,5 @@
/*
* Author: KoffeinFlummi, commy2
*
* Filters array and removes every element not fitting the condition
*
* Arguments:
@ -12,22 +11,21 @@
*
* Usage:
* [[0,1,2,3,4], {_this > 2}] call FUNC(filter) ==> [3,4]
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_newArray", "_index"];
params ["_array", "_code"];
PARAMS_2(_array,_code);
private "_result";
_result = [];
if (isNil "_array") exitWith {
ACE_LOGERROR_1("No array for function filter in %1.",_fnc_scriptNameParent);
[]
};
_newArray = [];
for "_index" from 0 to (count _array - 1) do {
if ((_array select _index) call _code) then {
_newArray pushBack (_array select _index);
{
if (_x call _code) then {
_result pushBack _x;
};
};
_newArray
false
} count _array;
_result

View File

@ -1,13 +1,14 @@
/*
* Author: commy2
* Attempt to fix physx collisions causing unreasonable impact forces and damage.
* Attempt to fix PhysX collisions causing unreasonable impact forces and damage.
*
* Arguments:
* 0: Object <OBJECT>
* Object <OBJECT>
*
* Return Value:
* Nothing
* None
*
* Public: No
*/
#include "script_component.hpp"

View File

@ -1,9 +1,20 @@
// by commy2
/*
* Author: commy2
* Fixes zeus placed crates containing buged mine detectors and ace items.
*
* Arguments:
* 0: Crate <OBJECT>
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_weapons", "_items"];
params ["_crate"];
PARAMS_1(_crate);
private ["_weapons", "_items"];
// get all weapons inside the crate
_weapons = weaponCargo _crate;

View File

@ -3,16 +3,16 @@
* Attempt to fix floating physx with disabled damage after setPosXXX commands.
*
* Arguments:
* Physx object (Object)
* PhysX object <OBJECT>
*
* Return Value:
* Nothing
* None
*
* Public: No
*/
#include "script_component.hpp"
private "_object";
_object = _this;
// setHitPointDamage requires local object

View File

@ -15,8 +15,8 @@
*/
#include "script_component.hpp"
PARAMS_1(_unit);
params ["_unit"];
if (currentWeapon _unit != "" && {currentWeapon _unit == primaryWeapon _unit} && {weaponLowered _unit} && {stance _unit == "STAND"} && {(vehicle _unit) == _unit}) then {
if (currentWeapon _unit != "" && {currentWeapon _unit == primaryWeapon _unit} && {weaponLowered _unit} && {stance _unit == "STAND"} && {vehicle _unit == _unit}) then {
[_unit, "amovpercmstpsraswrfldnon", 0] call FUNC(doAnimation);
};

View File

@ -4,10 +4,12 @@
* Fixes position of an object. E.g. moves object above ground and adjusts to terrain slope. Requires local object.
*
* Argument:
* Object (Object)
* Object <OBJECT>
*
* Return value:
* NONE
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"

View File

@ -3,10 +3,10 @@
* Check if the object still exists and is alive. This function exists because 'alive objNull' actually returns true.
*
* Argument:
* 0: Any object (Object)
* 0: Any object <OBJECT>
*
* Return value:
* The object exists and is alive (Bool).
* The object exists and is alive <BOOL>.
*
* Public: Yes
*
@ -14,4 +14,6 @@
*/
#include "script_component.hpp"
!isNull (_this select 0) && {alive (_this select 0)} // return
params ["_unit"];
!isNull _unit && {alive _unit} // return

View File

@ -12,7 +12,7 @@
* Usage:
* [["2", "gobblecock", "25"], {parseNumber _this}] call FUNC(map) ==> [2, 0, 25]
*
* Public: No
* Public: Yes
*/
#include "script_component.hpp"