-
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
Merged
Merged
Open glass and CUP doors #5226
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
a964c03
Fixed glassdoor
Phyma 998b242
Made it more pretty with new file
Phyma aec5ed5
Tidy up a bit
Phyma fce2b9c
Removed white space
Phyma de84521
Replace tabs with spaces
Phyma e9625be
Simplified and added comments
Phyma f41fce7
Changes + was stupid was commit
Phyma bcca866
Tabs to spaces
Phyma 2218de4
Small fixes + Fixed so CUP houses now works
Phyma 0bb4f14
Remove todo
Phyma d6124c6
Fixed requested changes
Phyma 0e5f0a4
Removed whitespaces
Phyma File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* Author: Phyma | ||
* Find glass door. | ||
* | ||
* Arguments: | ||
* 0: Distance <NUMBER> | ||
* 1: House <OBJECT> | ||
* 2: Door name <STRING> | ||
* | ||
* Return Value: | ||
* 0: Door Name <STRING> | ||
* | ||
* Example: | ||
* [player, target] call ace_interaction_fnc_getGlassDoor | ||
* | ||
* Public: No | ||
*/ | ||
#include "script_component.hpp" | ||
|
||
params ["_distance", "_house", "_door"]; | ||
|
||
private _doorParts = []; | ||
private _doorPos = []; | ||
private _animate = animationNames _house; | ||
private _glassDoor = _door splitString "_"; | ||
private _glassPos = (_house selectionPosition [(_glassDoor select 0) + "_" + (_glassDoor select 1) + "_effects", "Memory"]); | ||
// Calculate all animation names so we know what is there | ||
{ | ||
private _animName = toLower _x; | ||
if (((_animName find "door") != -1) && ((_animName find "locked") == -1) && ((_animName find "disabled") == -1) && ((_animName find "handle") == -1)) then { | ||
private _splitStr = _animName splitString "_"; | ||
_doorParts pushBack ((_splitStr select 0) + "_" + (_splitStr select 1) + "_trigger"); | ||
}; | ||
} forEach _animate; | ||
|
||
|
||
// Get the pos of all the door components and save the parts | ||
{ | ||
_doorPos pushBack (_house selectionPosition [_x, "Memory"]); | ||
} forEach _doorParts; | ||
|
||
// Calculate what door that is closest to the glass door | ||
private _lowestDistance = 0; | ||
{ | ||
private _objDist = _glassPos distance _x; | ||
//Make sure we dont take another door by mistake | ||
if (_objDist <= _distance) then { | ||
//Need to set the value in the beginning | ||
if (_lowestDistance == 0) then { | ||
_lowestDistance = _objDist; | ||
private _splitStr = (_doorParts select _forEachIndex) splitString "_"; | ||
_door = (_splitStr select 0) + "_" + (_splitStr select 1); | ||
} else { | ||
if (_objDist < _lowestDistance) then { | ||
_lowestDistance = _objDist; | ||
private _splitStr = (_doorParts select _forEachIndex) splitString "_"; | ||
_door = (_splitStr select 0) + "_" + (_splitStr select 1); | ||
}; | ||
}; | ||
}; | ||
} forEach _doorPos; | ||
|
||
// Check if we have a door or if it is the glass part | ||
if ((isNil "_door") || ((_door find "glass") != -1)) exitWith {}; | ||
|
||
_door | ||
|
||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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