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

Start loadouts Improvement #574

Merged
merged 12 commits into from Nov 20, 2019
4 changes: 1 addition & 3 deletions Altis_Life.Altis/Functions.hpp
Expand Up @@ -92,7 +92,6 @@ class Life_Client_Core {

class Civilian {
file = "core\civilian";
class civLoadout {};
class civMarkers {};
class demoChargeTimer {};
class freezePlayer {};
Expand Down Expand Up @@ -120,7 +119,6 @@ class Life_Client_Core {
class containerInvSearch {};
class copInteractionMenu {};
class copLights {};
class copLoadout {};
class copMarkers {};
class copSearch {};
class copSiren {};
Expand Down Expand Up @@ -214,6 +212,7 @@ class Life_Client_Core {
class revealObjects {};
class saveGear {};
class simDisable {};
class startupLoadout {};
class stripDownPlayer {};
class teleport {};
class whereAmI {};
Expand Down Expand Up @@ -276,7 +275,6 @@ class Life_Client_Core {
file = "core\medical";
class deathScreen {};
class medicLights {};
class medicLoadout {};
class medicMarkers {};
class medicRequest {};
class medicSiren {};
Expand Down
35 changes: 35 additions & 0 deletions Altis_Life.Altis/config/Config_Loadouts.hpp
@@ -0,0 +1,35 @@
class LifeStartupLoadouts {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class LifeStartupLoadouts {
class Loadouts {

commonItens[] = {"ItemMap","ItemCompass","ItemWatch"}; //Common link items between sides
class WEST {
life_loadOutItens[] = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
life_loadOutItens[] = {
loadout[] = {

"U_Rangemaster", //Uniform - empty ("" or {""} or {}) will load nothing...Otherwise, use "" for a unique uniform or {"",""} for a randomly selected uniform
"V_Rangemaster_belt", //Vest - empty ("") will load nothing
"", //Backpack - empty ("") will load nothing
"hgun_P07_snds_F", //Weapon - empty ("") will load nothing
{"16Rnd_9x21_Mag",6}, //Mags, amount - empty ("",0) will load nothing
{} //Specific items to be loaded on player - empty ({}) will load nothing...Otherwise, {"ItemName", Amount}
};
};

class CIV {
life_loadOutItens[] = {
{"U_C_Poloshirt_blue","U_C_Poloshirt_burgundy","U_C_Poloshirt_stripped","U_C_Poloshirt_tricolour","U_C_Poloshirt_salmon","U_C_Poloshirt_redwhite","U_C_Commoner1_1"}, //Uniform - empty ("" or {""}) will load nothing...Otherwise, use "" for a unique uniform or {"",""} for a randomly selected uniform
"", //Vest - empty ("") will load nothing
"", //Backpack - empty ("") will load nothing
"", //Weapon - empty ("") will load nothing
{"",0}, //Mags, amount - empty ("",0) will load nothing
{} //Specific items to be loaded on player - empty ({}) will load nothing...Otherwise, {"ItemName", Amount}
};
};

class GUER {
life_loadOutItens[] = {
"U_I_HeliPilotCoveralls", //Uniform - empty ("" or {""}) will load nothing...Otherwise, use "" for a unique uniform or {"",""} for a randomly selected uniform
"V_Rangemaster_belt", //Vest - empty ("") will load nothing
"", //Backpack - empty ("") will load nothing
"hgun_P07_snds_F", //Weapon - empty ("") will load nothing
{"16Rnd_9x21_Mag",1}, //Mags, amount - empty ("",0) will load nothing
{{"FirstAidKit",2}} //Specific items to be loaded on player - empty ({}) will load nothing...Otherwise, {"ItemName", Amount}
};
};
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps move the comments to the top of the class, instead of being on every line (like the other configs)

1 change: 1 addition & 0 deletions Altis_Life.Altis/config/Config_Master.hpp
Expand Up @@ -229,3 +229,4 @@ class Life_Settings {
#include "Config_Process.hpp"
#include "Config_Housing.hpp"
#include "Config_Garages.hpp"
#include "Config_Loadouts.hpp"
8 changes: 4 additions & 4 deletions Altis_Life.Altis/config/Config_SpyGlass.hpp
Expand Up @@ -244,9 +244,9 @@ class SpyGlass {
"life_fnc_adminspectate_meta","life_fnc_adminteleport","life_fnc_adminteleport_meta","life_fnc_admintphere","life_fnc_admintphere_meta","life_fnc_animsync","life_fnc_animsync_meta","life_fnc_arrestaction","life_fnc_arrestaction_meta","life_fnc_atmmenu","life_fnc_atmmenu_meta","life_fnc_bankdeposit","life_fnc_bankdeposit_meta","life_fnc_banktransfer",
"life_fnc_banktransfer_meta","life_fnc_bankwithdraw","life_fnc_bankwithdraw_meta","life_fnc_blastingcharge","life_fnc_blastingcharge_meta","life_fnc_boltcutter","life_fnc_boltcutter_meta","life_fnc_bountyreceive","life_fnc_bountyreceive_meta","life_fnc_broadcast","life_fnc_broadcast_meta","life_fnc_buyclothes","life_fnc_buyclothes_meta","life_fnc_buyhouse",
"life_fnc_buyhouse_meta","life_fnc_buyhousegarage","life_fnc_buyhousegarage_meta","life_fnc_buylicense","life_fnc_buylicense_meta","life_fnc_calweightdiff","life_fnc_calweightdiff_meta","life_fnc_capturehideout","life_fnc_capturehideout_meta","life_fnc_catchfish","life_fnc_catchfish_meta","life_fnc_catchturtle","life_fnc_catchturtle_meta","life_fnc_cellphone",
"life_fnc_cellphone_meta","life_fnc_checkmap","life_fnc_checkmap_meta","life_fnc_changeclothes","life_fnc_changeclothes_meta","life_fnc_chopshopmenu","life_fnc_chopshopmenu_meta","life_fnc_chopshopselection","life_fnc_chopshopselection_meta","life_fnc_chopshopsell","life_fnc_chopshopsell_meta","life_fnc_chopShopSold","life_fnc_chopShopSold_meta","life_fnc_civloadout","life_fnc_civloadout_meta","life_fnc_civmarkers","life_fnc_civmarkers_meta",
"life_fnc_cellphone_meta","life_fnc_checkmap","life_fnc_checkmap_meta","life_fnc_changeclothes","life_fnc_changeclothes_meta","life_fnc_chopshopmenu","life_fnc_chopshopmenu_meta","life_fnc_chopshopselection","life_fnc_chopshopselection_meta","life_fnc_chopshopsell","life_fnc_chopshopsell_meta","life_fnc_chopShopSold","life_fnc_chopShopSold_meta","life_fnc_civmarkers","life_fnc_civmarkers_meta",
"life_fnc_clearvehicleammo","life_fnc_clearvehicleammo_meta","life_fnc_clothingfilter","life_fnc_clothingfilter_meta","life_fnc_clothingmenu","life_fnc_clothingmenu_meta","life_fnc_colorvehicle","life_fnc_colorvehicle_meta","life_fnc_containerinvsearch","life_fnc_containerinvsearch_meta","life_fnc_containermenu","life_fnc_containermenu_meta","life_fnc_copbreakdoor",
"life_fnc_copbreakdoor_meta","life_fnc_cophouseowner","life_fnc_cophouseowner_meta","life_fnc_copinteractionmenu","life_fnc_copinteractionmenu_meta","life_fnc_coplights","life_fnc_coplights_meta","life_fnc_coploadout","life_fnc_coploadout_meta","life_fnc_copmarkers","life_fnc_copmarkers_meta","life_fnc_copsearch","life_fnc_copsearch_meta","life_fnc_copsiren",
"life_fnc_copbreakdoor_meta","life_fnc_cophouseowner","life_fnc_cophouseowner_meta","life_fnc_copinteractionmenu","life_fnc_copinteractionmenu_meta","life_fnc_coplights","life_fnc_coplights_meta","life_fnc_copmarkers","life_fnc_copmarkers_meta","life_fnc_copsearch","life_fnc_copsearch_meta","life_fnc_copsiren",
"life_fnc_copsiren_meta","life_fnc_copsplit","life_fnc_copsplit_meta","life_fnc_corpse","life_fnc_corpse_meta","life_fnc_creategang","life_fnc_creategang_meta","life_fnc_deathscreen","life_fnc_deathscreen_meta","life_fnc_defusekit","life_fnc_defusekit_meta","life_fnc_demochargetimer","life_fnc_demochargetimer_meta","life_fnc_devicemine","life_fnc_devicemine_meta",
"life_fnc_displayhandler","life_fnc_displayhandler_meta","life_fnc_dooranimate","life_fnc_dooranimate_meta","life_fnc_dpfinish","life_fnc_dpfinish_meta","life_fnc_dropfishingnet","life_fnc_dropfishingnet_meta","life_fnc_dropitems","life_fnc_dropitems_meta","life_fnc_escinterupt","life_fnc_escinterupt_meta","life_fnc_escortaction","life_fnc_escortaction_meta",
"life_fnc_fedcamdisplay","life_fnc_fedcamdisplay_meta","life_fnc_fetchcfgdetails","life_fnc_fetchcfgdetails_meta","life_fnc_fetchdeadgear","life_fnc_fetchdeadgear_meta","life_fnc_fetchvehinfo","life_fnc_fetchvehinfo_meta","life_fnc_flashbang","life_fnc_flashbang_meta","life_fnc_freezeplayer","life_fnc_freezeplayer_meta","life_fnc_fuellbchange","life_fnc_fuellbchange_meta",
Expand All @@ -259,7 +259,7 @@ class SpyGlass {
"life_fnc_itemweight","life_fnc_itemweight_meta","life_fnc_jail","life_fnc_jail_meta","life_fnc_jailme","life_fnc_jailme_meta","life_fnc_jailsys","life_fnc_jailsys_meta","life_fnc_jerrycanrefuel","life_fnc_jerrycanrefuel_meta","life_fnc_jerryrefuel","life_fnc_jerryrefuel_meta","life_fnc_jumpfnc","life_fnc_jumpfnc_meta","life_fnc_keydrop","life_fnc_keydrop_meta","life_fnc_keygive",
"life_fnc_keygive_meta","life_fnc_keyhandler","life_fnc_keyhandler_meta","life_fnc_keymenu","life_fnc_keymenu_meta","life_fnc_knockedout","life_fnc_knockedout_meta","life_fnc_knockoutaction","life_fnc_knockoutaction_meta","life_fnc_levelcheck","life_fnc_levelcheck_meta","life_fnc_licensecheck","life_fnc_licensecheck_meta","life_fnc_licensesread","life_fnc_licensesread_meta","life_fnc_lighthouse",
"life_fnc_lighthouse_meta","life_fnc_lighthouseaction","life_fnc_lighthouseaction_meta","life_fnc_loaddeadgear","life_fnc_loaddeadgear_meta","life_fnc_loadgear","life_fnc_loadgear_meta","life_fnc_lockhouse","life_fnc_lockhouse_meta","life_fnc_lockpick","life_fnc_lockpick_meta","life_fnc_lockuphouse","life_fnc_lockuphouse_meta","life_fnc_lockvehicle","life_fnc_lockvehicle_meta","life_fnc_mediclights",
"life_fnc_mediclights_meta","life_fnc_medicloadout","life_fnc_medicloadout_meta","life_fnc_medicmarkers","life_fnc_medicmarkers_meta","life_fnc_medicrequest","life_fnc_medicrequest_meta","life_fnc_medicsiren","life_fnc_medicsiren_meta","life_fnc_medicsirenlights","life_fnc_medicsirenlights_meta","life_fnc_mine","life_fnc_mine_meta","life_fnc_movein","life_fnc_movein_meta","life_fnc_nearatm","life_fnc_nearatm_meta",
"life_fnc_mediclights_meta","life_fnc_medicmarkers","life_fnc_medicmarkers_meta","life_fnc_medicrequest","life_fnc_medicrequest_meta","life_fnc_medicsiren","life_fnc_medicsiren_meta","life_fnc_medicsirenlights","life_fnc_medicsirenlights_meta","life_fnc_mine","life_fnc_mine_meta","life_fnc_movein","life_fnc_movein_meta","life_fnc_nearatm","life_fnc_nearatm_meta",
"life_fnc_nearestdoor","life_fnc_nearestdoor_meta","life_fnc_nearestobjects","life_fnc_nearestobjects_meta","life_fnc_nearunits","life_fnc_nearunits_meta","life_fnc_newsbroadcast","life_fnc_newsbroadcast_meta","life_fnc_numbertext","life_fnc_numbertext_meta","life_fnc_onfired","life_fnc_onfired_meta","life_fnc_onplayerkilled","life_fnc_onplayerkilled_meta","life_fnc_onplayerrespawn",
"life_fnc_onplayerrespawn_meta","life_fnc_ontakeitem","life_fnc_ontakeitem_meta","life_fnc_openinventory","life_fnc_openinventory_meta","life_fnc_p_changescreen","life_fnc_p_changescreen_meta","life_fnc_p_getscreengroupidc","life_fnc_p_getscreengroupidc_meta","life_fnc_p_handlescreenevent","life_fnc_p_handlescreenevent_meta","life_fnc_p_init","life_fnc_p_init_meta","life_fnc_p_initmainmenu",
"life_fnc_p_initmainmenu_meta","life_fnc_p_onclick","life_fnc_p_onclick_meta","life_fnc_p_oneachframe","life_fnc_p_oneachframe_meta","life_fnc_p_onload","life_fnc_p_onload_meta","life_fnc_p_onmouseenter","life_fnc_p_onmouseenter_meta","life_fnc_p_onmouseexit","life_fnc_p_onmouseexit_meta","life_fnc_p_onunload","life_fnc_p_onunload_meta","life_fnc_p_openmenu","life_fnc_p_openmenu_meta",
Expand All @@ -273,7 +273,7 @@ class SpyGlass {
"life_fnc_seizeplayeraction_meta","life_fnc_sellgarage","life_fnc_sellgarage_meta","life_fnc_sellhouse","life_fnc_sellhouse_meta","life_fnc_sellhousegarage","life_fnc_sellhousegarage_meta","life_fnc_servicechopper","life_fnc_servicechopper_meta","life_fnc_setfuel","life_fnc_setfuel_meta","life_fnc_setmapposition","life_fnc_setmapposition_meta","life_fnc_settexture_meta","life_fnc_settingsmenu",
"life_fnc_settingsmenu_meta","life_fnc_setupactions","life_fnc_setupactions_meta","life_fnc_setupevh","life_fnc_setupevh_meta","life_fnc_simdisable","life_fnc_simdisable_meta","life_fnc_sirenlights","life_fnc_sirenlights_meta","life_fnc_sounddevice","life_fnc_sounddevice_meta","life_fnc_spawnconfirm","life_fnc_spawnconfirm_meta","life_fnc_spawnmenu","life_fnc_spawnmenu_meta","life_fnc_spawnpointcfg",
"life_fnc_spawnpointcfg_meta","life_fnc_spawnpointselected","life_fnc_spawnpointselected_meta","life_fnc_spikestrip","life_fnc_spikestrip_meta","life_fnc_spikestripeffect","life_fnc_spikestripeffect_meta","life_fnc_stopescorting","life_fnc_stopescorting_meta","life_fnc_storagebox","life_fnc_storagebox_meta","life_fnc_storevehicle","life_fnc_storevehicle_meta","life_fnc_storevehicleaction",
"life_fnc_storevehicleaction_meta","life_fnc_stripdownplayer","life_fnc_stripdownplayer_meta","life_fnc_surrender","life_fnc_surrender_meta","life_fnc_survival","life_fnc_survival_meta","life_fnc_tazed","life_fnc_tazed_meta","life_fnc_teleport","life_fnc_teleport_meta","life_fnc_ticketaction","life_fnc_ticketaction_meta","life_fnc_ticketgive",
"life_fnc_storevehicleaction_meta","life_fnc_startupLoadout","life_fnc_startupLoadout_meta","life_fnc_stripdownplayer","life_fnc_stripdownplayer_meta","life_fnc_surrender","life_fnc_surrender_meta","life_fnc_survival","life_fnc_survival_meta","life_fnc_tazed","life_fnc_tazed_meta","life_fnc_teleport","life_fnc_teleport_meta","life_fnc_ticketaction","life_fnc_ticketaction_meta","life_fnc_ticketgive",
"life_fnc_ticketgive_meta","life_fnc_ticketpaid","life_fnc_ticketpaid_meta","life_fnc_ticketpay","life_fnc_ticketpay_meta","life_fnc_ticketprompt","life_fnc_ticketprompt_meta","life_fnc_unimpound","life_fnc_unimpound_meta","life_fnc_unrestrain","life_fnc_unrestrain_meta","life_fnc_updateviewdistance","life_fnc_updateviewdistance_meta","life_fnc_useitem","life_fnc_useitem_meta",
"life_fnc_vehicleanimate","life_fnc_vehicleanimate_meta","life_fnc_vehiclecolor3drefresh","life_fnc_vehiclecolor3drefresh_meta","life_fnc_vehiclecolorcfg","life_fnc_vehiclecolorcfg_meta","life_fnc_vehiclecolorstr","life_fnc_vehiclecolorstr_meta","life_fnc_vehiclegarage","life_fnc_vehiclegarage_meta","life_fnc_vehiclelistcfg","life_fnc_vehiclelistcfg_meta","life_fnc_vehicleowners",
"life_fnc_vehicleowners_meta","life_fnc_3dpreviewdisplay","life_fnc_3dpreviewdisplay_meta","life_fnc_vehicleshopbuy","life_fnc_vehicleshopbuy_meta","life_fnc_3dpreviewexit","life_fnc_3dpreviewexit_meta","life_fnc_3dpreviewinit","life_fnc_3dpreviewinit_meta","life_fnc_vehicleshoplbchange","life_fnc_vehicleshoplbchange_meta",
Expand Down
21 changes: 0 additions & 21 deletions Altis_Life.Altis/core/civilian/fn_civLoadout.sqf

This file was deleted.

32 changes: 0 additions & 32 deletions Altis_Life.Altis/core/cop/fn_copLoadout.sqf

This file was deleted.

3 changes: 1 addition & 2 deletions Altis_Life.Altis/core/fn_initCiv.sqf
Expand Up @@ -22,8 +22,7 @@ if (life_is_alive && !life_is_arrested) then {
} else {
if (!life_is_alive && !life_is_arrested) then {
if (LIFE_SETTINGS(getNumber,"save_civilian_positionStrict") isEqualTo 1) then {
_handle = [] spawn life_fnc_civLoadout;
waitUntil {scriptDone _handle};
[] call life_fnc_startupLoadout;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[] call life_fnc_startupLoadout;
[] call life_fnc_startLoadout;

CASH = 0;
[0] call SOCK_fnc_updatePartial;
};
Expand Down
23 changes: 4 additions & 19 deletions Altis_Life.Altis/core/functions/fn_loadGear.sqf
Expand Up @@ -6,28 +6,13 @@
Description:
Loads saved civilian gear, this is limited for a reason and that's balance.
*/
private ["_itemArray","_handle"];
_itemArray = life_gear;
private ["_handle"];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private ["_handle"];

private _itemArray = life_gear;
waitUntil {!(isNull (findDisplay 46))};

_handle = [] spawn life_fnc_stripDownPlayer;
waitUntil {scriptDone _handle};
[] call life_fnc_stripDownPlayer;

if (count _itemArray isEqualTo 0) exitWith {
switch (playerSide) do {
case west: {
[] call life_fnc_copLoadout;
};

case civilian: {
[] call life_fnc_civLoadout;
};

case independent: {
[] call life_fnc_medicLoadout;
};
};
};
if (_itemArray isEqualTo []) exitWith {[] call life_fnc_startupLoadout;};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (_itemArray isEqualTo []) exitWith {[] call life_fnc_startupLoadout;};
if (_itemArray isEqualTo []) exitWith {[] call life_fnc_startLoadout;};


_itemArray params [
"_uniform",
Expand Down
29 changes: 29 additions & 0 deletions Altis_Life.Altis/core/functions/fn_startupLoadout.sqf
@@ -0,0 +1,29 @@
/*
File: fn_startupLoadout
Author: Casperento

Description:
Loads a custom loadout on player
*/
private _loadOutCfg = getArray(missionConfigFile >> "LifeStartupLoadouts" >> (side player) >> "life_loadOutItens");
private _commonItens = getArray(missionConfigFile >> "LifeStartupLoadouts" >> "commonItens");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private _commonItens = getArray(missionConfigFile >> "LifeStartupLoadouts" >> "commonItens");
private _commonItems = getArray(missionConfigFile >> "Loadouts" >> "commonItens");

private _pCloth = if ((_loadOutCfg select 0) isEqualType [] && !((_loadOutCfg select 0) isEqualTo [] || (_loadOutCfg select 0) select 0 isEqualTo "")) then {selectRandom (_loadOutCfg select 0)} else {(_loadOutCfg select 0)};

if !(life_is_arrested) then {player addUniform _pCloth;};
if !((_loadOutCfg select 1) isEqualTo "") then {player addVest (_loadOutCfg select 1);};
if !((_loadOutCfg select 2) isEqualTo "") then {player addBackpack (_loadOutCfg select 2);};
if !((_loadOutCfg select 3) isEqualTo "") then {player addWeapon (_loadOutCfg select 3);};
if !((_loadOutCfg select 4) select 0 isEqualTo "" || {(_loadOutCfg select 4) select 1 isEqualTo 0}) then {
for "_i" from 1 to ((_loadOutCfg select 4) select 1) step 1 do {player addMagazine ((_loadOutCfg select 4) select 0);};
};
if !((_loadOutCfg select 5) isEqualTo []) then {
for "_i" from 0 to count(_loadOutCfg select 5)-1 step 1 do {
for "_j" from 1 to (((_loadOutCfg select 5) select _i) select 1) step 1 do {
player addItem (((_loadOutCfg select 5) select _i) select 0);
};
};
};
for "_i" from 0 to (count _commonItens)-1 do {player linkItem (_commonItens select _i);};

[] call life_fnc_playerSkins;
[] call life_fnc_saveGear;
21 changes: 0 additions & 21 deletions Altis_Life.Altis/core/medical/fn_medicLoadout.sqf

This file was deleted.

15 changes: 1 addition & 14 deletions Altis_Life.Altis/core/medical/fn_respawned.sqf
Expand Up @@ -25,20 +25,7 @@ player setVariable ["Revive",nil,true];
player setVariable ["name",nil,true];
player setVariable ["Reviving",nil,true];

//Load gear for a 'new life'
switch (playerSide) do
{
case west: {
_handle = [] spawn life_fnc_copLoadout;
};
case civilian: {
_handle = [] spawn life_fnc_civLoadout;
};
case independent: {
_handle = [] spawn life_fnc_medicLoadout;
};
waitUntil {scriptDone _handle};
};
[] call life_fnc_startupLoadout;

//Cleanup of weapon containers near the body & hide it.
if (!isNull life_corpse) then {
Expand Down