Files
how_progression/shared/contacts/init.lua
T

28 lines
965 B
Lua
Raw Normal View History

2026-09-20 17:12:20 +00:00
-- Passive definitions. Requiring this module does not create world entities.
local byId = {
unknown = require 'shared.contacts.unknown',
crowbar = require 'shared.contacts.crowbar',
mack = require 'shared.contacts.mack',
gabe = require 'shared.contacts.gabe',
deke = require 'shared.contacts.deke',
vinny = require 'shared.contacts.vinny',
cosmic_dave = require 'shared.contacts.cosmic_dave',
}
local phoneOwners = {}
for id, contact in pairs(byId) do
assert(contact.id == id, 'contact ID mismatch: ' .. id)
local number = contact.phone and contact.phone.number
if number then
assert(number:match('^555%-%d%d%d%d$'), 'invalid contact number: ' .. id)
assert(not phoneOwners[number], 'duplicate contact number: ' .. number)
phoneOwners[number] = id
end
end
return {
byId = byId,
get = function(id) return byId[id] end,
phoneOwner = function(number) return phoneOwners[number] end,
}