mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
move to functions
This commit is contained in:
parent
ff5d56af46
commit
c89dffa1d0
@ -0,0 +1,34 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Converts array to boolean logic checks
|
||||
|
||||
Licence:
|
||||
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
|
||||
|
||||
Github:
|
||||
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/functions/EPOCH_fnc_arrayToLogic.sqf
|
||||
|
||||
Example:
|
||||
[1,">=",0] call EPOCH_fnc_arrayToLogic; // returns: true
|
||||
|
||||
Parameter(s):
|
||||
_this select 0: NUMBER - First value
|
||||
_this select 1: STRING - compare operator
|
||||
_this select 2: NUMBER - Second value
|
||||
|
||||
Returns:
|
||||
BOOL
|
||||
*/
|
||||
params [["_v",""],["_t",""],["_d",""]];
|
||||
switch (_t) do {
|
||||
case ">=": {_v >= _d};
|
||||
case "<=": {_v <= _d};
|
||||
case "<": {_v < _d};
|
||||
case ">": {_v > _d};
|
||||
case "!=": {!(_v isEqualTo _d)};
|
||||
default {_v isEqualTo _d};
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Returns specific values based on an index or falls back to defaults.
|
||||
|
||||
Licence:
|
||||
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
|
||||
|
||||
Github:
|
||||
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/functions/EPOCH_fnc_returnHudVar.sqf
|
||||
|
||||
Example:
|
||||
// HUD and Logic functions - todo move to client function.
|
||||
[_selVarName,_varIndex,_selVarType,_selVarSubData] call EPOCH_fnc_returnHudVar
|
||||
|
||||
Parameter(s):
|
||||
_this select 0: STRING - variable name
|
||||
_this select 1: NUMBER - default variable index
|
||||
_this select 2: STRING - variable type
|
||||
_this select 3: STRING - extra data
|
||||
|
||||
Returns:
|
||||
MIXED
|
||||
*/
|
||||
params [["_selVarName",""],["_varIndex",0],["_selVarType",""],["_selVarSubData",""]];
|
||||
switch (_selVarType) do {
|
||||
case "getMissionNamespaceVariable": {missionNamespace getVariable[_selVarName,_selVarSubData]};
|
||||
case "getPlayerHitPointDamage": {player getHitPointDamage _selVarSubData};
|
||||
case "getPlayerOxygenRemaining": {getOxygenRemaining player};
|
||||
case "getPlayerDamage": {damage player};
|
||||
default {missionNamespace getVariable[format['EPOCH_player%1', _selVarName],EPOCH_defaultVars select _varIndex]};
|
||||
}
|
@ -51,7 +51,7 @@ EPOCH_currentTargetMode = _currentTargetMode;
|
||||
if (_customVarLimits isEqualTo []) then {
|
||||
_customVarLimits = EPOCH_customVarLimits select _varIndex;
|
||||
};
|
||||
_currentVarVal = [_selVarName,_varIndex,_selVarType,_selVarSubData] call _fnc_returnHudVar;
|
||||
_currentVarVal = [_selVarName,_varIndex,_selVarType,_selVarSubData] call EPOCH_fnc_returnHudVar;
|
||||
_customVarLimits params [["_playerLimitMax",100],["_playerLimitMin",0],["_playerWarnLimit",101],["_playerCriticalLimit",101],["_playerWarnLow",0],["_playerCriticalLow",0]];
|
||||
|
||||
_extraLogic = false;
|
||||
@ -63,7 +63,7 @@ EPOCH_currentTargetMode = _currentTargetMode;
|
||||
_extraLogicType params [["_extraLogicVarName",""],["_extraLogicType",""],["_extraLogicDefaultValue",""]];
|
||||
};
|
||||
_extraVarIndex = EPOCH_customVars find _extraLogicVarName;
|
||||
_extraLogic = [([_extraLogicVarName,_extraVarIndex,_extraLogicType,_extraLogicDefaultValue] call _fnc_returnHudVar),_extraLogicCond,_extraLogicData] call _fnc_arrayToLogic;
|
||||
_extraLogic = [([_extraLogicVarName,_extraVarIndex,_extraLogicType,_extraLogicDefaultValue] call EPOCH_fnc_returnHudVar),_extraLogicCond,_extraLogicData] call EPOCH_fnc_arrayToLogic;
|
||||
};
|
||||
|
||||
if (_playerLimitMax isEqualType "") then {
|
||||
|
@ -37,40 +37,11 @@ EPOCH_chargeRate = 0;
|
||||
EPOCH_playerIsSwimming = false;
|
||||
|
||||
// default data if mismatch
|
||||
if (count EPOCH_playerSpawnArray != count EPOCH_spawnIndex) then{
|
||||
if !(EPOCH_playerSpawnArray isEqualTypeParams EPOCH_spawnIndex) then{
|
||||
EPOCH_playerSpawnArray = [];
|
||||
{ EPOCH_playerSpawnArray pushBack 0 } forEach EPOCH_spawnIndex;
|
||||
};
|
||||
|
||||
// HUD and Logic functions - todo move to client function.
|
||||
/*
|
||||
[_selVarName,_varIndex,_selVarType,_selVarSubData] call _fnc_returnHudVar
|
||||
*/
|
||||
_fnc_returnHudVar = {
|
||||
params [["_selVarName",""],["_varIndex",0],["_selVarType",""],["_selVarSubData",""]];
|
||||
switch (_selVarType) do {
|
||||
case "getMissionNamespaceVariable": {missionNamespace getVariable[_selVarName,_selVarSubData]};
|
||||
case "getPlayerHitPointDamage": {player getHitPointDamage _selVarSubData};
|
||||
case "getPlayerOxygenRemaining": {getOxygenRemaining player};
|
||||
case "getPlayerDamage": {damage player};
|
||||
default {missionNamespace getVariable[format['EPOCH_player%1', _selVarName],EPOCH_defaultVars select _varIndex]};
|
||||
}
|
||||
};
|
||||
/*
|
||||
[1,">=",0] call _fnc_arrayToLogic; // returns: true
|
||||
*/
|
||||
_fnc_arrayToLogic = {
|
||||
params [["_v",""],["_t",""],["_d",""]];
|
||||
switch (_t) do {
|
||||
case ">=": {_v >= _d};
|
||||
case "<=": {_v <= _d};
|
||||
case "<": {_v < _d};
|
||||
case ">": {_v > _d};
|
||||
case "!=": {!(_v isEqualTo _d)};
|
||||
default {_v isEqualTo _d};
|
||||
}
|
||||
};
|
||||
|
||||
// find radio
|
||||
{
|
||||
if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) == "ItemRadio") exitWith{
|
||||
@ -112,27 +83,6 @@ _lootBubble = {
|
||||
EPOCH_lastPlayerPos = _playerPos;
|
||||
};
|
||||
|
||||
// [control,bool] call _fadeUI;
|
||||
_fadeUI = {
|
||||
params ["_ctrl","_bool"];
|
||||
if (_bool) then {
|
||||
if (ctrlFade _ctrl == 0) then {
|
||||
_ctrl ctrlSetFade 1;
|
||||
_ctrl ctrlCommit 0.5;
|
||||
};
|
||||
if (ctrlFade _ctrl == 1) then {
|
||||
_ctrl ctrlSetFade 0;
|
||||
_ctrl ctrlCommit 0.5;
|
||||
};
|
||||
} else {
|
||||
if (ctrlFade _ctrl != 1) then {
|
||||
_ctrl ctrlSetFade 0;
|
||||
_ctrl ctrlCommit 0;
|
||||
};
|
||||
};
|
||||
_bool
|
||||
};
|
||||
|
||||
_cursorTarget = objNull;
|
||||
|
||||
// init cfgBaseBuilding config var
|
||||
|
Loading…
Reference in New Issue
Block a user