surrender test 2

This commit is contained in:
[VB]AWOL
2013-11-10 23:34:09 -06:00
parent e6a5587962
commit 332dc68919
4 changed files with 47 additions and 35 deletions

View File

@@ -1,4 +1,4 @@
private ["_dikCode", "_handled"];
private ["_dikCode","_handled","_primaryWeapon","_secondaryWeapon","_nearbyObjects","_nill","_shift","_ctrl","_alt"];
_dikCode = _this select 1;
_handled = false;
@@ -14,43 +14,37 @@ if ((_dikCode == 0x3E or _dikCode == 0x0F or _dikCode == 0xD3) and (diag_tickTim
// surrender
if (_dikCode in actionKeys "Surrender") then {
// Toggle on/off
if (DZE_Surrender) then {
DZE_Surrender = false;
[objNull, player, rSwitchMove,""] call RE;
player playActionNow "";
player setVariable ["DZE_Surrendered", false, true];
} else {
if (!DZE_Surrender) then {
DZE_Surrender = true;
// remove weaponns and ammo
if (primaryWeapon player != "") then {
player action ["dropWeapon",player, (primaryWeapon player)];
_primaryWeapon = primaryWeapon player;
_secondaryWeapon = secondaryWeapon player;
if (_primaryWeapon != "") then {
player action ["dropWeapon",player, _primaryWeapon];
};
if (secondaryWeapon player != "") then {
player action ["dropWeapon",player, (secondaryWeapon player)];
if (_secondaryWeapon != "") then {
player action ["dropWeapon",player, _secondaryWeapon];
};
// set publicvariable that allows other player to access gear
player setVariable ["DZE_Surrendered", true, true];
// surrender animation
player playMove "AmovPercMstpSsurWnonDnon";
diag_log format["DZE_Surrender: %1", DZE_Surrender];
};
r_interrupt = true
_handled = true;
};
if (_dikCode in actionKeys "MoveForward") then {r_interrupt = true};
if (_dikCode in actionKeys "MoveLeft") then {r_interrupt = true};
if (_dikCode in actionKeys "MoveRight") then {r_interrupt = true};
if (_dikCode in actionKeys "MoveBack") then {r_interrupt = true};
if (_dikCode in actionKeys "MoveForward") exitWith {r_interrupt = true};
if (_dikCode in actionKeys "MoveLeft") exitWith {r_interrupt = true};
if (_dikCode in actionKeys "MoveRight") exitWith {r_interrupt = true};
if (_dikCode in actionKeys "MoveBack") exitWith {r_interrupt = true};
if (DZE_Surrender and r_interrupt) then {
player setVariable ["DZE_Surrendered", false, true];
DZE_Surrender = false;
diag_log format["DZE_Surrender2: %1", DZE_Surrender];
};
//Prevent exploit of drag body
if ((_dikCode in actionKeys "Prone") and r_drag_sqf) exitWith { force_dropBody = true; };

View File

@@ -0,0 +1,7 @@
private ["_hasKnife","_qty","_item","_text","_string","_type","_started","_finished","_animState","_isMedic","_hasHarvested","_hasKnifeBlunt","_humanity"];
player removeAction s_player_SurrenderedGear;
player action ["Gear", (_this select 3)];
s_player_SurrenderedGear = -1;

View File

@@ -4,7 +4,7 @@ scriptName "Functions\misc\fn_selfActions.sqf";
- Function
- [] call fnc_usec_selfActions;
************************************************************/
private ["_isWreckBuilding","_temp_keys","_magazinesPlayer","_isPZombie","_vehicle","_inVehicle","_hasFuelE","_hasRawMeat","_hasKnife","_hasToolbox","_onLadder","_nearLight","_canPickLight","_canDo","_text","_isHarvested","_isVehicle","_isVehicletype","_isMan","_traderType","_ownerID","_isAnimal","_isDog","_isZombie","_isDestructable","_isTent","_isFuel","_isAlive","_Unlock","_lock","_buy","_dogHandle","_lieDown","_warn","_hastinitem","_allowedDistance","_menu","_menu1","_humanity_logic","_low_high","_cancel","_metals_trader","_traderMenu","_isWreck","_isRemovable","_isDisallowRepair","_rawmeat","_humanity","_speed","_dog","_hasbottleitem","_isAir","_isShip","_playersNear","_findNearestGens","_findNearestGen","_IsNearRunningGen","_cursorTarget","_isnewstorage","_itemsPlayer","_ownerKeyId","_typeOfCursorTarget","_hasKey","_oldOwner","_combi","_key_colors","_player_deleteBuild","_player_flipveh","_player_lockUnlock_crtl","_player_butcher","_player_studybody","_player_cook","_player_boil","_hasFuelBarrelE","_hasHotwireKit"];
private ["_isWreckBuilding","_temp_keys","_magazinesPlayer","_isPZombie","_vehicle","_inVehicle","_hasFuelE","_hasRawMeat","_hasKnife","_hasToolbox","_onLadder","_nearLight","_canPickLight","_canDo","_text","_isHarvested","_isVehicle","_isVehicletype","_isMan","_traderType","_ownerID","_isAnimal","_isDog","_isZombie","_isDestructable","_isTent","_isFuel","_isAlive","_Unlock","_lock","_buy","_dogHandle","_lieDown","_warn","_hastinitem","_allowedDistance","_menu","_menu1","_humanity_logic","_low_high","_cancel","_metals_trader","_traderMenu","_isWreck","_isRemovable","_isDisallowRepair","_rawmeat","_humanity","_speed","_dog","_hasbottleitem","_isAir","_isShip","_playersNear","_findNearestGens","_findNearestGen","_IsNearRunningGen","_cursorTarget","_isnewstorage","_itemsPlayer","_ownerKeyId","_typeOfCursorTarget","_hasKey","_oldOwner","_combi","_key_colors","_player_deleteBuild","_player_flipveh","_player_lockUnlock_crtl","_player_butcher","_player_studybody","_player_cook","_player_boil","_hasFuelBarrelE","_hasHotwireKit","_player_SurrenderedGear","_isSurrendered"];
if (TradeInprogress) exitWith {}; // Do not allow if any script is running.
@@ -307,6 +307,7 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
// logic vars for addactions
_player_butcher = false;
_player_studybody = false;
_player_SurrenderedGear = false;
// CURSOR TARGET NOT ALIVE
if (!_isAlive) then {
@@ -328,15 +329,12 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
// gear access on surrendered player
if(_isMan and !_isZombie and !_isAnimal) then {
if (_cursorTarget getVariable ["DZE_Surrendered",false]) then {
if (s_player_SurrenderedGear < 0) then {
//s_player_SurrenderedGear = player addAction [format[localize "str_actions_save",_text], "\z\addons\dayz_code\actions\forcesave.sqf",_cursorTarget, 1, true, true, "", ""];
s_player_SurrenderedGear = player addAction ["Gear",_text], (player action ["Gear", _cursorTarget]),_cursorTarget, 1, true, true, "", ""];
};
_isSurrendered = _cursorTarget getVariable ["DZE_Surrendered",false];
diag_log format["DZE_Surrendered: %1", _isSurrendered];
if (_isSurrendered) then {
_player_SurrenderedGear = true;
};
} else {
player removeAction s_player_SurrenderedGear;
s_player_SurrenderedGear = -1;
};
};
@@ -383,6 +381,15 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
};
};
if (_player_SurrenderedGear) then {
if (s_player_SurrenderedGear < 0) then {
s_player_SurrenderedGear = player addAction ["Gear", "\z\addons\dayz_code\actions\surrender_gear.sqf",_cursorTarget, 1, true, true, "", ""];
};
} else {
player removeAction s_player_SurrenderedGear;
s_player_SurrenderedGear = -1;
};
//Fireplace Actions check
if (_player_cook) then {
if (s_player_cook < 0) then {
@@ -773,6 +780,9 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
player removeAction s_player_checkGear;
s_player_checkGear = -1;
player removeAction s_player_SurrenderedGear;
s_player_SurrenderedGear = -1;
//Others
player removeAction s_player_forceSave;
s_player_forceSave = -1;

View File

@@ -244,6 +244,7 @@ dayz_resetSelfActions = {
s_player_downgrade_build = -1;
s_player_towing = -1;
s_halo_action = -1;
s_player_SurrenderedGear = -1;
};
call dayz_resetSelfActions;