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

Repair - Make eden attributes use config values as default #6480

Merged
merged 2 commits into from
Oct 21, 2018
Merged
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
27 changes: 11 additions & 16 deletions addons/repair/CfgEden.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#define GET_NUMBER(config,default) (if (isNumber (config)) then {getNumber (config)} else {default})

#define DEFAULT_ISENGINEER ([ARR_2(0,1)] select (_this getUnitTrait 'engineer'))
#define DEFAULT_ISREPAIRVEHICLE GET_NUMBER(configFile >> 'CfgVehicles' >> typeOf _this >> QQGVAR(canRepair),0)

class ctrlToolbox;

class Cfg3DEN {
Expand Down Expand Up @@ -35,10 +40,10 @@ class Cfg3DEN {
property = QUOTE(ace_isEngineer);
displayName = CSTRING(AssignEngineerRole_role_DisplayName);
tooltip = CSTRING(AssignEngineerRole_role_Description);
expression = "if (_value != -1) then {_this setVariable ['%s',_value, true];}";
expression = QUOTE(if !(_value == DEFAULT_ISENGINEER || {_value == -1}) then {_this setVariable [ARR_3('%s',_value,true)]});
typeName = "NUMBER";
condition = "objectBrain";
defaultValue = "-1";
defaultValue = QUOTE(DEFAULT_ISENGINEER);
control = QGVAR(isEngineerControl);
};
class ace_isRepairVehicle {
Expand All @@ -47,21 +52,16 @@ class Cfg3DEN {
control = "CheckboxNumber";
displayName = CSTRING(AssignRepairVehicle_role_DisplayName);
tooltip = CSTRING(AssignRepairVehicle_role_Description);
expression = "_this setVariable ['%s',_value, true];";
expression = QUOTE(if (_value != DEFAULT_ISREPAIRVEHICLE) then {_this setVariable [ARR_3('%s',_value,true)]});
typeName = "NUMBER";
condition = "objectVehicle";
defaultValue = 0;
defaultValue = QUOTE(DEFAULT_ISREPAIRVEHICLE);
};
class ace_isRepairFacility {
class ace_isRepairFacility: ace_isRepairVehicle {
property = QUOTE(ace_isRepairFacility);
value = 0;
control = "CheckboxNumber";
displayName = CSTRING(AssignRepairFacility_role_DisplayName);
tooltip = CSTRING(AssignRepairFacility_role_Description);
expression = "_this setVariable ['%s',_value, true];";
typeName = "NUMBER";
condition = "(1 - objectBrain) * (1 - objectVehicle)";
defaultValue = 0;
};
class GVAR(editorLoadedTracks) {
displayName = CSTRING(editorLoadedTracks);
Expand All @@ -74,16 +74,11 @@ class Cfg3DEN {
condition = "objectHasInventoryCargo";
typeName = "NUMBER";
};
class GVAR(editorLoadedWheels) {
class GVAR(editorLoadedWheels): GVAR(editorLoadedTracks) {
displayName = CSTRING(editorLoadedWheels);
tooltip = CSTRING(editorLoadedWheels_tooltip);
property = QGVAR(editorLoadedWheels);
control = "Edit";
expression = "_this setVariable ['%s',_value];";
defaultValue = "[0,1] select (_this isKindOf 'Car')"; // must match pre init script
validate = "number";
condition = "objectHasInventoryCargo";
typeName = "NUMBER";
};
};
};
Expand Down