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

Port ACE delayed execution functions to CBA #288

Merged

Conversation

nicolasbadano
Copy link
Contributor

This PR ports the following functions from ACE, with some optimizations. All of them run in non sched environment and are handled by the onFrame loop that handles PFH.

  • CBA_fnc_waitAndExecute: Executes a code once in non sched environment with a given game time delay. It' based on a queue, so only the bare minimum of elements are evaluated each frame. This is a very efficient way of delaying execution, certainly much more than a PFH, specially for long delays. It's savegame compatible due to the use of CBA_missionTime.
  • CBA_fnc_execNextFrame: A specialized version of CBA_fnc_waitAndExecute that delays execution a single frame.
  • CBA_fnc_waitUntilAndExecute: Evaluates a condition code on each frame, and finally launches a sepparate statement code once when the condition returns true. This behaves like BIS waitUntil, but in non sched environment. Due to all condition being evaluated each frame, this function should be used only when necessary.

All of this are heavily used in ACE. We'll certainly switch to CBA's versions if this is merged.

@@ -141,6 +141,12 @@ class CfgFunctions
description = "Drops a weapon.";
file = "\x\cba\addons\common\fnc_dropWeapon.sqf";
};
// CBA_fnc_execNextFrame
class execNextFrame
{
Copy link
Member

Choose a reason for hiding this comment

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

Opening brace on same line as class. I know it's not used in others in this file but it has to get converted anyways.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ït's not used at all in cba_common, so I prefer to maintain consistency

Copy link
Member

Choose a reason for hiding this comment

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

@commy2 is changing it, he is currently going through entire cba_common. But sure.

@jonpas
Copy link
Member

jonpas commented Mar 2, 2016

Totally awesome! 👍

@commy2 commy2 added the Feature label Mar 2, 2016
Killswitch00 added a commit that referenced this pull request Mar 5, 2016
Port ACE delayed execution functions to CBA
@Killswitch00 Killswitch00 merged commit 579b0a5 into CBATeam:master Mar 5, 2016
@nicolasbadano nicolasbadano deleted the aceDelayedExecutionFunctions branch March 5, 2016 12:43
@nicolasbadano
Copy link
Contributor Author

Thanks!

@commy2 commy2 added this to the 2.3.2 milestone May 15, 2016
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.

None yet

4 participants