Energy Tweaks

Added some missing and new configs to CfgEpochClient
Added Energy settings for default map sources to CfgBaseBuilding
Included wind / overcast / distance to energy calculations (depents on
powertype)
- Solars are affected by SunOrMoon and overcast
- Windmills are affected by wind
- Satellites are affected by distance
This commit is contained in:
He-Man 2018-04-18 19:41:16 +02:00
parent d8632a89d5
commit 9945f9246e
5 changed files with 51 additions and 16 deletions

View File

@ -21,7 +21,7 @@ _energyValue = _chargeRate min _energyRegenMax;
_vehicle = vehicle player;
if (_vehicle != player && isEngineOn _vehicle) then {
if !(_vehicle iskindof "Bicycle") then {
_energyValue = _energyValue + 5;
_energyValue = _energyValue + _energyRegenInVeh;
};
};
if (currentVisionMode player == 1) then { //NV enabled

View File

@ -2,7 +2,7 @@ _position = getPosATL player;
_nearestLocations = nearestLocations[player, _radioactiveLocations, 300];
EPOCH_nearestLocations = _nearestLocations;
_powerSources = nearestObjects[player, ["Land_spp_Tower_F","Land_wpp_Turbine_V2_F","Land_wpp_Turbine_V1_F","SolarGen_EPOCH","Land_Wreck_Satellite_EPOCH"], _energyRange];
_powerSources = nearestObjects[player, _energyPowerSources, _energyRange];
// TODO: add more sources and config based check instead of global var
// _nearestLocations removed as they don't support getVariable
@ -109,25 +109,26 @@ _chargeRate = 0;
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;
_powerClass = typeOf _x;
_powerCap = getNumber(_cfgBaseBuilding >> _powerClass >> "powerCapacity");
_powerType = getNumber(_cfgBaseBuilding >> _powerClass >> "powerType");
if (_powerCap == 0) then {
_powerCap = 100;
};
_powerCap = switch _powerType do {
case 1: {if (sunOrMoon == 1) then {_powerCap * (1-overcast)} else {(_powerCap * (1 - overcast))/2}};
case 2: {_powerCap * windstr};
case 3: {_powerCap * (1 - ((player distance _x) / _energyRange))};
default {_powerCap};
};
_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;
_chargeRate = round _totalCapacity;
} else {
_chargeRate = ceil (_totalCapacity / (count _players));
_chargeRate = round (_totalCapacity / (count _players));
};
};
};

View File

@ -125,6 +125,8 @@ _baseThirstLoss = ["CfgEpochClient", "baseThirstLoss", 2] call EPOCH_fnc_returnC
_baseAlcoholLoss = ["CfgEpochClient", "baseAlcoholLoss", 0.17] call EPOCH_fnc_returnConfigEntryV2;
_lossMultiplier = if (["CfgEpochClient", "accelerateHTALoss", true] call EPOCH_fnc_returnConfigEntryV2) then {timeMultiplier} else {1};
_energyCostNV = ["CfgEpochClient", "energyCostNV", 3] call EPOCH_fnc_returnConfigEntryV2;
_energyPowerSources = ["CfgEpochClient", "energyPowerSources", ["Land_spp_Tower_F","Land_wpp_Turbine_V2_F","Land_wpp_Turbine_V1_F","SolarGen_EPOCH","Land_Wreck_Satellite_EPOCH"]] call EPOCH_fnc_returnConfigEntryV2;
_energyRegenInVeh = ["CfgEpochClient", "energyChargeInVeh", 5] call EPOCH_fnc_returnConfigEntryV2;
_energyRegenMax = ["CfgEpochClient", "energyRegenMax", 5] call EPOCH_fnc_returnConfigEntryV2;
_energyRange = ["CfgEpochClient", "energyRange", 75] call EPOCH_fnc_returnConfigEntryV2;
_hudConfigs = ["CfgEpochClient", "hudConfigs", []] call EPOCH_fnc_returnConfigEntryV2;

View File

@ -8,6 +8,25 @@
*/
class CfgBaseBuilding
{
// Power Sources (only for Energy Calculations)
class Land_spp_Tower_F
{
powerCapacity = 10;
powerType = 1; // Solar
};
class Land_wpp_Turbine_V1_F
{
powerCapacity = 10;
powerType = 2; // Wind
};
class Land_wpp_Turbine_V2_F : Land_wpp_Turbine_V1_F {};
class Land_Wreck_Satellite_EPOCH
{
powerCapacity = 10;
powerType = 3; // Satellite
};
// BaseBuilding
class Default
{
upgradeBuilding[] = {};

View File

@ -195,6 +195,19 @@ class CfgEpochClient
playerDeathMarkerGPSOnly = 1; // Map marker toggle in map dyna menu on death with assigned GPS only
mapOnZoomSetMarkerSize = 1; // When in map markers will change to larger size as player zooms in
bankTransferTime[] = {0.0006,1.2,0.06};
// Player (Building) Energy
energyPowerSources[] = { // Add PowerCapacity and PowerType in CfgBaseBuilding, if you add something here!
"Land_spp_Tower_F",
"Land_wpp_Turbine_V2_F",
"Land_wpp_Turbine_V1_F",
"SolarGen_EPOCH",
"Land_Wreck_Satellite_EPOCH"
};
energyRange = 75; // Range to check for energy sources
energyRegenMax = 5; // Max energy increase value (every 10 seconds)
energyCostNV = 3; // Energy loss value by using nightvision (every 10 seconds)
energyRegenInVeh = 5; // Energy increase value in Vehicles with Engine On (every 10 seconds)
// Favorite Bar
Fav_enableFavoriteBar = "true"; // If disabled, players will not be able to use favorite bar