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

186 lines
5.5 KiB
Plaintext
Raw Normal View History

2016-01-15 19:22:40 +00:00
if !(EPOCH_arr_interactedObjs isEqualTo[]) then {
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
[EPOCH_arr_interactedObjs] remoteExec["EPOCH_server_save_vehicles", 2];
2016-01-15 19:22:40 +00:00
EPOCH_arr_interactedObjs = [];
};
if (damage player != _damagePlayer) then {
if (alive player) then {
_forceUpdate = true;
2016-01-15 19:22:40 +00:00
_damagePlayer = damage player;
};
};
// calculate total available power
// 1. number of power production devices within range 75m
// find share of power based on factors
// 1. number of players
// 2. Other sources of drain (Lights)
_energyValue = EPOCH_chargeRate min _energyRegenMax;
_vehicle = vehicle player;
if (_vehicle != player && isEngineOn _vehicle) then {
_energyValue = _energyValue + 5;
2016-01-15 19:22:40 +00:00
};
if (currentVisionMode player == 1) then { //NV enabled
_energyValue = _energyValue - _energyCostNV;
if (EPOCH_playerEnergy == 0) then {
player action["nvGogglesOff", player];
["Night Vision Goggles: Need Energy", 5] call Epoch_message;
2016-01-15 19:22:40 +00:00
};
};
// Sets visual effect
if (EPOCH_playerAlcohol > 20) then {
2017-09-04 15:37:29 +00:00
_drunkVal = linearConversion [0,100,EPOCH_playerAlcohol,0.1,1,true];
[_drunkVal, 2] call epoch_setDrunk;
2016-01-15 19:22:40 +00:00
} else {
[0, 2] call epoch_setDrunk;
};
// Sets visual effect
if (_playerRadiation > 1) then {
2017-09-04 15:37:29 +00:00
_radiationVal = linearConversion [0,100,_playerRadiation,0.1,1,true];
[_radiationVal, 2] call epoch_setRadiation;
// if player has geiger counter make sound based on rads level
2017-09-04 15:54:55 +00:00
if ('ItemGeigerCounter_EPOCH' in assignedItems player) then {
_level = round(linearConversion [0,100,_radsLevel,0,3,true]);
_sound = format ["geiger_%1",_level];
playSound _sound;
};
} else {
[0, 2] call epoch_setRadiation;
};
2016-01-15 19:22:40 +00:00
EPOCH_playerEnergy = ((EPOCH_playerEnergy + _energyValue) min EPOCH_playerEnergyMax) max 0;
if !(EPOCH_playerEnergy isEqualTo _prevEnergy) then {
9993 cutRsc["EpochGameUI3", "PLAIN", 0, false];
_display3 = uiNamespace getVariable "EPOCH_EpochGameUI3";
_energyDiff = round(EPOCH_playerEnergy - _prevEnergy);
_diffText = if (_energyDiff > 0) then {format["+%1",_energyDiff]} else {format["%1",_energyDiff]};
(_display3 displayCtrl 21210) ctrlSetText format["%1/%2 %3", round(EPOCH_playerEnergy), EPOCH_playerEnergyMax, _diffText];
_prevEnergy = EPOCH_playerEnergy;
};
if (EPOCH_playerEnergy == 0) then {
if (EPOCH_buildMode > 0) then {
EPOCH_buildMode = 0;
EPOCH_snapDirection = 0;
2016-06-18 01:22:29 +00:00
["Build Mode Disabled: Need Energy", 5] call Epoch_message;
2016-01-15 19:22:40 +00:00
EPOCH_Target = objNull;
EPOCH_Z_OFFSET = 0;
EPOCH_X_OFFSET = 0;
EPOCH_Y_OFFSET = 5;
};
};
2016-06-15 00:58:22 +00:00
_attackers = player nearEntities[["Snake_random_EPOCH", "GreatWhite_F", "Epoch_Cloak_F"], 30];
2016-01-15 19:22:40 +00:00
if !(_attackers isEqualTo[]) then {
(_attackers select 0) call EPOCH_client_bitePlayer;
_panic = true;
} else {
_toxicObjs = player nearobjects["SmokeShellCustom", 6];
if!(_toxicObjs IsEqualTo[]) then {
(_toxicObjs select 0) call EPOCH_client_bitePlayer;
_panic = true;
} else {
_panic = false;
};
};
// weather stats
_airTemp = EPOCH_CURRENT_WEATHER;
_waterTemp = EPOCH_CURRENT_WEATHER/2;
_warming = true;
_wet = false;
_maxTemp = 98.6; // normal body temp
_increaseWet = 0;
_wetsuit = (getText(configfile >> "cfgweapons" >> uniform player >> "itemInfo" >> "uniformType") == "Neopren");
if (_isOnFoot) then {
if (EPOCH_playerIsSwimming) then {
// do nothing if player is wearing a wetsuit
if (!_wetsuit) then {
if (_waterTemp <= 50) then {
_warming = false;
};
_wet = true;
_increaseWet = 10;
};
} else {
if (EPOCH_playerWet > 50 && _airTemp <= 32) then {
_isNearFire = {inflamed _x} count (nearestObjects [player, ["ALL"], 3]);
if (!(call EPOCH_fnc_isInsideBuilding) && _isNearFire == 0) then {
_warming = false;
};
};
if (rain >= 0.25) then {
if (!_wetsuit) then {
_isNearFire = { inflamed _x } count(nearestObjects[player, ["ALL"], 3]);
if (!(call EPOCH_fnc_isInsideBuilding) && _isNearFire == 0) then {
_wet = true;
_increaseWet = rain * 10;
};
};
};
};
};
// allow player to over heat if air temp is high and player is Fatigued
if ((getFatigue player) >= 0.7 && _airTemp > 100) then {
_maxTemp = _airTemp;
};
// toxic fever and immunity increase
if (EPOCH_playerToxicity > 0) then {
EPOCH_playerImmunity = (EPOCH_playerImmunity + 0.1) min 100;
EPOCH_playerToxicity = (EPOCH_playerToxicity - 0.1) max 0;
_maxTemp = 106.7 + 10;
};
if (_warming) then {
EPOCH_playerTemp = (EPOCH_playerTemp + 0.01) min _maxTemp;
} else {
EPOCH_playerTemp = (EPOCH_playerTemp - 0.01) max (95.0 - 10);
};
// wet/dry
if (_wet) then {
EPOCH_playerWet = (EPOCH_playerWet + _increaseWet) min 100;
if (EPOCH_playerWet > 50) then {
EPOCH_playerSoiled = (EPOCH_playerSoiled - 1) max 0;
};
} else {
if (_warming) then {
EPOCH_playerWet = (EPOCH_playerWet - 1) max 0;
};
};
2016-01-15 19:22:40 +00:00
// Hunger / Thirst
_hungerlossRate = _baseHungerLoss * timeMultiplier;
_thirstlossRate = _baseThirstLoss * timeMultiplier;
// Increase hunger if player is Fatigued
2016-01-15 19:22:40 +00:00
if (EPOCH_playerStamina < 100) then {
if ((getFatigue player) > 0) then {
_hungerlossRate = _hungerlossRate + (_hungerlossRate*(getFatigue player));
2016-01-15 19:22:40 +00:00
};
} else {
// reduce hunger loss if player stamina is greater than 100
_hungerlossRate = (_hungerlossRate / 2);
2016-01-15 19:22:40 +00:00
};
EPOCH_playerHunger = (EPOCH_playerHunger - _hungerlossRate) max 0;
EPOCH_playerThirst = (EPOCH_playerThirst - _thirstlossRate) max 0;
2016-01-15 19:22:40 +00:00
call _lootBubble;
2017-09-05 21:16:13 +00:00
EPOCH_playerStaminaMax = (100 * (round(_playerAliveTime/360)/10)) min 2500;
// downtick Nuisance
2017-09-06 14:43:15 +00:00
(_customVarLimits select (_customVarNames find "Nuisance")) params [["_playerLimitMax",100],["_playerLimitMin",0]];
EPOCH_playerNuisance = ((EPOCH_playerNuisance - 1) min _playerLimitMax) max _playerLimitMin;