Archiving this project because Garry's Mod Among Us seems to be inactive and my addon is honestly very messy (I'll maybe rewrite it some day if I'm bored :D).
This addon makes it possible to add custom roles to Garry's Mod Among Us, inspired by TTT2.
This is still a beta version so expect bugs and let me know here if you find some.
Your role should be located in
lua/amongus/roles/[rolename].lua (shared)
or
init.lua (serverside)
lua/amongus/roles/[rolename]/ cl_init.lua (clientside)
shared.lua (shared)
Example shared file of a role with default values:
roles.CreateTeam(ROLE.name, {
color = Color(0, 0, 0)
})
ROLE.name = nil -- defaults to filename
ROLE.color = Color(0, 0, 0)
ROLE.defaultTeam = TEAM_CREWMATE
ROLE.CanKill = false,
ROLE.CanSabotage = false,
ROLE.CanVent = false,
ROLE.HasTasks = true,
ROLE.ShowTeammates = false
ROLE.defaultCVarData = {
pct = 1,
max = 1,
minPlayers = 1,
random = 100
}
-- called after all roles are loaded
-- roles.SetBaseRole should be called here
function ROLE:Initialize() end
-- called when hud buttons are created
-- can be used to add custom buttons
hook.Add("GMAU ModifyButtons", "example", function(hud) end)
hook.Add("GMAU ShouldWin", "example", function(team)
return true -- team wins
return false -- prevent team from winning
return nil -- do nothing
end)
-- used to modify which roles will be given to the players
-- table selectableRoles has roleIDs as keys and the amount of players who should get the role as value
hook.Add("GMAU ModifySelectableRoles", "example", function(selectableRoles) end)