From 212a44de75ea339a877fe0eae6adf3acd9861413 Mon Sep 17 00:00:00 2001 From: Dom Date: Thu, 30 Apr 2020 10:00:19 +0100 Subject: [PATCH 1/2] Container bugfix --- .../Functions/Housing/fn_houseCleanup.sqf | 47 +++++---- .../Functions/Systems/fn_clientDisconnect.sqf | 98 +++++++++---------- 2 files changed, 75 insertions(+), 70 deletions(-) diff --git a/life_server/Functions/Housing/fn_houseCleanup.sqf b/life_server/Functions/Housing/fn_houseCleanup.sqf index fc835445d..77d4f5af7 100644 --- a/life_server/Functions/Housing/fn_houseCleanup.sqf +++ b/life_server/Functions/Housing/fn_houseCleanup.sqf @@ -1,21 +1,26 @@ -/* - File: fn_houseCleanup.sqf - Author: NiiRoZz - - Description: - Cleans up containers inside in house of player. -*/ -params [ - ["_uid","",[""]] -]; - -private _query = format ["SELECT pos FROM containers WHERE pid='%1' AND owned='1'",_uid]; -private _containers = [_query,2,true] call DB_fnc_asyncCall; - -{ - _x params ["_pos"]; - _pos = parseSimpleArray _pos; - { - deleteVehicle _x; - } forEach (nearestObjects[_pos,["Box_IND_Grenades_F","B_supplyCrate_F"],12]); -} forEach _containers; \ No newline at end of file +/* + File: fn_houseCleanup.sqf + Author: NiiRoZz + + Description: + Cleans up containers inside in house of player. +*/ +params [ + ["_uid","",[""]] +]; + +private _query = format ["SELECT pos FROM containers WHERE pid='%1' AND owned='1'",_uid]; +private _containers = [_query,2,true] call DB_fnc_asyncCall; + +{ + _x params ["_pos"]; + _pos = parseSimpleArray _pos; + { + deleteVehicle _x; + } forEach (nearestObjects[_pos,["Box_IND_Grenades_F","B_supplyCrate_F"],12]); + + private _house = nearestObject [_pos, "House"]; + if !(_house getVariable ["containers",[]] isEqualTo []) then { + _house setVariable ["containers",nil,true]; + }; +} forEach _containers; diff --git a/life_server/Functions/Systems/fn_clientDisconnect.sqf b/life_server/Functions/Systems/fn_clientDisconnect.sqf index f8edf4c17..c17d41657 100644 --- a/life_server/Functions/Systems/fn_clientDisconnect.sqf +++ b/life_server/Functions/Systems/fn_clientDisconnect.sqf @@ -1,49 +1,49 @@ -#include "\life_server\script_macros.hpp" -/* - File: fn_clientDisconnect.sqf - Author: Bryan "Tonic" Boardwine - - Description: - When a client disconnects this will remove their corpse and - clean up their storage boxes in their house. Also, saves player infos & position. -*/ -params [ - ["_unit",objNull,[objNull]], - "", - ["_uid","",[""]] -]; -if (isNull _unit) exitWith {}; - -//Save civilian position -if (life_save_civilian_position && {side _unit isEqualTo civilian}) then { - if (isNil "HC_UID" || {!(_uid isEqualTo HC_UID)}) then { - private _position = getPosATL _unit; - if ((getMarkerPos "respawn_civilian" distance _position) > 300) then { - private _alive = alive _unit; - if (life_HC_isActive) then {[_uid,civilian,_alive,4,_position] remoteExec ["HC_fnc_updatePartial",HC_Life]} else {[_uid,civilian,_alive,4,_position] spawn DB_fnc_updatePartial}; - }; - }; -}; - -if !(alive _unit) then { - diag_log format["%1 disconnected while dead.",_uid]; -} else { - { - _x params [ - ["_corpseUID","",[""]], - ["_corpse",objNull,[objNull]] - ]; - if (_corpseUID isEqualTo _uid) exitWith { - if (isNull _corpse) exitWith {server_corpses deleteAt _forEachIndex}; - [_corpse] remoteExecCall ["life_fnc_corpse",0]; - diag_log format["%1 disconnected while dead.",_corpseUID]; - server_corpses deleteAt _forEachIndex; - }; - } forEach server_corpses; -}; - -private _containers = nearestObjects[_unit,["WeaponHolderSimulated"],5]; -{deleteVehicle _x} forEach _containers; -deleteVehicle _unit; - -[_uid] spawn TON_fnc_houseCleanup; +#include "\life_server\script_macros.hpp" +/* + File: fn_clientDisconnect.sqf + Author: Bryan "Tonic" Boardwine + + Description: + When a client disconnects this will remove their corpse and + clean up their storage boxes in their house. Also, saves player infos & position. +*/ +params [ + ["_unit",objNull,[objNull]], + "", + ["_uid","",[""]] +]; +if (isNull _unit) exitWith {}; + +//Save civilian position +if (life_save_civilian_position && {side _unit isEqualTo civilian}) then { + if (isNil "HC_UID" || {!(_uid isEqualTo HC_UID)}) then { + private _position = getPosATL _unit; + if ((getMarkerPos "respawn_civilian" distance _position) > 300) then { + private _alive = alive _unit; + if (life_HC_isActive) then {[_uid,civilian,_alive,4,_position] remoteExec ["HC_fnc_updatePartial",HC_Life]} else {[_uid,civilian,_alive,4,_position] spawn DB_fnc_updatePartial}; + }; + }; +}; + +if !(alive _unit) then { + diag_log format["%1 disconnected while dead.",_uid]; +} else { + { + _x params [ + ["_corpseUID","",[""]], + ["_corpse",objNull,[objNull]] + ]; + if (_corpseUID isEqualTo _uid) exitWith { + if (isNull _corpse) exitWith {server_corpses deleteAt _forEachIndex}; + [_corpse] remoteExecCall ["life_fnc_corpse",0]; + diag_log format["%1 disconnected while dead.",_corpseUID]; + server_corpses deleteAt _forEachIndex; + }; + } forEach server_corpses; +}; + +private _containers = nearestObjects[_unit,["WeaponHolderSimulated"],5]; +{deleteVehicle _x} forEach _containers; +deleteVehicle _unit; + +[_uid] call TON_fnc_houseCleanup; From f19c581f2be62e0a077426f90162904f8ff567ca Mon Sep 17 00:00:00 2001 From: Dom Date: Thu, 30 Apr 2020 17:51:35 +0100 Subject: [PATCH 2/2] crlf > lf --- .editorconfig | 52 +++++----- .../Functions/Housing/fn_houseCleanup.sqf | 52 +++++----- .../Functions/Systems/fn_clientDisconnect.sqf | 98 +++++++++---------- 3 files changed, 101 insertions(+), 101 deletions(-) diff --git a/.editorconfig b/.editorconfig index 625461baa..9b6d800e5 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,26 +1,26 @@ -# editorconfig.org -# Some editors do not have native support for EditorConfig and require a plugin. -# For a list of those editors and a plugin for them, see http://editorconfig.org/#download - -# Top-most EditorConfig file -root = true - -# Every file -[*] -# Soft tabs -indent_style = space -# 1 indent is 4 spaces -indent_size = 4 -# Windows-style newlines -end_of_line = crlf -# Set default character encoding -charset = utf-8 -# Remove any whitespace characters preceding newline characters -trim_trailing_whitespace = true -# A newline ending every file -insert_final_newline = true - -# Markdown files -[*.md] -# Do not remove any whitespace characters preceding newline characters -trim_trailing_whitespace = false +# editorconfig.org +# Some editors do not have native support for EditorConfig and require a plugin. +# For a list of those editors and a plugin for them, see http://editorconfig.org/#download + +# Top-most EditorConfig file +root = true + +# Every file +[*] +# Soft tabs +indent_style = space +# 1 indent is 4 spaces +indent_size = 4 +# Windows-style newlines +end_of_line = lf +# Set default character encoding +charset = utf-8 +# Remove any whitespace characters preceding newline characters +trim_trailing_whitespace = true +# A newline ending every file +insert_final_newline = true + +# Markdown files +[*.md] +# Do not remove any whitespace characters preceding newline characters +trim_trailing_whitespace = false diff --git a/life_server/Functions/Housing/fn_houseCleanup.sqf b/life_server/Functions/Housing/fn_houseCleanup.sqf index 77d4f5af7..4fd3731a6 100644 --- a/life_server/Functions/Housing/fn_houseCleanup.sqf +++ b/life_server/Functions/Housing/fn_houseCleanup.sqf @@ -1,26 +1,26 @@ -/* - File: fn_houseCleanup.sqf - Author: NiiRoZz - - Description: - Cleans up containers inside in house of player. -*/ -params [ - ["_uid","",[""]] -]; - -private _query = format ["SELECT pos FROM containers WHERE pid='%1' AND owned='1'",_uid]; -private _containers = [_query,2,true] call DB_fnc_asyncCall; - -{ - _x params ["_pos"]; - _pos = parseSimpleArray _pos; - { - deleteVehicle _x; - } forEach (nearestObjects[_pos,["Box_IND_Grenades_F","B_supplyCrate_F"],12]); - - private _house = nearestObject [_pos, "House"]; - if !(_house getVariable ["containers",[]] isEqualTo []) then { - _house setVariable ["containers",nil,true]; - }; -} forEach _containers; +/* + File: fn_houseCleanup.sqf + Author: NiiRoZz + + Description: + Cleans up containers inside in house of player. +*/ +params [ + ["_uid","",[""]] +]; + +private _query = format ["SELECT pos FROM containers WHERE pid='%1' AND owned='1'",_uid]; +private _containers = [_query,2,true] call DB_fnc_asyncCall; + +{ + _x params ["_pos"]; + _pos = parseSimpleArray _pos; + { + deleteVehicle _x; + } forEach (nearestObjects[_pos,["Box_IND_Grenades_F","B_supplyCrate_F"],12]); + + private _house = nearestObject [_pos, "House"]; + if !(_house getVariable ["containers",[]] isEqualTo []) then { + _house setVariable ["containers",nil,true]; + }; +} forEach _containers; diff --git a/life_server/Functions/Systems/fn_clientDisconnect.sqf b/life_server/Functions/Systems/fn_clientDisconnect.sqf index c17d41657..e7b0db332 100644 --- a/life_server/Functions/Systems/fn_clientDisconnect.sqf +++ b/life_server/Functions/Systems/fn_clientDisconnect.sqf @@ -1,49 +1,49 @@ -#include "\life_server\script_macros.hpp" -/* - File: fn_clientDisconnect.sqf - Author: Bryan "Tonic" Boardwine - - Description: - When a client disconnects this will remove their corpse and - clean up their storage boxes in their house. Also, saves player infos & position. -*/ -params [ - ["_unit",objNull,[objNull]], - "", - ["_uid","",[""]] -]; -if (isNull _unit) exitWith {}; - -//Save civilian position -if (life_save_civilian_position && {side _unit isEqualTo civilian}) then { - if (isNil "HC_UID" || {!(_uid isEqualTo HC_UID)}) then { - private _position = getPosATL _unit; - if ((getMarkerPos "respawn_civilian" distance _position) > 300) then { - private _alive = alive _unit; - if (life_HC_isActive) then {[_uid,civilian,_alive,4,_position] remoteExec ["HC_fnc_updatePartial",HC_Life]} else {[_uid,civilian,_alive,4,_position] spawn DB_fnc_updatePartial}; - }; - }; -}; - -if !(alive _unit) then { - diag_log format["%1 disconnected while dead.",_uid]; -} else { - { - _x params [ - ["_corpseUID","",[""]], - ["_corpse",objNull,[objNull]] - ]; - if (_corpseUID isEqualTo _uid) exitWith { - if (isNull _corpse) exitWith {server_corpses deleteAt _forEachIndex}; - [_corpse] remoteExecCall ["life_fnc_corpse",0]; - diag_log format["%1 disconnected while dead.",_corpseUID]; - server_corpses deleteAt _forEachIndex; - }; - } forEach server_corpses; -}; - -private _containers = nearestObjects[_unit,["WeaponHolderSimulated"],5]; -{deleteVehicle _x} forEach _containers; -deleteVehicle _unit; - -[_uid] call TON_fnc_houseCleanup; +#include "\life_server\script_macros.hpp" +/* + File: fn_clientDisconnect.sqf + Author: Bryan "Tonic" Boardwine + + Description: + When a client disconnects this will remove their corpse and + clean up their storage boxes in their house. Also, saves player infos & position. +*/ +params [ + ["_unit",objNull,[objNull]], + "", + ["_uid","",[""]] +]; +if (isNull _unit) exitWith {}; + +//Save civilian position +if (life_save_civilian_position && {side _unit isEqualTo civilian}) then { + if (isNil "HC_UID" || {!(_uid isEqualTo HC_UID)}) then { + private _position = getPosATL _unit; + if ((getMarkerPos "respawn_civilian" distance _position) > 300) then { + private _alive = alive _unit; + if (life_HC_isActive) then {[_uid,civilian,_alive,4,_position] remoteExec ["HC_fnc_updatePartial",HC_Life]} else {[_uid,civilian,_alive,4,_position] spawn DB_fnc_updatePartial}; + }; + }; +}; + +if !(alive _unit) then { + diag_log format["%1 disconnected while dead.",_uid]; +} else { + { + _x params [ + ["_corpseUID","",[""]], + ["_corpse",objNull,[objNull]] + ]; + if (_corpseUID isEqualTo _uid) exitWith { + if (isNull _corpse) exitWith {server_corpses deleteAt _forEachIndex}; + [_corpse] remoteExecCall ["life_fnc_corpse",0]; + diag_log format["%1 disconnected while dead.",_corpseUID]; + server_corpses deleteAt _forEachIndex; + }; + } forEach server_corpses; +}; + +private _containers = nearestObjects[_unit,["WeaponHolderSimulated"],5]; +{deleteVehicle _x} forEach _containers; +deleteVehicle _unit; + +[_uid] call TON_fnc_houseCleanup;