Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private ["_projectile","_unit","_ammo"];
- //[unit, weapon, muzzle, mode, ammo, magazine, projectile]
- _unit = _this select 0;
- //_weapon = _this select 1;
- _ammo = _this select 4;
- _projectile = _this select 6;
- //Alert Nearby
- _audible = getNumber (configFile >> "CfgAmmo" >> _ammo >> "audibleFire");
- _caliber = getNumber (configFile >> "CfgAmmo" >> _ammo >> "caliber");
- _distance = round(_audible * 10 * _caliber);
- _origdist = _distance;
- // Modified for sound dampening if raining (based upon intensity) by ^bdc
- if (dayz_PlayerFiredSoundRealism_RainSoundDampening) then {
- _CorrectionFactor = 0;
- _RainAmt = drn_var_DynamicWeather_Rain; // referenced from \z\addons\dayz_code\system\DynamicWeatherEffects.sqf
- if ((_distance > 0) and (_RainAmt > 0)) then {
- if (_RainAmt > 0.72) then { // very heavy rain
- _CorrectionFactor = dayz_PlayerFiredSoundRealism_VeryHeavyRainMagnitude; }; // 40%
- if (_RainAmt > 0.53) then { // heavy rain
- _CorrectionFactor = dayz_PlayerFiredSoundRealism_HeavyRainMagnitude; }; // 55%
- if (_RainAmt > 0.25) then { // medium rain
- _CorrectionFactor = dayz_PlayerFiredSoundRealism_ModerateRainMagnitude; }; // 70%
- if (_RainAmt < 0.25) then { // light rain
- _CorrectionFactor = dayz_PlayerFiredSoundRealism_ModerateRainMagnitude; }; // 85%
- _distance = (_distance * _CorrectionFactor);
- };
- };
- if (dayz_PlayerFiredSoundRealism_Enabled) then { // init.sqf
- _distance = (_distance * dayz_PlayerFiredSoundRealism_Magnitude);
- if (_distance >= dayz_PlayerFiredSoundRealism_MaximumDisAudialRange) then {
- _distance = dayz_PlayerFiredSoundRealism_MaximumDisAudialRange;
- };
- };
- dayz_disAudial = _distance;
- dayz_firedCooldown = time;
- if (dayz_PlayerFiredSoundRealism_Logging) then {
- diag_log format["Player_Fired.SQF: Diagnostic: OriginalDistance %1 RainCorrectionFactor %2 TotalDistance %3 SoundRealismMagnitude %4",_origdist,_CorrectionFactor,dayz_disAudial,dayz_PlayerFiredSoundRealism_Magnitude];
- };
- // added for debug - ^bdc
- //cutText [format["Player fired - ammo %1 audible %2 caliber %3 distance %4 RainAmt %5",_ammo,_audible,_caliber,_distance,_RainAmt], "PLAIN DOWN"];
- if (_ammo isKindOf "Melee") exitWith {
- _unit playActionNow "GestureSwing";
- };
- if ((_ammo isKindOf "SmokeShell") or (_ammo isKindOf "GrenadeHandTimedWest") or (_ammo isKindOf "G_40mm_HE")) then {
- if (_ammo isKindOf "G_40mm_HE") then { dayz_disAudial = 30 };
- [_unit,_ammo] spawn {
- private ["_pos","_group","_localtargets","_remotetargets"];
- _unit = _this select 0;
- _ammo = _this select 1;
- _projectile = nearestObject [_unit, _ammo];
- _pos = getPosATL _projectile;
- if (_ammo isKindOf "SmokeShell") then {
- while { ((getPosATL _projectile) select 2) >= 1 } do {
- _pos = getPosATL _projectile;
- sleep 0.01;
- };
- _listTalk = _pos nearEntities ["zZombie_Base",50];
- {
- _group = group _x;
- if (isNull group _x) then {
- _group = _x;
- };
- _isLocal = (local _x);
- _x reveal [_projectile,4];
- _localtargets = _group getVariable ["localtargets",[]];
- _remotetargets = _group getVariable ["remotetargets",[]];
- _targets = _localtargets + _remotetargets;
- if (!(_projectile in _targets)) then {
- switch (_isLocal) do {
- case false: {
- _remotetargets set [count _remotetargets,_projectile];
- _x setVariable ["remotetargets",_remotetargets,true];
- };
- case true: {
- _localtargets set [count _localtargets,_projectile];
- _x setVariable ["localtargets",_localtargets,false];
- };
- };
- };
- } forEach _listTalk;
- } else {
- while { alive _projectile } do {
- _pos = getPosATL _projectile;
- sleep 0.01;
- };
- _listTalk = _pos nearEntities ["zZombie_Base",50];
- {
- _x setVariable ["myDest",_pos]; // removed networked var. targets should be enough
- } forEach _listTalk;
- };
- };
- } else {
- [_unit,_distance,true,(getPosATL player)] call player_alertZombies;
- /*
- _combattimeout = player getVariable["combattimeout",0];
- if (_combattimeout > 0) then {
- _timeleft = _combattimeout - time;
- if (_timeleft > 0) then {
- // [getPosATL player] call combat_spawnZombies;
- } else {
- };
- } else {
- };
- */
- //Check if need to place arrow
- if (_ammo isKindOf "Bolt") then {
- [_this] spawn player_crossbowBolt;
- };
- if (_ammo isKindOf "GrenadeHand") then {
- if (_ammo isKindOf "ThrownObjects") then {
- [_this] spawn player_throwObject;
- };
- if (_ammo isKindOf "RoadFlare") then {
- //hint str(_ammo);
- _projectile = nearestObject [_unit, "RoadFlare"];
- [_projectile,0] spawn object_roadFlare;
- PVDZ_obj_RoadFlare = [_projectile,0];
- publicVariable "PVDZ_obj_RoadFlare";
- [_this] spawn player_throwObject;
- };
- if (_ammo isKindOf "ChemLight") then {
- _projectile = nearestObject [_unit, "ChemLight"];
- [_projectile,1] spawn object_roadFlare;
- PVDZ_obj_RoadFlare = [_projectile,1];
- publicVariable "PVDZ_obj_RoadFlare";
- [_this] spawn player_throwObject;
- };
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement