Headers and Replace Old Funcs

This commit is contained in:
PabstMirror 2015-01-19 16:51:27 -06:00
parent cf59a3c2d4
commit 8c9b90df76
17 changed files with 146 additions and 248 deletions

View File

@ -1,53 +1,50 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
serverInit = QUOTE(call COMPILE_FILE(scripts\readParameters));
disableModuload = true;
};
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
serverInit = QUOTE(call COMPILE_FILE(scripts\readParameters));
disableModuload = true;
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
disableModuload = true;
};
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
disableModuload = true;
};
};
class Extended_InitPost_EventHandlers {
class All {
class GVAR(executePersistent) {
init = QUOTE([_this select 0] call FUNC(executePersistent));
};
class All {
class GVAR(executePersistent) {
init = QUOTE([_this select 0] call FUNC(executePersistent));
};
class CAManBase {
class GVAR(setName) {
init = QUOTE(if (local (_this select 0)) then {_this call FUNC(setName)};);
};
// class GVAR(forceWalk) {
// init = QUOTE(if (local (_this select 0)) then {_this call FUNC(applyForceWalkStatus);};);
// };
class GVAR(statusEffects) {
init = QUOTE(if (local (_this select 0)) then {[ARR_3(_this select 0, SLX_XEH_MACHINE select 1, false)] call FUNC(applyStatusEffects);};);
};
};
class CAManBase {
class GVAR(setName) {
init = QUOTE(if (local (_this select 0)) then {_this call FUNC(setName)};);
};
class GVAR(statusEffects) {
init = QUOTE(if (local (_this select 0)) then {[ARR_3(_this select 0, SLX_XEH_MACHINE select 1, false)] call FUNC(applyStatusEffects);};);
};
};
};
class Extended_Respawn_EventHandlers {
class All {
class GVAR(restoreVariablesJIP) {
respawn = QUOTE(_this call FUNC(restoreVariablesJIP));
};
class GVAR(setName) {
respawn = QUOTE(_this call FUNC(setName));
};
class GVAR(RESETDefaults) {
respawn = QUOTE(_this call FUNC(resetAllDefaults_F));
};
class All {
class GVAR(restoreVariablesJIP) {
respawn = QUOTE(_this call FUNC(restoreVariablesJIP));
};
class CAManBase {
class GVAR(statusEffects) {
respawn = QUOTE(if (local (_this select 0)) then {[ARR_3(_this select 0, SLX_XEH_MACHINE select 1, true)] call FUNC(applyStatusEffects);};);
};
class GVAR(setName) {
respawn = QUOTE(_this call FUNC(setName));
};
class GVAR(RESETDefaults) {
respawn = QUOTE(_this call FUNC(resetAllDefaults_F));
};
};
class CAManBase {
class GVAR(statusEffects) {
respawn = QUOTE(if (local (_this select 0)) then {[ARR_3(_this select 0, false, true)] call FUNC(applyStatusEffects);};);
};
};
};

View File

@ -61,17 +61,18 @@ call COMPILE_FILE(scripts\KeyInput\initScrollWheel);
enableCamShake true;
// Set the name for the current player
["playerChanged", {
EXPLODE_2_PVT(_this,_newPlayer,_oldPlayer);
// Set the name for the current player
if (alive _newPlayer) then {
[_newPlayer] call FUNC(setName)
};
if (alive _oldPlayer) then {
[_oldPlayer] call FUNC(setName)
};
//Apply effects to new unit
["applyStatusEffects", [_newPlayer]] call FUNC(localEvent);
}] call FUNC(addEventhandler);
GVAR(OldPlayerInventory) = ACE_player call FUNC(getAllGear);

View File

@ -10,7 +10,6 @@ PREP(addMapMarkerCreatedEventHandler);
PREP(addScrollWheelEventHandler);
PREP(adminKick);
PREP(ambientBrightness);
PREP(applyForceWalkStatus);
PREP(binarizeNumber);
PREP(callCustomEventHandlers);
PREP(callCustomEventHandlersGlobal);
@ -38,12 +37,10 @@ PREP(executePersistent);
PREP(filter);
PREP(fixLoweredRifleAnimation);
PREP(getAllGear);
PREP(getCaptivityStatus);
PREP(getConfigCommander);
PREP(getConfigGunner);
PREP(getDefaultAnim);
PREP(getDoorTurrets);
PREP(getForceWalkStatus);
PREP(getHitPoints);
PREP(getHitPointsWithSelections);
PREP(getInPosition);
@ -106,8 +103,6 @@ PREP(restoreVariablesJIP);
PREP(revertKeyCodeLocalized);
PREP(sanitizeString);
PREP(serverLog);
PREP(setCaptivityStatus);
PREP(setForceWalkStatus);
PREP(setKeyDefault);
PREP(setName);
PREP(setParameter);
@ -265,10 +260,8 @@ PREP(getStatusEffects);
PREP(statusEffectSetCaptive);
PREP(statusEffectForceWalk);
["setCaptive", {_this call FUNC(statusEffectSetCaptive)}] call FUNC(addEventHandler);
["forceWalk", {_this call FUNC(statusEffectForceWalk)}] call FUNC(addEventHandler);
ADDON = true;

View File

@ -1,25 +0,0 @@
/*
Name: FUNC(applyForceWalkStatus)
Author: Pabst Mirror
Description:
Applys the forceWalk status of an unit. Called from Extended_InitPost_EventHandlers.
Parameters:
0: OBJECT - Unit
Returns:
None
Example:
[ACE_Player] call FUNC(applyForceWalkStatus)
*/
#include "script_component.hpp"
private ["_unit", "_forceWalkNumber"];
_unit = _this select 0;
_forceWalkNumber = _unit getVariable ["ACE_forceWalkStatusNumber", 0];
_unit forceWalk (_forceWalkNumber > 0);

View File

@ -1,3 +1,19 @@
/*
Name: applyStatusEffect
Author: Pabst Mirror
Description:
Sets the status effect on a unit.
Parameters:
0: OBJECT - Unit
Returns:
None
*/
#define DEBUG_MODE_FULL
#include "script_component.hpp"

View File

@ -1,29 +0,0 @@
/*
* Author: commy2
*
* Return the captivity status of an unit.
*
* Argument:
* 0: Unit (Object)
*
* Return value:
* Reasons, why the unit is a captive. An empty array is returned if the unit is not a captive (Array of Strings)
*/
#include "script_component.hpp"
private ["_unit", "_captivityReasons", "_unitCaptivityStatus", "_unitCaptivityReasons"];
_unit = _this select 0;
_captivityReasons = missionNamespace getVariable ["ACE_captivityReasons", []];
_unitCaptivityStatus = [captiveNum _unit, count _captivityReasons] call FUNC(binarizeNumber);
_unitCaptivityReasons = [];
{
if (_unitCaptivityStatus select _forEachIndex) then {
_unitCaptivityReasons pushBack _x;
};
} forEach _captivityReasons;
_unitCaptivityReasons

View File

@ -1,37 +0,0 @@
/*
Name: FUNC(getForceWalkStatus)
Author: Pabst Mirror (from captivity by commy2)
Description:
Returns reasons why the unit is forceWalk-ing, empty if not forced.
Parameters:
0: OBJECT - Unit
Returns:
ARRAY(of strings) - Reason why the unit is force walking
Example:
[ACE_Player] call FUNC(getForceWalkStatus)
*/
#include "script_component.hpp"
private ["_unit", "_forceWalkReasons", "_unitForceWalkNumber", "_unitForceWalkStatus", "_unitForceWalkReasons"];
_unit = _this select 0;
_forceWalkReasons = missionNamespace getVariable ["ACE_forceWalkReasons", []];
_unitForceWalkNumber = _unit getVariable ["ACE_forceWalkStatusNumber", 0];
_unitForceWalkStatus = [_unitForceWalkNumber, count _forceWalkReasons] call FUNC(binarizeNumber);
_unitForceWalkReasons = [];
{
if (_unitForceWalkStatus select _forEachIndex) then {
_unitForceWalkReasons pushBack _x;
};
} forEach _forceWalkReasons;
_unitForceWalkReasons

View File

@ -1,3 +1,20 @@
/*
Name: getStatusEffect
Author: Pabst Mirror
Description:
Sets the status effect on a unit.
Parameters:
0: OBJECT - Unit
1: STRING - Effect Type ("forceWalk")
Returns:
ARRAY of strings of the active Effect Names
*/
#define DEBUG_MODE_FULL
#include "script_component.hpp"

View File

@ -1,45 +0,0 @@
/*
* Author: commy2
*
* Set the captivity status of an unit. This allows the handling of more than one reason to set a unit captive.
*
* Argument:
* 0: Unit (Object)
* 1: The reason of the captivity (String)
* 2: Is the reason still valid? True for setting this reason, false for removing it (Bool)
*
* Return value:
* None.
*/
#include "script_component.hpp"
private ["_unit", "_reason", "_status", "_captivityReasons", "_unitCaptivityReasons", "_captivityReasonsBooleans", "_bitmask"];
_unit = _this select 0;
_reason = _this select 1;
_status = _this select 2;
_captivityReasons = missionNamespace getVariable ["ACE_captivityReasons", []];
// register new reason (these reasons are shared publicly, since units can change ownership, but keep their captivity status)
if !(_reason in _captivityReasons) then {
_captivityReasons pushBack _reason;
ACE_captivityReasons = _captivityReasons;
publicVariable "ACE_captivityReasons";
};
// get reasons why the unit is captive already and update to the new status
_unitCaptivityReasons = [_unit] call FUNC(getCaptivityStatus);
_captivityReasonsBooleans = [];
{
_captivityReasonsBooleans set [_forEachIndex, (_captivityReasons select _forEachIndex) in _unitCaptivityReasons];
} forEach _captivityReasons;
_captivityReasonsBooleans set [_captivityReasons find _reason, _status];
_bitmask = _captivityReasonsBooleans call FUNC(toBitmask);
// actually apply the setCaptive command globaly
[[_unit, _bitmask], "{(_this select 0) setCaptive (_this select 1)}", _unit] call FUNC(execRemoteFnc);

View File

@ -1,53 +0,0 @@
/*
Name: FUNC(setForceWalkStatus)
Author: Pabst Mirror (from captivity by commy2)
Description:
Sets the forceWalk status of an unit. This allows the handling of more than one reason to set forceWalk.
Unit will force walk until all reasons are removed.
Parameters:
0: OBJECT - Unit
1: STRING - Reason for forcing walking
2: BOOL - Is the reason still valid. True to force walk, false to remove restriction.
Returns:
None
Example:
[ACE_Player, "BrokenLeg", true] call FUNC(setForceWalkStatus)
*/
#include "script_component.hpp"
private ["_unit", "_reason", "_status", "_forceWalkReasons", "_unitForceWalkReasons", "_forceWalkReasonsBooleans", "_bitmaskNumber"];
_unit = _this select 0;
_reason = _this select 1;
_status = _this select 2;
_forceWalkReasons = missionNamespace getVariable ["ACE_forceWalkReasons", []];
// register new reason (these reasons are shared publicly, since units can change ownership, but keep their forceWalk status)
if !(_reason in _forceWalkReasons) then {
_forceWalkReasons pushBack _reason;
ACE_forceWalkReasons = _forceWalkReasons;
publicVariable "ACE_forceWalkReasons";
};
// get reasons why the unit is forceWalking already and update to the new status
_unitForceWalkReasons = [_unit] call FUNC(getForceWalkStatus);
_forceWalkReasonsBooleans = [];
{
_forceWalkReasonsBooleans set [_forEachIndex, (_forceWalkReasons select _forEachIndex) in _unitForceWalkReasons];
} forEach _forceWalkReasons;
_forceWalkReasonsBooleans set [_forceWalkReasons find _reason, _status];
_bitmaskNumber = _forceWalkReasonsBooleans call FUNC(toBitmask);
_unit setVariable ["ACE_forceWalkStatusNumber", _bitmaskNumber, true];
// actually apply the forceWalk command globaly
[[_unit], QUOTE(FUNC(applyForceWalkStatus)), _unit] call FUNC(execRemoteFnc);

View File

@ -1,10 +1,32 @@
/*
Name: setStatusEffect
Author: Pabst Mirror
Description:
Sets the status effect on a unit.
Note: the JIP/Respawn settings are global, so use different names.
Parameters:
0: OBJECT - Unit
1: STRING - Effect Name ("brokenLeg")
2: STRING - Effect Type ("forceWalk")
3: BOOL - Enabled
4: BOOL - Remove on JIP
5: BOOL - Remove on Respawn
Returns:
None
Example:
[this, "fattie", "forceWalk", true, false, false] call ace_common_fnc_setStatusEffect; //permenetnt effect
[this, "carrying jerrycan", "forceWalk", true, true, true] call ace_common_fnc_setStatusEffect; //will be removed if the disconnectAndJIP or respawn
*/
#define DEBUG_MODE_FULL
#include "script_component.hpp"
//[this, "fattie", "forceWalk", true, false, false] call ace_common_fnc_setStatusEffect;
//[this, "carrying jerrycan", "forceWalk", true, false, false] call ace_common_fnc_setStatusEffect;
#define HASH_INDEX(hash,key) ((hash select 0) find key)
PARAMS_4(_unit,_effectName,_effectType,_isEnabled);

View File

@ -1,7 +1,28 @@
/*
Name: statusEffectForceWalk
Author: Pabst Mirror
Description:
Handles the "forceWalk" event
Parameters:
0: OBJECT - Unit
1: BOOL - Enabled
Returns:
None
*/
#define DEBUG_MODE_FULL
#include "script_component.hpp"
PARAMS_2(_unit,_isEnabled);
_unit forceWalk _isEnabled;
if (!local _unit) then {
WARNING("statusEffectForceWalk with non local unit");
["forceWalk", _unit, [_unit, _isEnabled]] call FUNC(targetEvent);
} else {
_unit forceWalk _isEnabled;
};

View File

@ -1,12 +1,28 @@
/*
Name: statusEffectSetCaptive
Author: Pabst Mirror
Description:
Handles the "setCaptive" event
Parameters:
0: OBJECT - Unit
1: BOOL - Enabled
Returns:
None
*/
#define DEBUG_MODE_FULL
#include "script_component.hpp"
PARAMS_2(_unit,_isEnabled);
DEFAULT_PARAM(2,_isGlobal, false);
if (!_isGlobal) exitWith {
["setCaptive", [_unit, _isEnabled, true]] call FUNC(globalEvent);
if (!local _unit) then {
WARNING("statusEffectSetCaptive with non local unit");
["setCaptive", _unit, [_unit, _isEnabled]] call FUNC(targetEvent);
} else {
_unit setCaptive _isEnabled;
};
};

View File

@ -24,7 +24,8 @@ if (GVAR(pfeh_running)) then {
private ["_mag", "_setup", "_player"];
_setup = GVAR(Setup);
GVAR(Setup) = objNull;
[GVAR(placer), "ACE_Explosives", false] call EFUNC(Common,setForceWalkStatus);
// [GVAR(placer), "ACE_Explosives", false] call EFUNC(Common,setForceWalkStatus);
[GVAR(placer), "ACE_Explosives_Walk", "forceWalk", false, true, true] call EFUNC(common,setStatusEffect);
GVAR(placer) = objNull;
_player = ACE_player;
[_player, "DefaultAction", _player getVariable [QGVAR(Place), -1]] call EFUNC(Common,removeActionEventHandler);

View File

@ -28,7 +28,8 @@ GVAR(Setup) = objNull;
if (isNil {GVAR(placer)}) then {
GVAR(placer) = objNull;
};
[GVAR(placer), "ACE_Explosives", false] call EFUNC(Common,setForceWalkStatus);
// [GVAR(placer), "ACE_Explosives", false] call EFUNC(Common,setForceWalkStatus);
[GVAR(placer), "ACE_Explosives_Walk", "forceWalk", false, true, true] call EFUNC(common,setStatusEffect);
GVAR(placer) = objNull;
call EFUNC(interaction,hideMouseHint);
[ACE_player, "DefaultAction", ACE_player getVariable [QGVAR(Place), -1]] call EFUNC(Common,removeActionEventHandler);

View File

@ -43,7 +43,8 @@ if (!isNil "_timer") then {
GVAR(Setup) setVariable [QGVAR(Timer), _timer];
};
[_unit, "ACE_Explosives", true] call EFUNC(common,setForceWalkStatus);
// [_unit, "ACE_Explosives", true] call EFUNC(common,setForceWalkStatus);
[GVAR(placer), "ACE_Explosives_Walk", "forceWalk", true, true, true] call EFUNC(common,setStatusEffect);
GVAR(TweakedAngle) = 180;
[QGVAR(Placement),"OnEachFrame", {
private "_player";

View File

@ -44,7 +44,8 @@ if (vehicle _playerUnit == _playerUnit) then {
_playerUnit linkItem "ItemMap";
removeUniform _playerUnit;
[_playerUnit, "ACE_SwitchUnits", true] call EFUNC(common,setForceWalkStatus);
// [_playerUnit, "ACE_SwitchUnits", true] call EFUNC(common,setForceWalkStatus);
[_playerUnit, "ACE_SwitchUnits_Walk", "forceWalk", true, true, true] call EFUNC(common,setStatusEffect); //does anything disable this?
[_playerUnit, _sides] call FUNC(addMapFunction);
};