-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
342 changed files
with
72,655 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
z\addons\dayz_server |
19 changes: 19 additions & 0 deletions
19
@dayz_epoch_server/addons/dayz_server/DZAI/SHK_pos/shk_pos_fnc_findclosestposition.sqf
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,19 @@ | ||
// Return the closest position from array to the positionA. | ||
// In: [positionA,[array of positions]] | ||
// Out: positionB | ||
private ["_pA","_ps","_p1","_p2"]; | ||
_pA = _this select 0; | ||
_ps = _this select 1; | ||
|
||
_p1 = _ps select 0; | ||
|
||
if (count _ps > 1) then { | ||
for "_i" from 1 to (count _ps - 1) do { | ||
_p2 = _ps select _i; | ||
if ((_p2 distance _pA) < (_p1 distance _pA)) then { | ||
_p1 = _p2; | ||
}; | ||
}; | ||
}; | ||
|
||
_p1 |
59 changes: 59 additions & 0 deletions
59
@dayz_epoch_server/addons/dayz_server/DZAI/SHK_pos/shk_pos_fnc_getmarkercorners.sqf
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,59 @@ | ||
// In: marker | ||
// Out: array of positions | ||
private ["_area","_corners"]; | ||
_area = _this; | ||
_corners = []; | ||
|
||
// Center point | ||
private ["_center","_centerX","_centerY"]; | ||
_center = getMarkerPos _area; | ||
_centerX = _center select 0; | ||
_centerY = _center select 1; | ||
|
||
// Direction and make sure it's between 0 and 360. | ||
private ["_dir","_dirCos","_dirSin"]; | ||
_dir = (markerDir _area) * -1; | ||
_dir = _dir % 360; | ||
_dirCos = cos _dir; | ||
_dirSin = sin _dir; | ||
|
||
// Size | ||
private ["_size","_sizeX","_sizeY"]; | ||
_size = getMarkerSize _area; | ||
_sizeX = _size select 0; | ||
_sizeY = _size select 1; | ||
|
||
|
||
private ["_cosX","_sinX","_cosY","_sinY","_addX","_addY","_subX","_subY"]; | ||
_cosX = _dirCos * _sizeX; | ||
_sinX = _dirSin * _sizeX; | ||
_cosY = _dirCos * _sizeY; | ||
_sinY = _dirSin * _sizeY; | ||
|
||
_addX = _cosX + _sinY; | ||
_addY = _sinX + _cosY; | ||
_subX = _cosX - _sinY; | ||
_subY = _sinX - _cosY; | ||
|
||
private ["_posX","_posY"]; | ||
// Bottom Left | ||
_posX = _centerX - _subX; | ||
_posY = _centerY - _addY; | ||
_corners set [0,[_posX,_posY]]; | ||
|
||
// Top Left | ||
_posX = _centerX - _addX; | ||
_posY = _centerY - _subY; | ||
_corners set [1,[_posX,_posY]]; | ||
|
||
// Top Right | ||
_posX = _centerX + _subX; | ||
_posY = _centerY + _addY; | ||
_corners set [2,[_posX,_posY]]; | ||
|
||
// Bottom Right | ||
_posX = _centerX + _addX; | ||
_posY = _centerY + _subY; | ||
_corners set [3,[_posX,_posY]]; | ||
|
||
_corners |
30 changes: 30 additions & 0 deletions
30
@dayz_epoch_server/addons/dayz_server/DZAI/SHK_pos/shk_pos_fnc_getmarkershape.sqf
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,30 @@ | ||
// In: marker | ||
// Out: string (marker shape) | ||
|
||
private ["_size","_x","_y","_ret"]; | ||
_size = markersize _this; | ||
_x = _size select 0; | ||
_y = _size select 1; | ||
|
||
_ret = ""; | ||
|
||
switch (tolower(markershape _this)) do { | ||
case "rectangle": { | ||
if (_x == _y) then { | ||
_ret = "SQUARE"; | ||
} else { | ||
_ret = "RECTANGLE"; | ||
}; | ||
}; | ||
case "ellipse": { | ||
if (_x == _y) then { | ||
_ret = "CIRCLE"; | ||
} else { | ||
_ret = "ELLIPSE"; | ||
}; | ||
}; | ||
case "icon": { | ||
_ret = "ICON"; | ||
}; | ||
}; | ||
_ret |
13 changes: 13 additions & 0 deletions
13
@dayz_epoch_server/addons/dayz_server/DZAI/SHK_pos/shk_pos_fnc_getpos.sqf
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,13 @@ | ||
// In: [position,distance,direction] | ||
// Out: position | ||
private ["_pos","_dst","_dir","_orgX","_orgY","_posX","_posY"]; | ||
_pos = _this select 0; | ||
_dst = _this select 1; | ||
_dir = _this select 2; | ||
|
||
_orgX = _pos select 0; | ||
_orgY = _pos select 1; | ||
_posX = _orgX + (_dst * sin _dir); | ||
_posY = _orgY + (_dst * cos _dir); | ||
|
||
[_posX,_posY,0] |
26 changes: 26 additions & 0 deletions
26
@dayz_epoch_server/addons/dayz_server/DZAI/SHK_pos/shk_pos_fnc_getposfromcircle.sqf
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,26 @@ | ||
// In: marker | ||
// Out: position | ||
|
||
// Center point | ||
private ["_center","_centerX","_centerY"]; | ||
_center = getMarkerPos _this; | ||
_centerX = _center select 0; | ||
_centerY = _center select 1; | ||
|
||
// Size | ||
private ["_size"]; | ||
_size = getMarkerSize _this; | ||
_size = _size select 0; | ||
|
||
// Randomly pick a direction, | ||
private ["_dir","_posX","_posY","_rand","_pos"]; | ||
_dir = random 360; | ||
_rand = sqrt random 1; | ||
_posX = (_size * (cos _dir)) * _rand; | ||
_posY = (_size * (sin _dir)) * _rand; | ||
_pos = [_posX,_posY]; | ||
|
||
_posX = _centerX + (_pos select 0); | ||
_posY = _centerY + (_pos select 1); | ||
|
||
[_posX,_posY,0] |
43 changes: 43 additions & 0 deletions
43
@dayz_epoch_server/addons/dayz_server/DZAI/SHK_pos/shk_pos_fnc_getposfromellipse.sqf
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,43 @@ | ||
// In: ellipseMarker | ||
// Out: position | ||
|
||
// Center point | ||
private ["_center","_centerX","_centerY"]; | ||
_center = getMarkerPos _this; | ||
_centerX = _center select 0; | ||
_centerY = _center select 1; | ||
|
||
// Direction and make sure it's between 0 and 360. | ||
private ["_dirMrk"]; | ||
_dirMrk = (markerDir _this) * -1; | ||
_dirMrk = _dirMrk % 360; | ||
|
||
// Size | ||
private ["_size","_sizeX","_sizeY"]; | ||
_size = getMarkerSize _this; | ||
_sizeX = _size select 0; | ||
_sizeY = _size select 1; | ||
|
||
// If B axis is longer than A, switch them and fix direction. | ||
if (_sizeX < _sizeY) then { | ||
_sizeX = _size select 1; | ||
_sizeY = _size select 0; | ||
_dirMrk = _dirMrk + 90; | ||
}; | ||
|
||
// Randomly pick a direction, | ||
private ["_dir","_posX","_posY","_rand","_pos"]; | ||
_dir = random 360; | ||
_rand = sqrt random 1; | ||
_posX = (_sizeX * (cos _dir)) * _rand; | ||
_posY = (_sizeY * (sin _dir)) * _rand; | ||
_pos = [_posX,_posY]; | ||
|
||
if (_dirMrk != 0) then { | ||
_pos = [_pos,_dirMrk] call SHK_pos_fnc_rotatePosition; | ||
}; | ||
|
||
_posX = _centerX + (_pos select 0); | ||
_posY = _centerY + (_pos select 1); | ||
|
||
[_posX,_posY,0] |
37 changes: 37 additions & 0 deletions
37
@dayz_epoch_server/addons/dayz_server/DZAI/SHK_pos/shk_pos_fnc_getposfromrectangle.sqf
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,37 @@ | ||
// In: marker | ||
// Out: position | ||
|
||
// Center point | ||
private ["_center","_centerX","_centerY"]; | ||
_center = getMarkerPos _this; | ||
_centerX = _center select 0; | ||
_centerY = _center select 1; | ||
|
||
// Size | ||
private ["_size","_sizeX","_sizeY"]; | ||
_size = getMarkerSize _this; | ||
_sizeX = _size select 0; | ||
_sizeY = _size select 1; | ||
|
||
// Direction and make sure it's between 0 and 360. | ||
private ["_dir","_dirCos","_dirSin"]; | ||
_dir = (markerDir _this) * -1; | ||
_dir = _dir % 360; | ||
_dirCos = cos _dir; | ||
_dirSin = sin _dir; | ||
|
||
private ["_rndX","_rndY","_posX","_posY"]; | ||
// Select random X and Y | ||
_rndX = (random (_sizeX * 2)) - _sizeX; | ||
_rndY = (random (_sizeY * 2)) - _sizeY; | ||
|
||
// If area is angled, shift X and Y | ||
if (_dir != 0) then { | ||
_posX = _centerX + (_dirCos * _rndX - _dirSin * _rndY); | ||
_posY = _centerY + (_dirSin * _rndX + _dirCos * _rndY); | ||
} else { | ||
_posX = _centerX + _rndX; | ||
_posY = _centerY + _rndY; | ||
}; | ||
|
||
[_posX,_posY,0] |
36 changes: 36 additions & 0 deletions
36
@dayz_epoch_server/addons/dayz_server/DZAI/SHK_pos/shk_pos_fnc_getposfromsquare.sqf
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,36 @@ | ||
// In: marker | ||
// Out: position | ||
|
||
// Center point | ||
private ["_center","_centerX","_centerY"]; | ||
_center = getMarkerPos _this; | ||
_centerX = _center select 0; | ||
_centerY = _center select 1; | ||
|
||
// Size | ||
private ["_size"]; | ||
_size = getMarkerSize _this; | ||
_size = _size select 0; | ||
|
||
// Direction and make sure it's between 0 and 360. | ||
private ["_dir","_dirCos","_dirSin"]; | ||
_dir = (markerDir _this) * -1; | ||
_dir = _dir % 360; | ||
_dirCos = cos _dir; | ||
_dirSin = sin _dir; | ||
|
||
private ["_rndX","_rndY","_posX","_posY"]; | ||
// Select random X and Y | ||
_rndX = (random (_size * 2)) - _size; | ||
_rndY = (random (_size * 2)) - _size; | ||
|
||
// If area is angled, shift X and Y | ||
if (_dir != 0) then { | ||
_posX = _centerX + (_dirCos * _rndX - _dirSin * _rndY); | ||
_posY = _centerY + (_dirSin * _rndX + _dirCos * _rndY); | ||
} else { | ||
_posX = _centerX + _rndX; | ||
_posY = _centerY + _rndY; | ||
}; | ||
|
||
[_posX,_posY,0] |
85 changes: 85 additions & 0 deletions
85
@dayz_epoch_server/addons/dayz_server/DZAI/SHK_pos/shk_pos_fnc_isblacklisted.sqf
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,85 @@ | ||
// In: [position,blackListMarker] | ||
// Out: boolean | ||
|
||
private ["_pos","_area","_return"]; | ||
_pos = _this select 0; | ||
_area = _this select 1; | ||
_return = false; | ||
|
||
// Find corner positions of the rectangle | ||
private ["_dir"]; | ||
_dir = markerDir _area; | ||
_dir = _dir % 360; | ||
|
||
// Center point | ||
private ["_center","_centerX","_centerY"]; | ||
_center = getMarkerPos _area; | ||
_centerX = _center select 0; | ||
_centerY = _center select 1; | ||
|
||
private ["_shape"]; | ||
_shape = _area call SHK_pos_fnc_getMarkerShape; | ||
|
||
if (_shape == "ICON") then { | ||
// Icon has only one position, so if it equals to the given position, then it's blacklisted. | ||
if ([_pos,_center] call SHK_pos_fnc_isSamePosition) then { | ||
_return = true; | ||
}; | ||
|
||
// Markers that have an area. | ||
} else { | ||
if (_shape in ["RECTANGLE","SQUARE"]) then { | ||
private ["_corners"]; | ||
_corners = _area call SHK_pos_fnc_getMarkerCorners; | ||
|
||
// If rectangle is not axis-aligned. | ||
if (_dir % 90 != 0) then { | ||
// Add the point position to the array to have it shifted by the FOR below | ||
_corners set [4,_pos]; | ||
|
||
// Rotate each corner position so that the rectangle is aligned with x and y axises | ||
// Use origo as center while rotating, but for comparison shift positions back | ||
private ["_posCor","_posNew","_orgX","_orgY","_shiftedX","_shiftedY","_newX","_newY"]; | ||
for "_i" from 0 to (count _corners - 1) do { | ||
_posCor = _corners select _i; | ||
|
||
// Original coordinates | ||
_orgX = _posCor select 0; | ||
_orgY = _posCor select 1; | ||
|
||
// Subtract the marker center coordinates from corner coordinates. | ||
// Rotation is done using origo (0,0) as anchor/centerpoint. | ||
_shiftedX = _orgX - _centerX; | ||
_shiftedY = _orgY - _centerY; | ||
|
||
// Axis-aligned corner position | ||
_posNew = [[_shiftedX,_shiftedY],_dir] call SHK_pos_fnc_rotatePosition; | ||
|
||
// Shift the aligned corner position back near to the original marker location. | ||
_newX = _posNew select 0; | ||
_newY = _posNew select 1; | ||
_newX = _newX + _centerX; | ||
_newY = _newY + _centerY; | ||
|
||
_posCor = [_newX,_newY]; | ||
|
||
_corners set [_i,_posCor]; | ||
}; | ||
|
||
// Point position | ||
_pos = _corners select 4; | ||
}; | ||
|
||
// Check if the position is within the marker area. | ||
_return = [_pos,_corners] call SHK_pos_fnc_isInRectangle; | ||
} else { | ||
if (_shape == "CIRCLE") then { | ||
_return = [_pos,_area] call SHK_pos_fnc_isInCircle; | ||
} else { | ||
_return = [_pos,_area] call SHK_pos_fnc_isInEllipse; | ||
}; | ||
}; | ||
}; | ||
|
||
|
||
_return |
Oops, something went wrong.