Deweh / Native-Animation-Framework

A multi-character animation framework for Fallout 4.
GNU General Public License v3.0
20 stars 5 forks source link

NAF::SceneEnded #7

Closed lapolla closed 1 year ago

lapolla commented 1 year ago

NAF::SceneEnded event should contain the list of actors involved.

Or why not build and send AAF:OnSceneEnd custom event. That way will trigger all mods depending on that hook?

dlinny-lag commented 1 year ago

@lapolla GetSceneActors can be used to obtain actors in event handler.

lapolla commented 1 year ago

It can, but unlike NAF::SceneStarted it returns empty array:

Function OnNAFSceneEnd(NAF:SceneId akScene)
    Actor[] kActors = NAF.GetSceneActors(akScene)
    Notify(akScene + ":" + kActors)

I guess it has something in common with that comment:

;Returns all actors in akScene. If the scene does not exist, an empty array will be returned.
Actor[] Function GetSceneActors(SceneId akScene) Native Global
dlinny-lag commented 1 year ago

Ah, yes. At the moment of OnSceneEnd triggering the scene is already removed from the list of active scenes.

@Deweh We need a way to obtain list of actors in OnSceneEnd event handler. In addition, we need to know the position ID (if it was assigned to the scene) of the finished scene.

Maybe it should be better to pass full scene details in the OnSceneEnd event. What do you think?

Deweh commented 1 year ago

Ah, yes. At the moment of OnSceneEnd triggering the scene is already removed from the list of active scenes.

@Deweh We need a way to obtain list of actors in OnSceneEnd event handler. In addition, we need to know the position ID (if it was assigned to the scene) of the finished scene.

Maybe it should be better to pass full scene details in the OnSceneEnd event. What do you think?

Yes, that would probably be the cleanest way to handle this case.

There are ways of keeping the scene in the active scenes map until all OnSceneEnd event handlers finish executing, but that may be bug-prone.

Deweh commented 1 year ago

Fix implemented in fcf0b77