If Isaac.CreateTimer is called in MC_POST_NEW_ROOM callback, it'll fire instantly upon entering the room even with high interval set. Whether the timer is set as persistent or not appears to have no obvious effect. If the function is set to run more than once, it'll fire with the correct delay after the first call.
Reproduction is as simple as running Isaac.CreateTimer in a function called by the MC_POST_NEW_ROOM callback.
local mod = RegisterMod("Test", 1)
local function PostNewRoom()
Isaac.CreateTimer(function ()
Isaac.Spawn(
EntityType.ENTITY_PICKUP,
PickupVariant.PICKUP_COLLECTIBLE,
CollectibleType.COLLECTIBLE_SAD_ONION,
Game():GetRoom():GetCenterPos(),
Vector.Zero,
nil
)
end, 60, 1, false)
end
mod:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, PostNewRoom)
Marking as low priority since there's a "good enough" workaround for now of wrapping the CreateTimer in another CreateTimer with 0 or 1 frame of interval.
local function PostNewRoom()
Isaac.CreateTimer(function ()
Isaac.CreateTimer(function ()
Isaac.Spawn(
EntityType.ENTITY_PICKUP,
PickupVariant.PICKUP_COLLECTIBLE,
CollectibleType.COLLECTIBLE_SAD_ONION,
Game():GetRoom():GetCenterPos(),
Vector.Zero,
nil
)
end, 30, 1, true)
end, 0, 1, true)
end
If Isaac.CreateTimer is called in MC_POST_NEW_ROOM callback, it'll fire instantly upon entering the room even with high interval set. Whether the timer is set as persistent or not appears to have no obvious effect. If the function is set to run more than once, it'll fire with the correct delay after the first call.
Reproduction is as simple as running Isaac.CreateTimer in a function called by the MC_POST_NEW_ROOM callback.
Marking as low priority since there's a "good enough" workaround for now of wrapping the CreateTimer in another CreateTimer with 0 or 1 frame of interval.