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. * green / red / blue, respectively.
* *
* Arguments: * Arguments:
* 0: Projectile to be tracked. <OBJECT> * 0: Projectile to be tracked <OBJECT>
* 1: Add projectile hit/explode/defelceted event handlers. <BOOL> * 1: Add projectile hit/explode/defelceted event handlers <BOOL> (default: true)
* 2: Is the round fired by a unit on the same side as the player * 2: Should the round track be blue. True results in blue traces, false in red <BOOL> (default: true)
* true results in blue traces, false in red. <BOOL>
* *
* Return Value: * Return Value:
* Nothing Useful * Nothing Useful
@ -24,10 +23,10 @@
params [ params [
"_projectile", "_projectile",
["_addProjectileEventHandlers", true], ["_addProjectileEventHandlers", true],
["_isSidePlayer", true] ["_isTraceBlue", true]
]; ];
if (_isSidePlayer) then { if (_isTraceBlue) then {
GVAR(dev_trackLines) set [getObjectID _projectile, [[getPosATL _projectile], [0, 0, 1, 1]]]; GVAR(dev_trackLines) set [getObjectID _projectile, [[getPosATL _projectile], [0, 0, 1, 1]]];
} else { } else {
GVAR(dev_trackLines) set [getObjectID _projectile, [[getPosATL _projectile], [1, 0, 0, 1]]]; GVAR(dev_trackLines) set [getObjectID _projectile, [[getPosATL _projectile], [1, 0, 0, 1]]];

View File

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

View File

@ -18,4 +18,6 @@
//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; //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); TRACE_10("firedEH:",_unit,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile,_vehicle,_gunner,_turret);
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); [_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" #include "..\script_component.hpp"
/* /*
* Author: Lambda.Tiger, based on fnc_dev_debugAmmo by "ACE-Team" * 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 * Dumps all ammo types to see if there's any reason to spawn fragments given hit power and distance.
* given hit power and distance. Good for grasping the values used in * Good for grasping the values used in shouldFrag to cull non-fragmenting rounds.
* shouldFrag to cull non-fragmenting rounds.
* *
* Arguments: * 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: * Return Value:
* None * None

View File

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

View File

@ -1,12 +1,11 @@
#include "..\script_component.hpp" #include "..\script_component.hpp"
/* /*
* Author: Lambda.Tiger * Author: Lambda.Tiger
* Add a hit box outline to an object, outdated for unit hits as they * Add a hit box outline to an object.
* use hit-point locations.
* *
* Arguments: * Arguments:
* 0: Object that should have it's hit box drawn. <OBJECT> * 0: Object that should have it's hit box drawn <OBJECT> (default: objNull)
* 1: Add sphere at object origin. <BOOL> (Default: true) * 1: Add sphere at object origin <BOOL> (default: true)
* *
* Return Value: * Return Value:
* None * None
@ -18,8 +17,8 @@
*/ */
params [ params [
["_object", objNull, [objNull]], ["_object", objNull],
["_addSphere", true, [true]] ["_addSphere", true]
]; ];
TRACE_2("Adding hitbox",_object,_addSphere); TRACE_2("Adding hitbox",_object,_addSphere);
@ -46,7 +45,7 @@ switch (stance _object) do {
}; };
private _centerPoint = ASLToAGL getPosASL _object; 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); private _centerSphere = [getPosASL _object, "yellow"] call FUNC(dev_sphereDraw);
_centerSphere disableCollisionWith _object; _centerSphere disableCollisionWith _object;
_centerSphere attachTo [_object, _object worldToModel _centerPoint]; _centerSphere attachTo [_object, _object worldToModel _centerPoint];
@ -67,9 +66,9 @@ private _points = [
]; ];
private _color = switch (side _object) do { private _color = switch (side _object) do {
case east: {[1, 0, 0, 1]}; case east: {[0.8, 0, 0, 1]};
case resistance: {[0, 1, 0, 1]}; case resistance: {[0, 0.8, 0, 1]};
default {[0, 0, 1, 1]}; default {[0, 0, 0.8, 1]};
}; };
GVAR(dev_hitBoxes) set [getObjectID _object, [_object, _points, _color]]; 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). * This function adds an object to have its course tracked (every frame).
* *
* Arguments: * Arguments:
* 0: Object to draw track OBJECT> * 0: Object to draw track OBJECT> (default: "objNull")
* 1: Color of trace <STRING> * 1: Color of trace <STRING> (default: "blue")
* 2: Whether the object is a projectile or whether to add projectile EHs <BOOL> * 2: Whether the object is a projectile or whether to add projectile EHs <BOOL> (default: false)
* *
* Return Value: * Return Value:
* None * None
@ -18,12 +18,13 @@
*/ */
params [ params [
["_object", objNull, [objNull]], ["_object", objNull],
["_color", "blue", ["blue"]], ["_color", "blue"],
["_isProj", false, [false]] ["_isProj", false]
]; ];
TRACE_3("devDraw",_object,_color,_isProj); TRACE_3("devDraw",_object,_color,_isProj);
// pick color and add it to the array // pick color and add it to the array
private _colorArray = switch (toLowerANSI _color) do { private _colorArray = switch (toLowerANSI _color) do {
case "purple": {[0.8, 0, 0.8, 1]}; 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" // event handler to track round and cleanup when round is "dead"
[ [
{ {
if (isGamePaused) exitWith {}; if (isGamePaused || setAccTime == 0) exitWith {};
params ["_object", "_handle"]; params ["_object", "_handle"];
if (!alive _object) exitWith { if (!alive _object) exitWith {