-
Notifications
You must be signed in to change notification settings - Fork 150
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
add weapon eventhandler framework #829
Conversation
addons/events/fnc_weaponEvents.sqf
Outdated
_soundSource | ||
}; | ||
|
||
if (isEmpty) then { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing _
addons/events/fnc_weaponEvents.sqf
Outdated
private _soundSource = _unit getVariable [_soundSourceName, objNull]; | ||
|
||
if !(_soundSource in attachedObjects _unit) then { | ||
_soundSource = "Building" createVehicleLocal [0,0,0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using #particlesource is faster
0.0093 ms
Cycles:
10000/10000
Code:
JK_test pushBack ("#particlesource" createVehicleLocal [0,0,0]);
VS
Result:
0.25208 ms
Cycles:
3967/10000
Code:
JK_test pushBack ("Building" createVehicleLocal [0,0,0]);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How long does it live?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
until you delete it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to not use #soundsource
? You know, because it's supposed to be a soundsource?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Result:
0.0075 ms
Cycles:
10000/10000
Code:
"#particlesource" createVehicleLocal [0,0,0]
vs
Result:
0.143308 ms
Cycles:
6978/10000
Code:
"#soundsource" createVehicleLocal [0,0,0];
i think there is more stuff run in the background
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nvm, seems like those don't work with createVehicleLocal
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does not work with createVehicleLocal?
}; | ||
|
||
if (_sound != "") then { | ||
_soundSource say3D _sound; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the sound object dont get delete anywhere so they would stack up. or did i miss something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No point in deleting it, if you can recycle it instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See L45
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aha i oversaw that sorry :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but maybe delete it when the unit dies? because else when some units would use that and die they would eather way stack up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question is if the gain would be worth the effort. I have my doubts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it would. else you could take a look at what i did within the ammo cookoff. Object Pooling would be the perfect thing for this i think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it to reuse the sound source from the corpse. But I still don't want to delete them after use.
private _onEmpty = true; | ||
|
||
if (isNumber (_config >> "onEmpty")) then { | ||
_onEmpty = getNumber (_config >> "onEmpty") == 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default returns 0, so can probably skip isNumber
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I want 1/true to be the default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not CBA_fnc_getConfigEntry
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overhead.
For |
^ a null object is attached to the player in the arsenal, so we have to make sure we don't check |
|
why not make it a standart animation for the "M320 LRR .408"? |
Not CBA goal I think. ACE3 could do it. |
ah, i see. |
Documentation:
https://github.com/CBATeam/CBA_A3/wiki/Weapon-Animations-Framework
When merged this pull request will:
Helped a guy on discord to implement this the other day, so might as well make it a function in CBA.