Skip to content

Commit

Permalink
update grad-civs
Browse files Browse the repository at this point in the history
  • Loading branch information
McDiod committed Sep 8, 2017
1 parent 8b90e66 commit 83c325c
Show file tree
Hide file tree
Showing 22 changed files with 347 additions and 108 deletions.
1 change: 1 addition & 0 deletions functions/missionSetup/cfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ class grad_missionSetup {
class missionSetup {
class createDiaryRecords {};
class initCivs {};
class initCivsEquip {preInit = 1;};
class initMission {postInit = 1;};
class initVars {preInit = 1;};
class intro {};
Expand Down
43 changes: 0 additions & 43 deletions functions/missionSetup/fn_initCivs.sqf
Original file line number Diff line number Diff line change
@@ -1,49 +1,6 @@
#include "component.hpp"
#define REPNIF0(var1,var2) if(count var2 > 0) then {var1 = var2}
#define APPENDUNIQUE(var1,var2) var1 = var1 + var2;var1 = var1 arrayIntersect var1


private _enable = ([missionConfigFile >> "CfgGradCivs","enableCivs",0] call BIS_fnc_returnConfigEntry) == 1;
if !(_enable) exitWith {};

private _islandType = [missionConfigFile >> "CfgIslands" >> worldName,"type",""] call BIS_fnc_returnConfigEntry;
if (_islandType == "") exitWith {ERROR("World is not defined in cfgIslands.")};

private _civCfg = missionConfigFile >> "CfgCivilians" >> _islandType;

private _clothes = [_civCfg,"clothes",[]] call BIS_fnc_returnConfigEntry;
private _headgear = [_civCfg,"headgear",[]] call BIS_fnc_returnConfigEntry;
private _faces = [_civCfg,"faces",[]] call BIS_fnc_returnConfigEntry;
private _goggles = [_civCfg,"goggles",[]] call BIS_fnc_returnConfigEntry;
private _backpacks = [_civCfg,"backpacks",[]] call BIS_fnc_returnConfigEntry;

private _userEquipmentCfg = missionConfigFile >> "CfgGradCivs" >> "userEquipment";
private _userClothes = [_userEquipmentCfg,"clothes",[]] call BIS_fnc_returnConfigEntry;
private _userHeadgear = [_userEquipmentCfg,"headgear",[]] call BIS_fnc_returnConfigEntry;
private _userFaces = [_userEquipmentCfg,"faces",[]] call BIS_fnc_returnConfigEntry;
private _userGoggles = [_userEquipmentCfg,"goggles",[]] call BIS_fnc_returnConfigEntry;
private _userBackpacks = [_userEquipmentCfg,"backpacks",[]] call BIS_fnc_returnConfigEntry;


private _replace = ([_userEquipmentCfg,"replace",0] call BIS_fnc_returnConfigEntry) == 1;
if (_replace) then {
REPNIF0(_clothes,_userClothes);
REPNIF0(_headgear,_userHeadgear);
REPNIF0(_faces,_userFaces);
REPNIF0(_goggles,_userGoggles);
REPNIF0(_backpacks,_userBackpacks);
} else {
APPENDUNIQUE(_clothes,_userClothes);
APPENDUNIQUE(_headgear,_userHeadgear);
APPENDUNIQUE(_faces,_userFaces);
APPENDUNIQUE(_goggles,_userGoggles);
APPENDUNIQUE(_backpacks,_userBackpacks);
};

[_clothes] call grad_civs_fnc_setClothes;
[_headgear] call grad_civs_fnc_setHeadgear;
[_faces] call grad_civs_fnc_setFaces;
[_goggles] call grad_civs_fnc_setGoggles;
[_backpacks] call grad_civs_fnc_setBackpacks;

[] call grad_civs_fnc_initModule;
51 changes: 51 additions & 0 deletions functions/missionSetup/fn_initCivsEquip.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#include "component.hpp"
#define REPNIF0(var1,var2) if(count var2 > 0) then {var1 = var2}
#define APPENDUNIQUE(var1,var2) var1 = var1 + var2;var1 = var1 arrayIntersect var1

private _enable = ([missionConfigFile >> "CfgGradCivs","enableCivs",0] call BIS_fnc_returnConfigEntry) == 1;
if !(_enable) exitWith {};

private _islandType = [missionConfigFile >> "CfgIslands" >> worldName,"type",""] call BIS_fnc_returnConfigEntry;
if (_islandType == "") exitWith {ERROR("World is not defined in cfgIslands.")};

private _civCfg = missionConfigFile >> "CfgCivilians" >> _islandType;

private _clothes = [_civCfg,"clothes",[]] call BIS_fnc_returnConfigEntry;
private _headgear = [_civCfg,"headgear",[]] call BIS_fnc_returnConfigEntry;
private _faces = [_civCfg,"faces",[]] call BIS_fnc_returnConfigEntry;
private _goggles = [_civCfg,"goggles",[]] call BIS_fnc_returnConfigEntry;
private _backpacks = [_civCfg,"backpacks",[]] call BIS_fnc_returnConfigEntry;
private _vehicles = [_civCfg,"vehicles",[]] call BIS_fnc_returnConfigEntry;

private _userEquipmentCfg = missionConfigFile >> "CfgGradCivs" >> "userEquipment";
private _userClothes = [_userEquipmentCfg,"clothes",[]] call BIS_fnc_returnConfigEntry;
private _userHeadgear = [_userEquipmentCfg,"headgear",[]] call BIS_fnc_returnConfigEntry;
private _userFaces = [_userEquipmentCfg,"faces",[]] call BIS_fnc_returnConfigEntry;
private _userGoggles = [_userEquipmentCfg,"goggles",[]] call BIS_fnc_returnConfigEntry;
private _userBackpacks = [_userEquipmentCfg,"backpacks",[]] call BIS_fnc_returnConfigEntry;
private _userVehicles = [_userEquipmentCfg,"vehicles",[]] call BIS_fnc_returnConfigEntry;


private _replace = ([_userEquipmentCfg,"replace",0] call BIS_fnc_returnConfigEntry) == 1;
if (_replace) then {
REPNIF0(_clothes,_userClothes);
REPNIF0(_headgear,_userHeadgear);
REPNIF0(_faces,_userFaces);
REPNIF0(_goggles,_userGoggles);
REPNIF0(_backpacks,_userBackpacks);
REPNIF0(_vehicles,_userVehicles);
} else {
APPENDUNIQUE(_clothes,_userClothes);
APPENDUNIQUE(_headgear,_userHeadgear);
APPENDUNIQUE(_faces,_userFaces);
APPENDUNIQUE(_goggles,_userGoggles);
APPENDUNIQUE(_backpacks,_userBackpacks);
APPENDUNIQUE(_vehicles,_userVehicles);
};

[_clothes] call grad_civs_fnc_setClothes;
[_headgear] call grad_civs_fnc_setHeadgear;
[_faces] call grad_civs_fnc_setFaces;
[_goggles] call grad_civs_fnc_setGoggles;
[_backpacks] call grad_civs_fnc_setBackpacks;
[_vehicles] call grad_civs_fnc_setVehicles;
10 changes: 10 additions & 0 deletions node_modules/grad-civs/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion node_modules/grad-civs/cfgFunctions.hpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/grad-civs/component.hpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion node_modules/grad-civs/functions/behaviour/fn_flee.sqf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node_modules/grad-civs/functions/behaviour/fn_stopCiv.sqf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 12 additions & 9 deletions node_modules/grad-civs/functions/behaviour/fn_taskPatrol.sqf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions node_modules/grad-civs/functions/common/fn_findBuildings.sqf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions node_modules/grad-civs/functions/common/fn_findRandomPos.sqf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions node_modules/grad-civs/functions/common/fn_findRandomPosArea.sqf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 39 additions & 0 deletions node_modules/grad-civs/functions/common/fn_populateArea.sqf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions node_modules/grad-civs/functions/spawn/fn_cleanup.sqf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 83c325c

Please sign in to comment.