Skip to content

Global Class "Isaac"⚓︎

Modified Functions⚓︎

FindByType ()⚓︎

Entity[] FindByType ( EntityType Type, int Variant = -1, int SubType = -1, boolean Cache = false, boolean IgnoreFriendly = false )⚓︎

与原版功能相同,但速度快得多。


FindInRadius ()⚓︎

Entity[] FindInRadius ( Vector Position, float Radius, EntityPartition Partitions = 0xFFFFFFFF )⚓︎

与原版功能相同,但速度快得多,并且修复了效果搜索的问题。


GetRoomEntities ()⚓︎

Entity[] GetRoomEntities ( )⚓︎

与原版功能相同,但速度快得多。


AllMarksFilled ()⚓︎

int AllMarksFilled ( PlayerType Character)⚓︎

检查给定角色是否已完成所有标记,并返回一个整数,表示完成这些标记的最高难度。

Note

难度等级如下: - 0 - 未完成 - 1 - 普通 - 2 - 困难


AllTaintedCompletion ()⚓︎

int AllTaintedCompletion ( PlayerType Character, TaintedMarksGroup Group)⚓︎

检查给定角色是否已完成所有与受污染解锁相关的标记,并返回一个整数,表示完成这些标记的最高难度。

Note

难度等级如下: - 0 - 未完成 - 1 - 普通 - 2 - 困难


CanStartTrueCoop ()⚓︎

boolean CanStartTrueCoop ( )⚓︎


CenterCursor ()⚓︎

void CenterCursor ( )⚓︎

将窗口鼠标光标移动到游戏窗口的中心。这是一个非常小众但很有用的功能,如果您想使用光标控制进行任何奇特的操作并完全控制它。如果 Isaac.exe 失去焦点,它不会移动光标。

Note

请记住,屏幕中心不一定是房间的中心,它只是游戏窗口的中心(如果您处于全屏模式,则是实际屏幕的中心)。


ClearBossHazards ()⚓︎

void ClearBossHazards ( boolean IgnoreNPCs = false )⚓︎

清除所有弹幕。如果 IgnoreNPCs 为 false,还会清除所有能够关闭门的非友方 NPC。


ClearChallenge ()⚓︎

void ClearChallenge ( int challengeid)⚓︎

将相应 challengeid 的挑战标记为已完成。


ClearCompletionMarks ()⚓︎

void ClearCompletionMarks ( PlayerType Character)⚓︎

删除给定角色的所有完成标记。


CreateTimer ()⚓︎

EntityEffect CreateTimer ( function Function, int Interval, int Times, boolean Persistent )⚓︎

此计时器在每次游戏更新时调用。这意味着计时器仅考虑游戏正在积极运行且未暂停的帧,并使用更新帧作为其延迟参数(每秒 30 帧)。 生成一个计时器实体效果。该实体将在 Interval 帧后开始运行 Function 函数,并将重复执行 Times 次。Persistent 控制此计时器是在当前房间“死亡”,还是跨房间持续存在。

计时器行为

如果您的用例需要计时器考虑暂停时间,请使用在 RENDER 回调上运行的自定义计时器。


CreateWeapon ()⚓︎

Weapon CreateWeapon ( WeaponType Type, Entity Owner )⚓︎

创建并返回一个 Weapon 对象。它不会自动被 owner 使用,必须与 Isaac.SetWeaponType 一起使用。


DestroyWeapon ()⚓︎

void DestroyWeapon ( Weapon Weapon )⚓︎

销毁提供的 Weapon 对象。


DrawLine ()⚓︎

void DrawLine ( Vector StartPos, Vector EndPos, KColor StartColor, KColor EndColor, int Thickness )⚓︎

在当前渲染帧中,在两个给定位置之间绘制一条线。


DrawQuad ()⚓︎

void DrawQuad ( Vector TopLeftPos, Vector TopRightPos, Vector BottomLeftPos, Vector BottomRightPos, KColor Color, int Thickness )⚓︎

在当前渲染帧中,在两个给定位置之间绘制一条线。游戏内部使用自己的结构体 DestinationQuad 来实现此功能,但我还没有将其添加到 Lua 中 🐊


FillCompletionMarks ()⚓︎

void FillCompletionMarks ( PlayerType Character)⚓︎

完成给定角色的所有完成标记。


FindInCapsule ()⚓︎

Entity[] FindInCapsule ( Capsule Capsule, EntityPartitions Partitions = -1 )⚓︎

返回给定胶囊内的实体,并根据分区掩码进行过滤。


FindTargetPit ()⚓︎

int FindTargetPit ( Vector Position, Vector TargetPosition, int PitIndex = -1 )⚓︎


GetAchievementIdByName ()⚓︎

int GetAchievementIdByName ( string Name )⚓︎

按名称获取成就 ID。


GetAxisAlignedUnitVectorFromDir ()⚓︎

Vector GetAxisAlignedUnitVectorFromDir ( Direction Direction = -1 )⚓︎


GetBackdropIdByName ()⚓︎

int GetBackdropIdByName ( string BackdropName )⚓︎


GetBossColorIdxByName ()⚓︎

int GetBossColorIdxByName ( string Name )⚓︎

按名称获取 boss 颜色索引,该索引通常是 boss 变为所需颜色所需的子类型。当然,您实际上需要在 xml 中为您的颜色条目命名,此功能才能正常工作(后缀通常不起作用,因为它不是必需的)。


GetClipboard ()⚓︎

string GetClipboard ( )⚓︎

获取剪贴板的内容,前提是它们是文本形式,否则将返回 nil。


GetCollectibleSpawnPosition ()⚓︎

Vector GetCollectibleSpawnPosition ( Vector Position )⚓︎


GetCompletionMark ()⚓︎

int GetCompletionMark ( PlayerType Character, CompletionType Mark)⚓︎

获取特定角色的完成标记值,值范围从 02(0 = 未完成,1 = 普通,2 = 困难.


GetCompletionMarks ()⚓︎

table GetCompletionMarks ( PlayerType Character)⚓︎

返回一个包含给定角色所有标记的表

Table structure & usage

该表具有以下字段

  • 角色类型(PlayerType):包含与标记相关的 PlayerType.
  • MomsHeart: Difficulty 值为 0 - 2,表示完成情况
  • Isaac: Difficulty 值为 0 - 2,表示完成情况
  • Satan: Difficulty 值为 0 - 2,表示完成情况
  • BossRush: Difficulty 值为 0 - 2,表示完成情况
  • BlueBaby: Difficulty 值为 0 - 2,表示完成情况
  • Lamb: Difficulty 值为 0 - 2,表示完成情况
  • MegaSatan: Difficulty 值为 0 - 2,表示完成情况
  • UltraGreed: Difficulty 值为 0 - 2,表示完成情况
  • Hush: Difficulty 值为 0 - 2,表示完成情况
  • UltraGreedier: 困难贪婪模式,值2 ,大多冗余,无需设置
  • Delirium: Difficulty 值为 0 - 2,表示完成情况
  • Mother: Difficulty 值为 0 - 2,表示完成情况
  • Beast: Difficulty 值为 0 - 2,表示完成情况
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
local marks = Isaac.GetCompletionMarks(0)
if (marks.MomsHeart > 0) then
    print("got mom")
end
if (marks.Lamb >= 2) then
    print("GOATED ON H4RD")
end
if (Isaac.GetCompletionMarks(0).Delirium > 0) then --doing it the lazy way, fitting deliriums theme
    print("Got Deli")
end

GetCurrentStageConfigId ()⚓︎

StbType GetCurrentStageConfigId ( )⚓︎

获取当前阶段的当前 stageconfigId/stbType,或者您想称呼的 stages.xml 的 ID。


GetCursorSprite ()⚓︎

Sprite GetCursorSprite ( )⚓︎

Options.MouseControl 设置为 true 时,返回渲染的光标精灵。


GetCutsceneIdByName ()⚓︎

table GetCutsceneIdByName ( string Name )⚓︎

按名称获取过场动画 ID。


GetDwmWindowAttribute ()⚓︎

DwmWindowAttribute GetDwmWindowAttribute ( )⚓︎


GetEntitySubTypeByName ()⚓︎

int GetEntitySubTypeByName ( string Name )⚓︎

按实体名称获取实体子类型。


GetGiantBookIdByName ()⚓︎

int GetGiantBookIdByName ( string Name )⚓︎

按名称获取巨型书籍 ID。对于原版巨型书籍,gfx xml 属性中的 png 文件名用作巨型书籍名称。


GetLoadedModules ()⚓︎

table GetLoadedModules ( )⚓︎

返回一个键值表,包含所有已加载的脚本文件,其中键是给定脚本文件的名称或路径,值是加载该文件后的返回值(在大多数情况下是 true 或一个表)。


GetLocalizedString ()⚓︎

string GetLocalizedString ( string Category, string Key, int Language )⚓︎

返回给定类别中与给定键关联的翻译字符串。翻译以作为参数给出的语言 ID/语言代码提供。


GetModChallengeClearCount ()⚓︎

int GetModChallengeClearCount ( int challengeid )⚓︎

返回自定义挑战被通关的次数。如果该挑战被设置为未完成,则该次数将重置。


GetNullItemIdByName ()⚓︎

int GetNullItemIdByName ( string NullItemName )⚓︎


GetPersistentGameData ()⚓︎

PersistentGameData GetPersistentGameData ( )⚓︎


GetPoolIdByName ()⚓︎

ItemPoolType GetPoolIdByName ( string PoolName )⚓︎

返回给定自定义池的 ID。如果未找到该池,则返回 -1


GetRenderPosition ()⚓︎

Vector GetRenderPosition ( Vector Position, boolean Scale = true )⚓︎


GetString ()⚓︎

string GetString ( string Category, string Key )⚓︎

返回给定类别中与给定键关联的翻译字符串。翻译以当前选定的语言提供。


GetWindowTitle ()⚓︎

string GetWindowTitle ( )⚓︎

返回游戏窗口标题上附加的文本。


IsChallengeDone ()⚓︎

boolean IsChallengeDone ( int challengeid )⚓︎

如果相应 challengeid 的挑战已完成,则返回 true


IsInGame ()⚓︎

boolean IsInGame ( )⚓︎

如果 Game 不为 nil 且当前状态正确,则返回 true


LevelGeneratorEntry ()⚓︎

LevelGeneratorEntry LevelGeneratorEntry ( )⚓︎

创建一个新的空白 LevelGeneratorEntry 对象。


MarkChallengeAsNotDone ()⚓︎

void MarkChallengeAsNotDone ( int challengeid )⚓︎

将挑战标记为未完成。


PlayCutscene ()⚓︎

int PlayCutscene ( int ID, boolean ClearGameState = false )⚓︎

播放提供的 ID 对应的过场动画。使用 Isaac.GetCutsceneIdByName 来获取 ID,或者如果您愿意,也可以使用原版的枚举。


SetClipboard ()⚓︎

boolean SetClipboard ( string ClipboardData )⚓︎

将剪贴板的内容设置为提供的字符串。


SetCompletionMark ()⚓︎

void SetCompletionMark ( PlayerType Character, CompletionType Mark, int Value)⚓︎

将角色的完成标记设置为匹配从 02 的特定值(0 = 未完成,1 = 普通,2 = 困难)。


SetCompletionMarks ()⚓︎

void SetCompletionMarks ( table Marks )⚓︎

将角色的完成标记设置为匹配输入表。需要一个包含该角色所有标记的表,为了方便起见,建议从 GetCompletionMarks 获取该表。

Table structure & usage

该表具有以下字段:

  • PlayerType: containing the PlayerType asociated to the marks

  • Delirium: Difficulty 值为 0 - 2,表示完成情况

  • MegaSatan: Difficulty 值为 0 - 2,表示完成情况
  • Mother: Difficulty 值为 0 - 2,表示完成情况
  • UltraGreed: Difficulty 值为 0 - 2,表示完成情况
  • BlueBaby: Difficulty 值为 0 - 2,表示完成情况
  • UltraGreedier: 困难贪婪模式,值2 ,大多冗余,无需设置
  • BossRush: Difficulty 值为 0 - 2,表示完成情况
  • Beast: Difficulty 值为 0 - 2,表示完成情况
  • Isaac: Difficulty 值为 0 - 2,表示完成情况
  • Lamb: Difficulty 值为 0 - 2,表示完成情况
  • MomsHeart: Difficulty 值为 0 - 2,表示完成情况
  • Hush: Difficulty 值为 0 - 2,表示完成情况
  • Satan: Difficulty 值为 0 - 2,表示完成情况
1
2
3
4
5
local marks = Isaac.GetCompletionMarks(0) --getting the current table
marks.MomsHeart = 2 --Isaac now will have the hard mark on MHeart
marks.Satan = 1 --Isaac will now have the normal mark on Satan
marks.BlueBaby = 0 --Removes the BlueBaby Mark if its present
Isaac.SetCompletionMarks(marks) --Impacts the changes on the player

SetCurrentFloorBackdrop ()⚓︎

void SetCurrentFloorBackdrop ( int BackdropId )⚓︎

将当前楼层的默认房间背景更改为匹配输入的 ID。此更改在保存/继续游戏时不会保留,因此请确保考虑到这一点。


SetCurrentFloorMusic ()⚓︎

void SetCurrentFloorMusic ( int MusicId )⚓︎

将当前楼层的音乐曲目更改为匹配输入的 ID。此更改在保存/继续游戏时不会保留,因此请确保考虑到这一点。


SetCurrentFloorName ()⚓︎

void SetCurrentFloorName ( string Name )⚓︎

将当前楼层的显示名称更改为匹配输入的 ID。此更改在保存/继续游戏时不会保留,因此请确保考虑到这一点。

SetDwmWindowAttribute ()⚓︎

void SetDwmWindowAttribute ( DwmWindowAttribute Attribute )⚓︎


SetIcon ()⚓︎

void SetIcon ( int IsaacIcon OR string IconPath, boolean BypassSize)⚓︎

设置游戏窗口上的 16x16 图标。不会更新其他地方的图标,例如任务栏。 IsaacIcon0 表示正常图标,1 表示受污染图标。 IconPath 接受一个 .ico 文件的路径。 BypassSize 绕过 16x16 分辨率限制。


SetWindowTitle ()⚓︎

void SetWindowTitle ( string Title )⚓︎

设置游戏窗口标题上附加的文本。


ShowErrorDialog ()⚓︎

DialogReturn ShowErrorDialog ( string Title, string Text, DialogIcons Icon = DialogIcons.ERROR, DialogButtons Buttons = DialogButtons.OK )⚓︎

显示一个 Win32 消息框。可以使用 iconbuttons 参数进行控制。返回一个 DialogReturn 值,表示按下的按钮。

Note

请记住,游戏手柄对此弹出窗口不起作用,您需要使用鼠标/键盘或触摸屏,并且在某些环境(如 Steam Deck)中窗口标题可能不会显示,因此不要过于依赖它。


StartNewGame ()⚓︎

void StartNewGame ( PlayerType Character, Challenge Challenge = ChallengeType.CHALLENGE_NULL, Difficulty Mode = Difficulty.DIFFICULTY_NORMAL, int Seed = Random )⚓︎

使用指定的参数开始新游戏。可以从主菜单使用。


TriggerWindowResize ()⚓︎

void TriggerWindowResize ( )⚓︎

模拟窗口大小调整,对于刷新一些选项更改(如 MaxRenderScale)很有用。


WorldToMenuPosition ()⚓︎

Vector WorldToMenuPosition ( MainMenu MenuId, Vector Position )⚓︎

将输入的世界位置转换为固定的主菜单位置,该位置根据所选的枚举而变化。重要的是要像 WorldToRender 一样,每一帧都重新转换此位置,以便在菜单更改或窗口大小调整时正确渲染。