Allow sleeping at all tents

Vanilla development commit:

e647be13c1
This commit is contained in:
ebaydayz
2016-04-28 20:30:09 -04:00
parent 9df5c5a156
commit 2b61ce850a
4 changed files with 16 additions and 16 deletions

View File

@@ -282,7 +282,7 @@ if (_canBuild select 0) then {
if(_location1 distance _location2 > 10) exitWith { if(_location1 distance _location2 > 10) exitWith {
_isOk = false; _isOk = false;
_cancel = true; _cancel = true;
_reason = "You've moved to far away from where you started building (within 10 meters)"; _reason = "You've moved too far away from where you started building (within 10 meters)";
detach _object; detach _object;
deleteVehicle _object; deleteVehicle _object;
detach _objectHelper; detach _objectHelper;
@@ -292,7 +292,7 @@ if (_canBuild select 0) then {
if(_location1 distance _objectHelperPos > 10) exitWith { if(_location1 distance _objectHelperPos > 10) exitWith {
_isOk = false; _isOk = false;
_cancel = true; _cancel = true;
_reason = "Object is placed to far away from where you started building (within 10 meters)"; _reason = "Object is placed too far away from where you started building (within 10 meters)";
detach _object; detach _object;
deleteVehicle _object; deleteVehicle _object;
detach _objectHelper; detach _objectHelper;

View File

@@ -246,7 +246,7 @@ if (_canBuild select 0) then {
if(_location1 distance _location2 > 5) exitWith { if(_location1 distance _location2 > 5) exitWith {
_isOk = false; _isOk = false;
_cancel = true; _cancel = true;
_reason = "You've moved to far away from where you started building (within 5 meters)"; _reason = "You've moved too far away from where you started building (within 5 meters)";
detach _object; detach _object;
deleteVehicle _object; deleteVehicle _object;
}; };

View File

@@ -1,4 +1,4 @@
private ["_playArray","_lastRest","_blood","_timesincedrink","_bloodinc","_Moves","_sleepArray","_animState","_started","_finished","_timer","_i","_r","_cureAttempt","_isAsleep","_cureChance","_infectedStatus","_randomamount"]; private ["_playArray","_lastRest","_blood","_timesincedrink","_bloodinc","_Moves","_sleepArray","_animState","_started","_finished","_timer","_i","_r","_cureAttempt","_isAsleep","_cureChance","_infectedStatus","_randomamount","_isOwner","_tent"];
//_timesincedrink = time - dayz_lastDrink; //_timesincedrink = time - dayz_lastDrink;
//_bloodinc =100; Removed for now(untested) due to it not needed yet //_bloodinc =100; Removed for now(untested) due to it not needed yet
//http://community.bistudio.com/wiki/ArmA2:_Moves //http://community.bistudio.com/wiki/ArmA2:_Moves
@@ -24,6 +24,8 @@ _r = 0;
_blood = 0; _blood = 0;
_cureAttempt = 0; _cureAttempt = 0;
_lastRest = player getVariable ["lastRest", 0]; _lastRest = player getVariable ["lastRest", 0];
_tent = _this select 3;
_isOwner = (_tent getVariable ["characterID","0"]) == dayz_characterID;
while {r_doLoop} do { while {r_doLoop} do {
_isAsleep = (animationState player) in _sleepArray; _isAsleep = (animationState player) in _sleepArray;
@@ -39,8 +41,8 @@ while {r_doLoop} do {
//Update the local value. //Update the local value.
_lastRest = diag_ticktime; _lastRest = diag_ticktime;
//10% chance of cure to infection every 60 seconds of sleeping //10% chance of cure to infection every 60 seconds of sleeping if owner, 5% if not owner
_cureChance = 0.10 + _cureAttempt; _cureChance = if (_isOwner) then {0.10 + _cureAttempt} else {0.05 + _cureAttempt};
if ([_cureChance] call fn_chance) then { if ([_cureChance] call fn_chance) then {
r_player_infected = false; r_player_infected = false;
player setVariable["USEC_infected",false,false]; player setVariable["USEC_infected",false,false];

View File

@@ -459,15 +459,9 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
if (s_player_packtent < 0) then { if (s_player_packtent < 0) then {
s_player_packtent = player addAction [localize "str_actions_self_07", "\z\addons\dayz_code\actions\tent_pack.sqf",_cursorTarget, 0, false, true]; s_player_packtent = player addAction [localize "str_actions_self_07", "\z\addons\dayz_code\actions\tent_pack.sqf",_cursorTarget, 0, false, true];
}; };
//sleep
if (s_player_sleep < 0) then {
s_player_sleep = player addAction [localize "str_actions_self_sleep", "\z\addons\dayz_code\actions\player_sleep.sqf",_cursorTarget, 0, false, true];
};
} else { } else {
player removeAction s_player_packtent; player removeAction s_player_packtent;
s_player_packtent = -1; s_player_packtent = -1;
player removeAction s_player_sleep;
s_player_sleep = -1;
}; };
} else { } else {
player removeAction s_player_deleteBuild; player removeAction s_player_deleteBuild;
@@ -476,8 +470,6 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
s_player_upgradestroage = -1; s_player_upgradestroage = -1;
player removeAction s_player_packtent; player removeAction s_player_packtent;
s_player_packtent = -1; s_player_packtent = -1;
player removeAction s_player_sleep;
s_player_sleep = -1;
}; };
//other tents //other tents
if (_istypeTent) then { if (_istypeTent) then {
@@ -491,8 +483,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
} else { } else {
player removeAction s_player_destorytent; player removeAction s_player_destorytent;
s_player_destorytent = -1; s_player_destorytent = -1;
}; };
if (_typeOfCursorTarget in ["IC_DomeTent","IC_Tent"]) then { if (_typeOfCursorTarget in ["IC_DomeTent","IC_Tent"]) then {
if (s_player_packtentinfected < 0) then { if (s_player_packtentinfected < 0) then {
s_player_packtentinfected = player addAction [localize "str_actions_self_07", "\z\addons\dayz_code\actions\tent_pack.sqf",_cursorTarget, 0, false, true]; s_player_packtentinfected = player addAction [localize "str_actions_self_07", "\z\addons\dayz_code\actions\tent_pack.sqf",_cursorTarget, 0, false, true];
@@ -501,6 +492,13 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
player removeAction s_player_packtentinfected; player removeAction s_player_packtentinfected;
s_player_packtentinfected = -1; s_player_packtentinfected = -1;
}; };
//sleep
if (s_player_sleep < 0) then {
s_player_sleep = player addAction [localize "str_actions_self_sleep", "\z\addons\dayz_code\actions\player_sleep.sqf",_cursorTarget, 0, false, true];
};
} else {
player removeAction s_player_sleep;
s_player_sleep = -1;
}; };
//Study Body //Study Body