-
Notifications
You must be signed in to change notification settings - Fork 738
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
Open glass and CUP doors #5226
Open glass and CUP doors #5226
Conversation
Fixed so glassdoor now works with ace slow open.
Made it more pretty with new file
You need to use 4 spaces for indentation instead of tabs. If you use a text editor like Sublime Text, Atom or Notepad++ you should be able to change that in your settings. |
Or just install EditorConfig plugin for the editor you use and it will be automatic (we have configuration for it). |
Replace tabs with spaces
Changes to go with code guidlines and extra check if door is empty
Fixed so CUP houses now works
Changes to Pullrequest: |
Known issue when on CUP houses if you have a door that is both glass and door then if you aim on the glass it wont open. but if you aim on the doorframe then it works. it wont make a click sound when on the glass. |
Should use |
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.
I like this very much, but the code should be more precise with the usage of private
variables. It helps a lot when trying to create clean SQF.
private _lockedVariable = []; | ||
|
||
{ | ||
_animName = _x; |
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 private
@@ -22,102 +22,19 @@ params ["_house", "_door"]; | |||
|
|||
private ["_index", "_animations", "_lockedVariable"]; |
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.
delete this
_door = [_distance, _house, _door] call FUNC(getGlassDoor); | ||
}; | ||
|
||
if (isNil "_door") exitWith {systemChat "Wrong"; [_house, ""]}; |
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.
debug doesn't use systemChat
private _glassPos = (_house selectionPosition [(_glassDoor select 0) + "_" + (_glassDoor select 1) + "_effects", "Memory"]); | ||
// Calculate all animation names so we know what is there | ||
{ | ||
_animName = _x; |
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.
private
here. The variable is not used outside this scope
{ | ||
_animName = _x; | ||
if ((["door", _animName] call BIS_fnc_inString) && !(["locked", _animName] call BIS_fnc_inString) && !(["disabled", _animName] call BIS_fnc_inString) && !(["handle", _animName] call BIS_fnc_inString)) then { | ||
_splitStr = _animName splitString "_"; |
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.
private
here. The variable is not used outside this scope
//Need to set the value in the beginning | ||
if (_lowestDistance == 0) then { | ||
_lowestDistance = _objDist; | ||
_newString = (_doorParts select _forEachIndex) splitString "_"; |
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.
private
here. The variable is not used outside this scope. No reason not to reuse the same identifier for a temporary value as _splitStr
uses a few blocks before this one.
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.
changed _newString to _splitStr and decaled private ["_splitStr"];
just over if (_objDist <= _distance) then {
. Okey?
Will try so everything works later will push after tested.
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.
Just use private _splitStr =
here and in the if block below, as well as in L32 above.
They are unrelated and only temporary, so there is no need for them to be set to the same scope. Yet the concept is the same so they should use the same identifier.
|
||
params ["_distance", "_house", "_door"]; | ||
|
||
private ["_animName", "_splitStr", "_newString", "_objDist", "_animate"]; |
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.
delete this
_objDist
and _animate
are already set to private in their scopes.
This seems to be working pretty good
|
|
||
//Check if door is glass because then we need to find the proper location of the door so we can use it | ||
if ((_door find "glass") != -1) then { | ||
_door = [_distance, _house, _door] call FUNC(getGlassDoor); |
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.
white space
|
||
{ | ||
private _animName = toLower _x; | ||
if ((_animName find (toLower _door)) != -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.
white space
if ((isNil "_door") || ((_door find "glass") != -1)) exitWith {}; | ||
|
||
_door | ||
|
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.
many lines with white space in this file
Sublime Text 3 is the best editor
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.
Well white lines are nice for readability. Segmenting the code, there is not a single white line in a segment. A segment could be a forEach and it wont affect the performance of the code. So I'm hesitating to do this change.
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.
Commy means spaces (literally) after text. There are a few lines in this file that have that.
I suggest you install EditorConfig plugin for your editor, it will automatically clean that up. Otherwise you can probably also manually set it.
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.
Some text editors let you visualize whitespace,
Notepad++: View -> Show Symbol -> Show White Space and Tab
Sublimb Text: "draw_white_space": "all"
I think Atom is "Show Invisables"
EditorConfig should also clean these up automatically and prevent things like tabs from being saved
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.
Okey I fixed sublime with EditorConfig and all that setup so should not be a problem now. It should say something about this in the Developer wiki.
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.
could be added somewhere to:
https://ace3mod.com/wiki/development/coding-guidelines.html
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.
lgtm
Thank you for the contribution and for having the patience to satisfy my OCD. :)
Will make sure that you can Ace slow open glass doors.
Also a bit flexible animation gathering instead of fixed strings.
CUP houses now works to incremental open!
The reason behind getGlassDoor is that if you do the regular door check you will get the hide and unhide of the glass pane. So you then need to find the closest doorobject because thats the door.
When merged this pull request will: