123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- if (isServer) then {
- params ["_v","_w"];
- private [
- "_selectionLod",
- "_weaponStartPos",
- "_weaponEndPos",
- "_weaponWorldStart",
- "_weaponWorldEnd",
- "_weaponDir",
- "_maxDistance",
- "_crosshairPos",
- "_intersection"
- ];
- private [
- "_laser_chamber",
- "_laser_muzzle",
- "_laser_anim"
- ];
- _v = _this select 0;
- _w = _this select 1;
-
-
- if (_w == "RD501_turret_laat_ball_beam_l" || _w == "RD501_turret_laat_ball_beam_r") then {
- if (_w == "RD501_turret_laat_ball_beam_l") then {
- _laser_chamber = "Laser_L_chamber";
- _laser_muzzle = "Laser_L_muzzle";
- _laser_anim = "Laser_L";
- } else {
- if (_w == "RD501_turret_laat_ball_beam_r") then {
- _laser_chamber = "Lazer_R_chamber";
- _laser_muzzle = "Laser_R_muzzle";
- _laser_anim = "Laser_R";
- };
- } ;
-
-
-
-
-
-
- if (_v animationphase _laser_anim == 0) then {
- _selectionLod= "memory";
- _weaponStartPos = _v selectionPosition [_laser_chamber ,_selectionLod];
- _weaponEndPos = _v selectionPosition [_laser_muzzle ,_selectionLod];
- _weaponWorldStart = _v modelToWorld _weaponStartPos;
- _weaponWorldEnd = _v modelToWorld _weaponEndPos;
- _weaponDir = _weaponWorldStart vectorFromTo _weaponWorldEnd;
- _maxDistance = 2000;
- _crosshairPos = [(_weaponWorldStart select 0 )+ ((_weaponDir select 0)*_maxDistance ),(_weaponWorldStart select 1 ) + ((_weaponDir select 1)*_maxDistance ),(_weaponWorldStart select 2)+ ((_weaponDir select 2)*_maxDistance )];
- _intersection = lineIntersectsSurfaces
- [
- AGLToASL _weaponWorldEnd,
- AGLToASL _crosshairPos,
- vehicle player,
- player,
- true,
- 1,
- "VIEW",
- "GEOM"
- ];
- if (count _intersection > 0) then
- {
- _crosshairPos = ASLToAGL (_intersection select 0 select 0);
- };
- _distanceToTarget = _weaponWorldEnd vectorDistance _crosshairPos;
-
- _v animateSource [_laser_anim, _distanceToTarget, true];
- sleep 0.08;
- _v animateSource [_laser_anim, 0, true];
- };
- };
- };
|