mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
a0e9ec0153
-use the second set of GVARs to track adding and removing attributes. -Epoch_player* vars moved to local vars only accessible inside the master loop. -TODO: finish digest system with a config entry to control digest limits. Some extra logic is needed. Basically, when you consume some food, it will not increase your hunger level immediately but raise over time. Each of these should have limits on how much you can store in the digest and how much each tick the digest var can affect the local player var in the master loop.
81 lines
2.6 KiB
Plaintext
81 lines
2.6 KiB
Plaintext
_position = getPosATL player;
|
|
|
|
EPOCH_nearestLocations = nearestLocations[player, ["NameCityCapital", "NameCity", "Airport"], 300];
|
|
_powerSources = nearestObjects[player, ["Land_spp_Tower_F","Land_wpp_Turbine_V2_F","Land_wpp_Turbine_V1_F","SolarGen_EPOCH","Land_Wreck_Satellite_EPOCH"], _energyRange];
|
|
|
|
// TODO: add more sources and config based check instead of global var
|
|
_nearbyRadioactiveObjects = (_powerSources + EPOCH_nearestLocations) select {_x getVariable ["EPOCH_Rads", 0] > 0};
|
|
|
|
// check if player is out of map bounds.
|
|
_radsLevel = 0;
|
|
_worldSize = worldSize/2;
|
|
_outOfBounds = !(player inArea [[_worldSize,_worldSize,0], _worldSize, _worldSize, 0, true ]);
|
|
if (_outOfBounds) then {
|
|
// player is out of map bounds, give ten times background rads
|
|
["You are out of the play area!", 5] call Epoch_message;
|
|
_radsLevel = _outOfBoundsRadiation;
|
|
} else {
|
|
// radiated objects or locations nearby
|
|
if !(_nearbyRadioactiveObjects isEqualTo []) then {
|
|
// add extra rads based on intensity and distance from site.
|
|
_radsLevel = ((_nearbyRadioactiveObjects select 0) getVariable ["EPOCH_Rads", 0]) / (player distance _radioActiveSite);
|
|
};
|
|
};
|
|
|
|
|
|
EPOCH_playerIsSwimming = false;
|
|
|
|
if !(surfaceIsWater _position) then {
|
|
if (EPOCH_nearestLocations isEqualTo []) then{
|
|
if (count(player nearEntities["Animal_Base_F", 800]) < 2) then {
|
|
call EPOCH_client_loadAnimalBrain;
|
|
};
|
|
};
|
|
} else {
|
|
// spawn shark if player is deep water and not in vehicle
|
|
if !(_isOnFoot) then{
|
|
_offsetZ = ((_position vectorDiff getPosASL player) select 2);
|
|
EPOCH_playerIsSwimming = (_offsetZ > 1.7);
|
|
if (_offsetZ > 50) then {
|
|
["GreatWhite_F", player, true] call EPOCH_unitSpawn;
|
|
};
|
|
};
|
|
};
|
|
|
|
// default power state
|
|
_chargeRate = 0;
|
|
|
|
// energy Charge from nearby power plants
|
|
if !(_powerSources isEqualTo[]) then {
|
|
_totalCapacity = 0;
|
|
{
|
|
_powerClass = typeOf _x;
|
|
_powerCap = getNumber(_cfgBaseBuilding >> _powerClass >> "powerCapacity");
|
|
_powerType = getNumber(_cfgBaseBuilding >> _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 {
|
|
_chargeRate = ceil _totalCapacity;
|
|
} else {
|
|
_chargeRate = ceil (_totalCapacity / (count _players));
|
|
};
|
|
};
|
|
};
|
|
|
|
|
|
_playerAliveTime = round(_playerAliveTime + (_tickTime - _clientAliveTimer));
|
|
_clientAliveTimer = _tickTime;
|
|
|
|
// force update after 60 seconds
|
|
_forceUpdate = true;
|