View Restriction - Add setting to preserve view for vehicle types#107
View Restriction - Add setting to preserve view for vehicle types#107jonpas merged 2 commits intoacemod:masterfrom
Conversation
| QGVAR(preserveView), | ||
| "CHECKBOX", | ||
| [LSTRING(SettingPreserveViewName), LSTRING(SettingPreserveViewDesc)], | ||
| "ACEX " + localize LSTRING(ModuleDisplayName), |
There was a problem hiding this comment.
why? It's slower and not more readable.
There was a problem hiding this comment.
You're right, for 2 strings it's slower. But such a tiny bit that I think just using format is better overall.
There was a problem hiding this comment.
In case of changes in the future, it's easier to add another, without risking worse performance loss. But this is so minimal in this case no one cares.
Actually why not just have "ACEX" as part of string?
There was a problem hiding this comment.
Actually why not just have "ACEX" as part of string?
It's already used in editor module name.
| #include "script_component.hpp" | ||
|
|
||
| params ["_enabled"]; | ||
| if (!_enabled || {GVAR(mode) > 0}) exitWith { |
Why exactly is that restriction? Could this not be solved by a simple check of what View Restriction mode is set to and then ignoring the view perservation? |
|
I just don't need it and don't want to implement those numerous |
|
Good from my side, can be improved later if someone wants the functionality I mentioned above. Other ACE Settings also need to be moved to CBA Settings. |
jonpas
left a comment
There was a problem hiding this comment.
Just two tiny things @Dystopian, small performance gain.
|
|
||
| private _vehicle = vehicle _player; | ||
| private _vehicleClass = {if (_vehicle isKindOf _x) exitWith {_x}} forEach ["CAManBase", "LandVehicle", "Air", "Ship", "All"]; | ||
| private _varName = QGVAR(preserveView) + _vehicleClass; |
There was a problem hiding this comment.
Use format [QGVAR(preserveView%1), _vehicleClass].
There was a problem hiding this comment.
it's slower not faster
There was a problem hiding this comment.
Are you sure? Last I remember format was faster. But that could be just on more concatenations or longer strings.
There was a problem hiding this comment.
I'm sure. It's faster for more than 2 strings. You said that too above #107 (comment) 😆
| if !([_cameraView, cameraOn] call FUNC(canChangeCamera)) exitWith {}; | ||
|
|
||
| private _vehicleClass = {if (_vehicle isKindOf _x) exitWith {_x}} forEach ["CAManBase", "LandVehicle", "Air", "Ship", "All"]; | ||
| private _savedView = profileNamespace getVariable (QGVAR(preserveView) + _vehicleClass); |
There was a problem hiding this comment.
Use format [QGVAR(preserveView%1), _vehicleClass].
When merged this pull request will:
This feature switches view on vehicle enter/exit to last used in this vehicle type/on foot. Supported types are the same as for
Selectivemode:LandVehicle,Air,Ship.This setting will work only if View Restriction mode is
Disabled.Please higher attention to english strings.
To discuss: