object_setFixServer -> fnc_veh_setFixServer

Fnc_veh_handleRepair is a new version of fnc_veh_setFixServer with extra
handling. It is used in salvage and some other scripts, but not
server_monitor.
This commit is contained in:
ebaydayz
2016-03-22 16:34:08 -04:00
parent cc64d2e7fb
commit debb714277
10 changed files with 227 additions and 259 deletions

View File

@@ -1,41 +1,40 @@
//[unit, weapon, muzzle, mode, ammo, magazine, projectile]
private ["_unit","_evType","_recordable","_inVehicle","_isPlayer","_isRocket","_dmgDistance","_isBallistic","_handled","_id","_firer","_distance","_weapon","_ammo","_killerID","_arc","_turretDir","_weaponDir","_pos1","_pos2","_facing","_firingArc","_isInFront","_isInRear"];
private ["_handled"];
//Init
//[unit, firer, distance, weapon, muzzle, mode, ammo]
_unit = _this select 0;
_firer = _this select 1;
_unit = _this select 0;
_firer = _this select 1;
_distance = _this select 2;
_weapon = _this select 3;
_ammo = _this select 6;
_killerID = _firer getVariable["MemberID",0];
_weapon = _this select 3;
_ammo = _this select 6;
//_killerID = _firer getVariable["MemberID",0];
_handled = false;
_handled = false;
_arc = 60;
_isBallistic = (getNumber (configfile >> "CfgAmmo" >> _ammo >> "whistleOnFire") > 0);
_dmgDistance = getNumber (configfile >> "CfgAmmo" >> _ammo >> "whistleDist");
_isRocket = ((_ammo isKindOf "RocketBase") && (_firer isKindOf "Man"));
_isPlayer = (_unit == player);
_inVehicle = (vehicle _unit != _unit);
_evType = "";
_recordable = false;
//_evType = "";
//_recordable = false;
// Both the firer && those nearby (<=8m) go into "combat" to prevent ALT-F4
// Both the firer and those nearby (<=8m) go into "combat" to prevent ALT-F4
//diag_log ("DEBUG: AMMO TYPE: " +str(_ammo));
_firer setVariable["startcombattimer", 1];
if (_distance <= 8) then {
_unit setVariable["startcombattimer", 1];
};
if (_inVehicle) exitWith{};
if (_firer == player) exitWith{};
if (_inVehicle) exitWith {};
if (_firer == player) exitWith {};
//Is in danger angle?
_turretDir = _firer weaponDirection _weapon;
_weaponDir = ((_turretDir select 0) atan2 (_turretDir select 1));
_pos1 = getposATL _unit;
_pos2 = getposATL _firer;
_facing = ((_pos1 Select 0) - (_pos2 Select 0)) ATan2 ((_pos1 Select 1) - (_pos2 Select 1));
_pos1 = getPosATL _unit;
_pos2 = getPosATL _firer;
_facing = ((_pos1 select 0) - (_pos2 select 0)) atan2 ((_pos1 select 1) - (_pos2 select 1));
_firingArc = (_weaponDir - _facing);
_firingArc = (-_firingArc) max (_firingArc);
@@ -53,10 +52,11 @@ private ["_unit","_evType","_recordable","_inVehicle","_isPlayer","_isRocket","_
//serious ballistic damage
if (_isPlayer) then {
[_unit, "head_hit", 1.51, _firer, _ammo] call fnc_usec_damageHandler;
// head damage > 1.5 ---> log + death
};
[_unit,4] call fnc_usec_damageUnconscious;
} else {;
} else {
//Just Knocked out
[_unit,0.5] call fnc_usec_damageUnconscious;
};
@@ -68,13 +68,14 @@ private ["_unit","_evType","_recordable","_inVehicle","_isPlayer","_isRocket","_
};
};
} else {
if (_isRocket && (_isInFront || _isInRear)) then {
if (_isRocket && (_isInFront or _isInRear)) then {
if ((_distance < 5) && !_handled) then {
1 call fnc_usec_bulletHit;
[20,45] call fnc_usec_pitchWhine; //Visual , Sound
// Dead
if (_isPlayer) then {
[_unit, "head_hit", 1.51, _firer, _ammo] call fnc_usec_damageHandler;
// head damage > 1.5 ---> log + death
};
[_unit,2] call fnc_usec_damageUnconscious;
};