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 events to support scene group substitution #2413

Merged
merged 3 commits into from
Nov 1, 2023

Conversation

longfruit
Copy link
Contributor

Description

Add new events to support scene group substitution:

Event Called when
SceneBlockLoadedEvent SceneBlock finishes reading from block script
SceneMetaLoadEvent SceneScriptManager starts loading SceneMeta

Example plugin using these events: SceneHook. Disclaimer: I wrote it.

gif

Basic flow:

  1. Plugin provides replacement groups.
  2. Replacement groups can be registered on demand or automatically at plugin load time.
    1. On SceneBlock load, plugin can change existing and add new groups.
    2. On SceneMeta load, plugin can hook in dynamic group loads when scene finishes loading.
  3. Groups become replaced on demand or automatically at scene load time.

Also, fix a script issue caused by EVENT_ANY_MONSTER_DIE firing at the same time.

Before After
gif gif

Issues fixed by this PR

Type of changes

  • Bug fix
  • New feature
  • Enhancement
  • Documentation

Checklist:

  • My code follows the style guidelines of this project
  • My pull request is unique and no other pull requests have been opened for these changes
  • I have read the Contributing note and Code of conduct
  • I am responsible for any copyright issues with my code if it occurs in the future.

@KingRainbow44 KingRainbow44 merged commit cf6fb27 into Grasscutters:development Nov 1, 2023
2 checks passed
@longfruit longfruit deleted the scene-hook branch November 2, 2023 23:40
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.

2 participants