Selectable Plots- Fix #1

This commit is contained in:
He-Man 2019-02-20 22:31:09 +01:00
parent c2c79f8a77
commit cb26e80a81
16 changed files with 54 additions and 32 deletions

View File

@ -18,8 +18,8 @@ _mycams = EPOCH_BaseCams select {(_x getVariable["BUILD_OWNER", "-1"]) in [getPl
if (["CfgEpochClient", "BaseCamOnlyHome",true] call EPOCH_fnc_returnConfigEntryV2) then {
_mycams = _mycams select {
_cam = _x;
_jammer = (nearestObjects[player, call EPOCH_JammerClasses, call EPOCH_MaxJammerRange]) select {_cam distance _x < (getnumber (getmissionconfig ("CfgEpochClient" >> "CfgJammers" >> (typeof _x) >> "buildingJammerRange")))};
!(_jammer select {(_x getVariable["BUILD_OWNER", "-1"]) in [getPlayerUID player, Epoch_my_GroupUID]}) isequalto []) &&
_jammer = (nearestObjects[player, call EPOCH_JammerClasses, call EPOCH_MaxJammerRange]) select {_cam distance _x < (getnumber (getmissionconfig "CfgEpochClient" >> "CfgJammers" >> (typeof _x) >> "buildingJammerRange"))};
!((_jammer select {(_x getVariable["BUILD_OWNER", "-1"]) in [getPlayerUID player, Epoch_my_GroupUID]}) isequalto [])
};
};
if !(_mycams isequalto []) then {

View File

@ -91,7 +91,7 @@ if (diag_tickTime - EPOCH_lastTrash > 2) then {
};
if (!isNull _bankTerminal) then {
_AtmBlockedAtPlot = ["CfgEpochClient", "AtmBlockedAtPlot", false] call EPOCH_fnc_returnConfigEntryV2;
_jammer = (nearestObjects[player, call EPOCH_JammerClasses, call EPOCH_MaxJammerRange]) select {player distance _x < (getnumber (getmissionconfig ("CfgEpochClient" >> "CfgJammers" >> (typeof _x) >> "buildingJammerRange")))};
_jammer = (nearestObjects[player, call EPOCH_JammerClasses, call EPOCH_MaxJammerRange]) select {player distance _x < (getnumber (getmissionconfig "CfgEpochClient" >> "CfgJammers" >> (typeof _x) >> "buildingJammerRange"))};
if (!(_jammer isequalto []) && _AtmBlockedAtPlot) exitwith {
["Bank Terminal blocked by Jammer Signal",5] call Epoch_Message;
};

View File

@ -41,7 +41,7 @@ _unit = objNull;
_targetPos = getPosATL _trgt;
_targetPos set [2,0];
_jammers = (nearestObjects[_targetPos, call EPOCH_JammerClasses, call EPOCH_MaxJammerRange]) select {_targetPos distance _x < (getnumber (getmissionconfig ("CfgEpochClient" >> "CfgJammers" >> (typeof _x) >> "buildingJammerRange")))};
_jammers = (nearestObjects[_targetPos, call EPOCH_JammerClasses, call EPOCH_MaxJammerRange]) select {_targetPos distance _x < (getnumber (getmissionconfig "CfgEpochClient" >> "CfgJammers" >> (typeof _x) >> "buildingJammerRange"))};
if(!(_jammers isEqualTo []) && (_unitClass in _nonJammer))exitWith{};
_restricted = nearestObjects [_targetPos, ["ProtectionZone_Invisible_F"], _nonTraderAIRange];

View File

@ -67,7 +67,7 @@ _ghostClass = getText(_cfgBaseBuilding >> _objType >> "GhostPreview");
_bypassJammer = getNumber(_cfgBaseBuilding >> _staticClass >> "bypassJammer");
// Jammer
_jammer = (nearestObjects[player, _JammerCheckClasses, call EPOCH_MaxJammerRange]) select {player distance _x < (getnumber (getmissionconfig (_JammerConfig >> (typeof _x) >> "buildingJammerRange")))};
_jammer = (nearestObjects[player, _JammerCheckClasses, call EPOCH_MaxJammerRange]) select {player distance _x < (getnumber (_JammerConfig >> (typeof _x) >> "buildingJammerRange"))};
if !(_jammer isEqualTo []) then {
if (_objType in _JammerCheckClasses) then {
{
@ -99,10 +99,10 @@ if !(_jammer isEqualTo []) then {
["_memberArray",[]]
];
_membercount = count _modArray + count _memberArray;
_buildingJammerRange = getnumber (getmissionconfig (_JammerConfig >> "buildingJammerRange"));
_storageCountLimit = (getnumber (getmissionconfig (_JammerConfig >> "storageCountLimit"))) + ((getnumber (getmissionconfig (_JammerConfig >> "storageCountPerMember"))) * _membercount);
_buildingCountLimit = (getnumber (getmissionconfig (_JammerConfig >> "buildingCountLimit"))) + ((getnumber (getmissionconfig (_JammerConfig >> "buildingCountPerMember"))) * _membercount);
_CamCountLimit = getnumber (getmissionconfig (_JammerConfig >> "maxCams"));
_buildingJammerRange = getnumber (_JammerConfig >> "buildingJammerRange");
_storageCountLimit = (getnumber (_JammerConfig >> "storageCountLimit")) + ((getnumber (_JammerConfig >> "storageCountPerMember")) * _membercount);
_buildingCountLimit = (getnumber (_JammerConfig >> "buildingCountLimit")) + ((getnumber (_JammerConfig >> "buildingCountPerMember")) * _membercount);
_CamCountLimit = getnumber (_JammerConfig >> "maxCams");
if (_useSplitCountLimits) then {
if({_objType iskindof _x} count _StorageClasses > 0) then {
@ -148,7 +148,7 @@ else {
if ((_x getVariable["BUILD_OWNER", "-1"]) in[getPlayerUID player, Epoch_my_GroupUID]) then {
_c = _c+1;
};
} foreach (missionnamespace getvariable ["Epoch_Plotpoles",_allplots = [];{_allplots pushback (allmissionobjects _x)} foreach (call EPOCH_JammerClasses);_allplots]);
} foreach (missionnamespace getvariable ["Epoch_Plotpoles",call {_allplots = [];{_allplots append (allmissionobjects _x)} foreach (call EPOCH_JammerClasses);_allplots}]);
if (_c >= _jammerPerGroup) then {
_buildingAllowed = false;
[format["Building Disallowed: Max %1 Jammer per Group!", _jammerPerGroup], 5] call Epoch_message;

View File

@ -25,7 +25,7 @@
private ["_jammed","_jammer"];
//[[[end]]]
_jammer = (nearestObjects[player, call EPOCH_JammerClasses, call EPOCH_MaxJammerRange]) select {player distance _x < (getnumber (getmissionconfig ("CfgEpochClient" >> "CfgJammers" >> (typeof _x) >> "buildingJammerRange")))};
_jammer = (nearestObjects[player, call EPOCH_JammerClasses, call EPOCH_MaxJammerRange]) select {player distance _x < (getnumber (getmissionconfig "CfgEpochClient" >> "CfgJammers" >> (typeof _x) >> "buildingJammerRange"))};
_jammed = false;
if !(_jammer isEqualTo[]) then {
{

View File

@ -27,7 +27,7 @@ private ["_buildingJammerRange","_maintainCount","_rnd"];
if !(isNil "EPOCH_maintainLockout") exitWith {["Already Maintaining a base.", 5] call Epoch_message;};
if (EPOCH_playerCrypto > 0) then {
_buildingJammerRange = getnumber (getmissionconfig ("CfgEpochClient" >> "CfgJammers" >> (typeof _this) >> "buildingJammerRange"));;
_buildingJammerRange = getnumber (getmissionconfig "CfgEpochClient" >> "CfgJammers" >> (typeof _this) >> "buildingJammerRange");;
if (_buildingJammerRange == 0) then { _buildingJammerRange = 75; };
_maintainCount = {(damage _x) > 0} count nearestObjects[_this, ["Constructions_static_F","Constructions_foundation_F","Buildable_Storage","Constructions_lockedstatic_F"], _buildingJammerRange];

View File

@ -57,7 +57,7 @@ if (_objType in (call EPOCH_JammerClasses)) then {
};
}
else {
_jammer = (nearestObjects[player, call EPOCH_JammerClasses, call EPOCH_MaxJammerRange]) select {player distance _x < (getnumber (getmissionconfig ("CfgEpochClient" >> "CfgJammers" >> (typeof _x) >> "buildingJammerRange")))};
_jammer = (nearestObjects[player, call EPOCH_JammerClasses, call EPOCH_MaxJammerRange]) select {player distance _x < (getnumber (getmissionconfig "CfgEpochClient" >> "CfgJammers" >> (typeof _x) >> "buildingJammerRange"))};
if !(_jammer isEqualTo[]) then{
{
if (alive _x) exitWith{

View File

@ -51,7 +51,7 @@ if (_stability > 0) exitWith{
};
};
_jammer = (nearestObjects[_object, call EPOCH_JammerClasses, call EPOCH_MaxJammerRange]) select {alive _x && {_object distance _x < (getnumber (getmissionconfig ("CfgEpochClient" >> "CfgJammers" >> (typeof _x) >> "buildingJammerRange")))}};
_jammer = (nearestObjects[_object, call EPOCH_JammerClasses, call EPOCH_MaxJammerRange]) select {alive _x && {_object distance _x < (getnumber (getmissionconfig "CfgEpochClient" >> "CfgJammers" >> (typeof _x) >> "buildingJammerRange"))}};
if !(_jammer isEqualTo[]) then {
_nearestJammer = _jammer select 0;
@ -65,11 +65,11 @@ if !(_jammer isEqualTo[]) then {
};
if !(_buildingAllowed)exitWith{ false };
if (_object isKindOf "Constructions_static_F") then {
if (_object isKindOf "Constructions_static_F" || {(typeof _object) in (call EPOCH_JammerClasses)}) then {
// take upgrade item from player here
_config = 'CfgBaseBuilding' call EPOCH_returnConfig;
_config2 = getmissionconfig ("CfgEpochClient" >> "CfgJammers" >> (typeof _object));
_config2 = getmissionconfig "CfgEpochClient" >> "CfgJammers" >> (typeof _object);
_upgrades = getArray(_config >> (typeOf _object) >> "upgradeBuilding");
if !(_upgrades isEqualTo []) then {
@ -99,7 +99,7 @@ if (_object isKindOf "Constructions_static_F") then {
if (_canUpgrade) then {
_doors = ["CfgEpochClient", "DoorClasses", ["WoodLargeWallDoorL_EPOCH","WoodWall4_EPOCH","CinderWallDoorwHatch_EPOCH","WoodStairs3_EPOCH","JailWallDoor_EPOCH"]] call EPOCH_fnc_returnConfigEntryV2;
_gates = ["CfgEpochClient", "GateClasses", ["CinderWallGarage_EPOCH","WoodWallGarage_EPOCH","MetalWallGarage_EPOCH"]] call EPOCH_fnc_returnConfigEntryV2;
_JammerConfig = getmissionconfig ("CfgEpochClient" >> "CfgJammers" >> (typeof _nearestJammer);
_JammerConfig = getmissionconfig "CfgEpochClient" >> "CfgJammers" >> (typeof _nearestJammer);
_buildingJammerRange = getnumber (_JammerConfig >> "buildingJammerRange");
_maxdoors = getnumber (_JammerConfig >> "maxdoors");
_maxgates = getnumber (_JammerConfig >> "maxgates");

View File

@ -31,7 +31,7 @@ if (!isNull _cursorTarget && {!(EPOCH_target isEqualTo _cursorTarget)}) then {
if (_cursorTarget isKindOf "AllVehicles") then {
_currentTarget = _cursorTarget;
} else {
if (_cursorTarget isKindOf "Constructions_modular_F" || _cursorTarget isKindOf "Constructions_static_F") then {
if (_cursorTarget isKindOf "Constructions_modular_F" || {_cursorTarget isKindOf "Constructions_static_F"} || {(typeof _cursorTarget) in (call Epoch_JammerClasses)}) then {
_currentTargetMode = 1;
_currentTarget = _cursorTarget;
};

View File

@ -275,7 +275,7 @@ _lootBubble = {
_objects resize 4;
};
// diag_log format["DEBUG: loot objects %1",_objects];
_jammer = ((_lootLoc nearObjects [call EPOCH_JammerClasses, (call EPOCH_MaxJammerRange) + 50]) select {_x distance _lootLoc < ((getnumber (getmissionconfig >> "cfgEpochClient" >> "CfgJammers" >> (typeof _x) >> "buildingJammerRange"))+50)}) + (_lootLoc nearObjects ["ProtectionZone_Invisible_F", 25]);
_jammer = ((nearestObjects [_lootLoc, call EPOCH_JammerClasses, ((call EPOCH_MaxJammerRange) + 50)]) select {_x distance _lootLoc < ((getnumber (getmissionconfig "cfgEpochClient" >> "CfgJammers" >> (typeof _x) >> "buildingJammerRange"))+50)}) + (_lootLoc nearObjects ["ProtectionZone_Invisible_F", 25]);
if (!(_objects isEqualTo[]) && (_jammer isEqualTo[])) then {
_building = selectRandom _objects;
if (_building getvariable ["EPOCH_Skiploot",false]) exitwith {};

View File

@ -13,7 +13,7 @@
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/init/both_init.sqf
*/
//[[[cog import generate_private_arrays ]]]
private ["_communityStatsInit","_customVarsInit","_dynSimToggle","_JammerConfig","_cfgBaseBuilding","_JammerClass","_preview"];
private ["_communityStatsInit","_customVarsInit","_dynSimToggle","_JammerConfig","_JammerClass","_preview"];
//[[[end]]]
// Check if Advanced Vehicle Repair is enabled
@ -75,7 +75,7 @@ disableRemoteSensors (["CfgEpochClient", "disableRemoteSensors", true] call EPOC
EPOCH_JammerClasses = [];
EPOCH_JammerGhosts = [];
EPOCH_MaxJammerRange = 75;
_JammerConfig = (getmissionconfig >> "CfgEpochClient" >> "CfgJammers");
_JammerConfig = (getmissionconfig "CfgEpochClient" >> "CfgJammers");
if !(isclass _JammerConfig) exitwith {
diag_log "EPOCH_debug: Error: No Jammerclasses defined in CfgEpochClient";
};
@ -86,19 +86,18 @@ if !(isclass _JammerConfig) exitwith {
if (_JammerRangeX > EPOCH_MaxJammerRange) then {
EPOCH_MaxJammerRange = _JammerRangeX;
};
} foreach (configclasses _JammerConfig);
} foreach ("true" configClasses _JammerConfig);
if (EPOCH_JammerClasses isEqualTo []) then {
diag_log "EPOCH_debug: Error: Jammerconfig in CfgEpochClient seems to be wrong";
};
_cfgBaseBuilding = 'CfgBaseBuilding' call EPOCH_returnConfig;
{
_JammerClass = _x;
{
_preview = gettext (_cfgBaseBuilding >> _JammerClass >> _x);
if !(_preview isEqualTo "" || _preview isEqualTo _x) then {
_preview = gettext (getmissionconfig "CfgBaseBuilding" >> _JammerClass >> _x);
if !(_preview isEqualTo "" || _preview isEqualTo _JammerClass) then {
EPOCH_JammerGhosts pushBackUnique _preview;
};
} foreach ["GhostPreview","simClass"];
} foreach ["GhostPreview","simulClass"];
} foreach EPOCH_JammerClasses;
EPOCH_JammerClasses = compilefinal (str EPOCH_JammerClasses);
EPOCH_MaxJammerRange = compilefinal (str EPOCH_MaxJammerRange);

View File

@ -49,7 +49,7 @@ class CfgActionMenu
dyna_deathMarkerAvail = "!(dyna_deathMarker isEqualTo [])";
dyna_mapDeathMarker = "(((getArray(('CfgMarkerSets' call EPOCH_returnConfig) >> 'DeathMarker' >> 'markerArray') select 0) select 0) in allMapMarkers)";
dyna_AtHome = "call {_nearjammers = (nearestObjects[player, _JammerCheckClasses, call EPOCH_MaxJammerRange]) select {player distance _x < (getnumber (getmissionconfig (_JammerConfig >> (typeof _x) >> 'buildingJammerRange')))};if (_nearjammers isEqualTo []) exitwith {false};_nearestJammer = _nearjammers select 0;((_nearestJammer getVariable['BUILD_OWNER', '-1']) in[getPlayerUID player, Epoch_my_GroupUID])}";
dyna_AtHome = "call {_nearjammers = (nearestObjects[player, call EPOCH_JammerClasses, call EPOCH_MaxJammerRange]) select {player distance _x < (getnumber (getmissionconfig 'cfgEpochClient' >> 'CfgJammers' >> (typeof _x) >> 'buildingJammerRange'))};if (_nearjammers isEqualTo []) exitwith {false};_nearestJammer = _nearjammers select 0;((_nearestJammer getVariable['BUILD_OWNER', '-1']) in[getPlayerUID player, Epoch_my_GroupUID])}";
dyna_Watersource = "call {_nearObjects = nearestObjects [player, [], 2];_check = 'water';_ok = false;{if (alive _x) then {_ok = [_x, _check] call EPOCH_worldObjectType;};if (_ok) exitWith {};} forEach _nearObjects;_ok}";
};

View File

@ -187,6 +187,7 @@ class CfgBaseBuilding
};
class PlotPole_EPOCH : Default
{
upgradeBuilding[] = {{"PlotPole_L_EPOCH",{{"ItemCorrugatedLg",5},{"EnergyPackLg",2},{"CircuitParts",3},{"ItemBattery",3},{"ItemPipe",1}}}};
removeParts[] = {{"KitPlotPole",1}};
GhostPreview = "PlotPole_EPOCH";
staticClass = "PlotPole_EPOCH";
@ -197,6 +198,24 @@ class CfgBaseBuilding
{
removeParts[] = {};
};
class PlotPole_L_EPOCH : Default
{
upgradeBuilding[] = {{"PlotPole_XL_EPOCH",{{"ItemCorrugatedLg",5},{"EnergyPackLg",2},{"CircuitParts",3},{"ItemBattery",3},{"ItemPipe",1}}}};
removeParts[] = {{"KitPlotPole",1},{"ItemCorrugatedLg",5},{"EnergyPackLg",2},{"CircuitParts",3},{"ItemBattery",3},{"ItemPipe",1}};
GhostPreview = "PlotPole_L_EPOCH";
staticClass = "PlotPole_L_EPOCH";
simulClass = "PlotPole_L_EPOCH";
bypassJammer = 1;
};
class PlotPole_XL_EPOCH : Default
{
upgradeBuilding[] = {};
removeParts[] = {{"KitPlotPole",1},{"ItemCorrugatedLg",10},{"EnergyPackLg",4},{"CircuitParts",6},{"ItemBattery",6},{"ItemPipe",2}};
GhostPreview = "PlotPole_XL_EPOCH";
staticClass = "PlotPole_XL_EPOCH";
simulClass = "PlotPole_XL_EPOCH";
bypassJammer = 1;
};
class WoodRamp_EPOCH : Default
{
removeParts[] = {{"PartPlankPack",3}};

View File

@ -62,13 +62,13 @@ class CfgEpochClient
class PlotPole_L_EPOCH : PlotPole_EPOCH // inherits from "PlotPole_EPOCH" (not defined values will be taken from PlotPole_EPOCH)
{
buildingJammerRange = 100; // jammer range in meters
buildingCountLimit = 250; // Max Building Elements per Base
buildingCountLimit = 225; // Max Building Elements per Base
storageCountLimit = 125; // Max Storage Elements per Base
};
class PlotPole_XL_EPOCH : PlotPole_L_EPOCH
{
buildingJammerRange = 150; // jammer range in meters
buildingCountLimit = 300; // Max Building Elements per Base
buildingJammerRange = 125; // jammer range in meters
buildingCountLimit = 250; // Max Building Elements per Base
storageCountLimit = 150; // Max Storage Elements per Base
};
};

View File

@ -1,6 +1,6 @@
// _newObj = [_class,_object] call EPOCH_swapBuilding;
//[[[cog import generate_private_arrays ]]]
private ["_newObj","_objectPos"];
private ["_newObj","_objectPos","_owner"];
//[[[end]]]
params [["_class",""],["_object",objNull],["_method",0]];
_newObj = objNull;
@ -8,6 +8,10 @@ if (!isNull _object && !(_class isEqualTo "")) then {
_objectPos = getPosWorld _object;
_newObj = createVehicle [_class, ASLtoAGL _objectPos, [], 0, "CAN_COLLIDE"];
if (!isNull _newObj) then {
_owner = _object getvariable ["Build_Owner",""];
if !(_owner isEqualTo "") then {
_newObj setVariable ["BUILD_OWNER", _owner, true];
};
_object hideObjectGlobal true;
switch (_method) do {
case 0: {

View File

@ -295,7 +295,7 @@ else {
_staticFuelSources pushback _x;
} foreach (((_x nearObjects ['Building',call EPOCH_MaxJammerRange]) select {getFuelCargo _x > 0}));
} foreach (missionnamespace getvariable ["Epoch_Plotpoles",_allplots = [];{_allplots pushback (allmissionobjects _x)} foreach (call EPOCH_JammerClasses);_allplots]);
} foreach (missionnamespace getvariable ["Epoch_Plotpoles",call {_allplots = [];{_allplots append (allmissionobjects _x)} foreach (call EPOCH_JammerClasses);_allplots}]);
missionNamespace setVariable ["EPOCH_staticFuelSources", _staticFuelSources, true];
};
};