ACE3/addons/frag/functions/fnc_addPfhRound.sqf
Dedmen Miller e2ac18a05d [WIP] Fix script errors reporting wrong line numbers (#6407)
* advanced_ballistics

* advanced_fatigue

* advanced_throwing

* ai

* aircraft

* arsenal

* atragmx

* attach

* backpacks

* ballistics

* captives

* cargo

* chemlights

* common

* concertina_wire

* cookoff

* dagr

* disarming

* disposable

* dogtags

* dragging

* explosives

* fastroping

* fcs

* finger

* frag

* gestures

* gforces

* goggles

* grenades

* gunbag

* hearing

* hitreactions

* huntir

* interact_menu

* interaction

* inventory

* kestrel4500

* laser

* laserpointer

* logistics_uavbattery

* logistics_wirecutter

* magazinerepack

* map

* map_gestures

* maptools

* markers

* medical

* medical_ai

* medical_blood

* medical_menu

* microdagr

* minedetector

* missileguidance

* missionmodules

* mk6mortar

* modules

* movement

* nametags

* nightvision

* nlaw

* optics

* optionsmenu

* overheating

* overpressure

* parachute

* pylons

* quickmount

* rangecard

* rearm

* recoil

* refuel

* reload

* reloadlaunchers

* repair

* respawn

* safemode

* sandbag

* scopes

* slideshow

* spectator

* spottingscope

* switchunits

* tacticalladder

* tagging

* trenches

* tripod

* ui

* vector

* vehiclelock

* vehicles

* viewdistance

* weaponselect

* weather

* winddeflection

* yardage450

* zeus

* arsenal defines.hpp

* optionals

* DEBUG_MODE_FULL 1

* DEBUG_MODE_FULL 2

* Manual fixes

* Add SQF Validator check for #include after block comment

* explosives fnc_openTimerUI

* fix uniqueItems
2018-09-17 14:19:29 -05:00

78 lines
2.4 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: Jaynus, NouberNou
* Starts tracking a round that will frag.
* Should only be called once per round.
*
* Arguments:
* 0: Shooter <OBJECT>
* 1: Ammo classname <STRING>
* 2: Projectile <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player, "handGrenade", bullet] call ace_frag_fnc_addPfhRound
*
* Public: No
*/
params ["_gun", "_type", "_round"];
TRACE_3("addPfhRound",_gun,_type,_round);
if (!GVAR(enabled)) exitWith {TRACE_1("setting disabled",_this);};
if (!alive _round) exitWith {TRACE_1("round dead?",_this);};
if (_round in GVAR(blackList)) exitWith {
TRACE_1("round in blackList",_this);
REM(GVAR(blackList),_round);
};
// Exit on max track
if ((count GVAR(objects)) >= GVAR(maxTrack)) exitWith {TRACE_1("maxTrack limit",count GVAR(objects));};
private _doSpall = false;
if (GVAR(SpallEnabled)) then {
if (GVAR(spallIsTrackingCount) <= 0) then {
GVAR(spallHPData) = [];
};
if (GVAR(spallIsTrackingCount) > 5) then {
TRACE_1("At Spall Limit",GVAR(spallIsTrackingCount));
} else {
_doSpall = true;
INC(GVAR(spallIsTrackingCount));
};
TRACE_2("",_doSpall,GVAR(spallIsTrackingCount));
};
#ifdef DRAW_FRAG_INFO
[ACE_player, _round, [0, 1, 0, 1]] call FUNC(dev_addTrack);
#endif
// We only do the single track object check here.
// We should do an {!(_round in GVAR(objects))}
// But we leave that out here for optimization. So this cannot be a framework function
// Otherwise, it should only be added once and from the FiredEH
if (alive _round) then {
private _spallTrack = [];
private _spallTrackID = [];
private _args = [
_round, getPosASL _round, velocity _round, _type, diag_frameno, _gun, _doSpall, _spallTrack, _spallTrackID,
getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(skip)),
getNumber (configFile >> "CfgAmmo" >> _type >> "explosive"),
getNumber (configFile >> "CfgAmmo" >> _type >> "indirectHitRange"),
getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(force)),
getNumber (configFile >> "CfgAmmo" >> _type >> "indirecthit") * (sqrt (getNumber (configFile >> "CfgAmmo" >> _type >> "indirectHitRange")))
];
TRACE_1("Initializing track", _round);
GVAR(objects) pushBack _round;
GVAR(arguments) pushBack _args;
if (_doSpall) then {
[_round, 1, _spallTrack, _spallTrackID] call FUNC(spallTrack);
};
};