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

WIP: fix setting velocity on paradropping cargo #8204

Conversation

LupusTheCanine
Copy link
Contributor

@LupusTheCanine LupusTheCanine commented Apr 9, 2021

When merged this pull request will:

  • Cargo - Fix setting velocity for airdropped objects

Fixes #8199

Code changes summary:

  • Cargo - Add serverParadrop to handle invoking ownerParadrop
  • Cargo - Add ownerParadrop to set velocity on owner's machine
  • Cargo - Change velocity setting related code in paradropCargo.
  • Cargo - replaced serverUnload event with serverParadrop

Makes paradropItem and unloadItem invoke event "ace_cargoUnloaded" with parameters _itemObject, _vehicle and "paradrop" or "unload" respectivelty.
paradropItem invoked said event but if item was classname it would send classname to event which is not particularly useful.
Moved event invocation to unloadItem, this provides ability to always pass object to eventhandlers.
Add ownerParadrop eventHandler that sets items velocity on owners machine
Add serverParadrop eventHandler that additionally handles invoking ownerParadrop
Rearange paradropItem to support above changes.
refactored according to acemod#8203 (comment)
replaced ownerParadrop with common, setVelocity which does exactly the same thing.

_item hideObjectGlobal false;
_item setPosASL (AGLtoASL _emptyPosAGL);
[QEGVAR(common,setVelocity), [_item,_dropVelocity],owner _item] call CBA_fnc_ownerEvent;
Copy link
Contributor

Choose a reason for hiding this comment

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

?

@commy2
Copy link
Contributor

commy2 commented Apr 9, 2021

I do not understand how this is supposed to solve anything.

To me it seems like it should just be:

_itemObject setVelocity ((velocity _vehicle) vectorAdd ((vectorNormalized (vectorDir _vehicle)) vectorMultiply -5));

->

private _velocity = velocity _vehicle vectorAdd (vectorNormalized vectorDir _vehicle vectorMultiply -5);
[QEGVAR(common,setVelocity), [_itemObject, _velocity]] call CBA_fnc_globalEvent;

and also consider the other setVelocity a few lines down.

Maybe I am missing something, but ownerEvent is a huge red flag to me.

@LupusTheCanine
Copy link
Contributor Author

I do not understand how this is supposed to solve anything.

To me it seems like it should just be:

_itemObject setVelocity ((velocity _vehicle) vectorAdd ((vectorNormalized (vectorDir _vehicle)) vectorMultiply -5));

->

private _velocity = velocity _vehicle vectorAdd (vectorNormalized vectorDir _vehicle vectorMultiply -5);
[QEGVAR(common,setVelocity), [_itemObject, _velocity]] call CBA_fnc_globalEvent;

and also consider the other setVelocity a few lines down.

Maybe I am missing something, but ownerEvent is a huge red flag to me.

After finalizing #8203 I will try a simpler approach you suggested in #8199.
What is the benefit of using global event vs target event? To me using global event looks like firing a claymore at a single soldier.

@commy2
Copy link
Contributor

commy2 commented Apr 9, 2021

After rewatching the video, targetEvent seems to be sufficient, however, the current ownerEvent is just weird and there is no reason to make a second handler on the server for a single line.

@LupusTheCanine
Copy link
Contributor Author

Closing now, I have a new version which incorporates changes suggested by commy2 and implementing them in a new branch will yield much cleaner pull request.
I will create new pull request after finalizing #8203 as new fix is written with it in mind.

@LupusTheCanine LupusTheCanine deleted the cargoParadrop-setVelocity-fix branch May 1, 2021 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ParadropItem inconsistency between SP and MP
2 participants