Merge pull request #662 from dayz10k/master

#661 tank trap griefing
This commit is contained in:
dayz10k
2013-11-06 11:13:47 -08:00
4 changed files with 89 additions and 61 deletions

View File

@@ -12,5 +12,10 @@ class ItemToolbox: ItemCore
text="Remove Camo Net";
script="spawn player_removeNet;";
};
class RemoveTankTrap
{
text="Remove Tank Trap";
script="spawn player_removeTankTrap;";
};
};
};

View File

@@ -112,6 +112,7 @@ if((count _offset) <= 0) then {
_isPole = (_classname == "Plastic_Pole_EP1_DZ");
_isLandFireDZ = (_classname == "Land_Fire_DZ");
_isTankTrap = (_classname == "Hedgehog_DZ");
_distance = 30;
_needText = "Plot Pole";
@@ -319,6 +320,14 @@ if (_hasrequireditem) then {
deleteVehicle _object;
};
if((_isTankTrap) and ((_position select 2)< 0)) exitWith {
_isOk = false;
_cancel = true;
_reason = "You cannot place TankTraps underground).";
detach _object;
deleteVehicle _object;
};
if(_location1 distance _location2 > 5) exitWith {
_isOk = false;
_cancel = true;
@@ -365,7 +374,7 @@ if (_hasrequireditem) then {
};
// No building on roads
if (isOnRoad _location) then { _cancel = true; _reason = "Cannot build on a road."; };
if (isOnRoad _position) then { _cancel = true; _reason = "Cannot build on a road."; };
// No building in trader zones
if(!canbuild) then { _cancel = true; _reason = "Cannot build in a city."; };

View File

@@ -0,0 +1,13 @@
private ["_nearTankTraps","_nearTankTrap"];
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
_canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder);
_nearTankTraps = nearestObjects [player, "Hedgehog_DZ", 1];
_nearTankTrap = _nearTankTraps select 0;
if (!isNull _nearTankTrap and _canDo) then {
[0,1,2,_nearTankTrap] spawn player_removeObject;
} else {
cutText ["No Tank Traps found nearby.", "PLAIN DOWN"];
};

View File

@@ -33,6 +33,7 @@ if (!isDedicated) then {
player_removeObject = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\remove.sqf";
player_removeNet = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_removeNet.sqf";
player_removeTankTrap = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_removeTankTrap.sqf";
player_unlockDoor = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_unlockDoor.sqf";
player_changeCombo = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_changeCombo.sqf";