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

Open glass and CUP doors #5226

Merged
merged 12 commits into from
Jun 2, 2017
Merged

Open glass and CUP doors #5226

merged 12 commits into from
Jun 2, 2017

Conversation

Phyma
Copy link
Contributor

@Phyma Phyma commented May 31, 2017

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:

  • Describe what this pull request will do
  • Each change in a separate line
  • Include documentation if applicable
  • Respect the Development Guidelines

Phyma added 4 commits May 31, 2017 04:16
Fixed so glassdoor now works with ace slow open.
Made it more pretty with new file
@Phyma Phyma mentioned this pull request May 31, 2017
@BaerMitUmlaut
Copy link
Member

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.

@jonpas
Copy link
Member

jonpas commented May 31, 2017

Or just install EditorConfig plugin for the editor you use and it will be automatic (we have configuration for it).

Phyma added 5 commits May 31, 2017 09:34
Replace tabs with spaces
Changes to go with code guidlines and extra check if door is empty
Fixed so CUP houses now works
@Phyma
Copy link
Contributor Author

Phyma commented May 31, 2017

Changes to Pullrequest:
CUP houses now works to incremental open!

@Phyma Phyma changed the title Open glass doors Open glass and CUP doors May 31, 2017
@Phyma
Copy link
Contributor Author

Phyma commented May 31, 2017

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.

@jonpas
Copy link
Member

jonpas commented May 31, 2017

Should use STRING find SUBSTRING != -1 instead of BI function.

Copy link
Contributor

@commy2 commy2 left a 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;
Copy link
Contributor

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"];
Copy link
Contributor

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, ""]};
Copy link
Contributor

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;
Copy link
Contributor

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 "_";
Copy link
Contributor

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 "_";
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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"];
Copy link
Contributor

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.

@commy2 commy2 self-assigned this May 31, 2017
@PabstMirror PabstMirror added this to the 3.10.0 milestone Jun 1, 2017
@PabstMirror PabstMirror added kind/bug-fix Release Notes: **FIXED:** kind/enhancement Release Notes: **IMPROVED:** labels Jun 1, 2017
@PabstMirror
Copy link
Contributor

This seems to be working pretty good

  • opening altis/stratis glass doors
    (except the sliding ones on the airport terminal, but I think they are extra weird)
  • working on CUP_Terrain buildings


//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);
Copy link
Contributor

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 {
Copy link
Contributor

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

Copy link
Contributor

@commy2 commy2 Jun 1, 2017

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

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor

@PabstMirror PabstMirror Jun 1, 2017

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

Copy link
Contributor Author

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.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

@commy2 commy2 left a 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. :)

@PabstMirror PabstMirror merged commit 288f956 into acemod:master Jun 2, 2017
@Phyma Phyma deleted the opendoor-custom branch June 8, 2017 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug-fix Release Notes: **FIXED:** kind/enhancement Release Notes: **IMPROVED:**
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants