Skip to content

Commit 1aa73ee

Browse files
author
PonyWarrior
committed
add skip
1 parent dfa9759 commit 1aa73ee

File tree

4 files changed

+192
-1
lines changed

4 files changed

+192
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- Added Skip module
13+
1014
## [0.8.1] - 2024-06-07
1115

1216
### Fixed

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,20 @@ Follow instructions on Hell 2 Modding's readme.
6060

6161
- RepeatableChaosTrials
6262
- Enabled by default
63-
- Maked all Chaos Trials repeatable. Repeatable star dust reward can be enabled. Also shows Chaos trials which you can't do yet.
63+
- Maked all Chaos Trials repeatable. Repeatable star dust reward can be enabled. Also shows Chaos trials which you can't do yet.
64+
65+
- Skip
66+
- Enabled by default
67+
- Skip certain cutscenes and events.
68+
- RunEndCutscene
69+
- Enabled by default
70+
- Skip the end run cutscene and returning to main menu with the early access message.
71+
- RespawnInTrainingGrounds
72+
- Disabled by default
73+
- Enable to respawn in the training grounds instead of the crossroads.
74+
- DeathCutScene
75+
- Disabled by default
76+
- Enable to skip the player death cutscene.
77+
- RunDialog
78+
- Disabled by default
79+
- Enable to skip all dialogs during runs.

src/config.lua

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ local config = {
4141
Enabled = true,
4242
RepeatableReward = false
4343
},
44+
Skip = {
45+
Enabled = true,
46+
RunEndCutscene = {
47+
Enabled = true,
48+
RespawnInTrainingGrounds = false,
49+
},
50+
DeathCutScene = false,
51+
RunDialog = false,
52+
},
4453
}
4554

4655
local description = {
@@ -85,6 +94,15 @@ local description = {
8594
Enabled = "Enable to make all Chaos Trials repeatable.",
8695
RepeatableReward = "Enable to make repeating Chaos Trials still grant Stardust."
8796
},
97+
Skip = {
98+
Enabled = "Enable to skip certain cutscenes and events.",
99+
RunEndCutscene = {
100+
Enabled = "Enable to skip the end run cutscene and returning to main menu with the early access message.",
101+
RespawnInTrainingGrounds = "Enable to respawn in the training grounds instead of the crossroads.",
102+
},
103+
DeathCutScene = "Enable to skip the player death cutscene.",
104+
RunDialog = "Enable to skip all dialogs during runs.",
105+
},
88106
}
89107

90108
return config, description

src/ready.lua

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,3 +629,156 @@ if config.RepeatableChaosTrials.Enabled then
629629
end
630630
end)
631631
end
632+
633+
if config.Skip.Enabled then
634+
if config.Skip.RunEndCutscene then
635+
ModUtil.Path.Override("EndEarlyAccessPresentation", function()
636+
AddInputBlock({ Name = "EndEarlyAccessPresentation" })
637+
SetPlayerInvulnerable("EndEarlyAccessPresentation")
638+
639+
CurrentRun.Hero.Mute = true
640+
CurrentRun.ActiveBiomeTimer = false
641+
ToggleCombatControl(CombatControlsDefaults, false, "EarlyAccessPresentation")
642+
643+
wait(0.1)
644+
StopAmbientSound({ All = true })
645+
SetAudioEffectState({ Name = "Reverb", Value = 1.5 })
646+
EndAmbience(0.5)
647+
EndAllBiomeStates()
648+
FadeOut({ Duration = 0.375, Color = Color.Black })
649+
650+
-- first production / early access
651+
EndBiomeRecords()
652+
RecordRunCleared()
653+
654+
-- destroy the player / back to DeathArea
655+
SetPlayerVulnerable("EndEarlyAccessPresentation")
656+
RemoveInputBlock({ Name = "EndEarlyAccessPresentation" })
657+
ToggleCombatControl(CombatControlsDefaults, true, "EarlyAccessPresentation")
658+
659+
CurrentRun.Hero.Mute = false
660+
thread(Kill, CurrentRun.Hero)
661+
wait(0.15)
662+
663+
FadeIn({ Duration = 0.5 })
664+
end)
665+
666+
ModUtil.Path.Override("KillHero", function(victim, triggerArgs)
667+
local killer = triggerArgs.AttackerTable
668+
thread(CheckOnDeathPowers, victim, killer, triggerArgs.SourceWeapon)
669+
for k, spawnThreadName in pairs(CurrentRun.CurrentRoom.SpawnThreads) do
670+
killTaggedThreads(spawnThreadName)
671+
end
672+
CurrentRun.CurrentRoom.SpawnThreads = {}
673+
killWaitUntilThreads("RequiredKillEnemyKilledOrSpawned")
674+
killWaitUntilThreads("AllRequiredKillEnemiesDead")
675+
killWaitUntilThreads("AllEncounterEnemiesDead")
676+
killWaitUntilThreads("RequiredEnemyKilled")
677+
killWaitUntilThreads(UIData.BoonMenuId)
678+
ClearGameplayElapsedTimeMultipliers()
679+
ClearPauseMenuTakeover()
680+
EndAmbience(0.5)
681+
EndMusic(AudioState.MusicId, AudioState.MusicName, triggerArgs.MusicEndTime or 0.0)
682+
if killer == nil then
683+
killer = {}
684+
killer.Name = triggerArgs.AttackerName
685+
killer.ObjectId = triggerArgs.AttackerId
686+
end
687+
local killedByName = killer.Name or triggerArgs.SourceWeapon
688+
CurrentRun.KilledByName = killedByName
689+
GameState.LastKilledByName = killedByName or GameState.LastKilledByName
690+
if GetConfigOptionValue({ Name = "EditingMode" }) then
691+
SetAnimation({ Name = "ZagreusDeadStartBlood", DestinationId = CurrentRun.Hero.ObjectId })
692+
return
693+
end
694+
AddTimerBlock(CurrentRun, "HandleDeath")
695+
if ActiveScreens.TraitTrayScreen ~= nil then
696+
TraitTrayScreenClose(ActiveScreens.TraitTrayScreen)
697+
end
698+
ClearHealthShroud()
699+
SessionMapState.HandlingDeath = true
700+
CurrentRun.Hero.IsDead = true
701+
CurrentRun.ActiveBiomeTimer = false
702+
CurrentRun.ActiveBiomeTimerKeepsake = false
703+
if ShouldIncrementEasyMode() then
704+
GameState.EasyModeLevel = GameState.EasyModeLevel + 1
705+
end
706+
if not CurrentRun.Cleared then -- Already recorded if cleared
707+
RecordRunStats()
708+
end
709+
InvalidateCheckpoint()
710+
FinishTargetMarker(killer)
711+
ResetObjectives()
712+
if killer.Name ~= nil and killer.ObjectId ~= nil and not killer.SkipModifiers then
713+
GameState.CauseOfDeath = GetGenusName(killer)
714+
end
715+
local deathPresentationFunctionName = "DeathPresentation"
716+
CallFunctionName(deathPresentationFunctionName, CurrentRun, killer, triggerArgs)
717+
AddInputBlock({ Name = "MapLoad" })
718+
719+
CurrentRun.CurrentRoom.EndingHealth = CurrentRun.Hero.Health
720+
table.insert(CurrentRun.RoomHistory, CurrentRun.CurrentRoom)
721+
UpdateRunHistoryCache(CurrentRun, CurrentRun.CurrentRoom)
722+
723+
GameState.Resources.Money = 0
724+
CurrentRun.NumRerolls = GetTotalHeroTraitValue("RerollCount")
725+
CurrentRun.NumTalentPoints = GetTotalHeroTraitValue("TalentPointCount")
726+
CurrentRun.ShrineUpgradesDisabled = {}
727+
728+
GamePhaseTick({ Ticks = GetDeathGamePhaseTicks(), SkipGarden = true })
729+
SessionMapState.HandlingDeath = false
730+
CurrentRun.Hero.Health = CurrentRun.Hero.MaxHealth
731+
CurrentRun.Hero.HealthBuffer = 0
732+
CurrentRun.Hero.Mana = CurrentRun.Hero.MaxMana
733+
CurrentRun.Hero.ReserveManaSources = {}
734+
735+
if CurrentRun.Hero.Weapons.WeaponLob then
736+
ReloadAmmo({ Name = "WeaponLob" })
737+
end
738+
for resourceName, resourceData in pairs(ResourceData) do
739+
if resourceData.RunResource then
740+
GameState.Resources[resourceName] = 0
741+
end
742+
end
743+
local currentRoom = CurrentRun.CurrentRoom
744+
local deathMap = GameData.HubMapName
745+
GameState.LocationName = HubRoomData.BaseHub.SaveProfileLocationText
746+
RandomSetNextInitSeed()
747+
for deathMapName, deathMapData in pairs( HubRoomData ) do
748+
if deathMapData.OnDeathLoadRequirements ~= nil then
749+
for k, gameStateRequirements in pairs( deathMapData.OnDeathLoadRequirements ) do
750+
if IsGameStateEligible( CurrentRun, gameStateRequirements ) then
751+
deathMap = deathMapName
752+
break
753+
end
754+
end
755+
end
756+
end
757+
CurrentRun.Hero.PreDeathTraits = CurrentRun.Hero.Traits
758+
if config.Skip.RunEndCutscene.RespawnInTrainingGrounds then
759+
deathMap = "Hub_PreRun"
760+
end
761+
RequestSave({ StartNextMap = deathMap, DevSaveName = CreateDevSaveName(CurrentRun, { StartNextMap = deathMap, PostDeath = true, }), SendSave = true })
762+
ClearUpgrades()
763+
SetConfigOption({ Name = "FlipMapThings", Value = false })
764+
LoadMap({ Name = deathMap, ResetBinks = true })
765+
end)
766+
end
767+
768+
if config.Skip.RunDialog then
769+
ModUtil.Path.Wrap("PlayTextLines", function(base, source, textLines, args)
770+
if CurrentRun.Hero.IsDead then
771+
return base(source, textLines, args)
772+
end
773+
return
774+
end)
775+
end
776+
777+
if config.Skip.DeathCutScene then
778+
ModUtil.Path.Context.Wrap("DeathPresentation", function()
779+
ModUtil.Path.Wrap("wait", function(...)
780+
return
781+
end)
782+
end)
783+
end
784+
end

0 commit comments

Comments
 (0)