mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-08-13 00:45:11 +09:00
Enable need-check-nil and start the burn down
`Roles.new_role` returned the result of `error`, which made it nullable, and `set_permission_group` returned nil for an unknown group, which broke the config chain with an index error rather than saying so. Positions and bounding boxes read back from the game always use the named members, so they are narrowed once where they enter a function. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -719,7 +719,7 @@ local role = Roles.new_role('Moderator', 'Mod')
|
||||
]]
|
||||
function Roles.new_role(name, short_hand)
|
||||
ExpUtil.assert_not_runtime()
|
||||
if Roles.config.roles[name] then return error("Role name is non unique") end
|
||||
if Roles.config.roles[name] then error("Role name is non unique") end
|
||||
local role = setmetatable({
|
||||
name = name,
|
||||
short_hand = short_hand or name,
|
||||
@@ -896,8 +896,7 @@ function Roles._prototype:set_permission_group(name, use_factorio_api)
|
||||
if use_factorio_api then
|
||||
self.permission_group = { true, name } --[[@as [boolean, string] ]]
|
||||
else
|
||||
local group = Groups.get_group_by_name(name)
|
||||
if not group then return end
|
||||
assert(Groups.get_group_by_name(name), "Permission group not found: " .. name)
|
||||
self.permission_group = name
|
||||
end
|
||||
return self
|
||||
|
||||
Reference in New Issue
Block a user