-
Notifications
You must be signed in to change notification settings - Fork 740
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
Changes from 10 commits
a964c03
998b242
aec5ed5
fce2b9c
de84521
e9625be
f41fce7
bcca866
2218de4
0bb4f14
d6124c6
0e5f0a4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Author: commy2 | ||
* Author: commy2, Phyma | ||
* Find door. | ||
* | ||
* Arguments: | ||
|
@@ -39,4 +39,11 @@ _door = _intersections select 0 select 0; | |
|
||
if (isNil "_door") exitWith {[_house, ""]}; | ||
|
||
//Check if door is glass because then we need to find the proper location of the door so we can use it | ||
if (["glass", _door] call BIS_fnc_inString) then { | ||
_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 commentThe reason will be displayed to describe this comment to others. Learn more. debug doesn't use |
||
|
||
[_house, _door] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
* Author: commy2 | ||
* Get door animations. @todo rewrite for better custom building support | ||
* Author: commy2, Phyma | ||
* Get door animations. | ||
* | ||
* Arguments: | ||
* 0: House <OBJECT> | ||
|
@@ -22,102 +22,19 @@ params ["_house", "_door"]; | |
|
||
private ["_index", "_animations", "_lockedVariable"]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. delete this |
||
|
||
_index = [ | ||
"door_1", | ||
"door_2", | ||
"door_3", | ||
"door_4", | ||
"door_5", | ||
"door_6", | ||
"door_7", | ||
"door_8", | ||
"door_9", | ||
"door_10", | ||
"door_11", | ||
"door_12", | ||
"door_13", | ||
"door_14", | ||
"door_15", | ||
"door_16", | ||
"door_17", | ||
"door_18", | ||
"door_19", | ||
"door_20", | ||
"door_21", | ||
"door_22", | ||
|
||
"hatch_1", | ||
"hatch_2", | ||
"hatch_3", | ||
"hatch_4", | ||
"hatch_5", | ||
"hatch_6" | ||
] find toLower _door; | ||
|
||
if (_index == -1) exitWith {[[],""]}; | ||
|
||
_animations = [ | ||
["Door_1_rot", "Door_Handle_1_rot_1", "Door_Handle_1_rot_2"], | ||
["Door_2_rot", "Door_Handle_2_rot_1", "Door_Handle_2_rot_2"], | ||
["Door_3_rot", "Door_Handle_3_rot_1", "Door_Handle_3_rot_2"], | ||
["Door_4_rot", "Door_Handle_4_rot_1", "Door_Handle_4_rot_2"], | ||
["Door_5_rot", "Door_Handle_5_rot_1", "Door_Handle_5_rot_2"], | ||
["Door_6_rot", "Door_Handle_6_rot_1", "Door_Handle_6_rot_2"], | ||
["Door_7_rot", "Door_Handle_7_rot_1", "Door_Handle_7_rot_2"], | ||
["Door_8_rot", "Door_Handle_8_rot_1", "Door_Handle_8_rot_2"], | ||
["Door_9_rot", "Door_Handle_9_rot_1", "Door_Handle_9_rot_2"], | ||
["Door_10_rot", "Door_Handle_10_rot_1", "Door_Handle_10_rot_2"], | ||
["Door_11_rot", "Door_Handle_11_rot_1", "Door_Handle_11_rot_2"], | ||
["Door_12_rot", "Door_Handle_12_rot_1", "Door_Handle_12_rot_2"], | ||
["Door_13_rot", "Door_Handle_13_rot_1", "Door_Handle_13_rot_2"], | ||
["Door_14_rot", "Door_Handle_14_rot_1", "Door_Handle_14_rot_2"], | ||
["Door_15_rot", "Door_Handle_15_rot_1", "Door_Handle_15_rot_2"], | ||
["Door_16_rot", "Door_Handle_16_rot_1", "Door_Handle_16_rot_2"], | ||
["Door_17_rot", "Door_Handle_17_rot_1", "Door_Handle_17_rot_2"], | ||
["Door_18_rot", "Door_Handle_18_rot_1", "Door_Handle_18_rot_2"], | ||
["Door_19_rot", "Door_Handle_19_rot_1", "Door_Handle_19_rot_2"], | ||
["Door_20_rot", "Door_Handle_20_rot_1", "Door_Handle_20_rot_2"], | ||
["Door_21_rot", "Door_Handle_21_rot_1", "Door_Handle_21_rot_2"], | ||
["Door_22_rot", "Door_Handle_22_rot_1", "Door_Handle_22_rot_2"], | ||
|
||
["Hatch_1_rot"], | ||
["Hatch_2_rot"], | ||
["Hatch_3_rot"], | ||
["Hatch_4_rot"], | ||
["Hatch_5_rot"], | ||
["Hatch_6_rot"] | ||
] select _index; | ||
|
||
_lockedVariable = [ | ||
["BIS_Disabled_Door_1", "Door_Handle_1_rot_1", "Door_Locked_1_rot"], | ||
["BIS_Disabled_Door_2", "Door_Handle_2_rot_1", "Door_Locked_2_rot"], | ||
["BIS_Disabled_Door_3", "Door_Handle_3_rot_1", "Door_Locked_3_rot"], | ||
["BIS_Disabled_Door_4", "Door_Handle_4_rot_1", "Door_Locked_4_rot"], | ||
["BIS_Disabled_Door_5", "Door_Handle_5_rot_1", "Door_Locked_5_rot"], | ||
["BIS_Disabled_Door_6", "Door_Handle_6_rot_1", "Door_Locked_6_rot"], | ||
["BIS_Disabled_Door_7", "Door_Handle_7_rot_1", "Door_Locked_7_rot"], | ||
["BIS_Disabled_Door_8", "Door_Handle_8_rot_1", "Door_Locked_8_rot"], | ||
["BIS_Disabled_Door_9", "Door_Handle_9_rot_1", "Door_Locked_9_rot"], | ||
["BIS_Disabled_Door_10", "Door_Handle_10_rot_1", "Door_Locked_10_rot"], | ||
["BIS_Disabled_Door_11", "Door_Handle_11_rot_1", "Door_Locked_11_rot"], | ||
["BIS_Disabled_Door_12", "Door_Handle_12_rot_1", "Door_Locked_12_rot"], | ||
["BIS_Disabled_Door_13", "Door_Handle_13_rot_1", "Door_Locked_13_rot"], | ||
["BIS_Disabled_Door_14", "Door_Handle_14_rot_1", "Door_Locked_14_rot"], | ||
["BIS_Disabled_Door_15", "Door_Handle_15_rot_1", "Door_Locked_15_rot"], | ||
["BIS_Disabled_Door_16", "Door_Handle_16_rot_1", "Door_Locked_16_rot"], | ||
["BIS_Disabled_Door_17", "Door_Handle_17_rot_1", "Door_Locked_17_rot"], | ||
["BIS_Disabled_Door_18", "Door_Handle_18_rot_1", "Door_Locked_18_rot"], | ||
["BIS_Disabled_Door_19", "Door_Handle_19_rot_1", "Door_Locked_19_rot"], | ||
["BIS_Disabled_Door_20", "Door_Handle_20_rot_1", "Door_Locked_20_rot"], | ||
["BIS_Disabled_Door_21", "Door_Handle_21_rot_1", "Door_Locked_21_rot"], | ||
["BIS_Disabled_Door_22", "Door_Handle_22_rot_1", "Door_Locked_22_rot"], | ||
|
||
["", ""], | ||
["", ""], | ||
["", ""], | ||
["", ""], | ||
["", ""], | ||
["", ""] | ||
] select _index; | ||
private _animate = animationNames _house; | ||
private _animations = []; | ||
private _lockedVariable = []; | ||
|
||
{ | ||
_animName = _x; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing |
||
if ([toLower _door, _animName] call BIS_fnc_inString) then { | ||
if (["disabled", _animName] call BIS_fnc_inString || ["locked", _animName] call BIS_fnc_inString) then { | ||
_LockedVariable pushBack _animName; | ||
} else { | ||
_animations pushBack _animName; | ||
}; | ||
}; | ||
} forEach _animate; | ||
|
||
[_animations, _lockedVariable] |
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 ["_animName", "_splitStr", "_newString", "_objDist", "_animate"]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. delete this |
||
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 | ||
{ | ||
_animName = _x; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
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 commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
_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; | ||
|
||
if (_objDist <= _distance) then { | ||
//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 commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changed _newString to _splitStr and decaled There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just use |
||
_door = (_newString select 0) + "_" + (_newString select 1); | ||
} else { | ||
if (_objDist < _lowestDistance) then { | ||
_lowestDistance = _objDist; | ||
_newString = (_doorParts select _forEachIndex) splitString "_"; | ||
_door = (_newString select 0) + "_" + (_newString select 1); | ||
}; | ||
}; | ||
}; | ||
} forEach _doorPos; | ||
|
||
// Check if we have a door or if it is the glass part | ||
if (isNil "_door"|| (["glass", _door] call BIS_fnc_inString)) exitWith {}; | ||
|
||
_door | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. many lines with white space in this file There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe 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 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. could be added somewhere to: |
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