Skip to content

Teams, Jobs and Factions

The social structure of the city. This is the system that makes Applejack a roleplay framework rather than a sandbox with money.

Sources: libraries/sh_team.lua (349 lines — the engine), sh_jobs.lua (the data), metatables/sv_player.lua (JoinTeam, Demote), sv_commands.lua.


1. The hierarchy

Three levels, and the distinction between them matters:

GROUP            Officials  ·  Civilians  ·  Underground
  └── GANG       an organisation within a group (gang 0 = "the unaffiliated")
        └── TEAM a job, with a numeric LEVEL (rank) inside its gang
  • A group is an allegiance. Moving between groups is the significant social act.
  • A gang is an organisation you belong to. Gang 0 is the group's general population — people in the group but not in any specific organisation. This is why door access to "group;0" grants the whole group (see 04).
  • A team is your job, and its level is your rank within the gang. Level drives who can demote whom.

cider.team.gangs holds gang display metadata per group: {name, model, motto}.


2. Defining a job

cider.team.add(
    name, colour, maleModels, femaleModels,
    { gang, access, level, group },
    description, salary, maxPlayers, accessFlag, blacklistable,
    canMakeCategories, cantUseCategories,
    { maxJobTime, rejoinCooldown },
    loadout, ammo
)

Fifteen positional parameters, several nullable, several tables. Reading sh_jobs.lua requires counting commas — and the file itself carries a comment block explaining the parameter order because nobody could remember it.

Design note: the data here is excellent and the encoding is the worst in the codebase. This is the single clearest argument for jobs as authored assets rather than code (ADR-0004 applies the same reasoning to items). A job definition should be an inspector-editable asset with named fields.

Team access flags

Distinct from the character access flags in 02:

Flag Meaning
b Boss — may demote members of the same level. Scoped to the gang if the holder is in one.
d Demote — may demote members of lower level. Same scoping.
g May give and take entities to/from the gang
D Deposable — underlings may vote to depose the holder
M Mandatory transit — all group-to-group transitions must pass through this team
e Used by leader roles alongside bdg (grants entity powers)

The M flag deserves attention. TEAM_CITIZEN has access = "M", and config["Master Race"] = true enforces that all group changes must route through one base class. You cannot go from Police Officer to Rogue directly; you must become a Citizen first. Changing sides is deliberately slow and visible. Preserve this.

Ordering is meaningful

sh_jobs.lua carries an explicit note: "THE ORDER IN WHICH TEAMS ARE IN HERE IS THE ORDER IN WHICH THEY APPEAR ON THE SCOREBOARD AND JOB MENU". Presentation order is encoded as file order. The new asset format needs an explicit sort key.

Jobs gated on plugins

Also from sh_jobs.lua: jobs that need a plugin are declared here with an if, not in the plugin, "so order may be maintained and all jobs be modified at once":

if (GM or GAMEMODE):GetPlugin("officials") then ... end
if (GM or GAMEMODE):GetPlugin("hunger") then TEAM_CHEF = ... end

An honest workaround for a real tension — presentation order versus modularity — and a direct cause of the load-order fragility in D-08. The new design resolves it with an explicit sort key on the asset, so a module can contribute a job without owning its position.


3. The full job table

Group: Officials — "Join the force for 'Public Good', maintaining law and order."

Requires the officials plugin. Group flag P.

Gangs: 0 The Officials ("Enough red tape to drown a continent"), 1 The Police ("Less talk, more action!").

Job Gang Lvl Flags Salary Max Blacklistable Time limit
Mayor 1 3 bdgeD 300 1 yes {0, 10}
Police Commander 1 3 deD 300 1 yes {60, 10}
Police Officer 1 2 250 15 yes
Quartermaster 0 2 200 1 yes {0, 5}
Secretary 0 1 200 no
  • Mayor cannot use weapons, illegal goods, illegal weapons, police weapons or explosives — the head of the city is deliberately unarmed.
  • Police Commander spawns with cider_glock18 + cider_baton, 60 pistol / 120 SMG ammo.
  • Police Officer spawns with cider_baton only and 60 pistol ammo — the pistol line is commented out, so officers start unarmed but for a baton. Strong design signal.
  • Quartermaster is the police supply chain: may manufacture weapons, police weapons and ammo, but not illegal goods. One per server.

Group: Civilians — "Join the ordinary and generally law-abiding civilians"

Gang 0 The Civilians ("Keep me out of this!"). No other gangs.

Job Lvl Salary Max Can manufacture Time limit
Supplier 2 100 6 vehicles, contraband, misc, packaging
Arms Dealer 2 100 2 vehicles, contraband, weapons, ammo {10, 10}
Chef 2 150 6 vehicles, contraband, food, alcohol, drinks
Doctor 2 150 6 vehicles, contraband, drugs
Citizen 1 200
Builder 2 50 2 {15, 15}
  • Chef exists only if the hunger plugin is loaded. No hunger, no reason to sell food.
  • Doctor requires character access flag h and manufactures the drugs category — which contains health kits. This is the entirety of the medical system (see §6).
  • Citizen pays 200, more than the Arms Dealer or Supplier. Doing nothing is a viable living; the specialist jobs are worth taking for their manufacturing rights, not their wage. That is a deliberate and unusual economic choice.
  • Builder is commented out. It charged $150 per prop, non-refundable, capped at 15 props and 15 minutes. Recorded for completeness; not part of shipped behaviour.

Group: Underground — "Join the underground for more fun, but harsher treatment if caught."

Gangs: 0 The Underground ("FUK DA POLIC"), 1 The Rogues ("Lean, mean, red machines!"), 2 The Renegades ("We might not be pretty, but we'll kick your asses!").

Job Gang Lvl Flags Salary Max
Rogue Leader 1 3 bdgeD 250 1
Rogue 1 2 225 10
Renegade Leader 2 3 bdgeD 250 1
Renegade 2 2 225 10
Black Market Dealer 0 2 100 2
Rebel 0 1 75 15
  • Two rival gangs with identical mechanics and different colours and models. The rivalry is entirely player-generated; the framework supplies only symmetry. This is the design philosophy in miniature.
  • Rebel pays 75 — the worst wage in the game, against Citizen's 200. Crime pays badly at the bottom and the description says so: "more likely to get a parking fine than GTA."
  • Black Market Dealer manufactures explosives, contraband, police weapons, illegal goods, illegal weapons and ammo — the widest manufacturing rights in the game, at the lowest legitimate salary.

TEAM_DEFAULT = TEAM_CITIZEN.


4. Joining, demotion and mutiny

meta:JoinTeam and meta:Demote (metatables/sv_player.lua:197).

Applying for a job checks: player cap, blacklist, M-flag transit rule, job time limits ({maxJobTime, rejoinCooldown} in minutes), and the required character access flag if the job declares one.

Salary is set from TEAM.Salary on join; GM:PlayerAdjustSalary (init.lua:711) doubles it for donators.

Command Line Purpose
/team 724 Apply for a job
/setteam 100 Admin: force a job
/demote 479 Demote a subordinate
/mutiny 1261 Vote to depose a leader

Governance thresholds

Setting Default Meaning
Minimum to demote 5 Gang size before a leader may demote at all
Minimum to mutiny 4 Gang size before a mutiny may be called
Mutiny Percentage 0.75 Share of positive votes required
Master Race true All group changes route through the M team

Leaders can only wield power over a gang large enough to survive them, and can only be removed by one large enough to have an opinion. A two-person gang has no politics at all. Preserve these thresholds and their intent.


5. Manufacturing rights are the real economy

Note what canMakeCategories / cantUseCategories actually do: a job is defined less by its salary than by which categories of item it may create and which it may not use. The Chef is the only source of food; the Arms Dealer the only legal source of weapons; the Black Market Dealer the only source of illegal goods.

This produces the trade network. A player who wants a gun must find an Arms Dealer, who wants food from a Chef, who wants medical supplies from a Doctor. Scarcity is enforced by role monopoly, not by drop rates.

This is the most important thing in this document. Any redesign of crafting or the economy must keep category-level role monopoly as a first-class concept.


6. Medical

There is no medical system. TEAM_DOCTOR manufactures the drugs category, which contains health_kit and similar consumables. Healing is "use item, gain health".

The master plan's Phase 10 (injuries, disease, bleeding, healing) is almost entirely new work. The one existing mechanic is meta:Bleed / StopBleeding (08_NEEDS_AND_STATE.md), and the one existing social structure worth preserving is that the Doctor is a player with a monopoly, not a vending machine.


7. What survives

Survives: the group → gang → team hierarchy; gang 0 as the group's general population; numeric levels driving demotion rights; the b/d/D/M governance flags; mandatory transit through a base class; mutiny with a quorum and a supermajority; per-job player caps; job time limits and rejoin cooldowns; blacklisting from jobs; category-level manufacturing monopolies; symmetric rival gangs; the salary curve (Citizen > Rebel).

Does not survive: 15 positional parameters; presentation order as file order; jobs gated by if GetPlugin(...) at load time; models as hardcoded Source 1 paths; the flag-character namespace.