diff --git a/SQF/dayz_code/compile/fn_damageHandler.sqf b/SQF/dayz_code/compile/fn_damageHandler.sqf index a64b4fd79..9148f6a52 100644 --- a/SQF/dayz_code/compile/fn_damageHandler.sqf +++ b/SQF/dayz_code/compile/fn_damageHandler.sqf @@ -225,6 +225,7 @@ if (_hit in USEC_MinorWounds) then { if (_unit == player) then { //Set player in combat _unit setVariable["startcombattimer", 1]; + _unit setVariable["inCombat", 1, true]; }; //Shake the cam, frighten them! diff --git a/SQF/dayz_code/compile/player_death.sqf b/SQF/dayz_code/compile/player_death.sqf index 0a586f2c9..cad35bdb8 100644 --- a/SQF/dayz_code/compile/player_death.sqf +++ b/SQF/dayz_code/compile/player_death.sqf @@ -65,6 +65,7 @@ player setVariable ["USEC_isCardiac",false,true]; player setVariable ["medForceUpdate",true,true]; player setVariable ["bloodTaken", false, true]; player setVariable ["startcombattimer", 0]; //remove combat timer on death +player setVariable ["inCombat", 0, true]; r_player_unconscious = false; r_player_cardiac = false; _model = typeOf player; diff --git a/SQF/dayz_code/compile/player_humanityMorph.sqf b/SQF/dayz_code/compile/player_humanityMorph.sqf index ba4057dc8..039d10dfa 100644 --- a/SQF/dayz_code/compile/player_humanityMorph.sqf +++ b/SQF/dayz_code/compile/player_humanityMorph.sqf @@ -1,4 +1,4 @@ -private ["_charID","_newmodel","_old","_updates","_humanity","_medical","_worldspace","_zombieKills","_headShots","_humanKills","_combattimeout","_banditKills","_fractures","_wpnType","_ismelee"]; +private ["_charID","_newmodel","_old","_updates","_humanity","_medical","_worldspace","_zombieKills","_headShots","_humanKills","_combattimeout","_inCombat","_banditKills","_fractures","_wpnType","_ismelee"]; //_playerUID = _this select 0; _charID = _this select 1; _model = _this select 2; @@ -24,7 +24,7 @@ _humanKills = player getVariable ["humanKills",0]; _banditKills = player getVariable ["banditKills",0]; _achievements = player getVariable ["Achievements",[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]; _combattimeout = player getVariable["combattimeout",0]; - +_inCombat = player getVariable["inCombat",0]; _ConfirmedHumanKills = player getVariable ["ConfirmedHumanKills",0]; _ConfirmedBanditKills = player getVariable ["ConfirmedBanditKills",0]; _friendlies = player getVariable ["friendlies",[]]; @@ -83,6 +83,7 @@ player setVariable ["characterID",_charID,true]; player setVariable ["worldspace",_worldspace]; player setVariable ["Achievements",_achievements]; player setVariable ["combattimeout",_combattimeout,false]; +player setVariable ["inCombat", _inCombat, true]; player setVariable ["ConfirmedHumanKills",_ConfirmedHumanKills,true]; player setVariable ["ConfirmedBanditKills",_ConfirmedBanditKills,true]; diff --git a/SQF/dayz_code/compile/player_projectileNear.sqf b/SQF/dayz_code/compile/player_projectileNear.sqf index 5bfe9cc5d..b945cd977 100644 --- a/SQF/dayz_code/compile/player_projectileNear.sqf +++ b/SQF/dayz_code/compile/player_projectileNear.sqf @@ -34,6 +34,7 @@ while {(alive _projectile) && !(isNull _projectile) && (_callCount < 85)} do { _isInCombat = _nearVehicle getVariable["startcombattimer",0]; if ((alive _nearVehicle) and _isInCombat == 0) then { _nearVehicle setVariable["startcombattimer", 1]; + _nearVehicle setVariable["inCombat", 1, true]; diag_log("Now in Combat (Player): " + name _unit); }; }; @@ -43,6 +44,7 @@ while {(alive _projectile) && !(isNull _projectile) && (_callCount < 85)} do { _isInCombat = _x getVariable["startcombattimer",0]; if (isPlayer _x and _isInCombat == 0 and alive _x) then { _x setVariable["startcombattimer", 1]; + _x setVariable["inCombat", 1, true]; diag_log("Now in Combat (Crew): " + name _x); }; } forEach (crew _nearVehicle); diff --git a/SQF/dayz_code/compile/player_weaponFiredNear.sqf b/SQF/dayz_code/compile/player_weaponFiredNear.sqf index a9490c0d2..1c9dc4f86 100644 --- a/SQF/dayz_code/compile/player_weaponFiredNear.sqf +++ b/SQF/dayz_code/compile/player_weaponFiredNear.sqf @@ -22,8 +22,10 @@ private ["_handled"]; // Both the firer and those nearby (<=8m) go into "combat" to prevent ALT-F4 //diag_log ("DEBUG: AMMO TYPE: " +str(_ammo)); _firer setVariable["startcombattimer", 1]; + _firer setVariable["inCombat", 1, true]; if (_distance <= 8) then { _unit setVariable["startcombattimer", 1]; + _unit setVariable["inCombat", 1, true]; }; if (_inVehicle) exitWith {}; diff --git a/SQF/dayz_code/system/player_monitor.fsm b/SQF/dayz_code/system/player_monitor.fsm index c62d39fc4..0430a5877 100644 --- a/SQF/dayz_code/system/player_monitor.fsm +++ b/SQF/dayz_code/system/player_monitor.fsm @@ -32,7 +32,7 @@ item27[] = {"ERROR__Bad_Versi",2,250,325.000000,850.000000,425.000000,900.000000 item28[] = {"Display_Ready",4,218,-175.000000,1200.000000,-75.000000,1250.000000,0.000000,"Display" \n "Ready"}; item29[] = {"Preload_Display",2,250,-75.000000,1250.000000,25.000000,1300.000000,0.000000,"Preload" \n "Display"}; item30[] = {"Preload_Done",4,218,-175.000000,1300.000000,-75.000000,1350.000000,0.000000,"Preload" \n "Done"}; -item31[] = {"Initialize",2,250,-75.000000,1350.000000,25.000000,1400.000000,0.000000,"Initialize"}; +item31[] = {"Initialize",2,4346,-75.000000,1350.000000,25.000000,1400.000000,0.000000,"Initialize"}; item32[] = {"Finish",1,250,-75.000000,1625.000000,25.000000,1675.000000,0.000000,"Finish"}; item33[] = {"no_Time_Date",4,218,125.000000,950.000000,225.000000,1000.000000,0.000000,"no Time/Date"}; item34[] = {"sleep",4,218,525.000000,150.000000,625.000000,200.000000,0.000000,"sleep"}; @@ -108,7 +108,7 @@ item103[] = {"",7,210,-279.000000,371.000000,-271.000000,379.000000,0.000000,""} item104[] = {"retry_Login",4,218,-250.000000,350.000000,-150.000000,400.000000,0.000000,"retry Login"}; item105[] = {"",7,210,-379.000031,471.000000,-371.000000,479.000000,0.000000,""}; item106[] = {"Finish_1",2,250,-75.000000,1500.000000,25.000000,1550.000000,0.000000,"Finish"}; -item107[] = {"dayz_preloadFini",4,4314,50.000000,1550.000000,150.000000,1600.000000,0.000000,"dayz_preloadFinished"}; +item107[] = {"dayz_preloadFini",4,218,50.000000,1550.000000,150.000000,1600.000000,0.000000,"dayz_preloadFinished"}; item108[] = {"New_INFECTED_Character",4,218,-271.606934,571.673645,-171.606934,621.673645,5.000000,"New" \n "INFECTED Character" \n "258"}; item109[] = {"Player_Zombie__S",2,250,-611.348511,641.870300,-521.348145,691.870300,0.000000,"Player Zombie" \n " Selection"}; item110[] = {"",7,210,-955.744385,664.969482,-947.744385,672.969482,0.000000,""}; @@ -243,8 +243,8 @@ link127[] = {107,32}; link128[] = {108,109}; link129[] = {109,110}; link130[] = {110,64}; -globals[] = {0.000000,0,0,0,0,640,480,3,262,6316128,1,-633.732300,669.877075,2180.669678,358.546051,890,1244,1}; -window[] = {2,-1,-1,-1,-1,786,260,1280,260,3,908}; +globals[] = {0.000000,0,0,0,0,640,480,3,262,6316128,1,-420.384094,456.528290,1882.460693,656.753967,890,1244,1}; +window[] = {2,-1,-1,-32000,-32000,1270,1052,2072,744,3,908}; *//*%FSM*/ class FSM { @@ -732,7 +732,7 @@ class FSM "_worldspace = PVCDZ_plr_Login2 select 0;" \n "_state = PVCDZ_plr_Login2 select 1;" \n "" \n - "player setVariable [""Achievements"",[],false];" \n + "player setVariable [""Achievements"",[],false];" \n "" \n "_setDir = _worldspace select 0;" \n "_setPos = _worldspace select 1;" \n @@ -864,6 +864,7 @@ class FSM "r_player_cardiac = player getVariable[""USEC_isCardiac"",false];" \n "r_player_lowblood = player getVariable[""USEC_lowBlood"",false];" \n "r_player_blood = player getVariable[""USEC_BloodQty"",r_player_bloodTotal];" \n + "r_player_timeout = player getVariable[""unconsciousTime"",0];" \n "" \n "//Hunger/Thirst" \n "_messing = player getVariable[""messing"",[0,0,0]];" \n @@ -1136,13 +1137,12 @@ class FSM "//Medical" \n "dayz_medicalH = [] execVM ""\z\addons\dayz_code\medical\init_medical.sqf""; //Medical Monitor Script (client only)" \n "[player] call fnc_usec_damageHandle;" \n + "" \n "if (r_player_unconscious) then {" \n - " r_player_timeout = player getVariable[""unconsciousTime"",0];" \n " player playActionNow ""Die"";" \n + " [player,r_player_timeout] call fnc_usec_damageUnconscious;" \n "};" \n "" \n - "" \n - "" \n "//Add core tools" \n "player addWeapon ""Loot"";" \n "if ((currentWeapon player == """")) then { player action [""SWITCHWEAPON"", player,player,1]; };" \n @@ -1170,8 +1170,7 @@ class FSM "" \n "{ _x call fnc_veh_ResetEH; } forEach vehicles;" \n "player allowDamage true;" \n - "player enableSimulation true;" \n - ""/*%FSM*/; + "player enableSimulation true;"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { @@ -1195,9 +1194,9 @@ class FSM name = "Finish"; itemno = 32; init = /*%FSM*/"diag_log 'player_forceSave called from fsm';" \n - "//call player_forceSave;" \n - "" \n - "publicVariableServer ""PVDZ_plr_LoginRecord"";"/*%FSM*/; + "//call player_forceSave;" \n + "" \n + "publicVariableServer ""PVDZ_plr_LoginRecord"";"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { @@ -1934,22 +1933,28 @@ class FSM name = "Finish_1"; itemno = 106; init = /*%FSM*/"if (_debug == 1) then {diag_log [diag_tickTime,'Finish'];};" \n - "" \n - "PVDZ_plr_LoginRecord = [_playerUID,_charID,0,toArray (name vehicle player)];" \n - "" \n + "" \n + "PVDZ_plr_LoginRecord = [_playerUID,_charID,0,toArray (name vehicle player)];" \n + "" \n + "if (r_player_unconscious) then {" \n + " r_player_timeout = player getVariable[""unconsciousTime"",0];" \n + " player playActionNow ""Die"";" \n + " [player,r_player_timeout] call fnc_usec_damageUnconscious;" \n + "};" \n + "" \n "progressLoadingScreen 1;" \n - "" \n + "" \n "diag_log ['Sent to server: PVDZ_plr_LoginRecord', PVDZ_plr_LoginRecord]; " \n "" \n - "_world = toUpper(worldName); //toUpper(getText (configFile >> ""CfgWorlds"" >> (worldName) >> ""description""));" \n + "_world = toUpper(worldName); //toUpper(getText (configFile >> ""CfgWorlds"" >> (worldName) >> ""description""));" \n "_nearestCity = nearestLocations [getPos player, [""NameCityCapital"",""NameCity"",""NameVillage"",""NameLocal""],1000];" \n "" \n - "Dayz_logonTown = ""Wilderness"";" \n + "Dayz_logonTown = ""Wilderness"";" \n "if (count _nearestCity > 0) then {Dayz_logonTown = text (_nearestCity select 0)};" \n "" \n - "[_world,Dayz_logonTown,format[localize ""str_player_06"",dayz_Survived]] spawn {uiSleep 5; _this spawn BIS_fnc_infoText;};" \n + "[_world,Dayz_logonTown,format[localize ""str_player_06"",dayz_Survived]] spawn {uiSleep 5; _this spawn BIS_fnc_infoText;};" \n "" \n - "dayz_myPosition = getPosATL player;" \n + "dayz_myPosition = getPosATL player;" \n "Dayz_loginCompleted = true;" \n "" \n "//Other Counters" \n diff --git a/SQF/dayz_code/system/player_spawn_2.sqf b/SQF/dayz_code/system/player_spawn_2.sqf index 475bc3413..26cbca185 100644 --- a/SQF/dayz_code/system/player_spawn_2.sqf +++ b/SQF/dayz_code/system/player_spawn_2.sqf @@ -361,6 +361,7 @@ while {1 == 1} do { _startcombattimer = player getVariable["startcombattimer", 0]; if (_startcombattimer == 1) then { //if (_startcombattimer == 1 || _PlayerNearby) then { // do not use _PlayerNearby it makes building impossible, tthis is handled in player_onPause.sqf just fine player setVariable["combattimeout", diag_tickTime + 30, false]; + player setVariable["inCombat", 1, true]; player setVariable["startcombattimer", 0, false]; }; /* else { if (_ZedsNearby && !_isPZombie) then { //this makes building a nightmare, this is handled in player_onPause.sqf just fine diff --git a/SQF/dayz_code/system/scheduler/sched_playerActions.sqf b/SQF/dayz_code/system/scheduler/sched_playerActions.sqf index 9f0109dbd..25721e7cb 100644 --- a/SQF/dayz_code/system/scheduler/sched_playerActions.sqf +++ b/SQF/dayz_code/system/scheduler/sched_playerActions.sqf @@ -5,6 +5,11 @@ sched_playerActions = { call fnc_usec_selfActions; call fnc_usec_damageActions; call fnc_usec_upgradeActions; - + + //combat check + if ((player getVariable ["combattimeout",0] < diag_tickTime) && {player getVariable ["inCombat", 0] > 0}) then { + player setVariable ["inCombat", 0, true]; + }; + objNull }; diff --git a/SQF/dayz_server/compile/server_onPlayerDisconnect.sqf b/SQF/dayz_server/compile/server_onPlayerDisconnect.sqf index 2269a2c52..56222dc19 100644 --- a/SQF/dayz_server/compile/server_onPlayerDisconnect.sqf +++ b/SQF/dayz_server/compile/server_onPlayerDisconnect.sqf @@ -25,6 +25,7 @@ _characterID = _playerObj getVariable["characterID", "?"]; _lastDamage = _playerObj getVariable["noatlf4",0]; _Sepsis = _playerObj getVariable["USEC_Sepsis",false]; _lastDamage = round(diag_ticktime - _lastDamage); +_inCombat = _playerObj getVariable ["inCombat", 0]; //Readded Logout debug info. diag_log format["INFO - Player: %3(UID:%1/CID:%2) as (%4), logged off at %5%6", @@ -64,12 +65,12 @@ if (_characterID != "?") exitwith { }; //Punish combat log - if ((_lastDamage > 5 && {_lastDamage < 30}) && {alive _playerObj && (_playerObj distance (getMarkerpos "respawn_west") >= 2000)}) then { + if ((_inCombat > 0) && {alive _playerObj && (_playerObj distance (getMarkerpos "respawn_west") >= 2000)}) then { _playerObj setVariable ["NORRN_unconscious",true,true]; // Set status to unconscious _playerObj setVariable ["unconsciousTime",150,true]; // Set knock out timer to 150 seconds //_playerObj setVariable ["USEC_injured",true]; // Set status to bleeding //_playerObj setVariable ["USEC_BloodQty",3000]; // Set blood to 3000 - diag_log format["PLAYER COMBAT LOGGED: %1(%4) (with %2s combat time remaining) at location %3",_playerName,_lastDamage,_playerPos,_playerUID]; + diag_log format["PLAYER COMBAT LOGGED: %1(%3) at location %2",_playerName,_playerPos,_playerUID]; _message = format["PLAYER COMBAT LOGGED: %1",_playerName]; [nil, nil, rTitleText, _message, "PLAIN"] call RE; // Message whole server };