Epoch/Sources/epoch_code/compile/setup/masterLoop/Event1.sqf

264 lines
8.4 KiB
Plaintext
Raw Normal View History

2016-01-15 19:22:40 +00:00
_currentTarget = objNull;
_currentTargetMode = 0;
2016-01-15 19:22:40 +00:00
_cursorTarget = ([10] call EPOCH_fnc_cursorTarget);
if (!isNull _cursorTarget && {!(EPOCH_target isEqualTo _cursorTarget)}) then {
_interactType = typeOf _cursorTarget;
_interaction = (_cfgObjectInteractions >> _interactType);
if (isClass(_interaction)) then {
_currentTargetMode = getNumber (_interaction >> "interactMode");
_allowTarget = switch (getNumber (_interaction >> "aliveState")) do {
case 1: {!(alive _cursorTarget)};
case 2: {(alive _cursorTarget)};
default {true};
};
if (_allowTarget) then {
_currentTarget = _cursorTarget;
};
} else {
// AllVehicles = vehicles=0, bases=1
if (_cursorTarget isKindOf "AllVehicles") then {
_currentTarget = _cursorTarget;
2015-11-08 15:26:38 +00:00
} else {
if (_cursorTarget isKindOf "Constructions_modular_F" || _cursorTarget isKindOf "Constructions_static_F") then {
_currentTargetMode = 1;
_currentTarget = _cursorTarget;
};
2015-11-08 15:26:38 +00:00
};
2016-01-15 19:22:40 +00:00
};
};
EPOCH_currentTarget = _currentTarget;
EPOCH_currentTargetMode = _currentTargetMode;
2016-01-15 19:22:40 +00:00
_increaseStamina = false;
_vehicle = vehicle player;
if (_vehicle == player) then {
_val = log(abs(speed player));
_staminaThreshold = 0.7;
if (EPOCH_playerIsSwimming) then {_staminaThreshold = 0.3};
if (_val>_staminaThreshold) then {
EPOCH_playerStamina = (EPOCH_playerStamina - (_val/4)) max 0;
} else {
_increaseStamina = true;
};
} else {
if (EPOCH_buildMode > 0) then {
EPOCH_buildMode = 0;
EPOCH_snapDirection = 0;
2016-06-18 01:22:29 +00:00
["BUILD MODE: DISABLED", 5] call Epoch_message;
2016-01-15 19:22:40 +00:00
EPOCH_Target = objNull;
};
_increaseStamina = true;
2016-04-22 15:46:53 +00:00
// TODO: move back to vehicle configs
2016-01-15 19:22:40 +00:00
switch (typeOf _vehicle) do {
case "jetski_epoch": {
_clock_hour10 = floor ((date select 3)/10);
_clock_minute10 = floor ((date select 4)/10);
{
_vehicle setObjectTexture [_forEachIndex,_x];
}forEach[
format["\x\addons\a3_epoch_vehicles\data\num%1_ca.paa",_clock_hour10],
format["\x\addons\a3_epoch_vehicles\data\num%1_ca.paa",(date select 3)-(_clock_hour10*10)],
format["\x\addons\a3_epoch_vehicles\data\num%1_ca.paa",_clock_minute10],
format["\x\addons\a3_epoch_vehicles\data\num%1_ca.paa",(date select 4)-(_clock_minute10*10)],
format["\x\addons\a3_epoch_vehicles\data\fuel%1_ca.paa",floor(fuel _vehicle*10)]
];
2015-11-08 15:26:38 +00:00
};
2016-01-15 19:22:40 +00:00
case "ebike_epoch": {
{
_vehicle setObjectTexture [_forEachIndex,_x];
}forEach[
format["\x\addons\a3_epoch_vehicles\data\speed%1_ca.paa",floor(speed _vehicle/9) max 0],
format["\x\addons\a3_epoch_vehicles\data\energ%1_ca.paa",floor(fuel _vehicle*14)]
];
2015-11-08 15:26:38 +00:00
};
2016-01-15 19:22:40 +00:00
};
};
_envCold = EPOCH_playerTemp <= 95.0;
_envHot = EPOCH_playerTemp >= 106.7;
_hungry = EPOCH_playerHunger <= 0;
_thirsty = EPOCH_playerThirst <= 0;
_warnbloodPressure = EPOCH_playerBloodP > 120;
//_thirst ctrlShow (EPOCH_playerThirst <= 625);
/*
if (EPOCH_playerThirst <= 625) then {
_thirst = ["topRight",_hudIndex] call epoch_getHUDCtrl;
_hudIndex = _hudIndex + 1;
_thirst ctrlSetText "x\addons\a3_epoch_code\Data\UI\thirst_ca.paa";
[_thirst,_thirsty] call _scaleUI;
Release 0.3.8 (#502) * first build for 0.3.8 * 0.3.8.0190 * 0.3.8.0202 * 0.3.8.0213 * 0.3.7.0214 * 0.3.8.0222 * 0.3.8.0246 * 0.3.8.0247 fixed typo * 0.3.8.0249 more fixes for server compiler * 0.3.8.0256 * add build number and simple batch file for packing * match build number with internal * add build numbers to server pbo's and mission files also reworked build script for more options * 0.3.8.0261 * 0.3.8.0261 * 0.3.8.0283 * 0.3.8.0284 * changelog * 0.3.8.0307 * 0.3.8.0311 * remove old BEC plugin * update redis-server.exe to latest build and full config * 0.3.8.0314 * 0.3.8.0315 * inverse logic This should correctly prevent spawning these units nearby jammer or protection zones * use pushbackUnique here * optimized loot function by using selectRandom instead of slower sqf logic * 0.3.8.0316 * make use of new getDir functionality instead of BIS fnc * add lower disconnect value to server.cfg * use new getpos functionality * 0.3.8.0317 * 0.3.8.0319 * 0.3.8.0327 * 0.3.8.0338 changelog update tba * changelog * 0.3.8.0341 * BE update * 0.3.8.0353 * changelog * removed duplicates * 0.3.8.0355 fixed error in getIDC * 0.3.8.0356 revert to BIS_fnc_param as params threw errors * 0.3.8.0357 fixes for #496 #497 * 0.3.8.0359 fixed #497 fixed #496 * 0.3.8.0365 * 0.3.8.0371 * 0.3.8.0373 * 0.3.8.0379 * 0.3.8.0381 * 0.3.8.0386 * 0.3.8.0393 * 0.3.8.0395 * 0.3.8.0396 * 0.3.8.0397 * 0.3.8.0406 * 0.3.8.0409 * 0.3.8.0410 loot balance suppress error in spawnloot make near object check based on building size * 0.3.8.0412 * 0.3.8.0414 removed classes with scope 0 test remove loot trash on gear for #498 fixed #501 * 0.3.8.0415 * same
2016-04-08 20:21:46 +00:00
_color = [2500,0,EPOCH_playerThirst,1] call EPOCH_colorRange;
_thirst ctrlSetTextColor _color;
2016-01-15 19:22:40 +00:00
};
if (EPOCH_playerHunger <= 1250) then {
_hunger = ["topRight",_hudIndex] call epoch_getHUDCtrl;
_hudIndex = _hudIndex + 1;
_hunger ctrlSetText "x\addons\a3_epoch_code\Data\UI\hunger_ca.paa";
[_hunger,_hungry] call _scaleUI;
Release 0.3.8 (#502) * first build for 0.3.8 * 0.3.8.0190 * 0.3.8.0202 * 0.3.8.0213 * 0.3.7.0214 * 0.3.8.0222 * 0.3.8.0246 * 0.3.8.0247 fixed typo * 0.3.8.0249 more fixes for server compiler * 0.3.8.0256 * add build number and simple batch file for packing * match build number with internal * add build numbers to server pbo's and mission files also reworked build script for more options * 0.3.8.0261 * 0.3.8.0261 * 0.3.8.0283 * 0.3.8.0284 * changelog * 0.3.8.0307 * 0.3.8.0311 * remove old BEC plugin * update redis-server.exe to latest build and full config * 0.3.8.0314 * 0.3.8.0315 * inverse logic This should correctly prevent spawning these units nearby jammer or protection zones * use pushbackUnique here * optimized loot function by using selectRandom instead of slower sqf logic * 0.3.8.0316 * make use of new getDir functionality instead of BIS fnc * add lower disconnect value to server.cfg * use new getpos functionality * 0.3.8.0317 * 0.3.8.0319 * 0.3.8.0327 * 0.3.8.0338 changelog update tba * changelog * 0.3.8.0341 * BE update * 0.3.8.0353 * changelog * removed duplicates * 0.3.8.0355 fixed error in getIDC * 0.3.8.0356 revert to BIS_fnc_param as params threw errors * 0.3.8.0357 fixes for #496 #497 * 0.3.8.0359 fixed #497 fixed #496 * 0.3.8.0365 * 0.3.8.0371 * 0.3.8.0373 * 0.3.8.0379 * 0.3.8.0381 * 0.3.8.0386 * 0.3.8.0393 * 0.3.8.0395 * 0.3.8.0396 * 0.3.8.0397 * 0.3.8.0406 * 0.3.8.0409 * 0.3.8.0410 loot balance suppress error in spawnloot make near object check based on building size * 0.3.8.0412 * 0.3.8.0414 removed classes with scope 0 test remove loot trash on gear for #498 fixed #501 * 0.3.8.0415 * same
2016-04-08 20:21:46 +00:00
_color = [5000,0,EPOCH_playerHunger,1] call EPOCH_colorRange;
_hunger ctrlSetTextColor _color;
2016-01-15 19:22:40 +00:00
};
*/
2016-01-15 19:22:40 +00:00
_playerOxygen = getOxygenRemaining player;
//_oxygen ctrlShow (_playerOxygen < 1);
if (_playerOxygen < 1) then {
_hudIndex = missionNamespace getVariable [format["EPOCH_dynHUD_%1","topRight"],1];
_oxygen = ["topRight",_hudIndex] call epoch_getHUDCtrl;
missionNamespace setVariable [format["EPOCH_dynHUD_%1","topRight"], _hudIndex + 1];
_oxygen ctrlSetText "x\addons\a3_epoch_code\Data\UI\oxygen_ca.paa";
[_oxygen,(_playerOxygen <= 0.55)] call _scaleUI;
Release 0.3.8 (#502) * first build for 0.3.8 * 0.3.8.0190 * 0.3.8.0202 * 0.3.8.0213 * 0.3.7.0214 * 0.3.8.0222 * 0.3.8.0246 * 0.3.8.0247 fixed typo * 0.3.8.0249 more fixes for server compiler * 0.3.8.0256 * add build number and simple batch file for packing * match build number with internal * add build numbers to server pbo's and mission files also reworked build script for more options * 0.3.8.0261 * 0.3.8.0261 * 0.3.8.0283 * 0.3.8.0284 * changelog * 0.3.8.0307 * 0.3.8.0311 * remove old BEC plugin * update redis-server.exe to latest build and full config * 0.3.8.0314 * 0.3.8.0315 * inverse logic This should correctly prevent spawning these units nearby jammer or protection zones * use pushbackUnique here * optimized loot function by using selectRandom instead of slower sqf logic * 0.3.8.0316 * make use of new getDir functionality instead of BIS fnc * add lower disconnect value to server.cfg * use new getpos functionality * 0.3.8.0317 * 0.3.8.0319 * 0.3.8.0327 * 0.3.8.0338 changelog update tba * changelog * 0.3.8.0341 * BE update * 0.3.8.0353 * changelog * removed duplicates * 0.3.8.0355 fixed error in getIDC * 0.3.8.0356 revert to BIS_fnc_param as params threw errors * 0.3.8.0357 fixes for #496 #497 * 0.3.8.0359 fixed #497 fixed #496 * 0.3.8.0365 * 0.3.8.0371 * 0.3.8.0373 * 0.3.8.0379 * 0.3.8.0381 * 0.3.8.0386 * 0.3.8.0393 * 0.3.8.0395 * 0.3.8.0396 * 0.3.8.0397 * 0.3.8.0406 * 0.3.8.0409 * 0.3.8.0410 loot balance suppress error in spawnloot make near object check based on building size * 0.3.8.0412 * 0.3.8.0414 removed classes with scope 0 test remove loot trash on gear for #498 fixed #501 * 0.3.8.0415 * same
2016-04-08 20:21:46 +00:00
_color = [0,1,_playerOxygen,1] call EPOCH_colorRange;
_oxygen ctrlSetTextColor _color;
2016-01-15 19:22:40 +00:00
};
// dynamic start (greater than)
{
_x params [["_selVarName",""],["_HUDclass","topRight"],["_ctrlText",""]];
_varIndex = EPOCH_customVars find _selVarName;
if (_varIndex != -1) then {
_currentVarVal = missionNamespace getVariable[format['EPOCH_player%1', _selVarName],EPOCH_defaultVars select _varIndex];
(EPOCH_customVarLimits select _varIndex) params [["_playerLimitMax",100],["_playerLimitMin",0],["_playerWarnLimit",25],["_playerCriticalLimit",75],["_playerWarnLow",0],["_playerCriticalLow",0]];
if (_playerLimitMax isEqualType "") then {
_playerLimitMax = missionNamespace getVariable [_playerLimitMax, 0];
};
if (_playerLimitMin isEqualType "") then {
_playerLimitMin = missionNamespace getVariable [_playerLimitMin, 0];
};
_warnLow = _currentVarVal < _playerWarnLow;
_warnHigh = _currentVarVal > _playerWarnLimit;
_criticalLow = _currentVarVal <= _playerCriticalLow;
_criticalHigh = _currentVarVal >= _playerCriticalLimit;
if (_warnHigh || _warnLow) then {
_hudIndex = missionNamespace getVariable [format["EPOCH_dynHUD_%1",_HUDclass],1];
_curCtrl = [_HUDclass,_hudIndex] call epoch_getHUDCtrl;
missionNamespace setVariable [format["EPOCH_dynHUD_%1",_HUDclass], _hudIndex + 1];
if (_ctrlText isEqualType []) then {
_ctrlText = if (_warnHigh) then {_ctrlText select 0} else {_ctrlText select 1};
};
_curCtrl ctrlSetText _ctrlText;
_critical = (_criticalHigh || _criticalLow);
[_curCtrl,_critical] call _scaleUI;
_color = [_playerLimitMin,_playerLimitMax,_currentVarVal,1] call EPOCH_colorRange;
_curCtrl ctrlSetTextColor _color;
};
};
} forEach
[
[
'Temp',
"topRight",
[
"x\addons\a3_epoch_code\Data\UI\hot_ca.paa",
"x\addons\a3_epoch_code\Data\UI\cold_ca.paa"
]
],
[
'Hunger',
"topRight",
"x\addons\a3_epoch_code\Data\UI\hunger_ca.paa"
],
[
'Thirst',
"topRight",
"x\addons\a3_epoch_code\Data\UI\thirst_ca.paa"
],
[ 'Toxicity',
"topRight",
"x\addons\a3_epoch_code\Data\UI\hazzard_ca.paa"
],
[
'Wet',
"topRight",
"x\addons\a3_epoch_code\Data\UI\wet_ca.paa"
],
[
'BloodP',
"topRight",
"x\addons\a3_epoch_code\Data\UI\bleeding_ca.paa"
],
[
'Alcohol',
"topRight",
"x\addons\a3_epoch_code\Data\UI\drunk_ca.paa"
],
[
'Soiled',
"topRight",
"x\addons\a3_epoch_code\Data\UI\soiled_ca.paa"
],
[
'Radiation',
"topRight",
"x\addons\a3_epoch_code\Data\UI\rads_ca.paa"
]
];
// dynamic end
2016-01-15 19:22:40 +00:00
Release 0.3.8 (#502) * first build for 0.3.8 * 0.3.8.0190 * 0.3.8.0202 * 0.3.8.0213 * 0.3.7.0214 * 0.3.8.0222 * 0.3.8.0246 * 0.3.8.0247 fixed typo * 0.3.8.0249 more fixes for server compiler * 0.3.8.0256 * add build number and simple batch file for packing * match build number with internal * add build numbers to server pbo's and mission files also reworked build script for more options * 0.3.8.0261 * 0.3.8.0261 * 0.3.8.0283 * 0.3.8.0284 * changelog * 0.3.8.0307 * 0.3.8.0311 * remove old BEC plugin * update redis-server.exe to latest build and full config * 0.3.8.0314 * 0.3.8.0315 * inverse logic This should correctly prevent spawning these units nearby jammer or protection zones * use pushbackUnique here * optimized loot function by using selectRandom instead of slower sqf logic * 0.3.8.0316 * make use of new getDir functionality instead of BIS fnc * add lower disconnect value to server.cfg * use new getpos functionality * 0.3.8.0317 * 0.3.8.0319 * 0.3.8.0327 * 0.3.8.0338 changelog update tba * changelog * 0.3.8.0341 * BE update * 0.3.8.0353 * changelog * removed duplicates * 0.3.8.0355 fixed error in getIDC * 0.3.8.0356 revert to BIS_fnc_param as params threw errors * 0.3.8.0357 fixes for #496 #497 * 0.3.8.0359 fixed #497 fixed #496 * 0.3.8.0365 * 0.3.8.0371 * 0.3.8.0373 * 0.3.8.0379 * 0.3.8.0381 * 0.3.8.0386 * 0.3.8.0393 * 0.3.8.0395 * 0.3.8.0396 * 0.3.8.0397 * 0.3.8.0406 * 0.3.8.0409 * 0.3.8.0410 loot balance suppress error in spawnloot make near object check based on building size * 0.3.8.0412 * 0.3.8.0414 removed classes with scope 0 test remove loot trash on gear for #498 fixed #501 * 0.3.8.0415 * same
2016-04-08 20:21:46 +00:00
_legDamage = player getHitPointDamage "HitLegs";
// _broken ctrlShow (_legDamage >= 0.5);
if (_legDamage >= 0.5) then {
_hudIndex = missionNamespace getVariable [format["EPOCH_dynHUD_%1","topRight"],1];
_broken = ["topRight",_hudIndex] call epoch_getHUDCtrl;
missionNamespace setVariable [format["EPOCH_dynHUD_%1","topRight"], _hudIndex + 1];
_broken ctrlSetText "x\addons\a3_epoch_code\Data\UI\broken_ca.paa";
[_broken,true] call _scaleUI;
Release 0.3.8 (#502) * first build for 0.3.8 * 0.3.8.0190 * 0.3.8.0202 * 0.3.8.0213 * 0.3.7.0214 * 0.3.8.0222 * 0.3.8.0246 * 0.3.8.0247 fixed typo * 0.3.8.0249 more fixes for server compiler * 0.3.8.0256 * add build number and simple batch file for packing * match build number with internal * add build numbers to server pbo's and mission files also reworked build script for more options * 0.3.8.0261 * 0.3.8.0261 * 0.3.8.0283 * 0.3.8.0284 * changelog * 0.3.8.0307 * 0.3.8.0311 * remove old BEC plugin * update redis-server.exe to latest build and full config * 0.3.8.0314 * 0.3.8.0315 * inverse logic This should correctly prevent spawning these units nearby jammer or protection zones * use pushbackUnique here * optimized loot function by using selectRandom instead of slower sqf logic * 0.3.8.0316 * make use of new getDir functionality instead of BIS fnc * add lower disconnect value to server.cfg * use new getpos functionality * 0.3.8.0317 * 0.3.8.0319 * 0.3.8.0327 * 0.3.8.0338 changelog update tba * changelog * 0.3.8.0341 * BE update * 0.3.8.0353 * changelog * removed duplicates * 0.3.8.0355 fixed error in getIDC * 0.3.8.0356 revert to BIS_fnc_param as params threw errors * 0.3.8.0357 fixes for #496 #497 * 0.3.8.0359 fixed #497 fixed #496 * 0.3.8.0365 * 0.3.8.0371 * 0.3.8.0373 * 0.3.8.0379 * 0.3.8.0381 * 0.3.8.0386 * 0.3.8.0393 * 0.3.8.0395 * 0.3.8.0396 * 0.3.8.0397 * 0.3.8.0406 * 0.3.8.0409 * 0.3.8.0410 loot balance suppress error in spawnloot make near object check based on building size * 0.3.8.0412 * 0.3.8.0414 removed classes with scope 0 test remove loot trash on gear for #498 fixed #501 * 0.3.8.0415 * same
2016-04-08 20:21:46 +00:00
_color = [1,0,_legDamage,1] call EPOCH_colorRange;
_broken ctrlSetTextColor _color;
2016-01-15 19:22:40 +00:00
};
if (_envCold || _envHot || _hungry || _thirsty) then {
if (_envHot || _envCold) then {
player setFatigue 1;
};
EPOCH_playerBloodP = (EPOCH_playerBloodP + 0.05) min 190;
_increaseStamina = false;
} else {
if (EPOCH_playerStamina > 0) then {
if !(_panic) then {
if (!_warnbloodPressure) then {
player setFatigue 0;
2015-11-08 15:26:38 +00:00
};
2016-01-15 19:22:40 +00:00
EPOCH_playerBloodP = EPOCH_playerBloodP - 1 max 100;
2015-11-08 15:26:38 +00:00
};
2016-01-15 19:22:40 +00:00
};
};
_critical = (damage player >= 0.7 || _warnbloodPressure);
// _emergency ctrlShow _critical;
if (_critical) then {
_hudIndex = missionNamespace getVariable [format["EPOCH_dynHUD_%1","topRight"],1];
_emergency = ["topRight",_hudIndex] call epoch_getHUDCtrl;
missionNamespace setVariable [format["EPOCH_dynHUD_%1","topRight"], _hudIndex + 1];
_emergency ctrlSetText "x\addons\a3_epoch_code\Data\UI\bleeding_ca.paa";
[_emergency,(EPOCH_playerBloodP > 140)] call _scaleUI;
Release 0.3.8 (#502) * first build for 0.3.8 * 0.3.8.0190 * 0.3.8.0202 * 0.3.8.0213 * 0.3.7.0214 * 0.3.8.0222 * 0.3.8.0246 * 0.3.8.0247 fixed typo * 0.3.8.0249 more fixes for server compiler * 0.3.8.0256 * add build number and simple batch file for packing * match build number with internal * add build numbers to server pbo's and mission files also reworked build script for more options * 0.3.8.0261 * 0.3.8.0261 * 0.3.8.0283 * 0.3.8.0284 * changelog * 0.3.8.0307 * 0.3.8.0311 * remove old BEC plugin * update redis-server.exe to latest build and full config * 0.3.8.0314 * 0.3.8.0315 * inverse logic This should correctly prevent spawning these units nearby jammer or protection zones * use pushbackUnique here * optimized loot function by using selectRandom instead of slower sqf logic * 0.3.8.0316 * make use of new getDir functionality instead of BIS fnc * add lower disconnect value to server.cfg * use new getpos functionality * 0.3.8.0317 * 0.3.8.0319 * 0.3.8.0327 * 0.3.8.0338 changelog update tba * changelog * 0.3.8.0341 * BE update * 0.3.8.0353 * changelog * removed duplicates * 0.3.8.0355 fixed error in getIDC * 0.3.8.0356 revert to BIS_fnc_param as params threw errors * 0.3.8.0357 fixes for #496 #497 * 0.3.8.0359 fixed #497 fixed #496 * 0.3.8.0365 * 0.3.8.0371 * 0.3.8.0373 * 0.3.8.0379 * 0.3.8.0381 * 0.3.8.0386 * 0.3.8.0393 * 0.3.8.0395 * 0.3.8.0396 * 0.3.8.0397 * 0.3.8.0406 * 0.3.8.0409 * 0.3.8.0410 loot balance suppress error in spawnloot make near object check based on building size * 0.3.8.0412 * 0.3.8.0414 removed classes with scope 0 test remove loot trash on gear for #498 fixed #501 * 0.3.8.0415 * same
2016-04-08 20:21:46 +00:00
_color = [180,100,EPOCH_playerBloodP,1] call EPOCH_colorRange;
_emergency ctrlSetTextColor _color;
2016-01-15 19:22:40 +00:00
};
if (EPOCH_playerBloodP >= 180) then {
true call EPOCH_pushCustomVar;
};
if (_increaseStamina && (getFatigue player) == 0) then {
EPOCH_playerStamina = (EPOCH_playerStamina + 0.5) min EPOCH_playerStaminaMax;
};
if (EPOCH_debugMode) then {
call EPOCH_debugMonitor;
};
call EPOCH_TradeLoop;
// blank out unused hud elements
_hudIndex = missionNamespace getVariable [format["EPOCH_dynHUD_%1","topRight"],1];
for "_i" from _hudIndex to 9 do {
_c = ["topRight",_i] call epoch_getHUDCtrl;
_c ctrlSetText "";
};
missionNamespace setVariable [format["EPOCH_dynHUD_%1","topRight"], nil];