Updated Breaking to support Metal Gates.

Vanilla development commit:

bf16f402f6
This commit is contained in:
ebaydayz
2016-07-28 11:17:11 -04:00
parent e399556af2
commit 82cf8e76f0

View File

@@ -1,8 +1,10 @@
private ["_brokein","_isOk","_hasSledgeHammer","_gps","_vars","_hasToolbox","_hasCrowbar","_limit","_proceed","_counter", private ["_brokein","_isOk","_hasSledgeHammer","_gps","_vars","_hasToolbox","_hasCrowbar","_limit","_proceed","_counter",
"_dis","_sfx","_roll","_animState","_started","_finished","_isMedic","_isGate"]; "_dis","_sfx","_roll","_animState","_started","_finished","_isMedic","_isGate"];
_target = _this select 3; _target = _this select 3;
_pos = getPos _target; _pos = getPos _target;
_isGate = (typeOf cursorTarget) in ["WoodenGate_2","WoodenGate_3","WoodenGate_4"]; _isWoodenGate = (typeOf cursorTarget) in ["WoodenGate_2","WoodenGate_3","WoodenGate_4"];
_isMetalGate = (typeOf cursorTarget) in ["MetalGate_2","MetalGate_3","MetalGate_4"];
_limit = 2 + round(random 3); _limit = 2 + round(random 3);
_hasSledgeHammer = "ItemSledge" in items player; _hasSledgeHammer = "ItemSledge" in items player;
@@ -86,14 +88,20 @@ while {_isOk} do {
//Add to Counter //Add to Counter
_counter = _counter + 1; _counter = _counter + 1;
if (_isMetalGate) then {
//start chance to gain access.
if ([0.02] call fn_chance) then {
_isOk = false;
_proceed = true;
_brokein = true;
_target setVariable ["isOpen", "1", true];
};
};
//start chance to gain access. if (_isWoodenGate) then {
if ([0.01] call fn_chance) then { if ([0.06] call fn_chance) then {
//stop loop _isOk = false;
_isOk = false; _proceed = true;
//Set Done var
_proceed = true;
if (_isGate) then {
_brokein = true; _brokein = true;
_target setVariable ["isOpen", "1", true]; _target setVariable ["isOpen", "1", true];
}; };
@@ -106,12 +114,14 @@ while {_isOk} do {
player removeWeapon "ItemSledge"; player removeWeapon "ItemSledge";
player addMagazine "ItemSledgeHandle"; player addMagazine "ItemSledgeHandle";
player addMagazine "ItemSledgeHead"; player addMagazine "ItemSledgeHead";
localize "STR_BLD_BREAKIN_BROKEN_SLEDGE" call dayz_rollingMessages; localize "STR_BLD_BREAKIN_BROKEN_SLEDGE" call dayz_rollingMessages;
}; };
if ([0.04] call fn_chance) then { if ([0.04] call fn_chance) then {
player removeWeapon "ItemCrowbar"; player removeWeapon "ItemCrowbar";
player addWeapon "ItemCrowbarBent"; player addWeapon "ItemCrowbarBent";
localize "STR_BLD_BREAKIN_BENT_CROWBAR" call dayz_rollingMessages; localize "STR_BLD_BREAKIN_BENT_CROWBAR" call dayz_rollingMessages;
}; };
}; };
@@ -136,6 +146,7 @@ if (!_proceed) then {
[objNull, player, rSwitchMove,""] call RE; [objNull, player, rSwitchMove,""] call RE;
player playActionNow "stop"; player playActionNow "stop";
}; };
localize "STR_BLD_BREAKIN_CANCELLED" call dayz_rollingMessages; localize "STR_BLD_BREAKIN_CANCELLED" call dayz_rollingMessages;
}; };
@@ -146,6 +157,7 @@ if (!_proceed) then {
if (_proceed and !_brokein) then { if (_proceed and !_brokein) then {
localize "STR_BLD_BREAKIN_COMPLETE_FAIL" call dayz_rollingMessages; localize "STR_BLD_BREAKIN_COMPLETE_FAIL" call dayz_rollingMessages;
}; };
//Completed and successful //Completed and successful
if (_proceed and _brokein) then { if (_proceed and _brokein) then {
localize "STR_BLD_BREAKIN_COMPLETE" call dayz_rollingMessages; localize "STR_BLD_BREAKIN_COMPLETE" call dayz_rollingMessages;