mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
61 lines
1.9 KiB
Plaintext
61 lines
1.9 KiB
Plaintext
_position = getPosATL player;
|
|
|
|
EPOCH_nearestLocations = nearestLocations[player, ["NameCityCapital", "NameCity", "Airport"], 300];
|
|
EPOCH_playerIsSwimming = false;
|
|
|
|
if !(surfaceIsWater _position) then {
|
|
if (EPOCH_nearestLocations isEqualTo []) then{
|
|
if (count(_position nearEntities["Animal_Base_F", 800]) < 2) then {
|
|
// diag_log "DEBUG: Attempt to spawn animal";
|
|
call EPOCH_client_loadAnimalBrain;
|
|
};
|
|
};
|
|
} else {
|
|
// spawn shark if player is deep water and not in vehicle
|
|
if (vehicle player == player) then{
|
|
_offsetZ = ((_position vectorDiff getPosASL player) select 2);
|
|
if (_offsetZ > 1.7) then {
|
|
EPOCH_playerIsSwimming = true;
|
|
};
|
|
if (_offsetZ > 50) then {
|
|
"GreatWhite_F" call EPOCH_unitSpawn;
|
|
};
|
|
};
|
|
};
|
|
|
|
// default power state
|
|
EPOCH_nearPower = false;
|
|
EPOCH_chargeRate = 0;
|
|
|
|
// energy Charge from nearby power plants
|
|
_powerSources = nearestObjects[player, ["Land_spp_Tower_F","Land_wpp_Turbine_V2_F","Land_wpp_Turbine_V1_F","SolarGen_EPOCH"], _energyRange];
|
|
if !(_powerSources isEqualTo[]) then {
|
|
_totalCapacity = 0;
|
|
{
|
|
_powerClass = typeOf _x;
|
|
_powerCap = getNumber(configFile >> "CfgVehicles" >> _powerClass >> "powerCapacity");
|
|
_powerType = getNumber(configFile >> "CfgVehicles" >> _powerClass >> "powerType");
|
|
if (_powerCap == 0) then {
|
|
_powerCap = 100;
|
|
};
|
|
if (_powerType == 1) then {
|
|
if (sunOrMoon < 1) then {
|
|
_powerCap = _powerCap/2;
|
|
};
|
|
};
|
|
_totalCapacity = _totalCapacity + _powerCap;
|
|
} forEach _powerSources;
|
|
if (_totalCapacity > 0) then {
|
|
_players = player nearEntities[["Epoch_Male_F", "Epoch_Female_F"], _energyRange];
|
|
if (_players isEqualTo []) then {
|
|
EPOCH_chargeRate = ceil _totalCapacity;
|
|
} else {
|
|
EPOCH_chargeRate = ceil (_totalCapacity / (count _players));
|
|
};
|
|
EPOCH_nearPower = true;
|
|
};
|
|
};
|
|
|
|
EPOCH_playerAliveTime = round(EPOCH_playerAliveTime + (_tickTime - EPOCH_clientAliveTimer));
|
|
EPOCH_clientAliveTimer = _tickTime;
|