-
Notifications
You must be signed in to change notification settings - Fork 54
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
Extended Vehicle Customization #387
base: master
Are you sure you want to change the base?
Conversation
I am unsure about showing animations that would normally be hidden. For example, for the Prowler (HMG), you have ones such as "mainMuzzle rot" and "mainMuzzle reload" listed. And ones that are meant to be shown such as "Hide left front door" are hidden. |
There are some neat animations like hiding turrets of APCs and door animations. The "hide door" animations disappeared due to a bug fixed in ba3d0a3. |
Co-authored-by: NeilZar <[email protected]>
Still need to test how adequately the blacklist is for different mod sets. |
I'd say CUP, RHS, 3CB, and Project OPFOR are the main asset mods. |
case "door": { | ||
_vehicle doorPhase _configName; | ||
}; | ||
case "user": { | ||
_vehicle animationSourcePhase _configName; | ||
}; | ||
default { | ||
_vehicle animationPhase _configName; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_vehicle
is not defined in this function. Works currently because its called openGarage
function.
private _textures = if (_variant isEqualType "") then { | ||
getArray (_sourcesConfig >> _variant >> "textures"); | ||
} else { | ||
_variant; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No semicolon for return values of code blocks.
@@ -15,3 +15,32 @@ In order to easily apply the same customization to multiple vehicles, all vehicl | |||
- <kbd>BACKSPACE</kbd> : Toggle interface visibility. | |||
- <kbd>LMB</kbd> : Show hidden interface. | |||
- <kbd>RMB</kbd> : Toggle interface (when not panning). | |||
|
|||
### Register a Texture |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put this under frameworks
section in a new page.
private _configName = configName _x; | ||
private _displayName = getText (_x >> "displayName"); | ||
if (_displayName isEqualTo "") then { | ||
_displayName = (_configName splitString "_") joinString " "; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary parentheses.
if (_displayName isEqualTo "") then { | ||
_displayName = (_configName splitString "_") joinString " "; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would prefer a blank lines before and after the if
block.
// Some sources will return negative values | ||
if (_phase >= 0) then { | ||
_animations append [_configName, _phase]; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon.
private _vehicleType = typeOf _vehicle; | ||
private _vehicleConfig = configFile >> "CfgVehicles" >> _vehicleType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can use configOf
command.
private _configName = toLower configName _config; | ||
private _source = toLower getText (_config >> "source"); | ||
|
||
if (_source in WHITELIST_ANIMATION_SOURCES && {BLACKLIST_ANIMATION_INNAMES findIf {_x in _configName} == -1 && {BLACKLIST_ANIMATION_ATTRIBUTES findIf {isClass (_config >> _x)} == -1}}) then { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multi-line:
if (
_source in // ...
&& {}
&& {}
) then {
[_vehicle, _texture, nil, _mass] call BIS_fnc_initVehicle; | ||
}; | ||
|
||
nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary when function has return value of "None".
* Public: Yes | ||
*/ | ||
|
||
params ["_baseVehicleType", "_variantName", "_texture"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this function is public, should do type checking in params
.
if (_animation isEqualType []) then { | ||
for "_i" from 0 to (count _animation - 2) step 2 do { | ||
private _configName = _animation select _i; | ||
private _source = getText (configFile >> "CfgVehicles" >> _vehicleType >> "animationSources" >> _configName >> "source"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use configOf
}; | ||
|
||
if (_texture isEqualType [] && {count _texture < 2 || {(_texture select 1) isEqualType ""}}) then { | ||
[_vehicle, nil, nil, _mass] call BIS_fnc_initVehicle; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requires targetEvent #558
_vehicle setObjectTextureGlobal [_forEachIndex, _x]; | ||
} forEach _texture; | ||
} else { | ||
[_vehicle, _texture, nil, _mass] call BIS_fnc_initVehicle; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment above
}; | ||
|
||
// Add items to animations list | ||
private _ctrlListAnimations = _display displayCtrl IDC_LIST_ANIMATIONS; | ||
{ | ||
_x params ["_configName", "_displayName"]; | ||
|
||
private _isChecked = GVAR(center) animationPhase _configName; | ||
private _source = getText (configFile >> "CfgVehicles" >> _vehicleType >> "animationSources" >> _configName >> "source"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use configOf
When merged this pull request will:
zen_garage_fnc_defineCustomTexture
as API function for defining custom textures for the garage.