Skip to content

Cross-mod integration: expose workers via g_currentMission #10

@TheCodingDad-TisonK

Description

@TheCodingDad-TisonK

Request: expose worker data on g_currentMission for cross-mod access

Hi! We're building an integration between FS25_NPCFavor and ContractorMod so that contractor workers appear as named NPCs in the favor/relationship system. Players can then build relationships with their hired crew over time.

The problem:

FS25 sandboxes each mod's Lua environment. g_contractormod is set via getfenv(0) inside your mod's environment, so it's not visible from other mods. Same applies to the ContractorMod class table. This means we can't access ContractorMod.workers from NPCFavor.

We can detect ContractorMod is loaded via g_modManager:getModByName("FS25_ContractorMod"), but we can't read worker names or positions.

What we're asking for:

A single line in your load() function that exposes the workers table on g_currentMission, similar to how NPCFavor exposes its system:

-- In ContractorMod main.lua, after contractormod is created:
mission.contractorWorkers = ContractorMod.workers

This gives other mods read-only access to worker names, positions, and current vehicle — enough to build integrations without coupling to your internals.

Our end is ready. NPCFavor already checks g_currentMission.contractorWorkers as its primary access path and falls back gracefully if it's nil. The moment you expose it, workers will automatically appear in the NPCFavor list with their real names.

Currently we're falling back to g_npcManager HELPER* entries which gives us the right worker count but only generic names ("Worker 1", "Worker 2").

Thanks for the great mod — the role-play management angle is exactly what FS25 needs!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions