reformatted function headers, removed value type checking, and changed lazy eval.

This commit is contained in:
lambdatiger 2024-02-15 20:59:58 -06:00
parent 668d222a3f
commit c09c2a170c
7 changed files with 42 additions and 43 deletions

View File

@ -7,10 +7,9 @@
* green / red / blue, respectively.
*
* Arguments:
* 0: Projectile to be tracked. <OBJECT>
* 1: Add projectile hit/explode/defelceted event handlers. <BOOL>
* 2: Is the round fired by a unit on the same side as the player
* true results in blue traces, false in red. <BOOL>
* 0: Projectile to be tracked <OBJECT>
* 1: Add projectile hit/explode/defelceted event handlers <BOOL> (default: true)
* 2: Should the round track be blue. True results in blue traces, false in red <BOOL> (default: true)
*
* Return Value:
* Nothing Useful
@ -24,10 +23,10 @@
params [
"_projectile",
["_addProjectileEventHandlers", true],
["_isSidePlayer", true]
["_isTraceBlue", true]
];
if (_isSidePlayer) then {
if (_isTraceBlue) then {
GVAR(dev_trackLines) set [getObjectID _projectile, [[getPosATL _projectile], [0, 0, 1, 1]]];
} else {
GVAR(dev_trackLines) set [getObjectID _projectile, [[getPosATL _projectile], [1, 0, 0, 1]]];
@ -38,17 +37,17 @@ if (_isSidePlayer) then {
{
if (isGamePaused) exitWith {};
params ["_projectile", "_handle"];
if (!alive _projectile) exitWith {
[_handle] call CBA_fnc_removePerFrameHandler;
};
private _projectileArray = GVAR(dev_trackLines) get (getObjectID _projectile);
if (isNil "_projectileArray") exitWith {
[_handle] call CBA_fnc_removePerFrameHandler;
};
(_projectileArray#0) pushBack getPosATL _projectile;
},
0,

View File

@ -5,11 +5,11 @@
* fragments that could be fired from a weapon.
*
* Arguments:
* 0: Log ammo types that wouldn't normally frag. <BOOL> (Default: false)
* 1: Only print ammo without ACE_frag entries, inherited or otherwise. <BOOL> (Default: true)
* 0: Log ammo types that wouldn't normally frag <BOOL> (default: false)
* 1: Only print ammo without ACE_frag entries, inherited or otherwise <BOOL> (default: true)
* 2: Only export ammo classes of classes referenced in CfgMagazines and their
* submunitions. <BOOL> (Default: false)
* 3: Force a CSV format on debug print. <BOOL> (Default: false)
* submunitions <BOOL> (default: false)
* 3: Force a CSV format on debug print. <BOOL> (default: false)
*
* Return Value:
* None

View File

@ -18,4 +18,6 @@
//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"];
TRACE_10("firedEH:",_unit,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile,_vehicle,_gunner,_turret);
[_projectile, true, [side group _unit, side group ACE_player] call BIS_fnc_sideIsFriendly] call FUNC(dev_addRound);
if (GVAR(debugOptions) && {_ammo call FUNC(shouldFrag) || {_ammo call FUNC(shouldSpall)}}) then {
[_projectile, true, [side group _unit, side group ACE_player] call BIS_fnc_sideIsFriendly] call FUNC(dev_addRound);
};

View File

@ -1,12 +1,11 @@
#include "..\script_component.hpp"
/*
* Author: Lambda.Tiger, based on fnc_dev_debugAmmo by "ACE-Team"
* Dumps all ammo types to see if there's any reason to spawn fragments
* given hit power and distance. Good for grasping the values used in
* shouldFrag to cull non-fragmenting rounds.
* Dumps all ammo types to see if there's any reason to spawn fragments given hit power and distance.
* Good for grasping the values used in shouldFrag to cull non-fragmenting rounds.
*
* Arguments:
* 0: Display rounds that will never frag (power < 5). <BOOL> (default: false)
* 0: Display rounds that will never frag <BOOL> (default: false)
*
* Return Value:
* None

View File

@ -4,22 +4,21 @@
* Add a colored sphere at a specified point.
*
* Arguments:
* 0: ASL position to add sphere. <ARRAY>
* 1: Color of sphere. <STRING> (Default: Blue)
* 0: Position (posASL) to add sphere <ARRAY>
* 1: Color of sphere <STRING> (default: "blue")
*
* Return Value:
* None
*
* Example:
* [getPosASL player, "blue"] call ace_frag_fnc_dev_sphereDraw;
* [getPosASL player, "red"] call ace_frag_fnc_dev_sphereDraw;
*
* Public: No
*/
params [
"_posASL",
["_color", "blue", [""]]
];
params ["_posASL", ["_color", "blue"]];
if (!isServer) exitWith {};
if (_color select [0,1] != "(") then {
_color = switch (toLowerANSI _color) do {

View File

@ -1,12 +1,11 @@
#include "..\script_component.hpp"
/*
* Author: Lambda.Tiger
* Add a hit box outline to an object, outdated for unit hits as they
* use hit-point locations.
* Add a hit box outline to an object.
*
* Arguments:
* 0: Object that should have it's hit box drawn. <OBJECT>
* 1: Add sphere at object origin. <BOOL> (Default: true)
* 0: Object that should have it's hit box drawn <OBJECT> (default: objNull)
* 1: Add sphere at object origin <BOOL> (default: true)
*
* Return Value:
* None
@ -18,8 +17,8 @@
*/
params [
["_object", objNull, [objNull]],
["_addSphere", true, [true]]
["_object", objNull],
["_addSphere", true]
];
TRACE_2("Adding hitbox",_object,_addSphere);
@ -46,7 +45,7 @@ switch (stance _object) do {
};
private _centerPoint = ASLToAGL getPosASL _object;
if (GVAR(dbgSphere) && {_addSphere && {isNull objectParent _object}}) then {
if (GVAR(dbgSphere) && _addSphere && {isNull objectParent _object}) then {
private _centerSphere = [getPosASL _object, "yellow"] call FUNC(dev_sphereDraw);
_centerSphere disableCollisionWith _object;
_centerSphere attachTo [_object, _object worldToModel _centerPoint];
@ -67,9 +66,9 @@ private _points = [
];
private _color = switch (side _object) do {
case east: {[1, 0, 0, 1]};
case resistance: {[0, 1, 0, 1]};
default {[0, 0, 1, 1]};
case east: {[0.8, 0, 0, 1]};
case resistance: {[0, 0.8, 0, 1]};
default {[0, 0, 0.8, 1]};
};
GVAR(dev_hitBoxes) set [getObjectID _object, [_object, _points, _color]];

View File

@ -4,9 +4,9 @@
* This function adds an object to have its course tracked (every frame).
*
* Arguments:
* 0: Object to draw track OBJECT>
* 1: Color of trace <STRING>
* 2: Whether the object is a projectile or whether to add projectile EHs <BOOL>
* 0: Object to draw track OBJECT> (default: "objNull")
* 1: Color of trace <STRING> (default: "blue")
* 2: Whether the object is a projectile or whether to add projectile EHs <BOOL> (default: false)
*
* Return Value:
* None
@ -18,12 +18,13 @@
*/
params [
["_object", objNull, [objNull]],
["_color", "blue", ["blue"]],
["_isProj", false, [false]]
["_object", objNull],
["_color", "blue"],
["_isProj", false]
];
TRACE_3("devDraw",_object,_color,_isProj);
// pick color and add it to the array
private _colorArray = switch (toLowerANSI _color) do {
case "purple": {[0.8, 0, 0.8, 1]};
@ -41,7 +42,7 @@ GVAR(dev_trackLines) set [getObjectID _object, [[getPosATL _object], _colorArray
// event handler to track round and cleanup when round is "dead"
[
{
if (isGamePaused) exitWith {};
if (isGamePaused || setAccTime == 0) exitWith {};
params ["_object", "_handle"];
if (!alive _object) exitWith {