REPENTOGON phase 0 (e2c5aec, GPL-2): ISAAC_REPENTOGON option (on), src/repentogon/ with the hidden REPENTOGON global switch, callback ids 1000-1499 with REPENTOGON's enable state and dispatch (priorities, optional and two-parameter filters, isolated errors), its scripts loaded from assets/repentogon/scripts, its options store and a vanilla-parity switch (on) in the overlay, scripts/repentogon_coverage.py and analysis/repentogon_coverage.tsv (2,834 rows)
This commit is contained in:
1 parent
78cb0775b0
commit
2cc082f6ee
31 files changed
+12955
-149
No files matched your search
@@ -0,0 +1,49 @@
|
||||
---@type table<string, integer>
|
||||
local s_groupNames = {}
|
||||
local s_nextGroupId = 0
|
||||
|
||||
local ModManager = _GetModule("repentogon_extras.mod_manager")
|
||||
|
||||
---@param groupName string
|
||||
---@return integer groupId
|
||||
local function CreateGroup(groupName)
|
||||
if type(groupName) ~= "string" then
|
||||
error(string.format("bad argument #%d (string expected, got %s)", 1, type(groupName)), 2)
|
||||
end
|
||||
|
||||
local existingId = s_groupNames[groupName]
|
||||
if existingId then
|
||||
if not ModManager.ModsLoaded() then
|
||||
Console.PrintWarning(string.format("[WARN] [RGON] group \"%s\" already exists", groupName))
|
||||
end
|
||||
|
||||
return existingId
|
||||
end
|
||||
|
||||
if ModManager.ModsLoaded() then
|
||||
error("groups can only be created during Mod Load", 2)
|
||||
end
|
||||
|
||||
local groupId = s_nextGroupId
|
||||
|
||||
s_nextGroupId = s_nextGroupId + 1
|
||||
if s_nextGroupId == RoomGroup.GROUP_ULTRA_SECRET then
|
||||
s_nextGroupId = s_nextGroupId + 1
|
||||
end
|
||||
|
||||
s_groupNames[groupName] = groupId
|
||||
return groupId
|
||||
end
|
||||
|
||||
---@param groupName string
|
||||
---@return integer? groupId
|
||||
local function GetGroupByName(groupName)
|
||||
if type(groupName) ~= "string" then
|
||||
error(string.format("bad argument #%d (string expected, got %s)", 1, type(groupName)), 2)
|
||||
end
|
||||
|
||||
return s_groupNames[groupName]
|
||||
end
|
||||
|
||||
rawset(RoomDescriptor, "CreateGroup", CreateGroup)
|
||||
rawset(RoomDescriptor, "GetGroupByName", GetGroupByName)
|
||||
Reference in new issue
Block a user