Skip to content

MusicChange hook fires twice per level load #27

Description

@mazmazz
Sonic Robo Blast 2 v2.1.20 (Mar  4 2018 01:52:44 38fc17dc)
Speeding off to level...
Changing Map from 1
MusicChange from  to MAP01M | MapIsChanging true
MusicChange from MAP01M to MAP01M | MapIsChanging true
Loaded Map to 1
$map map02
Speeding off to level...
Changing Map from 1
MusicChange from MAP01M to MAP02M | MapIsChanging true
MusicChange from MAP02M to MAP02M | MapIsChanging true
Loaded Map to 2
$map map03
Speeding off to level...
Changing Map from 2
MusicChange from MAP02M to MAP03M | MapIsChanging true
MusicChange from MAP03M to MAP03M | MapIsChanging true
Loaded Map to 3
Changing Map from 3
MusicChange from MAP03M to MAP03M | MapIsChanging true
MusicChange from MAP03M to MAP03M | MapIsChanging true
Loaded Map to 3
local MapIsChanging = false

local function OnMapChange(oldmapnum)
    MapIsChanging = true
    print(string.format('Changing Map from %s', tostring(oldmapnum)))
end

local function OnMapLoad(mapnum)
    MapIsChanging = false
    print(string.format('Loaded Map to %s', tostring(mapnum)))
end

local function OnMusicChange(oldname, newname, flags, looping)
    print(string.format('MusicChange from %s to %s | MapIsChanging %s', oldname, newname, tostring(MapIsChanging)))
end

addHook('MapChange', OnMapChange)
addHook('MapLoad', OnMapLoad)
addHook('MusicChange', OnMusicChange)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions