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

Conversation

@Casperento
Copy link
Contributor

Casperento commented Sep 6, 2019

Changes proposed in this pull request:

  • New player loadout config file

  • Small improvements on related functions

  • Deleted old loadout functions and files

  • I have tested my changes and corrected any errors found

@Casperento Casperento changed the title Startup loadouts Startup loadouts Improvement Sep 6, 2019
Copy link
Contributor

Leigham left a comment

maybe use addMagazines instead of
for "_i" from 1 to ((_loadOutCfg select 4) select 1) step 1 do {player addMagazine ((_loadOutCfg select 4) select 0);}; you could just use (_loadOutCfg select 4) apply {player addMagazines [_x # 0, _x # 1]}

@Casperento

This comment has been minimized.

Copy link
Contributor Author

Casperento commented Sep 6, 2019

That's a good ideia

Casperento added 2 commits Sep 6, 2019
@Casperento

This comment has been minimized.

Copy link
Contributor Author

Casperento commented Sep 6, 2019

I've tested all changes and it's working very well

@@ -0,0 +1,39 @@
class LifeStartupLoadouts {
commonItens[] = {"ItemMap","ItemCompass","ItemWatch"}; //Common link items between sides - empty ({} or {""}) will load nothing

This comment has been minimized.

Copy link
@BoGuu

BoGuu Sep 7, 2019

Member
Suggested change
commonItens[] = {"ItemMap","ItemCompass","ItemWatch"}; //Common link items between sides - empty ({} or {""}) will load nothing
commonItems[] = {"ItemMap","ItemCompass","ItemWatch"}; //Common link items between sides - empty ({} or {""}) will load nothing
{{"FirstAidKit",2}} //Specific items to be loaded on player - empty ({}) will load nothing...Otherwise, {"ItemName", Amount}
};
};
};

This comment has been minimized.

Copy link
@BoGuu

BoGuu Sep 7, 2019

Member

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

@@ -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"];

This comment has been minimized.

Copy link
@BoGuu

BoGuu Sep 7, 2019

Member
Suggested change
private ["_handle"];
@@ -0,0 +1,41 @@
/*
File: fn_startupLoadout.sqf

This comment has been minimized.

Copy link
@BoGuu

BoGuu Sep 7, 2019

Member
Suggested change
File: fn_startupLoadout.sqf
File: fn_startLoadout.sqf
Loads a custom loadout on player
*/
private _loadOutCfg = getArray(missionConfigFile >> "LifeStartupLoadouts" >> str(side player) >> "life_loadOutItens");
private _commonItens = getArray(missionConfigFile >> "LifeStartupLoadouts" >> "commonItens");

This comment has been minimized.

Copy link
@BoGuu

BoGuu Sep 7, 2019

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

// COP
class WEST {
life_loadOutItens[] = {

This comment has been minimized.

Copy link
@BoGuu

BoGuu Sep 7, 2019

Member
Suggested change
life_loadOutItens[] = {
loadout[] = {
@@ -0,0 +1,39 @@
class LifeStartupLoadouts {

This comment has been minimized.

Copy link
@BoGuu

BoGuu Sep 7, 2019

Member
Suggested change
class LifeStartupLoadouts {
class Loadouts {
@@ -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;

This comment has been minimized.

Copy link
@BoGuu

BoGuu Sep 7, 2019

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

This comment has been minimized.

Copy link
@BoGuu

BoGuu Sep 7, 2019

Member
Suggested change
if (_itemArray isEqualTo []) exitWith {[] call life_fnc_startupLoadout;};
if (_itemArray isEqualTo []) exitWith {[] call life_fnc_startLoadout;};
*/
private _loadOutCfg = getArray(missionConfigFile >> "LifeStartupLoadouts" >> str(side player) >> "life_loadOutItens");
private _commonItens = getArray(missionConfigFile >> "LifeStartupLoadouts" >> "commonItens");
private _pCloth = if ((_loadOutCfg select 0) isEqualType [] && !((_loadOutCfg select 0) isEqualTo [])) then {selectRandom (_loadOutCfg select 0)} else {(_loadOutCfg select 0)};

This comment has been minimized.

Copy link
@BoGuu

BoGuu Sep 7, 2019

Member

Use params for all this:

_loadOutCfg params [
    "_clothing",
    ... ,
    "_magazines"
]
@BoGuu

This comment has been minimized.

Copy link
Member

BoGuu commented Sep 7, 2019

Above changes doesn't encompass all usage of things changed, etc.

@cxmeronmcgregor

This comment has been minimized.

Copy link

cxmeronmcgregor commented Oct 24, 2019

Looks good, useful for users storing items

@Casperento Casperento changed the title Startup loadouts Improvement Start loadouts Improvement Oct 26, 2019
@Casperento

This comment has been minimized.

Copy link
Contributor Author

Casperento commented Oct 26, 2019

Looks good, useful for users storing items

Not really..its just an improvement for player's start loadout code

@AngryHerring

This comment has been minimized.

Copy link

AngryHerring commented Oct 27, 2019

Not really an improvement, does not allow you to add custom conditions with ease (different rank loadout's for instance).

@Casperento

This comment has been minimized.

Copy link
Contributor Author

Casperento commented Oct 27, 2019

The main change is the new config file. But u got a good idea that can be written in the future

Copy link
Contributor

imthatguyhere left a comment

Syntax and functionality wise it looks fine, but I have some concerns with how the config looks and consistency of this with other similar functions and configs in the framework.

};
*/
class Loadouts {
commonItems[] = {"ItemMap","ItemCompass","ItemWatch"}; // Common link items between sides - empty ({} or {""}) will load nothing

This comment has been minimized.

Copy link
@imthatguyhere

imthatguyhere Nov 1, 2019

Contributor

Having common linked items is fine, but there needs to be linked items for each faction as for many they may differ.

@@ -0,0 +1,51 @@
/*
class PLAYERSIDE {
loadOut[] = {

This comment has been minimized.

Copy link
@imthatguyhere

imthatguyhere Nov 1, 2019

Contributor

Having the loadout be a single array isn't consistent with the other configs and isn't very human readable (you have to refer to the comments to see where everything is constantly). Each array item should be an attribute of it's own.

} count _pItems;
};
if !(_commonItems isEqualTo []) then {
_commonItems apply {

This comment has been minimized.

Copy link
@imthatguyhere

imthatguyhere Nov 1, 2019

Contributor

Why are you swapping between count and apply to loop through these arrays?

This comment has been minimized.

Copy link
@Casperento

Casperento Nov 2, 2019

Author Contributor

Nothing special..i'll change all of these count in my next commit...

Description:
Loads a custom loadout on player
*/
private _loadOutCfg = getArray(missionConfigFile >> "Loadouts" >> str(side player) >> "loadOut");

This comment has been minimized.

Copy link
@imthatguyhere

imthatguyhere Nov 1, 2019

Contributor

it's probably best to swap to using the M_CONFIG macro and include the macros to keep things consistent.

Copy link
Contributor

imthatguyhere left a comment

Definitely more readable now. Just a few little things.

class Loadouts {
// COP
class WEST {
cloth[] = {

This comment has been minimized.

Copy link
@imthatguyhere

imthatguyhere Nov 4, 2019

Contributor

I would rename this to uniform to be consistent with Arma's terminology.

Description:
Loads a custom loadout on player when he got a new life
*/
private _pCloth = M_CONFIG(getArray,"Loadouts",str(playerSide),"cloth");

This comment has been minimized.

Copy link
@imthatguyhere

imthatguyhere Nov 4, 2019

Contributor

Same note on uniform instead of cloth.

if !(_pCloth isEqualTo []) then {
if (playerSide isEqualTo civilian) then {
_pCloth = (selectRandom _pCloth);
if (!(_x isEqualTo []) && !((_pCloth select 0) isEqualTo "") && ([(_pCloth select 1)] call life_fnc_levelCheck)) then {

This comment has been minimized.

Copy link
@imthatguyhere

imthatguyhere Nov 4, 2019

Contributor

For these longer if statements, some short-circuit conditions would be better. EX:
if (con1 && { con2 && { con3 }}) then { codeHere };

@Casperento

This comment has been minimized.

Copy link
Contributor Author

Casperento commented Nov 4, 2019

pt3..done!

@Casperento

This comment has been minimized.

Copy link
Contributor Author

Casperento commented Nov 14, 2019

Fixed!

@Casperento

This comment has been minimized.

Copy link
Contributor Author

Casperento commented Nov 20, 2019

fixed

Copy link
Member

DomT602 left a comment

After merge into master, I'm happy.

@BoGuu
BoGuu approved these changes Nov 20, 2019
@DomT602 DomT602 merged commit 977db18 into AsYetUntitled:master Nov 20, 2019
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@IceEagle132

This comment has been minimized.

Copy link

IceEagle132 commented Nov 22, 2019

This issue is after the loadout push.

Expected behavior

Should be able to spawn Civ-Cop-Med

Actual behavior

Switching sides dose not work and says Received request from server....Validating...

Steps to reproduce the behavior

  • Start New Server
  • Spawn in as civilian
  • Add Cop or Med rank in DB
  • Go to server lobby
  • Switch role to Cop or Med

[RPT] and/or extDB3 logs
Nothing in the logs to do with this.
18-28-54.log
RPT https://paste-me.net/batej

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
9 participants
You can’t perform that action at this time.