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

Add Ability to Change Repair Times of Vehicles #5205

Merged
merged 5 commits into from
Jun 8, 2017
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
38 changes: 23 additions & 15 deletions addons/repair/functions/fnc_repair.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -177,23 +177,31 @@ if (vehicle _caller == _caller && {_callerAnim != ""}) then {
[_caller, _callerAnim] call EFUNC(common,doAnimation);
};

//Get repair time
_repairTime = if (isNumber (_config >> "repairingTime")) then {
getNumber (_config >> "repairingTime");
} else {
if (isText (_config >> "repairingTime")) exitWith {
_repairTimeConfig = getText(_config >> "repairingTime");
if (isNil _repairTimeConfig) then {
_repairTimeConfig = compile _repairTimeConfig;
} else {
_repairTimeConfig = missionNamespace getVariable _repairTimeConfig;
};
if (_repairTimeConfig isEqualType 0) exitWith {
_repairTimeConfig;
// Get repair time
_repairTime = [
configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(repairTimes) >> configName _config,
"number",
-1
] call CBA_fnc_getConfigEntry;

if (_repairTime < 0) then {
_repairTime = if (isNumber (_config >> "repairingTime")) then {
Copy link
Contributor

Choose a reason for hiding this comment

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

Personal preference maybe but I think its better to have the if statement alone and set the _repairTime in each section.
So in the if statement you have _repairTime = getNumber() and in the else you have something else. It's hard to read what is happening like it is now.

getNumber (_config >> "repairingTime");
} else {
if (isText (_config >> "repairingTime")) exitWith {
_repairTimeConfig = getText (_config >> "repairingTime");
if (isNil _repairTimeConfig) then {
_repairTimeConfig = compile _repairTimeConfig;
} else {
_repairTimeConfig = missionNamespace getVariable _repairTimeConfig;
};
if (_repairTimeConfig isEqualType 0) exitWith {
_repairTimeConfig;
};
[_caller, _target, _hitPoint, _className] call _repairTimeConfig;
};
[_caller, _target, _hitPoint, _className] call _repairTimeConfig;
0;
};
0;
};

// Find localized string
Expand Down