Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local template = RegisterMod( "Animations Don't Stall room opening", 1 );
- local roomClear = false
- local Log = {"Log:"}
- function template:LogDraw()
- for i,j in ipairs(Log) do
- Isaac.RenderText(j,50,i*15,1,1,1,1)
- end
- end
- local function print(str)
- table.insert(Log,tostring(str))
- if #Log > 10 then
- table.remove(Log,1)
- end
- end
- -- Clears the current room, and spawns the appropriate rewards
- local function clearCurrentRoom()
- -- Grabs the room
- local game = Game()
- local room = game:GetRoom()
- -- Spawns the clear Awards
- room:SpawnClearAward ()
- -- Check if it's a boss room
- if room:GetType() == RoomType.ROOM_BOSS then
- -- If so, try and spawn a DD
- room:TrySpawnDevilRoomDoor (true)
- end
- -- Set the room clear to True for the minimap
- room:SetClear(true)
- print ("Opening Doors")
- -- Opens the doors
- local door
- for i=1,8 do
- door = room:GetDoor(i)
- if door == nil then
- print ("Fuck You")
- else
- door:Open()
- door:SpawnDust()
- end
- end
- -- Sets the DoOnce for the room
- roomClear = true
- end
- function template:NpcUpdate(aNpc)
- -- Might as well make this work for every enemy, it's reasonably cheap.
- -- Make sure this is an enemy that counts.
- if aNpc.CanShutDoors then
- -- If this enemy has died, and there are none left, clear the room.
- if aNpc:IsDead() then
- print (aNpc:GetAliveEnemyCount())
- if aNpc:GetAliveEnemyCount() <= 1 and roomClear == false then
- clearCurrentRoom()
- end
- else
- -- Prevent a room from clearing more than once
- roomClear = false
- end
- end
- end
- function template:PostRender()
- template.LogDraw()
- end
- template:AddCallback( ModCallbacks.MC_POST_RENDER, template.PostRender)
- template:AddCallback( ModCallbacks.MC_NPC_UPDATE, template.NpcUpdate)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement