Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Major Cleanup rework #611

Merged
merged 14 commits into from
Feb 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions Altis_Life.Altis/config/Config_Master.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ class Life_Settings {
player_moneyLog = false; //False [default] - No money logging. True - Logs player bank deposits, withdraws, and transfers, gang bank deposits and withdraws, money picked up off of the ground, and player robbery. Search for: money_log
player_deathLog = false; //False [default] - No death logging. True - Logs victim and killer, and vehicle or weapon if used, when a player dies. Search for: death_log

/* Performance Settings */
/* Vehicle Wrecks */
dead_vehicles_despawn_delay = 30; //delay in seconds before despawning dead vehicles
dead_vehicles_max_units_distance = 300; //maximum distance between wreck and nearest player before despawning (vehicle despawns anyway after specified delay!)

/* Cleanup */
vehicles_despawn_max_distance = 1000; //maximum distance between a vehicle and the nearest player, before server puts it back to garage

/* Database Related Settings */
/* Player Data Saving */
save_virtualItems = true; //Save Virtual items (all sides)?
Expand Down Expand Up @@ -77,7 +85,7 @@ class Life_Settings {
gang_price = 75000; //Gang creation price. --Remember they are persistent so keep it reasonable to avoid millions of gangs.
gang_upgradeBase = 10000; //The base cost for purchasing additional slots in a gang
gang_upgradeMultiplier = 2.5; //CURRENTLY NOT IN USE
gang_area[] = {"gang_area_1","gang_area_2","gang_area_3"}; //Variable of gang zone markers
gang_area[] = {"gang_area_1","gang_area_2","gang_area_3"}; //Variable of gang zone markers

/* Housing System Configurations */
house_limit = 5; //Maximum number of houses a player can own.
Expand Down Expand Up @@ -212,11 +220,11 @@ class Life_Settings {
{"STR_Crime_24","10000","24"},
{"STR_Crime_25","20000","25"}
};

/* ! --- Do not change --- ! */
framework_version = "6.0.0";
/* ------------------------- */

};

#include "Config_Clothing.hpp"
Expand All @@ -229,4 +237,4 @@ class Life_Settings {
#include "Config_Process.hpp"
#include "Config_Housing.hpp"
#include "Config_Garages.hpp"
#include "Config_Loadouts.hpp"
#include "Config_Loadouts.hpp"
5 changes: 4 additions & 1 deletion Altis_Life.Altis/core/gangs/fn_gangDisbanded.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ if (isNull _group) exitWith {}; //Fail horn please.
if (!isNull (findDisplay 2620)) then {closeDialog 2620};

hint localize "STR_GNOTF_DisbandWarn_2";
[player] joinSilent (createGroup civilian);

private _newGroup = createGroup civilian;
[player] joinSilent _newGroup;
_newGroup deleteGroupWhenEmpty true;
1 change: 1 addition & 0 deletions Altis_Life.Altis/core/gangs/fn_initGang.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ if (!isNil "_group") then {
};
} else {
_group = group player;
_group deleteGroupWhenEmpty true;
_group setVariable ["gang_id",(life_gangData select 0),true];
_group setVariable ["gang_owner",(life_gangData select 1),true];
_group setVariable ["gang_name",(life_gangData select 2),true];
Expand Down
1 change: 1 addition & 0 deletions Altis_Life.Altis/core/init.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ switch (playerSide) do {
case civilian: {
life_paycheck = LIFE_SETTINGS(getNumber,"paycheck_civ");
[] call life_fnc_initCiv;
(group player) deleteGroupWhenEmpty true;
};
case independent: {
life_paycheck = LIFE_SETTINGS(getNumber,"paycheck_med");
Expand Down
145 changes: 0 additions & 145 deletions life_hc/FSM/cleanup.fsm

This file was deleted.

66 changes: 24 additions & 42 deletions life_hc/MySQL/General/fn_cleanup.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -9,61 +9,43 @@
Server-side cleanup script on vehicles.
Sort of a lame way but whatever.
*/
private "_deleted";
_deleted = false;
private _saveFuel = LIFE_SETTINGS(getNumber,"save_vehicle_fuel") isEqualTo 1;
private _minUnitDistance = LIFE_SETTINGS(getNumber,"vehicles_despawn_max_distance");

for "_i" from 0 to 1 step 0 do {
private ["_veh","_units","_fuel"];
sleep (60 * 60);
uiSleep (60 * 60);
{
_protect = false;
_veh = _x;
_vehicleClass = getText(configFile >> "CfgVehicles" >> (typeOf _veh) >> "vehicleClass");
_fuel = 1;

if (!isNil {_veh getVariable "NPC"} && {_veh getVariable "NPC"}) then {_protect = true;};
private _vehicleClass = getText(configFile >> "CfgVehicles" >> (typeOf _x) >> "vehicleClass");
private _protect = _x getVariable ["NPC",false];

if ((_vehicleClass in ["Car","Air","Ship","Armored","Submarine"]) && {!(_protect)}) then {
if (LIFE_SETTINGS(getNumber,"save_vehicle_fuel") isEqualTo 1) then {_fuel = (fuel _veh);};
_dbInfo = _veh getVariable ["dbInfo",[]];
_units = {(_x distance _veh < 300)} count playableUnits;
if (crew _x isEqualTo []) then {
switch (true) do {
case ((_x getHitPointDamage "HitEngine") > 0.7 && _units isEqualTo 0) : {deleteVehicle _x; _deleted = true;};
case ((_x getHitPointDamage "HitLFWheel") > 0.98 && _units isEqualTo 0) : {deleteVehicle _x; _deleted = true;};
case ((_x getHitPointDamage "HitLF2Wheel") > 0.98 && _units isEqualTo 0) : {deleteVehicle _x; _deleted = true;};
case ((_x getHitPointDamage "HitRFWheel") > 0.98 && _units isEqualTo 0) : {deleteVehicle _x; _deleted = true;};
case ((_x getHitPointDamage "HitRF2Wheel") > 0.98 && _units isEqualTo 0) : {deleteVehicle _x; _deleted = true;};
case (_units isEqualTo 0): {deleteVehicle _x; _deleted = true;};
};
};
private _noUnitsNear = ((nearestObjects [_x, ["CAManBase"], _minUnitDistance]) findIf {isPlayer _x && {alive _x}} isEqualTo -1);

if (_deleted) then {
waitUntil {isNull _veh};
_deleted = false;
};
if (crew _x isEqualTo [] && {_noUnitsNear}) then {
private _fuel = if (_saveFuel) then {fuel _x} else {1};
private _dbInfo = _x getVariable "dbInfo";

if (isNull _veh) then {
if (count _dbInfo > 0) then {
_uid = _dbInfo select 0;
_plate = _dbInfo select 1;
deleteVehicle _x;

_query = format ["cleanupVehicle:%1:%2:%3", _fuel, _uid, _plate];
if (isNil "_dbInfo") exitWith {};

[_query,1] call HC_fnc_asyncCall;
};
waitUntil {uiSleep 1; isNull _x};

_dbInfo params [
"_uid",
"_plate"
];

private _query = format ["cleanupVehicle:%1:%2:%3", _fuel, _uid, _plate];
[_query, 1] call HC_fnc_asyncCall;
};
};
} forEach vehicles;

sleep (3 * 60); //3 minute cool-down before next cycle.
{
if ((typeOf _x) in ["Land_BottlePlastic_V1_F","Land_TacticalBacon_F","Land_Can_V3_F","Land_CanisterFuel_F", "Land_Can_V3_F","Land_Money_F","Land_Suitcase_F"]) then {
if (!isNil {_x getVariable "item"}) then {
deleteVehicle _x;
};
} forEach (allMissionObjects "Thing");

sleep (2 * 60);
{
deleteVehicle _x;
} forEach (allMissionObjects "GroundWeaponHolder");
true
} count (allMissionObjects "Thing");
};
2 changes: 0 additions & 2 deletions life_hc/initHC.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ diag_log "------------------------------------ Starting Altis Life HC Init -----
diag_log format["-------------------------------------------- Version %1 -----------------------------------------",(LIFE_SETTINGS(getText,"framework_version"))];
diag_log "----------------------------------------------------------------------------------------------------";

[] execFSM "\life_hc\FSM\cleanup.fsm";

[] spawn HC_fnc_cleanup;

/* Initialize hunting zone(s) */
Expand Down
Loading