Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frag - Implement Arma v2.18 changes from #10157 #10313

Merged
merged 390 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
390 commits
Select commit Hold shift + click to select a range
67e125c
Merge branch 'master' of https://github.com/lambdatiger/ace_frag-over…
lambdatiger Jan 16, 2024
85b566a
removed old parameter changed in https://github.com/acemod/ACE3/pull/…
lambdatiger Jan 16, 2024
67ede76
compacted text a bit
lambdatiger Jan 16, 2024
572f909
formatting whitespace
lambdatiger Jan 16, 2024
7aa17aa
Grammatical erros
lambdatiger Jan 16, 2024
8dd76d1
Changes as discussed here https://github.com/acemod/ACE3/pull/9728#di…
lambdatiger Jan 16, 2024
6dacd38
Few quick optimizations of == to isEqualTo
lambdatiger Jan 16, 2024
9178611
Debug updated to be easier to control
lambdatiger Jan 16, 2024
769bb29
Changed how spall hold off is calculated to avoid repeated unneeded c…
lambdatiger Jan 16, 2024
63cba6b
clarified a hold off variable
lambdatiger Jan 16, 2024
4be8c82
Better approach to ACE_FRAG_RM_EH macro
lambdatiger Jan 17, 2024
4727386
Git rid of superfulous stringtable entries
lambdatiger Jan 17, 2024
16e699e
unneeded parens
lambdatiger Jan 18, 2024
cdf1b4d
Clarified arguments
lambdatiger Jan 18, 2024
1b03ef7
getposATL to getPosATL
lambdatiger Jan 18, 2024
0958d6a
Update addons/frag/functions/fnc_dev_addRound.sqf
lambdatiger Jan 18, 2024
1612872
Function header changes
lambdatiger Jan 18, 2024
3cc300a
another great isNotEqualTo opportunity
lambdatiger Jan 18, 2024
b6891b7
formatting changes
lambdatiger Jan 18, 2024
e5f62c7
unneeded parens
lambdatiger Jan 18, 2024
c0c423b
Declared _ammoInfo twice
lambdatiger Jan 18, 2024
5160361
optimized around checking if systems are active and moved debug argum…
lambdatiger Jan 18, 2024
73d0064
Removed white space from removing an if statement in a previous commit
lambdatiger Jan 18, 2024
ea15eea
Removed superfulous parenthese
lambdatiger Jan 18, 2024
a1c498d
clarified function description and removed unneeded comments
lambdatiger Jan 18, 2024
0321b78
Moved "isServer" check to initRound function
lambdatiger Jan 18, 2024
1f294f5
Merge branch 'master' of https://github.com/lambdatiger/ace_frag-over…
lambdatiger Jan 18, 2024
3f84a45
https://github.com/acemod/ACE3/pull/9728#discussion_r1454832701
lambdatiger Jan 18, 2024
da1d184
changed params statement, function header, and propigated doFrag argu…
lambdatiger Jan 18, 2024
183d9f0
capitization from cfg to Cfg in config lookups
lambdatiger Jan 18, 2024
df884dc
changed default arguments, check isKindOf to "CAManBase"
lambdatiger Jan 18, 2024
8b45d0a
Updated function headers
lambdatiger Jan 18, 2024
9bcf2b7
white space and define placement changes
lambdatiger Jan 18, 2024
35592fa
removed 2 argument option and removed some defaults
lambdatiger Jan 18, 2024
63d67df
removed spurious commas
lambdatiger Jan 18, 2024
c921b1f
removed unused debug GVAR
lambdatiger Jan 18, 2024
13834d7
Switched debug clear traces from addAction to ACE self interact
lambdatiger Jan 18, 2024
85df838
variable names weren't verbose enough
lambdatiger Jan 18, 2024
f741737
Mactched format https://github.com/acemod/ACE3/pull/9728#discussion_r…
lambdatiger Jan 18, 2024
a4f2ad4
Updated debug settings
lambdatiger Jan 18, 2024
59bf6e3
Shot parent possible fix #1
lambdatiger Jan 18, 2024
722e86a
Removed extra text from CfgAmmoFragParameters
lambdatiger Jan 18, 2024
4ebbc28
Makes sure spall power square root is positive and also we don't prod…
lambdatiger Jan 18, 2024
8b3826a
white space for clarity
lambdatiger Jan 18, 2024
78a15b1
Optimize dev_hitbox deleting
lambdatiger Jan 18, 2024
5f1cf0b
saving people from their own bad testing setup
lambdatiger Jan 18, 2024
f3788af
Since the functions always exist, I guess these variables should too
lambdatiger Jan 18, 2024
a3efede
Fixe bad search function
lambdatiger Jan 18, 2024
8636926
optimization, see https://github.com/acemod/ACE3/pull/9728#discussion…
lambdatiger Jan 19, 2024
00dc419
changed SPG-9 Fragments
lambdatiger Jan 19, 2024
2d9828d
removed unneeded toLower
lambdatiger Jan 19, 2024
40b9cd3
Merge branch 'master' of https://github.com/lambdatiger/ace_frag-over…
lambdatiger Jan 19, 2024
2e6186c
Changed case output to match config
lambdatiger Jan 19, 2024
33afd8a
Merge branch 'ACE_advancedThrowing-shotParent-issue'
lambdatiger Jan 21, 2024
3540062
Increased relative chance to hit torso/pelvis when fragemnt should hit.
lambdatiger Jan 21, 2024
fd6b9bc
Removed double space
lambdatiger Jan 21, 2024
07f055e
updated some round types
lambdatiger Feb 8, 2024
f63b408
Added commented 2.18 commands and updated script component
lambdatiger Feb 8, 2024
60543a5
added print incomplete only option to fnc_debugAmmo
lambdatiger Feb 8, 2024
2ad2564
removed all spaces from macros
lambdatiger Feb 8, 2024
49c6187
Sync main repo
lambdatiger Feb 8, 2024
a4c88ec
removd unneeded define
lambdatiger Feb 8, 2024
665707b
a Brett (HEMTT) suggested change I miss
lambdatiger Feb 8, 2024
1da1c68
Apply suggestions from code review
lambdatiger Feb 14, 2024
fa241ca
Removed doublespace
lambdatiger Feb 14, 2024
61029ba
Update addons/frag/functions/fnc_dev_addRound.sqf
lambdatiger Feb 14, 2024
4d9f61e
Update addons/frag/functions/fnc_dev_drawTrace.sqf
lambdatiger Feb 15, 2024
ae116e2
variable name changes
lambdatiger Feb 15, 2024
a976b28
magic number clean up and white space
lambdatiger Feb 15, 2024
4ef23df
white space, function headers and variable names
lambdatiger Feb 15, 2024
bc2a6bb
small Should spall optimization
lambdatiger Feb 15, 2024
7e54280
Merge branch 'master' of https://github.com/lambdatiger/ace_frag-over…
lambdatiger Feb 15, 2024
668d222
Removed blacklist functions and settings
lambdatiger Feb 16, 2024
c09c2a1
reformatted function headers, removed value type checking, and change…
lambdatiger Feb 16, 2024
656fa9f
fixed missing underscore in change from review
lambdatiger Feb 16, 2024
78a27ff
function header, lazy eval, and params list simplifications
lambdatiger Feb 16, 2024
dfdea2d
function header and variable name readability
lambdatiger Feb 16, 2024
6cbfe15
changed defaults to make them more clear they're just a default value
lambdatiger Feb 16, 2024
21e7b3d
Updated wiki to be clearer in a few areas, and add some other informa…
lambdatiger Feb 16, 2024
4913887
added MP debug compatability
lambdatiger Feb 16, 2024
66c566b
Possible shouldFrag legibility improvement
lambdatiger Feb 16, 2024
a8778a6
added changes to stringtable
lambdatiger Feb 16, 2024
f4dc052
Grammar sweep on the wiki, and added some clarifications to config va…
lambdatiger Feb 16, 2024
7248496
optimized dev_trackHitbox and made variables more explicit
lambdatiger Feb 16, 2024
4728a56
Cleaned up documentation and documentation
lambdatiger Feb 16, 2024
008328c
reorganized postInit CBA_settingInitialized EH
lambdatiger Feb 16, 2024
dd65fc8
missing underscore in fnc_dev_trackObj
lambdatiger Feb 17, 2024
c3470de
stopped adding unneeded extra points
lambdatiger Feb 17, 2024
b98aae7
cleaned un-updated stringtable entries
lambdatiger Feb 17, 2024
05dedff
reworked some function headers and deleted whitespace in doFragTargeted
lambdatiger Feb 21, 2024
776c1f7
Merge branch 'acemod:master' into master
lambdatiger Feb 21, 2024
fc745e4
Removed outdated code
johnb432 Mar 1, 2024
279f2e0
Formatting and header fixes
johnb432 Mar 1, 2024
480d2df
Ignore curators and spectators
johnb432 Mar 1, 2024
d6c21e0
Made clear traces global again, added interaction condition
johnb432 Mar 2, 2024
d6a37f3
Change stringtable entries
johnb432 Mar 2, 2024
e3395c5
Removed unused stringtable entries & fixed hitbox description
lambdatiger Mar 2, 2024
f57ac94
Small coding standard changes (missing semicolons on non-return valu…
lambdatiger Mar 2, 2024
8a2f40c
Changed sphere size and added return based on usage in dev_trackHitBox
lambdatiger Mar 3, 2024
3cb07e8
removed "_lo" random fragment entries as they are unused
lambdatiger Mar 3, 2024
3e52ce2
doFragRandom was always being called and spawning at least 5 fragment…
lambdatiger Mar 3, 2024
5915d0e
removed unnceassary "disableCollisionWith"
lambdatiger Mar 3, 2024
4c905fe
Clarified trace statements and corrected format and spelling
lambdatiger Mar 3, 2024
9c6a919
Do spall exits for time 90% of the time (round hits multiple walls) a…
lambdatiger Mar 3, 2024
fd2c595
Fixed ordering in which frag hold off variables are set to not skip w…
lambdatiger Mar 3, 2024
98caad5
initRound ordering and fixed define names
lambdatiger Mar 3, 2024
ff98917
Fixed function header
lambdatiger Mar 3, 2024
4583a0d
reformatted comments and some v2.18 remakrs comments
lambdatiger Mar 3, 2024
deecaf9
Removed unneeded ground offset
lambdatiger Mar 5, 2024
448f3e8
Merge remote-tracking branch 'upstream/master'
lambdatiger Mar 10, 2024
9dd45e1
Expanded TRACE
johnb432 Mar 13, 2024
ab51d8f
Fix typo
johnb432 Mar 13, 2024
04a3ba8
Moved event to preInit
johnb432 Mar 17, 2024
786ce92
Updated default fallback frag distance to be less extreme and changed…
lambdatiger Mar 17, 2024
48f96b4
Merge branch 'acemod:master' into master
lambdatiger Mar 18, 2024
e1d085c
Merge branch 'acemod:master' into master
lambdatiger Mar 22, 2024
eda865f
Randomized random frag directions
lambdatiger Mar 29, 2024
5bab127
removed some magic numbers, and cached numbers from shouldSpall
lambdatiger Mar 29, 2024
ef39e78
removed magic numbers and cached values preemptively (normally spallI…
lambdatiger Mar 29, 2024
c487f7f
Unify example formatting
lambdatiger Mar 29, 2024
5e41b51
Merge branch 'master' of https://github.com/lambdatiger/ace_frag-over…
lambdatiger Mar 29, 2024
bd23b42
cleaned up function examples
lambdatiger Mar 29, 2024
a817e5e
removed excess square brackets
lambdatiger Mar 29, 2024
0800205
Final function example reformat
lambdatiger Mar 29, 2024
60d0af8
Update addons/frag/script_component.hpp
johnb432 Mar 29, 2024
ecf5dbf
Merge branch 'master' into pr/9728
johnb432 Mar 29, 2024
6b82859
Corrected docs
johnb432 Apr 1, 2024
e8283c3
Use `getOrDefaultCall`
johnb432 Apr 1, 2024
6c53fff
Merge branch 'acemod:master' into master
lambdatiger Apr 4, 2024
2206ef4
Removed unused classes, redefined using macros to minimize error and …
lambdatiger Apr 14, 2024
25f14af
updated debugging output and fixed velocity error
lambdatiger Apr 14, 2024
eb24c11
Reformatted for legibility and debug output
lambdatiger Apr 14, 2024
3c2a3c7
caught calc error while answer johnb's question
lambdatiger Apr 14, 2024
ce60bd3
Almost finished with compats and I had some changes to align vanilla …
lambdatiger Apr 14, 2024
d6c400e
Missed variable when updating
lambdatiger Apr 14, 2024
283b806
Added unneeded class details to make PBOproject happy
lambdatiger Apr 14, 2024
868c613
Forgot to update doFragRandom docs with previous changes
lambdatiger Apr 14, 2024
559c611
and the debug context
lambdatiger Apr 14, 2024
afc3b10
Merge branch 'acemod:master' into master
lambdatiger Apr 16, 2024
4f0c167
Merge branch 'master' into pr/9728
johnb432 May 9, 2024
e2dce5e
Readd blacklist
johnb432 May 18, 2024
b9aa3cb
Fixed an issue with fragments being created above water for explosion…
lambdatiger May 19, 2024
eaff498
Exposed projectile event handlers for both blacklist use and other sh…
lambdatiger May 19, 2024
f1483c5
Revert "Exposed projectile event handlers for both blacklist use and …
lambdatiger May 19, 2024
8d071f9
added debug information and folded if statements
lambdatiger May 19, 2024
3d6c406
fixed error (if statement with no argument)
lambdatiger May 19, 2024
718c3d6
Only send blacklist updates to the server
lambdatiger May 20, 2024
130037d
Added default fragCount fallback value based on current ACE frag rang…
lambdatiger Jun 20, 2024
474321b
Converted all positions for doFrag to AGL since we're converting to t…
lambdatiger Jun 20, 2024
60a0dae
removed feet hitpoints & tightened multishot submunitions.
lambdatiger Jun 20, 2024
d0df8e5
Merge branch 'acemod:master' into master
lambdatiger Jun 20, 2024
eedbb0b
Revert to 60a0dae, merge conflict wasn't resolved properly
lambdatiger Jun 20, 2024
7050afb
Merge branch 'master' of https://github.com/lambdatiger/ace_frag-over…
lambdatiger Jun 20, 2024
d6adfb7
Merge remote-tracking branch 'upstream/master'
lambdatiger Jun 20, 2024
a6cfcbf
Removed event handlers
lambdatiger Jul 17, 2024
cf1860d
Changed blacklist to acting on local projectiles to match initial per…
lambdatiger Jul 17, 2024
9df2e5b
added fired EH and moved projectile tracking to be local to projectile
lambdatiger Jul 17, 2024
f65fcbf
updated initialization and should frag to check for submunitions sinc…
lambdatiger Jul 17, 2024
cd4d2a9
Fixed calls for shouldFrag and got rid of old initRound.sfq (maybe ba…
lambdatiger Jul 17, 2024
04e844f
fixed small mistakes in names and function calls
lambdatiger Jul 17, 2024
1ae4fc7
fixed frame offset to avoid hitting dead targets
lambdatiger Jul 17, 2024
15d5256
Merge branch 'acemod:master' into master
lambdatiger Jul 17, 2024
32af820
Fixed config path in shouldFrag
lambdatiger Jul 17, 2024
0269039
Didn't know that PBO project needed trailing {} on class inheritance …
lambdatiger Jul 17, 2024
15de0d9
fixed more useless trailing {}
lambdatiger Jul 17, 2024
b656ef6
Initial rollback to old frag simulation and spalling simulation. Upda…
lambdatiger Jul 17, 2024
2c5b058
missed comma
lambdatiger Jul 17, 2024
20b1ab7
remove fragCount from config
lambdatiger Jul 17, 2024
a20274a
made addBlackList remove projectile EHs
lambdatiger Jul 18, 2024
842b818
updated config path to be relevant to post-EH version
lambdatiger Jul 18, 2024
fbca983
All spalling in current version is local
lambdatiger Jul 18, 2024
04c4bd4
updated search pattern to one discussed in PR #9728
lambdatiger Jul 19, 2024
682568f
updated defines to match implementation
lambdatiger Jul 19, 2024
9c8e9e3
removed commented out debug information from nouber
lambdatiger Jul 19, 2024
3fcf6f7
removed magic numbers and code with no effect
lambdatiger Jul 19, 2024
3595f82
removed more magic numbers
lambdatiger Jul 19, 2024
39e7f7f
unfucked a comma
lambdatiger Jul 19, 2024
783c2aa
fixed debug def names
lambdatiger Jul 19, 2024
f7d6c78
updated documentation
lambdatiger Jul 19, 2024
8da5e47
changed debug colors
lambdatiger Jul 19, 2024
437f6c1
mass must be in grams in this version I guess
lambdatiger Jul 19, 2024
48e2996
fixed errors in frag with downgrade
lambdatiger Jul 19, 2024
1480715
fixed timing and other spall issues
lambdatiger Jul 19, 2024
4f25176
updated some defne names and usages
lambdatiger Jul 19, 2024
c344130
increased code legiblity and optimized some randomizations
lambdatiger Jul 19, 2024
f57f6f5
clarified parts of the spall event chain
lambdatiger Jul 19, 2024
2713acd
Optimized loop to find spall position using larger steps and fewer op…
lambdatiger Jul 19, 2024
e4d36c6
fixed small errors
lambdatiger Jul 19, 2024
160bb15
Merge remote-tracking branch 'upstream/master' into Event-hanlder-rep…
lambdatiger Jul 19, 2024
3efaef0
removed unused variables & EHs and set defaults in the case debug mod…
lambdatiger Jul 30, 2024
6137849
removed "class eventhandler" references
lambdatiger Jul 30, 2024
5df635c
removed _fragCount reference in newly backported debug functions
lambdatiger Jul 30, 2024
33a0653
fragmenting projectile velocity isn't used anywhere
lambdatiger Jul 30, 2024
72a6cff
removed unused variables, implemented fixes from full rewrite PR, and…
lambdatiger Jul 30, 2024
3659aff
added debug draw mode to DEBUG_ENABLED_FRAG define check
lambdatiger Jul 30, 2024
8b29b86
Merge branch 'acemod:master' into Event-hanlder-replacement
lambdatiger Jul 30, 2024
06d3b23
fix documentation to make units clear on metal and filler quanities
lambdatiger Jul 30, 2024
4d79e93
Merge branch 'Event-hanlder-replacement' of https://github.com/lambda…
lambdatiger Jul 30, 2024
0ef3991
command capitalization
lambdatiger Jul 30, 2024
cfdf291
added target point debug spheres
lambdatiger Jul 30, 2024
5745455
fixed target sphere visability
lambdatiger Jul 30, 2024
bee8eee
Jank fix so that the unit firing can get hit with it's own fragments
lambdatiger Jul 30, 2024
5059cb2
accidentally committed script_component.hpp w/ debug enabled
lambdatiger Jul 30, 2024
ed36b6a
Alternative way to address shot parent self-harm issue
lambdatiger Jul 30, 2024
61a1770
missed comma, going to bed, sorry
lambdatiger Jul 30, 2024
7b282ec
add newline and fix blacklist
lambdatiger Jul 30, 2024
22ca38f
legability formatting
lambdatiger Jul 30, 2024
25cc22b
removed extra newlines and double spaces
lambdatiger Jul 30, 2024
2e67d5d
Updated function documentation
lambdatiger Jul 30, 2024
4092177
Removed unused stringtable items
lambdatiger Jul 30, 2024
8c68f13
Debug sphere conditional was missing in frago
lambdatiger Jul 31, 2024
eb04dec
Completed suggested changed by johnb432
lambdatiger Aug 14, 2024
66fce29
Merge branch 'acemod:master' into Event-hanlder-replacement
lambdatiger Aug 14, 2024
5d16ecb
restored 40mm grenade fragmentation
lambdatiger Aug 23, 2024
b17ea96
Apply suggestions from code review
lambdatiger Aug 23, 2024
58e021b
Fixed firefist inheritance and order of 125mm shell
lambdatiger Aug 23, 2024
82d9044
Merge branch 'acemod:master' into Event-hanlder-replacement
lambdatiger Aug 23, 2024
ea782c1
Wrong order on reflections variables, but it's not like anyone uses that
lambdatiger Aug 23, 2024
9e150e0
Added projectile locality
lambdatiger Aug 24, 2024
b9138bd
Added proper projectile locality checks
lambdatiger Aug 24, 2024
bd557af
Merge branch 'Event-hanlder-replacement' of https://github.com/lambda…
lambdatiger Aug 24, 2024
f485b5a
left some locality debug text
lambdatiger Aug 24, 2024
dae81be
This isn't worthy of a warning as most of the time _objectHit is null…
lambdatiger Aug 24, 2024
70606d4
Removed a newlines for code brackets in arrays
lambdatiger Aug 28, 2024
1855441
updated debug functions with some minor optimizations
lambdatiger Aug 28, 2024
dfbcd15
Apply suggestions from code review
lambdatiger Aug 29, 2024
5ae31fa
Merge remote-tracking branch 'upstream/master' into Event-hanlder-rep…
lambdatiger Sep 4, 2024
6a51a82
didn't consider someone might use explosion reflections but not frag
lambdatiger Sep 4, 2024
7bbd8a0
addressed future arma v2.18 changes more aptly
lambdatiger Sep 4, 2024
c0ea806
Fixed authors line on fired function. Used to make sense different wh…
lambdatiger Sep 4, 2024
bdf0854
switch all hash fallbacks to getOrDefaultCall and turned default frag…
lambdatiger Sep 7, 2024
f512fab
Merge branch 'acemod:master' into Event-hanlder-replacement
lambdatiger Sep 8, 2024
f918816
Transitioned frag system from fired to ace explode event system
lambdatiger Sep 8, 2024
65c0304
decreased chance to hit / fragment inaccuracy.
lambdatiger Sep 9, 2024
18816cf
fixing setShotParents only sometimes setting first argument, not inst…
lambdatiger Sep 10, 2024
6808b81
cleanup
LinkIsGrim Sep 11, 2024
1568dde
Slight optimization of "_vecVar" calculation
lambdatiger Sep 11, 2024
4ec7dfd
removed dev_addRound function
lambdatiger Sep 11, 2024
6c49525
Command changes for Arma 2.18
lambdatiger Sep 12, 2024
d70686e
Fixed debug setting changes
lambdatiger Sep 12, 2024
64e44d3
missed exit condition
lambdatiger Sep 12, 2024
ee7c28d
removed shot parents due to local creation of spall
lambdatiger Sep 16, 2024
487b987
Merge remote-tracking branch 'upstream/master' into eventHandler-repl…
lambdatiger Sep 22, 2024
5f6bd5b
Merge remote-tracking branch 'upstream/master' into eventHandler-repl…
lambdatiger Oct 13, 2024
af575dc
Merge remote-tracking branch 'upstream/master' into eventHandler-repl…
lambdatiger Oct 13, 2024
93892cb
simplified comment
lambdatiger Oct 13, 2024
7c2ded5
Adjusted whitespace for readability
lambdatiger Oct 13, 2024
8a6f982
Reformatted comments per Johnb432's suggestions
lambdatiger Oct 19, 2024
da81d29
one more indent fix
lambdatiger Oct 19, 2024
dd36d92
Merge branch 'eventHandler-replace-2.18' of https://github.com/lambda…
lambdatiger Oct 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions addons/frag/functions/fnc_fired.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ private _hitPartEventHandler = _projectile addEventHandler ["HitPart", {
private _ammo = typeOf _projectile;
private _vectorUp = vectorUp _projectile;

/*
* Wait a frame to see what happens to the round
*/
// Wait a frame to see what happens to the round
[LINKFUNC(doSpallHitPart), [_projectile, _objectHit, _posASL, _velocity, _surfNorm, _surfType, _ammo, _vectorUp]] call CBA_fnc_execNextFrame;
}];
private _penetratedEventHandler = _projectile addEventHandler ["Penetrated",LINKFUNC(doSpallPenetrate)];
Expand Down
171 changes: 80 additions & 91 deletions addons/frag/functions/fnc_frago.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -39,105 +39,94 @@ _shellType call FUNC(getFragInfo) params ["_fragRange", "_fragVelocity", "_fragT

private _fragPosAGL = ASLToAGL _fragPosASL;
TRACE_5("fragValues",_fragPosASL,_fragPosAGL,_fragRange,_fragVelocity,_metalMassModifier);
// Post 2.18 change - uncomment line 43, modify lines 45, and remove lines 44, 51-57, 64-66
// private _targets = [ASLToAGL _fragPosAGL, _fragRange, _fragRange, 0, false, _fragRange] nearEntities [["Car", "Motorcycle", "Tank", "StaticWeapon", "CAManBase", "Air", "Ship"], false, true, true];
private _objects = _fragPosAGL nearEntities [["Car", "Motorcycle", "Tank", "StaticWeapon", "CAManBase", "Air", "Ship"], _fragRange];
if (_objects isEqualTo []) exitWith {

// compile possible targets including units, vehicles, and crews
lambdatiger marked this conversation as resolved.
Show resolved Hide resolved
private _targets = [_fragPosAGL, _fragRange, _fragRange, 0, false, _fragRange] nearEntities [["Car", "Motorcycle", "Tank", "StaticWeapon", "CAManBase", "Air", "Ship"], false, true, true];
if (_targets isEqualTo []) exitWith {
TRACE_2("No nearby targets",_fragPosAGL,_fragRange);
0
lambdatiger marked this conversation as resolved.
Show resolved Hide resolved
};

// grab crews and add them in so that targets stay approx. sorted by distance
TRACE_1("",_objects);
private _targets = [];
{
private _crew = crew _x;
_crew pushBackUnique _x;
_targets append _crew;
} forEach _objects;
TRACE_2("",_fragRange,count _targets);
TRACE_3("",_fragRange,count _targets,_targets);

private _fragCount = 0;

private _fragArcs = [];
_fragArcs set [360, 0];

if (_targets isNotEqualTo []) then {
if (GVAR(reflectionsEnabled)) then {
[_fragPosASL, _shellType] call FUNC(doReflections);
};
{
private _target = _x;
if (alive _target && {getNumber ((configOf _target) >> "isPlayableLogic") == 0}) then {
(boundingBox _target) params ["_boundingBoxA", "_boundingBoxB"];

private _cubic = ((abs (_boundingBoxA select 0)) + (_boundingBoxB select 0)) * ((abs (_boundingBoxA select 1)) + (_boundingBoxB select 1)) * ((abs (_boundingBoxA select 2)) + (_boundingBoxB select 2));

if (_cubic <= 1) exitWith {};

private _targetVel = velocity _target;
private _targetPos = getPosASL _target;
private _distance = _target distance _fragPosAGL;
private _add = ((_boundingBoxB select 2) / 2) + ((((_distance - (_fragVelocity / 8)) max 0) / _fragVelocity) * 10);

_targetPos = _targetPos vectorAdd [
(_targetVel select 0) * (_distance / _fragVelocity),
(_targetVel select 1) * (_distance / _fragVelocity),
_add
];

private _baseVec = _fragPosASL vectorFromTo _targetPos;

private _dir = floor (_baseVec call CBA_fnc_vectDir);
private _currentCount = RETDEF(_fragArcs select _dir,0);
if (_currentCount < 10) then {
private _count = ceil (random _metalMassModifier);
private _vecVar = FRAG_VEC_VAR;
if !(_target isKindOf "CAManBase") then {
ADD(_vecVar,(sqrt _cubic) / 2000);
if ((crew _target) isEqualTo [] && {_count > 0}) then {
_count = 0 max (_count / 2);
};
if (GVAR(reflectionsEnabled)) then {
[_fragPosASL, _shellType] call FUNC(doReflections);
};
{
private _target = _x;
if (getNumber ((configOf _target) >> "isPlayableLogic") == 0) then {
(boundingBox _target) params ["_boundingBoxA", "_boundingBoxB"];

private _cubic = ((abs (_boundingBoxA select 0)) + (_boundingBoxB select 0)) * ((abs (_boundingBoxA select 1)) + (_boundingBoxB select 1)) * ((abs (_boundingBoxA select 2)) + (_boundingBoxB select 2));

if (_cubic <= 1) exitWith {};

private _targetVel = velocity _target;
private _targetPos = getPosASL _target;
private _distance = _target distance _fragPosAGL;
private _add = ((_boundingBoxB select 2) / 2) + ((((_distance - (_fragVelocity / 8)) max 0) / _fragVelocity) * 10);

_targetPos = _targetPos vectorAdd [
(_targetVel select 0) * (_distance / _fragVelocity),
(_targetVel select 1) * (_distance / _fragVelocity),
_add
];

private _baseVec = _fragPosASL vectorFromTo _targetPos;

private _dir = floor (_baseVec call CBA_fnc_vectDir);
private _currentCount = RETDEF(_fragArcs select _dir,0);
if (_currentCount < 10) then {
private _count = ceil (random _metalMassModifier);
private _vecVar = FRAG_VEC_VAR;
if !(_target isKindOf "CAManBase") then {
ADD(_vecVar,(sqrt _cubic) / 2000);
if ((crew _target) isEqualTo [] && {_count > 0}) then {
_count = 0 max (_count / 2);
};
private _vecVarHalf = _vecVar / 2;
for "_i" from 1 to _count do {
private _vectorDir = _baseVec vectorDiff [
_vecVarHalf - (random _vecVar),
_vecVarHalf - (random _vecVar),
_vecVarHalf - (random _vecVar)
];

private _fragObjSpeed = _fragVelocity * (1 - random 0.5);
private _fragObjVelocity = _vectorDir vectorMultiply _fragObjSpeed;

private _fragObj = createVehicleLocal [selectRandom _fragTypes, _fragPosAGL, [], 0, "CAN_COLLIDE"];
_fragObj setVectorDir _vectorDir;
_fragObj setVelocity _fragObjVelocity;
#ifdef DEBUG_MODE_DRAW
[_fragObj, "green", true] call FUNC(dev_trackObj);
if (GVAR(dbgSphere)) then {
[_targetPos, "(0.88,0.36,0.92,0.8)"] call FUNC(dev_sphereDraw);
};
#endif
INC(_fragCount);
INC(_currentCount);
};
private _vecVarHalf = _vecVar / 2;
for "_i" from 1 to _count do {
private _vectorDir = _baseVec vectorDiff [
_vecVarHalf - (random _vecVar),
_vecVarHalf - (random _vecVar),
_vecVarHalf - (random _vecVar)
];

private _fragObjSpeed = _fragVelocity * (1 - random 0.5);
private _fragObjVelocity = _vectorDir vectorMultiply _fragObjSpeed;

private _fragObj = createVehicleLocal [selectRandom _fragTypes, _fragPosAGL, [], 0, "CAN_COLLIDE"];
_fragObj setVectorDir _vectorDir;
_fragObj setVelocity _fragObjVelocity;
#ifdef DEBUG_MODE_DRAW
[_fragObj, "green", true] call FUNC(dev_trackObj);
if (GVAR(dbgSphere)) then {
[_targetPos, "(0.88,0.36,0.92,0.8)"] call FUNC(dev_sphereDraw);
};
_fragArcs set [_dir, _currentCount];
#endif
INC(_fragCount);
INC(_currentCount);
};
_fragArcs set [_dir, _currentCount];
};
if (_fragCount > _maxFrags) exitWith {};
} forEach _targets;
TRACE_1("targeted",_fragCount);
};
if (_fragCount > _maxFrags) exitWith {};
private _randomCount = ceil ((_maxFrags - _fragCount) * 0.35);
TRACE_1("",_randomCount);
private _sectorSize = 360 / (_randomCount max 1);

for "_i" from 1 to _randomCount do {
// Distribute evenly
private _sectorOffset = 360 * (_i - 1) / (_randomCount max 1);
private _randomDir = random (_sectorSize);
private _vectorDir = [cos (_sectorOffset + _randomDir), sin (_sectorOffset + _randomDir), sin (30 - (random 45))];
} forEach _targets;
TRACE_1("targeted",_fragCount);
if (_fragCount > _maxFrags) exitWith {};
private _randomCount = ceil ((_maxFrags - _fragCount) * 0.35);
TRACE_1("",_randomCount);
private _sectorSize = 360 / (_randomCount max 1);

for "_i" from 1 to _randomCount do {
// Distribute evenly
private _sectorOffset = 360 * (_i - 1) / (_randomCount max 1);
private _randomDir = random (_sectorSize);
private _vectorDir = [cos (_sectorOffset + _randomDir), sin (_sectorOffset + _randomDir), sin (30 - (random 45))];

private _fragObjSpeed = _fragVelocity * (1 - random 0.5);
lambdatiger marked this conversation as resolved.
Show resolved Hide resolved
private _fragObjVelocity = _vectorDir vectorMultiply _fragObjSpeed;
Expand All @@ -146,13 +135,13 @@ if (_targets isNotEqualTo []) then {
_fragObj setVectorDir _vectorDir;
_fragObj setVelocity _fragObjVelocity;

#ifdef DEBUG_MODE_DRAW
[_fragObj, "blue", true] call FUNC(dev_trackObj);
#endif
INC(_fragCount);
};
#ifdef DEBUG_MODE_DRAW
[_fragObj, "blue", true] call FUNC(dev_trackObj);
#endif
INC(_fragCount);
};

TRACE_1("total created",_fragCount);

END_COUNTER(frago);
_fragCount
lambdatiger marked this conversation as resolved.
Show resolved Hide resolved