more custom options

This commit is contained in:
Sp4rkY 2016-11-14 02:04:08 +01:00
parent bf4de960dc
commit b624641f32
3 changed files with 96 additions and 62 deletions

View File

@ -23,11 +23,13 @@
BOOL BOOL
*/ */
//[[[cog import generate_private_arrays ]]] //[[[cog import generate_private_arrays ]]]
private ["_alljammer","_buildingAllowed","_buildingCountLeader","_buildingCountLimit","_buildingCountPerMember","_buildingJammerRange","_bypassJammer","_c","_cfgBaseBuilding","_config","_isAllowed","_jammer","_jammerpergroup","_limitNearby","_maxbuildingheigh","_membercount","_minjammerdistance","_myPosATL","_nearestJammer","_obj","_objType","_objectCount","_ownedJammerExists","_range","_restricted","_restrictedArray","_restrictedLocations","_restrictedLocationsArray","_restrictedLocationsRange","_simulClass","_staticClass","_storagecountLeader","_storagecountPerMember"]; private ["_alljammer","_buildingAllowed","_buildingCountLeader","_buildingCountLimit","_buildingCountPerMember","_buildingJammerRange","_bypassJammer","_c","_cfgBaseBuilding","_config","_isAllowed","_jammer","_jammerPerGroup","_limitNearby","_maxBuildingHeight","_membercount","_minjammerdistance","_myPosATL","_nearestJammer","_obj","_objType","_objectCount","_ownedJammerExists","_range","_restricted","_restrictedArray","_restrictedLocations","_restrictedLocationsArray","_restrictedLocationsRange","_simulClass","_staticClass","_storageCountLeader","_storageCountPerMember","_scl","_gcl","_storageCountLimit","_useGroupCountLimits","_ghostClass"];
//[[[end]]] //[[[end]]]
_buildingAllowed = true; _buildingAllowed = true;
_ownedJammerExists = false; _ownedJammerExists = false;
_scl = false;
_gcl = true;
_nearestJammer = objNull; _nearestJammer = objNull;
// reject building if in vehicle // reject building if in vehicle
@ -38,21 +40,23 @@ _config = 'CfgEpochClient' call EPOCH_returnConfig;
_cfgBaseBuilding = 'CfgBaseBuilding' call EPOCH_returnConfig; _cfgBaseBuilding = 'CfgBaseBuilding' call EPOCH_returnConfig;
_buildingJammerRange = getNumber(_config >> "buildingJammerRange"); _buildingJammerRange = getNumber(_config >> "buildingJammerRange");
_buildingCountLimit = getNumber(_config >> "buildingCountLimit"); _buildingCountLimit = getNumber(_config >> "buildingCountLimit");
if (_buildingJammerRange == 0) then { _buildingJammerRange = 75; }; _storageCountLimit = getNumber(_config >> "storageCountLimit");
if (_buildingCountLimit == 0) then { _buildingCountLimit = 200; };
_buildingCountLeader = getNumber(_config >> "buildingCountLeader"); _buildingCountLeader = getNumber(_config >> "buildingCountLeader");
_buildingCountPerMember = getNumber(_config >> "buildingCountPerMember"); _buildingCountPerMember = getNumber(_config >> "buildingCountPerMember");
_storagecountLeader = getNumber(_config >> "storagecountLeader"); _storageCountLeader = getNumber(_config >> "storageCountLeader");
_storagecountPerMember = getNumber(_config >> "storagecountPerMember"); _storageCountPerMember = getNumber(_config >> "storageCountPerMember");
_minjammerdistance = getNumber(_config >> "minJammerDistance"); _minJammerDistance = getNumber(_config >> "minJammerDistance");
_maxbuildingheigh = getNumber(_config >> "maxBuildingHeigh"); _maxBuildingHeight = getNumber(_config >> "maxBuildingHeight");
_jammerpergroup = getNumber(_config >> "JammerPerGroup"); _jammerPerGroup = getNumber(_config >> "jammerPerGroup");
if (_buildingCountLeader == 0) then { _buildingCountLeader = _buildingCountLimit}; if(getNumber(_config >> "useGroupCountLimits") == 0)then{_gcl=false};
if (_storagecountLeader == 0) then { _storagecountLeader = 100}; if(getNumber(_config >> "splitCountLimits") == 1)then{_scl=true};
if (_minjammerdistance == 0) then { _minjammerdistance = _buildingJammerRange*3}; if(_buildingJammerRange == 0)then{_buildingJammerRange = 75};
if (_maxbuildingheigh == 0) then { _maxbuildingheigh = 100}; if(_buildingCountLimit == 0)then{_buildingCountLimit = 200};
if (_jammerpergroup == 0) then { _jammerpergroup = 2}; if(_buildingCountLeader == 0)then{_buildingCountLeader = _buildingCountLimit};
if(_storageCountLeader == 0)then{_storageCountLeader = 100};
if(_minJammerDistance == 0)then{_minJammerDistance = _buildingJammerRange*3};
if(_maxBuildingHeight == 0)then{_maxBuildingHeight = 100};
if(_jammerPerGroup == 0)then{_jammerPerGroup = 2};
// input // input
params ["_objType"]; params ["_objType"];
@ -64,6 +68,7 @@ if (_objType isEqualType objNull) then {
_staticClass = getText(_cfgBaseBuilding >> _objType >> "staticClass"); _staticClass = getText(_cfgBaseBuilding >> _objType >> "staticClass");
_simulClass = getText(_cfgBaseBuilding >> _objType >> "simulClass"); _simulClass = getText(_cfgBaseBuilding >> _objType >> "simulClass");
_ghostClass = getText(_cfgBaseBuilding >> _objType >> "GhostPreview");
_bypassJammer = getNumber(_cfgBaseBuilding >> _staticClass >> "bypassJammer"); _bypassJammer = getNumber(_cfgBaseBuilding >> _staticClass >> "bypassJammer");
// Jammer // Jammer
@ -77,49 +82,67 @@ if !(_jammer isEqualTo []) then {
}; };
} foreach _jammer; } foreach _jammer;
} else { } else {
{ {
if (alive _x && (_x distance player) <= _buildingJammerRange) exitWith{ if (alive _x && (_x distance player) <= _buildingJammerRange) exitWith{
_nearestJammer = _x; _nearestJammer = _x;
}; };
} foreach _jammer; } foreach _jammer;
if !(isNull _nearestJammer) then { if !(isNull _nearestJammer) then {
if ((getposatl player) select 2 < _maxbuildingheigh) then { if ((getPosATL player) select 2 < _maxBuildingHeight) then {
if ((_nearestJammer getVariable["BUILD_OWNER", "-1"]) in[getPlayerUID player, Epoch_my_GroupUID]) then { if ((_nearestJammer getVariable["BUILD_OWNER", "-1"]) in[getPlayerUID player, Epoch_my_GroupUID]) then {
_ownedJammerExists = true; _ownedJammerExists = true;
} else { } else {
_buildingAllowed = false; _buildingAllowed = false;
["Building Disallowed: Frequency Blocked", 5] call Epoch_message; ["Building Disallowed: Frequency Blocked", 5] call Epoch_message;
}; };
_objectCount = count nearestObjects[_nearestJammer, ["Constructions_static_F"], _buildingJammerRange]; if(_gcl)then{
_membercount = 0;
if(count Epoch_my_Group > 0)then{_membercount = count (Epoch_my_Group select 3) + count (Epoch_my_Group select 4)}
};
if(_objType in ["WorkBench_EPOCH","StorageShelf_EPOCH","Tipi_EPOCH","LockBox_EPOCH","Safe_EPOCH","StorageShelf_SIM_EPOCH","LockBox_SIM_EPOCH","Safe_SIM_EPOCH","Workbench_SIM_EPOCH","Tipi_SIM_EPOCH"])then[{
if(_scl)then{
if(_gcl)then{
_storageCountLimit = _storageCountLeader + (_storageCountPerMember * _membercount);
if((_storageCountLeader + _storageCountPerMember) > _storageCountLimit)then{_storageCountLimit = _storageCountLeader}
};
if((count nearestObjects[_nearestJammer,["Buildable_Storage","Constructions_lockedstatic_F",_ghostClass],_buildingJammerRange]) >= _storageCountLimit)then{
_buildingAllowed = false;
[format["Building Disallowed: Max. %1 Storage Objects",_storageCountLimit],5] call Epoch_message
}
}else{
if(_gcl)then{_buildingCountLimit = _buildingCountLeader + (_buildingCountPerMember * _membercount)};
if((count nearestObjects[_nearestJammer,["Buildable_Storage","Constructions_lockedstatic_F","Constructions_static_F","Constructions_foundation_F",_ghostClass],_buildingJammerRange]) >= _buildingCountLimit)then{
_buildingAllowed = false;
[format["Building Disallowed, Frequency Overloaded: Limit %1",_buildingCountLimit],5] call Epoch_message
}
}
},{
//a try to prevent bugusing (TODO: not working for storage objects atm)
if((count nearestObjects[_nearestJammer,[_ghostClass],_buildingJammerRange]) >= 2)exitWith{ //setting this too low may not be player-friendly. Recommend: >= 2
_buildingAllowed = false;
["Building Disallowed: Frequency Unstable, Wait A Moment",5] call Epoch_message
};
_membercount = 0; if(_gcl)then{_buildingCountLimit = _buildingCountLeader + (_buildingCountPerMember * _membercount)};
if (count Epoch_my_Group > 0) then { if(_scl)then{
_membercount = count (Epoch_my_Group select 3) + count (Epoch_my_Group select 4); if((count nearestObjects[_nearestJammer,["Constructions_static_F","Constructions_foundation_F",_ghostClass],_buildingJammerRange]) >= (_buildingCountLimit +1))then{
}; _buildingAllowed = false;
if (_objType in ["WorkBench_EPOCH","StorageShelf_EPOCH","Tipi_EPOCH","LockBox_EPOCH","Safe_EPOCH","StorageShelf_SIM_EPOCH","LockBox_SIM_EPOCH","Safe_SIM_EPOCH","Workbench_SIM_EPOCH","Tipi_SIM_EPOCH"]) then { [format["Building Disallowed: Max. %1 Constructions",_buildingCountLimit],5] call Epoch_message
_buildingCountLimit = _storagecountLeader + _storagecountPerMember*_membercount; }
_objectCount = count nearestObjects[_nearestJammer, ["Buildable_Storage","Constructions_lockedstatic_F"], _buildingJammerRange]; }else{
} if((count nearestObjects[_nearestJammer,["Buildable_Storage","Constructions_lockedstatic_F","Constructions_static_F","Constructions_foundation_F",_ghostClass],_buildingJammerRange]) >= (_buildingCountLimit +1))then{
else { _buildingAllowed = false;
_buildingCountLimit = _buildingCountLeader + _buildingCountPerMember*_membercount; [format["Building Disallowed: Frequency Overloaded: Limit %1",_buildingCountLimit],5] call Epoch_message
_objectCount = count nearestObjects[_nearestJammer, ["Constructions_static_F","Constructions_foundation_F"], _buildingJammerRange]; }
}; }
}]
if (_objectCount >= _buildingCountLimit) then { }else{
_buildingAllowed = false; _buildingAllowed = false;
[format["Building Disallowed: Frequency Overloaded: Limit %1", _buildingCountLimit], 5] call Epoch_message; ["Building Disallowed: Max building height reached",5] call Epoch_message;
}; };
}
else {
_buildingAllowed = false;
["Building Disallowed: Max building heigh reached", 5] call Epoch_message;
};
}; };
}; };
} }else{
else {
if (_objType in ["PlotPole_EPOCH", "PlotPole_SIM_EPOCH"]) then { if (_objType in ["PlotPole_EPOCH", "PlotPole_SIM_EPOCH"]) then {
// TODO: rework not ideal to use allmissionobjects // TODO: rework not ideal to use allmissionobjects
_alljammer = allmissionobjects 'PlotPole_EPOCH'; _alljammer = allmissionobjects 'PlotPole_EPOCH';
@ -129,9 +152,9 @@ else {
_c = _c+1; _c = _c+1;
}; };
} foreach _alljammer; } foreach _alljammer;
if (_c >= _jammerpergroup) then { if (_c >= _jammerPerGroup) then {
_buildingAllowed = false; _buildingAllowed = false;
[format["Building Disallowed: Max %1 Jammer per Group!", _jammerpergroup], 5] call Epoch_message; [format["Building Disallowed: Max %1 Jammer per Group!", _jammerPerGroup], 5] call Epoch_message;
}; };
}; };
}; };
@ -154,7 +177,7 @@ if (!_ownedJammerExists) then{
if !(_buildingAllowed)exitWith{ false }; if !(_buildingAllowed)exitWith{ false };
// require jammer check if not found as owner of jammer // require jammer check if not found as owner of jammer
if (getNumber(_config >> "buildingRequireJammer") == 0 && _bypassJammer == 0) then{ if (getNumber(_config >> "buildingRequireJammer") == 1 && _bypassJammer == 0) then{
if !(_objType in ["PlotPole_EPOCH", "PlotPole_SIM_EPOCH"]) then { if !(_objType in ["PlotPole_EPOCH", "PlotPole_SIM_EPOCH"]) then {
_buildingAllowed = _ownedJammerExists; _buildingAllowed = _ownedJammerExists;
if !(_buildingAllowed) then { if !(_buildingAllowed) then {

View File

@ -17,22 +17,25 @@ class CfgEpochClient
epochVersion = "0.4.0.0"; epochVersion = "0.4.0.0";
sapperRngChance = 100; sapperRngChance = 100;
droneRngChance = 100; droneRngChance = 100;
buildingNearbyMilitary = 0; buildingNearbyMilitary = 0;
buildingNearbyMilitaryRange = 300; buildingNearbyMilitaryRange = 300;
buildingNearbyMilitaryClasses[] = {"Cargo_Tower_base_F","Cargo_HQ_base_F","Cargo_Patrol_base_F","Cargo_House_base_F"}; buildingNearbyMilitaryClasses[] = {"Cargo_Tower_base_F","Cargo_HQ_base_F","Cargo_Patrol_base_F","Cargo_House_base_F"};
restrictedLocations[] = {"NameCityCapital"}; restrictedLocations[] = {"NameCityCapital"};
restrictedLocationsRange = 300; restrictedLocationsRange = 300;
buildingRequireJammer = 0; buildingRequireJammer = 1; //1 = require jammer to build
buildingCountLimit = 200; buildingJammerRange = 75;
buildingJammerRange = 75; jammerPerGroup = 1;
JammerPerGroup = 1;
minJammerDistance = 650; minJammerDistance = 650;
maxBuildingHeigh = 33; maxBuildingHeight = 33;
buildingCountLeader = 125; buildingCountLimit = 200; //overall building limit in range of jammer (overridden if "useGroupCountLimits=1")
buildingCountPerMember = 5; storageCountLimit = 100; //overall storage limit in range of jammer (triggers only if "splitCountLimits=1" & "useGroupCountLimits=0")
storagecountLeader = 10; splitCountLimits = 0; //1 = distinguish buildingCountLimit from storageCountLimit (ex.: buildingCountLimit=100, storageCountLimit=100 >> you can build 100 baseparts AND additional 100 storage objects like safes, lockboxes...)
storagecountPerMember = 5; useGroupCountLimits = 1; //1 = enable leader and member counts (doesn´t affect "splitCountLimits")
maxdoors = 8; buildingCountLeader = 125; //ignore if "useGroupCountLimits=0"
buildingCountPerMember = 5; //ignore if "useGroupCountLimits=0"
storageCountLeader = 10; //ignore if "splitCountLimits=0" & "useGroupCountLimits=0"
storageCountPerMember = 5; //ignore if "splitCountLimits=0" & "useGroupCountLimits=0"
maxdoors = 8;
maxgates = 5; maxgates = 5;
disableRemoteSensors = true; disableRemoteSensors = true;
EPOCH_news[] = {"Word is that Sappers have a new boss.","Dogs will often lure them monsters away.","My dog was blown up. I miss him.."}; EPOCH_news[] = {"Word is that Sappers have a new boss.","Dogs will often lure them monsters away.","My dog was blown up. I miss him.."};

View File

@ -15,12 +15,15 @@
"NameCityCapital" "NameCityCapital"
], ],
"restrictedLocationsRange": 300, "restrictedLocationsRange": 300,
"buildingRequireJammer": 0, "buildingRequireJammer": 1,
"buildingCountLimit": 200, "buildingCountLimit": 200,
"buildingJammerRange": 75, "buildingJammerRange": 75,
"JammerPerGroup": 1, "JammerPerGroup": 1,
"minJammerDistance": 650, "minJammerDistance": 650,
"maxBuildingHeigh": 33, "maxBuildingHeigh": 33,
"storageCountLimit": 100,
"splitCountLimits": 0,
"useGroupCountLimits": 1,
"buildingCountLeader": 125, "buildingCountLeader": 125,
"buildingCountPerMember": 5, "buildingCountPerMember": 5,
"storagecountLeader": 10, "storagecountLeader": 10,
@ -340,6 +343,11 @@
"topRight", "topRight",
"x\\addons\\a3_epoch_code\\Data\\UI\\hazzard_ca.paa" "x\\addons\\a3_epoch_code\\Data\\UI\\hazzard_ca.paa"
], ],
[
"Wet",
"topRight",
"x\\addons\\a3_epoch_code\\Data\\UI\\wet_ca.paa"
],
[ [
"Alcohol", "Alcohol",
"topRight", "topRight",