Skip to content

Commit

Permalink
Removal of unnecessary function + optimised clientDisconnect EVH (#478)
Browse files Browse the repository at this point in the history
* Full removal of unnecessary function + optimised clientDisconnect EVH + related file

* Tab > space

* Removal of HC related code and comments

* Bane of my life
  • Loading branch information
DomT602 committed Sep 9, 2018
1 parent 2a90869 commit c024da2
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 83 deletions.
1 change: 0 additions & 1 deletion Altis_Life.Altis/CfgRemoteExec.hpp
Expand Up @@ -102,7 +102,6 @@ class CfgRemoteExec {
F(TON_fnc_removeGang,SERVER)
F(TON_fnc_sellHouse,SERVER)
F(TON_fnc_sellHouseContainer,SERVER)
F(TON_fnc_setObjVar,SERVER)
F(TON_fnc_spawnVehicle,SERVER)
F(TON_fnc_spikeStrip,SERVER)
F(TON_fnc_updateGang,SERVER)
Expand Down
2 changes: 1 addition & 1 deletion Altis_Life.Altis/config/Config_SpyGlass.hpp
Expand Up @@ -279,7 +279,7 @@ class SpyGlass {
"db_fnc_asynccall","db_fnc_bool","db_fnc_insertrequest","db_fnc_insertvehicle","db_fnc_mresarray","db_fnc_mresstring","db_fnc_mrestoarray","db_fnc_numbersafe","db_fnc_queryrequest","db_fnc_updatepartial","db_fnc_updaterequest","ton_fnc_addhouse","ton_fnc_addhouse_meta","ton_fnc_cell_adminmsg","ton_fnc_cell_adminmsgall","ton_fnc_cell_emsrequest","ton_fnc_cell_textadmin","ton_fnc_cell_textcop",
"ton_fnc_cell_textmsg","ton_fnc_chopshopsell","ton_fnc_chopshopsell_meta","ton_fnc_cleanup","ton_fnc_cleanup_meta","ton_fnc_cleanuprequest","ton_fnc_cleanuprequest_meta","ton_fnc_clientdisconnect","ton_fnc_clientdisconnect_meta","ton_fnc_clientgangkick","ton_fnc_clientgangleader","ton_fnc_clientgangleft","TON_fnc_clientGangLeft","ton_fnc_clientgetkey","ton_fnc_clientmessage","ton_fnc_federalupdate",
"ton_fnc_federalupdate_meta","ton_fnc_fetchplayerhouses","ton_fnc_fetchplayerhouses_meta","ton_fnc_getid","ton_fnc_getid_meta","ton_fnc_getvehicles","ton_fnc_getvehicles_meta","ton_fnc_housecleanup","ton_fnc_housecleanup_meta","ton_fnc_huntingzone","ton_fnc_huntingzone_meta","ton_fnc_index","ton_fnc_inithouses","ton_fnc_inithouses_meta","ton_fnc_insertgang","ton_fnc_insertgang_meta","ton_fnc_isnumber",
"ton_fnc_keymanagement","ton_fnc_keymanagement_meta","ton_fnc_managesc","ton_fnc_managesc_meta","ton_fnc_pickupaction","ton_fnc_pickupaction_meta","ton_fnc_player_query","ton_fnc_queryplayergang","ton_fnc_queryplayergang_meta","ton_fnc_removegang","ton_fnc_removegang_meta","ton_fnc_sellhouse","ton_fnc_sellhouse_meta","ton_fnc_setobjvar","ton_fnc_setobjvar_meta","ton_fnc_spawnvehicle",
"ton_fnc_keymanagement","ton_fnc_keymanagement_meta","ton_fnc_managesc","ton_fnc_managesc_meta","ton_fnc_pickupaction","ton_fnc_pickupaction_meta","ton_fnc_player_query","ton_fnc_queryplayergang","ton_fnc_queryplayergang_meta","ton_fnc_removegang","ton_fnc_removegang_meta","ton_fnc_sellhouse","ton_fnc_sellhouse_meta","ton_fnc_spawnvehicle",
"ton_fnc_spawnvehicle_meta","ton_fnc_spikestrip","ton_fnc_spikestrip_meta","ton_fnc_terrainsort","ton_fnc_terrainsort_meta","ton_fnc_updategang","ton_fnc_updategang_meta","ton_fnc_updatehousecontainers","ton_fnc_updatehousecontainers_meta","ton_fnc_updatehousetrunk","ton_fnc_updatehousetrunk_meta","ton_fnc_vehiclecreate","ton_fnc_vehiclecreate_meta","ton_fnc_vehicledead","ton_fnc_vehicledead_meta",
"ton_fnc_vehicledelete","ton_fnc_vehicledelete_meta","ton_fnc_vehiclestore","ton_fnc_vehiclestore_meta"
};
Expand Down
5 changes: 3 additions & 2 deletions Altis_Life.Altis/core/shops/fn_vehicleShopBuy.sqf
Expand Up @@ -106,8 +106,9 @@ _vehicle lock 2;

[_vehicle,_colorIndex] call life_fnc_colorVehicle;
[_vehicle] call life_fnc_clearVehicleAmmo;
[_vehicle,"trunk_in_use",false,true] remoteExecCall ["TON_fnc_setObjVar",RSERV];
[_vehicle,"vehicle_info_owners",[[getPlayerUID player,profileName]],true] remoteExecCall ["TON_fnc_setObjVar",RSERV];

_vehicle setVariable ["trunk_in_use",false,true];
_vehicle setVariable ["vehicle_info_owners",[getPlayerUID player,profileName],true];

This comment has been minimized.

Copy link
@Logfro

Logfro Sep 22, 2018

Contributor

[getPlayerUID player,profileName] should be [[getPlayerUID player,profileName]]
Because otherwise it can not store any vehicles which are newly bought


_vehicle disableTIEquipment true; //No Thermals.. They're cheap but addictive.

Expand Down
27 changes: 10 additions & 17 deletions Altis_Life.Altis/core/vehicle/fn_colorVehicle.sqf
Expand Up @@ -6,37 +6,30 @@
Description:
Reskins the vehicle.
*/
private ["_textures","_className","_classNameLife"];
params [
["_vehicle",objNull,[objNull]],
["_index",-1,[0]]
];

_className = typeOf _vehicle;
_classNameLife = _className;
private _className = typeOf _vehicle;

if (isNull _vehicle || !alive _vehicle || _index isEqualTo -1) exitWith {};
if (isNull _vehicle || {!alive _vehicle} || {_index isEqualTo -1}) exitWith {};
//Does the vehicle already have random styles? Halt till it's set.

if (local _vehicle) then {
switch _className do {
case "C_Offroad_01_F": {[_vehicle,"color",3,true] remoteExecCall ["TON_fnc_setObjVar",RSERV];};
case "C_Hatchback_01_F": {[_vehicle,"color",1,true] remoteExecCall ["TON_fnc_setObjVar",RSERV];};
case "C_Hatchback_01_sport_F": {[_vehicle,"color",1,true] remoteExecCall ["TON_fnc_setObjVar",RSERV];};
case "C_SUV_01_F": {[_vehicle,"color",1,true] remoteExecCall ["TON_fnc_setObjVar",RSERV];};
case "C_Van_01_box_F": {[_vehicle,"color",1,true] remoteExecCall ["TON_fnc_setObjVar",RSERV];};
case "C_Van_01_transport_F": {[_vehicle,"color",1,true] remoteExecCall ["TON_fnc_setObjVar",RSERV];};
};
private _colorIndex = 1;
if (_className isEqualTo "C_Offroad_01_F") then {_colorIndex = 3};
_vehicle setVariable ["color",_colorIndex,true];
};

if (!isClass (missionConfigFile >> "LifeCfgVehicles" >> _classNameLife)) then {
_classNameLife = "Default"; //Use Default class if it doesn't exist
if (!isClass (missionConfigFile >> "LifeCfgVehicles" >> _className)) then {
diag_log format ["%1: LifeCfgVehicles class doesn't exist",_className];
_className = "Default"; //Use Default class if it doesn't exist
};

_textures = ((M_CONFIG(getArray,"LifeCfgVehicles",_classNameLife,"textures") select _index) select 2);
if (isNil "_textures" || {count _textures isEqualTo 0}) exitWith {};
private _textures = ((M_CONFIG(getArray,"LifeCfgVehicles",_className,"textures") select _index) param [2,[]]);
if (_textures isEqualTo []) exitWith {};

_vehicle setVariable ["Life_VEH_color",_index,true];

{_vehicle setObjectTextureGlobal [_forEachIndex,_x];} forEach _textures;
{_vehicle setObjectTextureGlobal [_forEachIndex,_x]} forEach _textures;
2 changes: 1 addition & 1 deletion BEFilters/remoteexec.txt
@@ -1,3 +1,3 @@
//regex
1 "" !="_this call fn_whoDoneIt"
5 "" !BIS_fnc_(effectKilled(AirDestruction|Secondaries)|execVM) !DB_fnc_(insertRequest|queryRequest|updatePartial|updateRequest) !HC_fnc_(addContainer|addHouse|chopShopSell|deleteDBContainer|getVehicles|insertGang|insertRequest|jailSys|queryRequest|receivekeyofServer) !HC_fnc_(removeGang|sellHouse(Container)?|spawnVehicle|spikeStrip) !HC_fnc_update(Gang|HouseContainers|HouseTrunk|Partial|Request) !HC_fnc_vehicle(Create|Delete|Store|Update) !HC_fnc_wanted(Add|Bounty|Crimes|Fetch|ProfUpdate|Remove) !life_fnc_(AAN|addVehicle2Chain|adminid|admininfo|animSync|bountyReceive|broadcast|colorVehicle|copLights) !life_fnc_(copSearch|CopSiren|corpse|demoChargeTimer|flashbang|freezePlayer|gangCreated|gangDisbanded|gangInvite) !life_fnc_(garageRefund|giveDiff|hideObj|impoundMenu|jail(Me|Sys)?) !life_fnc_(jumpFnc|knockedOut|licenseCheck|licensesRead|lightHouse|lockVehicle|medic(Lights|Request|Siren)) !life_fnc_(moveIn|pickupItem|pickupMoney|pulloutVeh|receiveItem|receiveMoney|removeLicenses|restrain|revived) !life_fnc_(robPerson|robReceive|say3D|searchClient|seizeClient|setFuel|simDisable|soundDevice|spikeStripEffect) !life_fnc_(tazeSound|ticketPaid|ticketPrompt|vehicleAnimate) !life_fnc_wanted(Add|Bounty|Crimes|Fetch|Info|List|ProfUpdate|Remove) !life_fnc_wireTransfer !SOCK_fnc_(dataQuery|insertPlayerInfo|updateRequest) !SPY_fnc_(cookieJar|notifyAdmins|observe) !TON_fnc_(addContainer|addHouse|chopShopSell|cleanupRequest|handleBlastingCharge) !TON_fnc_clientGang(Kick|Leader|Left) !TON_fnc_(clientGetKey|clientMessage) !TON_fnc_(deleteDBContainer|getID|getVehicles|insertGang|keyManagement|managesc|pickupAction|player_query|recupkeyforHC) !TON_fnc_(removeGang|sellHouse(Container)?|setObjVar|spawnVehicle|spikeStrip) !TON_fnc_update(Gang|HouseContainers|HouseTrunk) !TON_fnc_vehicle(Create|Delete|Store|Update) !="_this call fn_whoDoneIt"
5 "" !BIS_fnc_(effectKilled(AirDestruction|Secondaries)|execVM) !DB_fnc_(insertRequest|queryRequest|updatePartial|updateRequest) !HC_fnc_(addContainer|addHouse|chopShopSell|deleteDBContainer|getVehicles|insertGang|insertRequest|jailSys|queryRequest|receivekeyofServer) !HC_fnc_(removeGang|sellHouse(Container)?|spawnVehicle|spikeStrip) !HC_fnc_update(Gang|HouseContainers|HouseTrunk|Partial|Request) !HC_fnc_vehicle(Create|Delete|Store|Update) !HC_fnc_wanted(Add|Bounty|Crimes|Fetch|ProfUpdate|Remove) !life_fnc_(AAN|addVehicle2Chain|adminid|admininfo|animSync|bountyReceive|broadcast|colorVehicle|copLights) !life_fnc_(copSearch|CopSiren|corpse|demoChargeTimer|flashbang|freezePlayer|gangCreated|gangDisbanded|gangInvite) !life_fnc_(garageRefund|giveDiff|hideObj|impoundMenu|jail(Me|Sys)?) !life_fnc_(jumpFnc|knockedOut|licenseCheck|licensesRead|lightHouse|lockVehicle|medic(Lights|Request|Siren)) !life_fnc_(moveIn|pickupItem|pickupMoney|pulloutVeh|receiveItem|receiveMoney|removeLicenses|restrain|revived) !life_fnc_(robPerson|robReceive|say3D|searchClient|seizeClient|setFuel|simDisable|soundDevice|spikeStripEffect) !life_fnc_(tazeSound|ticketPaid|ticketPrompt|vehicleAnimate) !life_fnc_wanted(Add|Bounty|Crimes|Fetch|Info|List|ProfUpdate|Remove) !life_fnc_wireTransfer !SOCK_fnc_(dataQuery|insertPlayerInfo|updateRequest) !SPY_fnc_(cookieJar|notifyAdmins|observe) !TON_fnc_(addContainer|addHouse|chopShopSell|cleanupRequest|handleBlastingCharge) !TON_fnc_clientGang(Kick|Leader|Left) !TON_fnc_(clientGetKey|clientMessage) !TON_fnc_(deleteDBContainer|getID|getVehicles|insertGang|keyManagement|managesc|pickupAction|player_query|recupkeyforHC) !TON_fnc_(removeGang|sellHouse(Container)?|spawnVehicle|spikeStrip) !TON_fnc_update(Gang|HouseContainers|HouseTrunk) !TON_fnc_vehicle(Create|Delete|Store|Update) !="_this call fn_whoDoneIt"
22 changes: 0 additions & 22 deletions life_hc/MySQL/Housing/fn_houseCleanup.sqf

This file was deleted.

1 change: 0 additions & 1 deletion life_hc/config.cpp
Expand Up @@ -53,7 +53,6 @@ class CfgFunctions
class addHouse {};
class deleteDBContainer {};
class fetchPlayerHouses {};
class houseCleanup {};
class sellHouse {};
class sellHouseContainer {};
class updateHouseContainers {};
Expand Down
16 changes: 8 additions & 8 deletions life_server/Functions/Housing/fn_houseCleanup.sqf
Expand Up @@ -5,16 +5,16 @@
Description:
Cleans up containers inside in house of player.
*/
private ["_query","_containers"];
_query = format ["SELECT pid, pos FROM containers WHERE pid='%1' AND owned='1'",_this];
params [
["_uid","",[""]]
];

_containers = [_query,2,true] call DB_fnc_asyncCall;
private _query = format ["SELECT pos FROM containers WHERE pid='%1' AND owned='1'",_uid];
private _containers = [_query,2,true] call DB_fnc_asyncCall;

if (count _containers isEqualTo 0) exitWith {};
{
_pos = call compile format ["%1",_x select 1];
_container = nearestObjects[_pos,["Box_IND_Grenades_F","B_supplyCrate_F"],12];
_x params ["_pos"];
{
deleteVehicle _x;
} forEach _container;
} forEach _containers;
} forEach (nearestObjects[_pos,["Box_IND_Grenades_F","B_supplyCrate_F"],12]);
} forEach _containers;
26 changes: 13 additions & 13 deletions life_server/Functions/Systems/fn_clientDisconnect.sqf
Expand Up @@ -7,29 +7,29 @@
When a client disconnects this will remove their corpse and
clean up their storage boxes in their house. Also, saves player infos & position.
*/
private ["_unit","_id","_uid","_name","_alive","_position","_side"];
_unit = _this select 0;
params [
["_unit",objNull,[objNull]],
"",
["_uid","",[""]]
];
if (isNull _unit) exitWith {};
_id = _this select 1;
_uid = _this select 2;
_name = _this select 3;
_side = side _unit;

private _side = side _unit;

//Save player info
if (isNil "HC_UID" || {!(_uid isEqualTo HC_UID)}) then {
_position = getPosATL _unit;
private _position = getPosATL _unit;
if ((getMarkerPos "respawn_civilian" distance _position) > 300) then {

//Civilian position
if (life_save_civilian_position && _side isEqualTo civilian) then {
_alive = alive _unit;
if (life_HC_isActive) then {[_uid,_side,_alive,4,_position] remoteExec ["HC_fnc_updatePartial",HC_Life];} else {[_uid,_side,_alive,4,_position] spawn DB_fnc_updatePartial;};
private _alive = alive _unit;
if (life_HC_isActive) then {[_uid,_side,_alive,4,_position] remoteExec ["HC_fnc_updatePartial",HC_Life]} else {[_uid,_side,_alive,4,_position] spawn DB_fnc_updatePartial};
};
};
};

_containers = nearestObjects[_unit,["WeaponHolderSimulated"],5];
{deleteVehicle _x;} forEach _containers;
private _containers = nearestObjects[_unit,["WeaponHolderSimulated"],5];
{deleteVehicle _x} forEach _containers;
deleteVehicle _unit;

_uid spawn TON_fnc_houseCleanup;
[_uid] spawn TON_fnc_houseCleanup;
16 changes: 0 additions & 16 deletions life_server/Functions/Systems/fn_setObjVar.sqf

This file was deleted.

1 change: 0 additions & 1 deletion life_server/config.cpp
Expand Up @@ -71,7 +71,6 @@ class CfgFunctions {
class chopShopSell {};
class clientDisconnect {};
class cleanupRequest {};
class setObjVar {};
class keyManagement {};
class vehicleUpdate {};
class recupkeyforHC {};
Expand Down

0 comments on commit c024da2

Please sign in to comment.