Skip to content

Fix custom modules not being added in ZGM missions#494

Merged
mharis001 merged 3 commits intomasterfrom
custom-modules-zgm
Jan 16, 2021
Merged

Fix custom modules not being added in ZGM missions#494
mharis001 merged 3 commits intomasterfrom
custom-modules-zgm

Conversation

@mharis001
Copy link
Copy Markdown
Member

@mharis001 mharis001 commented Dec 24, 2020

When merged this pull request will:

  • Fix custom modules not being added to modules tree in ZGM missions

@mharis001 mharis001 added the bug fix Fixes a bug label Dec 24, 2020
@mharis001 mharis001 added this to the 1.10.0 milestone Dec 24, 2020
Copy link
Copy Markdown
Member

@Kexanone Kexanone left a comment

Choose a reason for hiding this comment

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

Nope

Recorded test on dedicated server
2021-01-13.19-19-32.mp4

@mharis001
Copy link
Copy Markdown
Member Author

Yeah, doesn't work on dedicated since the curator addons takes time and the tree isn't refreshed in the next frame. Looking at it now, I am unsure about if there is a good way to support ZGM missions.

@Kexanone
Copy link
Copy Markdown
Member

Yeah, it's an issue that has troubled us a lot in the past.
It's far from perfect, but Achilles basically checked for the presence of ZGM and counted the entries in the module tree.
Adapting this approach to unscheduled environment might be the best approach:

sleep 0.001;
// For Zeus Game Master missions: Wait until respawn was placed
if (!(missionNamespace getVariable ["BIS_moduleMPTypeGameMaster_init", false]) && {count allMissionObjects "ModuleMPTypeGameMaster_F" > 0}) then
{
    waitUntil {sleep 0.1; _moduleTreeCtrl tvCount [] > 1 || isNull findDisplay IDD_RSCDISPLAYCURATOR};
};
if (isNull findDisplay IDD_RSCDISPLAYCURATOR) exitWith {};

// wait for the next frame
sleep 0.001;
[Achilles_fnc_onModuleTreeLoad, []] call CBA_fnc_directCall;

@Kexanone
Copy link
Copy Markdown
Member

If I remember correctly BIS_moduleMPTypeGameMaster_init gets set to true by the ZGM module when the respawn is placed, but due to race conditions, you still have to check the number of entries in the module tree.

@Kexanone
Copy link
Copy Markdown
Member

I'm also not sure if both "delay by one frame with sleep 0.001" are really necessary. I might have just tested everything possible and left some unnecessary stuff around.

@mharis001 mharis001 requested a review from Kexanone January 16, 2021 15:25
Comment thread addons/editor/functions/fnc_handleLoad.sqf
@Kexanone
Copy link
Copy Markdown
Member

I can confirm that it works now for dedicated servers too.

@mharis001 mharis001 merged commit fa70cff into master Jan 16, 2021
@mharis001 mharis001 deleted the custom-modules-zgm branch January 16, 2021 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug fix Fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants