Skip to content

Commit

Permalink
Repair - Make eden attributes use config values as default (#6480)
Browse files Browse the repository at this point in the history
* Make eden attributes use config values as default

* Simplify config with inheritance
  • Loading branch information
Dystopian authored and PabstMirror committed Oct 21, 2018
1 parent c4b436d commit 7b27d19
Showing 1 changed file with 11 additions and 16 deletions.
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

0 comments on commit 7b27d19

Please sign in to comment.