-
Notifications
You must be signed in to change notification settings - Fork 0
API Reference
DooDesch edited this page Jul 6, 2026
·
2 revisions
Reference Personnel.dll from your mod and declare the optional dependency so load order is right:
[assembly: MelonOptionalDependencies("Personnel")]One tiny subclass per NPC, then construct it - S1API builds the prefab and handles networking, save/load and the mugshot:
public sealed class PaleNpc : Personnel.PersonnelNpc
{
protected override string DefId => "examples_pale"; // derived id from an installed pack
}
// wherever you populate the world (e.g. after a save is loaded):
var npc = new PaleNpc();
npc.Position = spawnPoint; // then use S1API as usual: schedules, dialogue, relationships, ...Rules:
-
DefIdmust return a compile-time constant. S1API builds the prefab from an uninitialized instance of your type, so the getter cannot rely on constructor-set state. - The id is the derived
packname_npcnameid - the startup log lists every loaded id. - If the definition is missing (pack not installed),
ConfigurePrefablogs a warning and the NPC falls back to S1API defaults.
foreach (Personnel.Model.NpcDef def in Personnel.API.All)
MelonLogger.Msg($"{def.Id}: {def.DisplayName} (from {def.Source})");
if (Personnel.API.TryGet("examples_pale", out var pale)) { ... }For mods with their own character systems - apply a designed appearance to any avatar:
// Build the vanilla AvatarSettings (registers any custom PNG layers on first use; main thread only):
Il2CppScheduleOne.AvatarFramework.AvatarSettings settings = Personnel.API.BuildAvatarSettings(def);
// Or do both steps in one call:
Personnel.API.ApplyAppearance(avatar, def); // avatar is an Il2CppScheduleOne.AvatarFramework.AvatarIf you already have an S1API NPC subclass and only want the identity + appearance from a definition,
call this inside your ConfigurePrefab:
protected override void ConfigurePrefab(NPCPrefabBuilder builder)
{
if (Personnel.API.TryGet("examples_pale", out var def))
Personnel.API.ConfigureFromDef(builder, def);
// ... your own customer/dealer/schedule configuration
}Mods can provide definitions without a pack folder (de-duplicated by Source/Id):
var def = new Personnel.Model.NpcDef { Id = "mymod_bob", DisplayName = "Bob", Source = "MyMod" };
def.Appearance.SkinColor = new Color(0.6f, 0.5f, 0.4f);
Personnel.API.Register(def);Personnel.API.OnReloaded += () => { /* re-resolve your defs */ };
Personnel.API.Reload(); // rescans the packs folder; API-registered defs persistPer-consumer manifest blocks arrive raw:
if (def.Extensions.TryGetValue("mymod", out string json))
var cfg = JsonConvert.DeserializeObject<MyModBlock>(json);