isaacscript-common 6.5.1 → 6.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,6 +42,7 @@ function ____exports.setShadows(self, customStage)
42
42
  local decorationSeed = room:GetDecorationSeed()
43
43
  local shadowPNGPath = getRandomArrayElement(nil, shadowPNGPaths, decorationSeed)
44
44
  shadowSprite:ReplaceSpritesheet(0, shadowPNGPath)
45
+ shadowSprite:LoadGraphics()
45
46
  shadowSprite:SetFrame(animation, 0)
46
47
  v.room.showingShadows = true
47
48
  end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "6.5.1",
3
+ "version": "6.6.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -0,0 +1,7 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ /**
3
+ * Using the "luamod" console command with a mod that has custom shaders can crash the game. A
4
+ * simple fix for this is automatically applied to any upgraded mods. This method was originally
5
+ * discovered by AgentCucco.
6
+ */
7
+ export declare function loadShaderCrashFix(mod: Mod): void;
@@ -0,0 +1,18 @@
1
+ local ____exports = {}
2
+ local postPlayerInit
3
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
4
+ local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
5
+ local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
6
+ function postPlayerInit(self)
7
+ local players = Isaac.FindByType(EntityType.PLAYER)
8
+ if #players == 0 then
9
+ Isaac.ExecuteCommand("reloadshaders")
10
+ end
11
+ end
12
+ --- Using the "luamod" console command with a mod that has custom shaders can crash the game. A
13
+ -- simple fix for this is automatically applied to any upgraded mods. This method was originally
14
+ -- discovered by AgentCucco.
15
+ function ____exports.loadShaderCrashFix(self, mod)
16
+ mod:AddCallback(ModCallback.POST_PLAYER_INIT, postPlayerInit)
17
+ end
18
+ return ____exports
package/upgradeMod.lua CHANGED
@@ -17,6 +17,8 @@ local initFeaturesMajor = ____initFeatures.initFeaturesMajor
17
17
  local initFeaturesMinor = ____initFeatures.initFeaturesMinor
18
18
  local ____patchErrorFunctions = require("patchErrorFunctions")
19
19
  local patchErrorFunction = ____patchErrorFunctions.patchErrorFunction
20
+ local ____shaderCrashFix = require("shaderCrashFix")
21
+ local loadShaderCrashFix = ____shaderCrashFix.loadShaderCrashFix
20
22
  --- Use this function to enable the custom callbacks and other optional features provided by
21
23
  -- `isaacscript-common`.
22
24
  --
@@ -36,10 +38,11 @@ local patchErrorFunction = ____patchErrorFunctions.patchErrorFunction
36
38
  -- @param modVanilla The mod object returned by the `RegisterMod` function.
37
39
  -- @returns The upgraded mod object.
38
40
  function ____exports.upgradeMod(self, modVanilla)
39
- patchErrorFunction(nil)
40
41
  local mod = __TS__New(ModUpgraded, modVanilla)
41
42
  if not areFeaturesInitialized(nil) then
42
43
  setFeaturesInitialized(nil)
44
+ patchErrorFunction(nil)
45
+ loadShaderCrashFix(nil, modVanilla)
43
46
  postNewRoomEarlyCallbackInit(nil, mod)
44
47
  saveDataManagerInit(nil, mod)
45
48
  initCustomCallbacks(nil, mod)