more common code cleanup

This commit is contained in:
commy2 2015-09-20 16:40:49 +02:00
parent e8ebe87450
commit e62683a0c4
23 changed files with 48 additions and 60 deletions

View File

@ -3,18 +3,20 @@
*
* Execute a global event on all clients, including self.
*
* Argument:
* 0: Event name (string)
* 1: Event args (any)
* Arguments:
* 0: Event name <STRING>
* 1: Event args <ANY>
*
* Return value:
* Nothing
* Return Value:
* None
*
* Public: Yes
*/
#include "script_component.hpp"
//IGNORE_PRIVATE_WARNING("_handleNetEvent");
PARAMS_2(_eventName,_eventArgs);
params ["_eventName", "_eventArgs"];
ACEg = [_eventName, _eventArgs];
publicVariable "ACEg";
["ACEg", ACEg] call FUNC(_handleNetEvent);
["ACEg", ACEg] call FUNC(_handleNetEvent);

View File

@ -1,32 +1,22 @@
/*
* Author: commy2
* Move unit to kneeling position.
*
* Abhocken! Unit goes kneeling if not prone already and lowers weapon. Try, throw, catch because I'm bored.
* Arguments:
* 0: Unit <OBJECT>
*
* Argument:
* 0: Unit (Object)
* Return Value:
* None
*
* Return value:
* None.
* Public: No
*/
#include "script_component.hpp"
PARAMS_1(_unit);
params ["_unit"];
//IGNORE_PRIVATE_WARNING("_exception");
if (stance _unit == "PRONE") exitWith {};
try {
if (_unit == vehicle _unit) then {
switch (currentWeapon _unit) do {
case "" : {throw "AmovPknlMstpSnonWnonDnon"};
case (primaryWeapon _unit) : {throw "AmovPknlMstpSlowWrflDnon"};
case (secondaryWeapon _unit) : {throw "AmovPknlMstpSrasWlnrDnon"};
case (handgunWeapon _unit) : {throw "AmovPknlMstpSlowWpstDnon"};
case (binocular _unit) : {throw "AmovPknlMstpSoptWbinDnon"};
};
};
} catch {
if (stance _unit != "PRONE") then {
[_unit, _exception] call FUNC(doAnimation);
};
};
[
_unit,
["AmovPknlMstpSnonWnonDnon", "AmovPknlMstpSlowWrflDnon", "AmovPknlMstpSrasWlnrDnon", "AmovPknlMstpSlowWpstDnon", "AmovPknlMstpSoptWbinDnon"] select ((["", primaryWeapon _unit, secondaryWeapon _unit, handgunWeapon _unit, binocular _unit] find currentWeapon _unit) max 0)
] call FUNC(doAnimation);

View File

@ -1,6 +1,5 @@
/*
* Author: ?
*
* ?
*
* Arguments:

View File

@ -1,6 +1,5 @@
/*
* Author: ?
*
* ?
*
* Arguments:

View File

@ -1,6 +1,5 @@
/*
* Author: ?
*
* ?
*
* Arguments:

View File

@ -1,6 +1,5 @@
/*
* Author: ?
*
* ?
*
* Arguments:

View File

@ -1,6 +1,5 @@
/*
* Author: ?
*
* ?
*
* Arguments:

View File

@ -1,6 +1,5 @@
/*
* Author: ?
*
* ?
*
* Arguments:

View File

@ -1,6 +1,5 @@
/*
* Author: ?
*
* ?
*
* Arguments:

View File

@ -1,6 +1,5 @@
/*
* Author: ?
*
* ?
*
* Arguments:

View File

@ -14,4 +14,4 @@
*/
#include "script_component.hpp"
!isNull (_this select 0) && {alive (_this select 0)}
!isNull (_this select 0) && {alive (_this select 0)} // return

View File

@ -1,6 +1,5 @@
/*
* Author: Glowbal
*
* Check if unit is awake. Will be false when death or unit is unconscious.
*
* Arguments:
@ -15,4 +14,4 @@
params ["_unit"];
!(_unit getvariable ["ACE_isUnconscious", false]) && alive _unit && !(_unit getvariable ["ACE_isDead", false]);
!(_unit getvariable ["ACE_isUnconscious", false]) && alive _unit && !(_unit getvariable ["ACE_isDead", false]) // return

View File

@ -12,4 +12,6 @@
*/
#include "script_component.hpp"
isClass (configFile >> "cfgPatches" >> _this select 0) // return
params ["_modName"];
isClass (configFile >> "cfgPatches" >> _modName) // return

View File

@ -24,4 +24,5 @@ _array = + _array;
{
_array set [_forEachIndex, _x call _code];
} forEach _array;
_array

View File

@ -1,6 +1,5 @@
/*
* Author: KoffeinFlummi, joko // Jonas
*
* Nothing to see here, move along.
*
* Arguments:

View File

@ -1,6 +1,5 @@
/*
* Author: commy2
*
* Counterpart of ace_common_fnc_claim. Check if the given object is claimed by another unit.
*
* Arguments:

View File

@ -1,6 +1,5 @@
/*
* Author: bux578, commy2
*
* Returns the player or curator controlled unit.
* Use this in INIT and RESPAWN eh scripts, because ACE_player isn't reset yet.
*

View File

@ -1,6 +1,5 @@
/*
* Author: commy2
*
* Return the current side of the player
*
* Arguments:

View File

@ -10,7 +10,7 @@
* Return Value:
* None
*
* Public: No
* Public: Yes
*/
#include "script_component.hpp"

View File

@ -1,6 +1,5 @@
/*
* Author: esteldunedain
*
* Reads a setting value from a module, set it and force it. Logs if the setting is missing from the module.
* Must be called on the server, effect is global.
*

View File

@ -1,6 +1,5 @@
/*
* Author: commy2
*
* Remove a condition that gets checked by ace_common_fnc_canInteractWith.
*
* Arguments:

View File

@ -1,6 +1,5 @@
/*
* Author: commy2
*
* Called from respawn eventhandler. Resets all public object namespace variables that are added via FUNC(setVariableJIP).
*
* Arguments:

View File

@ -4,7 +4,7 @@
*
* Arguments:
* 0: Source string <STRING>
* 1: Remove html tags (optional) <BOOL>
* 1: Remove html tags (default: false) <BOOL>
*
* Return Value:
* Sanitized string
@ -15,28 +15,37 @@
params ["_string", ["_removeTags", false]];
private ["_array", "_arrayNew"];
private "_array";
_array = [];
_array = toArray _string;
_arrayNew = [];
{
switch _x do {
case 60 : {
_arrayNew = if (_removeTags) then {_arrayNew + toArray "&lt;";} else {_arrayNew + [_x];};
if (_removeTags) then {
_array append toArray "&lt;";
} else {
_array pushBack _x;
};
};
case 62 : {
_arrayNew = if (_removeTags) then {_arrayNew + toArray "&gt;";} else {_arrayNew + [_x];};
if (_removeTags) then {
_array append toArray "&gt;";
} else {
_array pushBack _x;
};
};
case 34 : {
};
case 39 : {
};
default {
_arrayNew = _arrayNew + [_x];
_array pushBack _x;
};
};
false
} count _array;
} count toArray _string;
toString _arrayNew
toString _array // return