Add setting to disable base takeover #1886

No classes inherit from Generator_DZ, so there is no need to use
isKindOf over typeOf.
This commit is contained in:
ebaydayz
2017-02-01 12:16:16 -05:00
parent 9f7ae93bef
commit 6aa5c9b64f
7 changed files with 22 additions and 24 deletions

View File

@@ -8,6 +8,7 @@
[NEW] Added loot positions for some more Sahrani and Tavi buildings
[NEW] Added military flashlight attachments
[NEW] Added full screen night vision goggles, classname: "NVGoggles_DZE" (must be added to traders by server owners) @icomrade
[NEW] Added setting to easily disable base takeover and configure which items are removable without ownership or access. See DZE_restrictRemoval in configVariables.sqf. #1886 @AirwavesMan @oiad
[CHANGED] Turbo and HoldBreath keybindings are now allowed again. @icomrade
[CHANGED] Commented drink from hands at ponds due to client FPS impact. Players can still fill drinks at ponds by right clicking a container. #1816

View File

@@ -76,7 +76,7 @@ if (_build) then {
};
/* //set fuel, Later use Generator
if (_object isKindOf "Generator_DZ") then {
if (typeOf _object == "Generator_DZ") then {
diag_log format["Object: %1, Fuel: %2",_object,fuel _object];
if (local _object) then {
_object setFuel 0;

View File

@@ -1,14 +1,15 @@
if (dayz_actionInProgress) exitWith {localize "str_epoch_player_24" call dayz_rollingMessages;};
dayz_actionInProgress = true;
private ["_vehicle","_canSize","_configVeh","_capacity","_nameType","_curFuel","_newFuel","_dis","_sfx","_fueling","_array","_cantype",
"_emptycan","_started","_finished","_animState","_isRefuel"];
"_emptycan","_started","_finished","_animState","_isRefuel","_type"];
_array = _this select 3;
_cantype = _array select 0;
_vehicle = _array select 1;
_type = typeOf _vehicle;
_canSize = getNumber(configFile >> "cfgMagazines" >> _cantype >> "fuelQuantity");
_emptycan = getText(configFile >> "cfgMagazines" >> _cantype >> "emptycan");
_configVeh = configFile >> "cfgVehicles" >> TypeOf(_vehicle);
_configVeh = configFile >> "cfgVehicles" >> _type;
_capacity = getNumber(_configVeh >> "fuelCapacity");
_nameType = getText(_configVeh >> "displayName");
_curFuel = ((fuel _vehicle) * _capacity);
@@ -57,7 +58,7 @@ if (!_fueling) then {
r_doLoop = false;
if (_finished) then {
if((_vehicle isKindOf "Generator_DZ") && {!(_vehicle getVariable ["GeneratorFilled", false])}) then {
if ((_type == "Generator_DZ") && {!(_vehicle getVariable ["GeneratorFilled", false])}) then {
_vehicle setVariable ["GeneratorFilled", true, true];
};
if (local _vehicle) then {

View File

@@ -130,8 +130,8 @@ while {_isOk} do {
if(_finished) then {
_counter = _counter + 1;
// 4% chance to break a required tool each pass
if((_isDestructable || _isRemovable) && !_isOwnerOfObj) then {
if (dayz_toolBreaking && {[0.04] call fn_chance}) then {_brokenTool = true;};
if ((_isDestructable || _isRemovable) && {!_isOwnerOfObj} && {dayz_toolBreaking && {[0.04] call fn_chance}}) then {
_brokenTool = true;
};
};
if(_brokenTool) exitWith {

View File

@@ -4,7 +4,7 @@ scriptName "Functions\misc\fn_selfActions.sqf";
- Function
- [] call fnc_usec_selfActions;
************************************************************/
private ["_canPickLight","_text","_unlock","_lock","_totalKeys","_temp_keys","_temp_keys_names",
private ["_canPickLight","_text","_unlock","_lock","_totalKeys","_temp_keys","_temp_keys_names","_restrict",
"_hasKey","_oldOwner","_hasAttached","_isZombie","_isHarvested","_isMan","_isFuel","_hasRawMeat","_hastinitem","_player_deleteBuild",
"_player_lockUnlock_crtl","_displayName","_hasIgnitors","_menu","_menu1","_allowTow","_liftHeli","_found","_posL","_posC","_height","_attached",
"_combi","_findNearestGen","_humanity_logic","_low_high","_cancel","_buy","_buyV","_humanity","_traderMenu","_warn","_typeOfCursorTarget",
@@ -226,7 +226,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
_isBicycle = _cursorTarget isKindOf "Bicycle";
_isMan = _cursorTarget isKindOf "Man"; //includes animals and zombies
_isDestructable = _cursorTarget isKindOf "BuiltItems";
_isGenerator = _cursorTarget isKindOf "Generator_DZ";
_isGenerator = _typeOfCursorTarget == "Generator_DZ";
//_isVehicletype = _typeOfCursorTarget in ["ATV_US_EP1","ATV_CZ_EP1"]; //Checked in player_flipvehicle
_isFuel = false;
_hasBarrel = "ItemFuelBarrel" in _magazinesPlayer;
@@ -389,22 +389,23 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
};
*/
if (_isAlive) then {
//Allow player to delete objects
if (_isDestructable || {((_typeOfCursorTarget in DZE_isWreck) or (_typeOfCursorTarget in DZE_isWreckBuilding))} || {(_typeOfCursorTarget in DZE_isRemovable)}) then {
_restrict = _typeOfCursorTarget in DZE_restrictRemoval;
//Allow player to remove objects with no ownership or access required
if (!_restrict && (_isDestructable || _typeOfCursorTarget in DZE_isWreck || _typeOfCursorTarget in DZE_isWreckBuilding || _typeOfCursorTarget in DZE_isRemovable)) then {
if (_hasToolbox && _hasCrowbar) then {
_player_deleteBuild = true;
};
};
if (_isModular || _isModularDoor || _isGenerator || {_typeOfCursorTarget in DZE_isDestroyableStorage}) then {
};
//Allow player to remove objects only if they have proper ownership or access
if (_restrict || _isModular || _isModularDoor || _isGenerator || _typeOfCursorTarget in DZE_isDestroyableStorage) then {
if (_hasToolbox && _hasCrowbar) then {
_hasAccess = [player, _cursorTarget] call FNC_check_access;
if ((_hasAccess select 0) or (_hasAccess select 2) or (_hasAccess select 3)) then {
_player_deleteBuild = true;
};
};
};
};
if (_isVehicle) then {
if ((_characterID != "0") && {!_isMan}) then {
_player_lockUnlock_crtl = true;
@@ -785,15 +786,10 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
if (_typeOfCursorTarget in dayz_fuelpumparray) then {
if (s_player_fuelauto < 0) then {
// check if Generator_DZ is running within 30 meters
_findNearestGen = [];
{
if ((alive _x) && (_x getVariable ["GeneratorRunning", false])) then {
_findNearestGen set [count _findNearestGen,_x];
};
} count (nearestObjects [([player] call FNC_getPos), ["Generator_DZ"], 30]);
_findNearestGen = {((alive _x) && (_x getVariable ["GeneratorRunning",false]))} count (([player] call FNC_getPos) nearObjects ["Generator_DZ",30]);
// show that pump needs power if no generator nearby.
if ((count _findNearestGen) > 0) then {
if (_findNearestGen > 0) then {
s_player_fuelauto = player addAction [localize "STR_EPOCH_ACTIONS_FILLVEH", "\z\addons\dayz_code\actions\fill_nearestVehicle.sqf",objNull, 0, false, true];
} else {
s_player_fuelauto = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_NEEDPOWER"], "",[], 0, false, true];

View File

@@ -77,6 +77,8 @@ DZE_plotManagementMustBeClose = false; //Players must be within 10m of pole to b
DZE_PlotManagementAdmins = []; //Array of admin PlayerUIDs. UIDs in this list are able to access every pole's management menu and delete or build any buildable with a pole nearby.
DZE_MaxPlotFriends = 10; //Max friends allowed on a plot. There is no character limit in the inventory field of the database, but lower values limit the max global setVariable size to improve performance.
DZE_maintainCurrencyRate = 100; //The currency rate of what maintaining an item will be, for instance: at 100, 10 items will have a worth of 1000 (1 10oz gold or 1k coins) see actions/maintain_area.sqf for more examples.
DZE_isRemovable = ["Plastic_Pole_EP1_DZ"]; //Items that can be removed with a crowbar with no ownership or access required. To forbid base take overs remove plot pole from this list and add it to DZE_restrictRemoval. It is not necessary to add wrecks or items that inherit from 'BuiltItems' to this list.
DZE_restrictRemoval = ["Fence_corrugated_DZ","M240Nest_DZ","ParkBench_DZ","FireBarrel_DZ","Scaffolding_DZ","CanvasHut_DZ","LightPole_DZ","DeerStand_DZ","MetalGate_DZ","StickFence_DZ"]; //Items that can be removed with a crowbar only with proper ownership or access. It is not necessary to add doors, storage or items that inherit from 'ModularItems' to this list. Items that inherit from 'BuiltItems' can be added to this list if desired.
// Snap Build and Build Vectors
DZE_modularBuild = true; // Enable Snap Building by @raymix and Build Vectors by @strikerforce.

View File

@@ -521,8 +521,6 @@ DZE_LockedStorage = ["VaultStorageLocked","LockboxStorageLocked"];
DZE_UnLockedStorage = ["VaultStorage","LockboxStorage"];
DZE_maintainClasses = ["ModularItems","DZE_Housebase","LightPole_DZ","BuiltItems","Generator_DZ","DZ_buildables","Plastic_Pole_EP1_DZ","Fence_corrugated_DZ","CanvasHut_DZ","ParkBench_DZ","MetalGate_DZ","StickFence_DZ","DesertCamoNet_DZ","ForestCamoNet_DZ","DesertLargeCamoNet_DZ","ForestLargeCamoNet_DZ","DeerStand_DZ","Scaffolding_DZ","FireBarrel_DZ","M240Nest_DZ"];
DZE_DoorsLocked = ["Land_DZE_GarageWoodDoorLocked","Land_DZE_LargeWoodDoorLocked","Land_DZE_WoodDoorLocked","CinderWallDoorLocked_DZ","CinderWallDoorSmallLocked_DZ"];
// List of removable items that require crowbar
DZE_isRemovable = ["Fence_corrugated_DZ","M240Nest_DZ","ParkBench_DZ","Plastic_Pole_EP1_DZ","FireBarrel_DZ","Scaffolding_DZ","CanvasHut_DZ","LightPole_DZ","DeerStand_DZ","MetalGate_DZ","StickFence_DZ"];
DZE_isWreck = ["SKODAWreck","HMMWVWreck","UralWreck","datsun01Wreck","hiluxWreck","datsun02Wreck","UAZWreck","Land_Misc_Garb_Heap_EP1","Fort_Barricade_EP1","Rubbish2"];
DZE_isWreckBuilding = ["Land_wreck_cinder","Land_wood_wreck_quarter","Land_wood_wreck_floor","Land_wood_wreck_third","Land_wood_wreck_frame","Land_iron_vein_wreck","Land_silver_vein_wreck","Land_gold_vein_wreck","Land_ammo_supply_wreck"];
DZE_isNewStorage = ["VaultStorage","OutHouse_DZ","Wooden_shed_DZ","WoodShack_DZ","StorageShed_DZ","GunRack_DZ","WoodCrate_DZ"];