mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
function header, lazy eval, and params list simplifications
This commit is contained in:
parent
656fa9f7f7
commit
78a27ff025
@ -41,7 +41,7 @@ GVAR(dev_trackLines) set [getObjectID _object, [[getPosATL _object], _colorArray
|
||||
// event handler to track round and cleanup when round is "dead"
|
||||
[
|
||||
{
|
||||
if (isGamePaused || setAccTime == 0) exitWith {};
|
||||
if (isGamePaused || accTime == 0) exitWith {};
|
||||
params ["_object", "_handle"];
|
||||
|
||||
if (!alive _object) exitWith {
|
||||
|
@ -1,11 +1,10 @@
|
||||
#include "..\script_component.hpp"
|
||||
/*
|
||||
* Author: Jaynus, NouberNou, Lambda.Tiger
|
||||
* This function handles creating both random and targeted fragments as well
|
||||
* as handling some of the performance optimizations.
|
||||
* This function handles creating both random and targeted fragments as well as handling some of the performance optimizations.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: ASL position of projectile. <ARRAY>
|
||||
* 0: Position (posASL) of projectile <ARRAY>
|
||||
* 1: Velocity of projectile <ARRAY>
|
||||
* 2: Projectile CfgAmmo classname <STRING>
|
||||
* 3: getShotParents of projectile at EH <ARRAY>
|
||||
@ -19,12 +18,7 @@
|
||||
* Public: No
|
||||
*/
|
||||
TRACE_1("begin doFrag",_this);
|
||||
params [
|
||||
"_posASL",
|
||||
"_velocity",
|
||||
"_ammo",
|
||||
"_shotParents"
|
||||
];
|
||||
params ["_posASL", "_velocity", "_ammo", "_shotParents"];
|
||||
|
||||
// Don't let a single object cause all fragmentation events
|
||||
_shotParents params ["_shotParentVic"];
|
||||
@ -35,7 +29,7 @@ _shotParentVic setVariable [QGVAR(obj_nextFragTime), CBA_missionTime + ACE_FRAG_
|
||||
|
||||
// Check normal round timeout and adjust _max frags
|
||||
private _timeSinceLastFrag = CBA_missionTime - GVAR(lastFragTime);
|
||||
if (_timeSinceLastFrag < ACE_FRAG_HOLDOFF || {_posASL isEqualTo [0, 0, 0] || _ammo isEqualTo ""}) exitWith {
|
||||
if (_timeSinceLastFrag < ACE_FRAG_HOLDOFF || {_posASL isEqualTo [0, 0, 0]} || {_ammo isEqualTo ""}) exitWith {
|
||||
TRACE_3("timeExit",_timeSinceLastFrag,CBA_missionTime,GVAR(lastFragTime));
|
||||
};
|
||||
private _maxFragCount = round linearConversion [ACE_FRAG_COUNT_MIN_TIME, ACE_FRAG_COUNT_MAX_TIME, _timeSinceLastFrag, ACE_FRAG_COUNT_MIN, ACE_FRAG_COUNT_MAX, true];
|
||||
|
@ -1,16 +1,15 @@
|
||||
#include "..\script_component.hpp"
|
||||
/*
|
||||
* Author: Jaynus, NouberNou, Lambda.Tiger
|
||||
* This function creates fragments randomly spreading out from an explosion to
|
||||
* a maximum of 15.
|
||||
* This function creates fragments randomly spreading out from an explosion to a maximum of 15.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Position of fragmenting projectile ASL. <ARRAY>
|
||||
* 1: Velocity of the fragmenting projectile. <ARRAY>
|
||||
* 2: Height (AGL) of the fragmenting projectile. <NUMBER>
|
||||
* 3: Type of fragments to generate. <ARRAY>
|
||||
* 4: Remaining fragment budget. <NUMBER>
|
||||
* 5: Shot parents. <ARRAY>
|
||||
* 0: Position (posASL) of fragmenting projectile <ARRAY>
|
||||
* 1: Velocity of the fragmenting projectile <ARRAY>
|
||||
* 2: Height (AGL) of the fragmenting projectile <NUMBER>
|
||||
* 3: Type of fragments to generate <ARRAY>
|
||||
* 4: Remaining fragment budget <NUMBER>
|
||||
* 5: Shot parents <ARRAY>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
@ -20,14 +19,7 @@
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
params [
|
||||
"_posASL",
|
||||
"_fragVelocity",
|
||||
"_heightAGL",
|
||||
"_fragType",
|
||||
"_maxFragCount",
|
||||
"_shotParents"
|
||||
];
|
||||
params ["_posASL", "_fragVelocity", "_heightAGL", "_fragType", "_maxFragCount", "_shotParents"];
|
||||
TRACE_6("doFragRandom",_posASL,_fragVelocity,_heightAGL,_fragType,_maxFragCount,_shotParents);
|
||||
|
||||
// See CfgAmmoFragSpawner for different frag types
|
||||
|
@ -1,8 +1,7 @@
|
||||
#include "..\script_component.hpp"
|
||||
/*
|
||||
* Author: Jaynus, NouberNou, Lambda.Tiger
|
||||
* This function creates fragments targeted at specific entities, up to
|
||||
* a configured maximum.
|
||||
* This function creates fragments targeted at specific entities, up to _maxFrags.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Position of fragmenting projectile ASL <ARRAY>
|
||||
@ -25,15 +24,7 @@
|
||||
#define ACE_FRAG_DEFAULT_CROSS_AREA 0.75
|
||||
#define ACE_FRAG_MIN_TARGET_AREA 0.5
|
||||
|
||||
params [
|
||||
"_posASL",
|
||||
"_fragVelocity",
|
||||
"_fragRange",
|
||||
"_maxFrags",
|
||||
"_fragTypes",
|
||||
"_modFragCount",
|
||||
"_shotParents"
|
||||
];
|
||||
params [ "_posASL", "_fragVelocity", "_fragRange", "_maxFrags", "_fragTypes", "_modFragCount", "_shotParents"];
|
||||
TRACE_5("fnc_doFragTargeted",_posASL,_fragRange,_maxFrags,_fragTypes,_modFragCount);
|
||||
|
||||
if (_fragTypes isEqualTo []) then {
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "..\script_component.hpp"
|
||||
/*
|
||||
* Author: Jaynus, NouberNou, Lambda.Tiger,
|
||||
* This function creates spalling if the hit slowed the speed down enough.
|
||||
* This function creates spalling if the hit slowed the projectile speed down enough.
|
||||
*
|
||||
* Arguments:
|
||||
* Arguments are the same as BI's "HitPart" EH:
|
||||
@ -15,24 +15,16 @@
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#define GLUE(g1,g2) g1##g2
|
||||
|
||||
TRACE_1("doSpall",_this);
|
||||
params [
|
||||
"_projectile",
|
||||
"_objectHit",
|
||||
"_lastPosASL",
|
||||
"_lastVelocity",
|
||||
"_surfaceNorm",
|
||||
"_surfaceType",
|
||||
"_ammo",
|
||||
"_shotParents",
|
||||
"_vectorUp"
|
||||
];
|
||||
params ["_projectile", "_objectHit", "_lastPosASL", "_lastVelocity", "_surfaceNorm", "_surfaceType", "_ammo", "_shotParents", "_vectorUp"];
|
||||
|
||||
if (CBA_missionTime < GVAR(nextSpallAllowTime) ||
|
||||
_lastPosASL isEqualTo [0,0,0] ||
|
||||
{_ammo isEqualTo "" || {!isNull _objectHit &&
|
||||
{objectHit isKindOf "CAManBase"}}}) exitWith {
|
||||
{isNull _objectHit} ||
|
||||
{_lastPosASL isEqualTo [0,0,0]} ||
|
||||
{_ammo isEqualTo ""} ||
|
||||
{_objectHit isKindOf "CAManBase"}) exitWith {
|
||||
TRACE_4("time/invalidHit",CBA_missionTime,GVAR(nextSpallAllowTime),_objectHit,_lastPosASL);
|
||||
};
|
||||
|
||||
@ -122,7 +114,7 @@ private _spawnSize = switch (true) do
|
||||
};
|
||||
|
||||
private _spallSpawner = createVehicle [
|
||||
"ace_frag_" + _material + _spawnSize,
|
||||
QUOTE(GLUE(ADDON,_)) + _material + _spawnSize,
|
||||
ASLToATL _spallPosASL,
|
||||
[],
|
||||
0,
|
||||
|
@ -1,23 +1,22 @@
|
||||
#include "..\script_component.hpp"
|
||||
#define ACE_FRAG_SOUNDENVIRON_STR_LEN 12
|
||||
#define ACE_FRAG_SOUNDGIT_STR_LEN 8
|
||||
#define ACE_FRAG_MATERIAL_SEARCH_LEN 10
|
||||
/*
|
||||
* Author: Lambda.Tiger
|
||||
* This function returns a classification of material type based
|
||||
* on the surface hit.
|
||||
* This function returns a classification of material type based on the surface hit.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: surfacetype <STRING> - either a CfgSurfaces path .bisurf filepath
|
||||
* 0: Surface type given as either a CfgSurfaces path or .bisurf filepath, same format as "HitPart" projectile parameter <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* _material <STRING> - Material categories as expanded on in line 44 below
|
||||
* Material categories as expanded on in line 44 below <STRING>
|
||||
*
|
||||
* Example:
|
||||
* [_surfaceType] call ace_frag_fnc_getFragInfo;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#define ACE_FRAG_SOUNDENVIRON_STR_LEN 12
|
||||
#define ACE_FRAG_SOUNDGIT_STR_LEN 8
|
||||
#define ACE_FRAG_MATERIAL_SEARCH_LEN 10
|
||||
|
||||
params ["_surfType"];
|
||||
|
||||
|
@ -1,17 +1,16 @@
|
||||
#include "..\script_component.hpp"
|
||||
/*
|
||||
* Author: Lambda.Tiger
|
||||
* This function returns spalling parameters for a specific
|
||||
* ammo type.
|
||||
* This function returns spalling parameters for a specific ammo type.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: _ammo <STRING> - CfgAmmo type of ammo to check
|
||||
* 0: Ammo classname <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* _ammoInfo <ARRAY>
|
||||
* 0: _caliber - search range for fragments <NUMBER>
|
||||
* 1: _explosive - whether the round is explosive or not <NUMBER>
|
||||
* 2: _indirectHitRange - Indirect hit damage <NUMBER>
|
||||
* 0: Caliber <NUMBER>
|
||||
* 1: What part of the hit damage is from ballistic vs explosive energy (1 for all explosive) <NUMBER>
|
||||
* 2: Indirect hit damage <NUMBER>
|
||||
*
|
||||
* Example:
|
||||
* ["B_556x45_Ball"] call ace_frag_fnc_getSpallInfo;
|
||||
|
@ -1,8 +1,7 @@
|
||||
#include "..\script_component.hpp"
|
||||
/*
|
||||
* Author: Lambda.Tiger
|
||||
* For performance, we load a bunch of vanilla materials preemptively into
|
||||
* the spall material cache.
|
||||
* For performance, we load a bunch of vanilla materials preemptively into the spall material cache.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
@ -11,7 +10,7 @@
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* call initMaterialCache;
|
||||
* call ace_frag_fnc_initMaterialCache;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
@ -19,7 +19,7 @@
|
||||
TRACE_1("ACE_Frag rndInit",_this);
|
||||
params ["_projectile"];
|
||||
|
||||
if !(isServer) exitWith {};
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
private _ammo = typeOf _projectile;
|
||||
if (_ammo isEqualTo "" || {isNull _projectile}) exitWith {
|
||||
@ -49,15 +49,12 @@ if (GVAR(spallEnabled) && {_ammo call FUNC(shouldSpall)}) then {
|
||||
_projectile addEventHandler [
|
||||
"HitPart",
|
||||
{
|
||||
params ["_projectile", "_hitObject", "",
|
||||
"_posASL", "_velocity", "_surfNorm", "",
|
||||
"", "_surfType"
|
||||
];
|
||||
params ["_projectile", "_hitObject", "", "_posASL", "_velocity", "_surfNorm", "", "", "_surfType"];
|
||||
private _shotParent = getShotParents _projectile;
|
||||
private _ammo = typeOf _projectile;
|
||||
private _vectorUp = vectorUp _projectile;
|
||||
/*
|
||||
* Wait a round to see what happens to the round, may result in
|
||||
* Wait a frame to see what happens to the round, may result in
|
||||
* multiple hits / slowdowns getting shunted to the first hit
|
||||
*/
|
||||
[
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This function checks whether an ammunition type should cause spalling.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Type of ammo to check <STRING>
|
||||
* 0: Ammo classname <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* Whether the round type would spall when hitting an object <BOOL>
|
||||
|
Loading…
Reference in New Issue
Block a user