Skip to content

Instantly share code, notes, and snippets.

@X-Raym
Last active July 15, 2026 12:32
Show Gist options
  • Select an option

  • Save X-Raym/ada281b76bbbc3a5cde4fc8d7f3ee605 to your computer and use it in GitHub Desktop.

Select an option

Save X-Raym/ada281b76bbbc3a5cde4fc8d7f3ee605 to your computer and use it in GitHub Desktop.
Binding of Isaac - Controller Restart is Rewind Mod: Prevent Restart a run if Right Stick and Right Trigger are pressed for too long
-- Binding of Isaac Mod: Controller Restart is Rewind
-- Description: Prevent Restart a run if Right Stick and Right Trigger are pressed for too long
-- Author: X-Raym
-- Version: 1.0.0
-- Link: https://gist.github.com/X-Raym/ada281b76bbbc3a5cde4fc8d7f3ee605/edit
-- License: GPL v3
local fart = true
local game = Game()
local mod = RegisterMod("Controller Restart is Rewind", 1)
local buttons = { joystick_r_click = 13, trigger_r = 12 }
local timers = { 0, 0, 0, 0 }
-- When run is started or continued
function mod:Update()
for i = 0, 3 do -- Multiplayer support
local player = Isaac.GetPlayer(i)
if player then
if Input.IsButtonPressed(buttons.trigger_r, player.ControllerIndex) and Input.IsButtonPressed(buttons.joystick_r_click, player.ControllerIndex) then
timers[i] = timers[i] + 1
if timers[i] > 35 then -- Go Faster than native Restart
Isaac.DebugString( "REWIND BY PLAYER " .. i )
Isaac.ExecuteCommand( "rewind" )
if fart then
game:Fart( player.Position )
end
timers[i] = 0
end
else
timers[i] = 0
end
end
end
end
mod:AddCallback(ModCallbacks.MC_POST_UPDATE, mod.Update)
local mod = RegisterMod("Controller Restart", 1)
local rbar = Isaac.GetEntityTypeByName("Restart Bar");
local rbarv = Isaac.GetEntityVariantByName("Restart Bar");
spawn = { false, false, false, false }
entities = { false, false, false, false }
buttons = { joystick_r_click = 13, trigger_r = 12 }
function mod:main()
for i = 0, 3 do
local player = Isaac.GetPlayer(i)
if player then
local MoveDir = player:GetMovementDirection()
if Input.IsButtonPressed(buttons.trigger_r, player.ControllerIndex) and Input.IsButtonPressed(buttons.joystick_r_click, player.ControllerIndex) and spawn[i] == false then
spawn[i] = true
entities[i] = Isaac.Spawn(rbar, rbarv, 0, player.Position - Vector(0,74), Vector(0,0), player)
entities[i]:GetSprite():Play("Charging", true)
entities[i].EntityCollisionClass = EntityCollisionClass.ENTCOLL_NONE
entities[i].GridCollisionClass = GridCollisionClass.COLLISION_NONE
end
if spawn[i] then
entities[i].Position = player.Position - Vector(0,74)
if not Input.IsButtonPressed(buttons.trigger_r, player.ControllerIndex) or not Input.IsButtonPressed(buttons.joystick_r_click, player.ControllerIndex) then
entities[i]:Remove()
spawn[i] = false
end
end
end
end
end
mod:AddCallback(ModCallbacks.MC_POST_UPDATE, mod.main)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment