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

add weapon eventhandler framework #829

Merged
merged 10 commits into from
Dec 22, 2017
Merged

add weapon eventhandler framework #829

merged 10 commits into from
Dec 22, 2017

Conversation

commy2
Copy link
Contributor

@commy2 commy2 commented Dec 9, 2017

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.

@commy2 commy2 added the Feature label Dec 9, 2017
_soundSource
};

if (isEmpty) then {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing _

private _soundSource = _unit getVariable [_soundSourceName, objNull];

if !(_soundSource in attachedObjects _unit) then {
_soundSource = "Building" createVehicleLocal [0,0,0];
Copy link
Member

@jokoho48 jokoho48 Dec 9, 2017

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]);

Copy link
Contributor Author

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

until you delete it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thanks!

Copy link
Contributor Author

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?

Copy link
Member

@jokoho48 jokoho48 Dec 9, 2017

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

Copy link
Contributor Author

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.

Copy link
Member

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;
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See L45

Copy link
Member

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

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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;
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overhead.

@commy2
Copy link
Contributor Author

commy2 commented Dec 11, 2017

For handActions with delay, this ^ prevents the action from interrupting the reload gesture, destroying the magazine.

@commy2 commy2 added this to the 3.5.1 milestone Dec 11, 2017
@commy2
Copy link
Contributor Author

commy2 commented Dec 11, 2017

^ a null object is attached to the player in the arsenal, so we have to make sure we don't check objNull in [<null>].

jonpas
jonpas previously approved these changes Dec 18, 2017
@commy2
Copy link
Contributor Author

commy2 commented Dec 18, 2017

Ok, so don't reload round as long as you look down sights.

@commy2 commy2 merged commit 73b07b7 into master Dec 22, 2017
@commy2 commy2 deleted the weaponEvents branch December 22, 2017 16:05
@madpat3
Copy link

madpat3 commented Jan 31, 2018

why not make it a standart animation for the "M320 LRR .408"?

@Dystopian
Copy link
Contributor

Not CBA goal I think. ACE3 could do it.

@madpat3
Copy link

madpat3 commented Jan 31, 2018

ah, i see.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integrate Weapon Eventhandler Framework
6 participants