FORGOTTEN TOWNS

FORGOTTEN TOWNS / 문서 수정

모딩 위키 ↗

Java API 참조(Javadoc)

MOD API 15

위키 찾아보기

현재 Mod API 문서.

기술 문서는 영어로 제공됩니다. 코드 및 필드 이름은 현재 Mod API를 따릅니다.

문서 수정

Campaign cities and recruitment

The campaign settlement map and recruitment service are native gameplay. Their historical provider identity remains settlement_map to preserve recruitment receipts, factions and keyboard preferences. No mod installation is required. Read the source study for the original extension. Press M or click the small compass next to the settlement banner button to open it. The compass is temporary art. The map reuses campaign geography, with settlement icons instead of mission buttons. The previous default Prefer melee shortcut moves to Y; both commands are rebindable.

Select a city on the map, or use the arrows below it. Its overview shows its name, biome, population, arrivals and births, deaths, purse and trade goods. Player names and statistics come from saved campaign towns in the same profile. Unknown statistics stay unknown. The authored location table contains campaigns with settlements, not every mission. Uncompleted destinations and an unfounded current settlement are hidden from markers, city navigation and detail panels. Revealed cities with unavailable actions remain dimmed. City orders require a completed source city, separate from the town you are playing. Independent factions have their own stable identity and can offer recruitment without a completed source mission.

The Kingdom supports trading and recruitment. Native campaign trading adds completed-city markets. The trade button opens the selected market, using its actual remaining stock and purse. Cities without a market display authored goods.

Seasonal supply

Source People available per season Gold per person
The Kingdom 3 citizens, 2 militia, 1 town guard 250 / 900 / 1,200
C1 None -
C2 2 citizens 250
C3 3 citizens, 3 recruits, 2 rogues 250 / 400 / 750
C4 No separate settlement -
C5 · Ezau's Camp 1 Ranger, 2 Archers 1,400 / 900
C6 4 citizens 250

C1's zero supply, C2's two citizens and C3's three recruits/two rogues implement the requested limits. Ezau's Camp is the shared base for the C4-C5 journey and opens for remote orders after C5 completion. Its campaign market supplies jungle fruits, berries, flowers, limestone and other local resources. Future missions have no placeholder trading towns; add them when their settlements are authored. Quantities and prices are editable in the location table.

Each offer displays remaining supply out of its seasonal limit. Purchases deduct gold immediately. Rejected orders consume neither gold nor supply. Supply is shared across towns in one campaign profile and replenishes after 12 newly played days across that profile. Switching towns or reloading a save does not reset stock. Replaying already recorded days cannot advance the refill clock again. There is no accumulating surplus of unused stock. The map shows days until refill.

The Kingdom is on the tutorial harbor's separate continent and delivers both goods and recruits in five days. For campaign cities, the core's default travel settings take one day from meadows; two from jungle, mixed, desert or the random-biome fallback; three from snow or mountains. Journeys advance on the receiving town's local calendar. The arrival list shows the remaining days. People appear near the settlement banner through the ordinary unit spawner. A blocked arrival tile or campaign recruitment restriction keeps the order pending, without another payment. The queue holds at most 64 people. Spectator scenes cannot place orders.

Author a city

The complete extension project compiles against the SDK API JAR, with no internal game imports. Its current manifest declares contentApi: 10 and captures data/locations.json as the locations table. One entry looks like this:

{
  "stage": "c3_main",
  "nameKey": "mods.settlement_map.city",
  "descriptionKey": "mods.settlement_map.military",
  "exports": {},
  "recruits": [
    {"id": "recruit", "unit": "recruit", "gold": 400, "perSeason": 3},
    {"id": "rogue", "unit": "rogue", "gold": 750, "perSeason": 2}
  ]
}

stage references native campaign coordinates and completion; it does not add mission logic. nameKey and descriptionKey must belong to the registering mod and be translated in every supported locale. The name receives biome and level number as {0} and {1}. A saved player name takes priority. Optional useSettlementName: false retains the authored name for a fixed camp such as Ezau's. exports maps resource IDs to seasonal quantities for display when no trade market is available.

Offer IDs are stable and unique within their city. unit must identify a native civilian or soldier archetype. Prices are integers from 1 to 100,000; supply is 0 to 1,000. Zero disables an offer's stock. Optional requiresCompletedStage adds a second completion requirement. Ordinary campaign recruitment restrictions still apply. The host allows at most 32 offers per city and validates these rules. Removing every entry from recruits gives a city no recruitment at all.

The Java entry point uses context.registerSettlementMap(...). Its pure policy selects applicable worlds, supplies immutable Location/Recruit records and determines travel days. The host owns the modal, payment validation, quota ledger, arrival queue and spawning. Like trade policies, the last applicable registration wins. This is a supported map surface, not an arbitrary window API.

Saves and recovery

Save format 59 adds pending arrivals. Older saves restore an empty queue. Paid recruitment receipts and shared seasonal quotas live beside trade records in the user-data settlement-trading directory. Back up that directory, campaign profiles and saves together. Loading an older save reapplies owed payment and its matching journey once; a current save restores already arrived units normally. Missing/older financial records or insufficient gold for an outstanding receipt block new orders until consistent records and funds are restored. They never manufacture replacement stock.

The separate settlement-directory folder is a rebuildable overview catalog, not financial state. Saving a campaign town publishes its name and statistics even without this mod. Existing older towns must be opened and saved once to appear with detailed statistics. Deleted save slots are ignored.

Changing authored data changes the pack fingerprint. Rebuild, validate and test in a new world; saved mod IDs and relative order still matter; updated versions are checked against saved content and restoration. Keep backups of distributed versions. Raids, reinforcements and other military missions remain future work.

Author an independent faction

Override SettlementMap.factions(world) to return immutable Faction records alongside locations. The current map mod reads factions.json and includes The Kingdom as a complete example. It is visible only when that map policy supports the current world. This adds an outpost, its trade stock and recruitment; it does not add diplomacy or missions.

Each faction has an owned namespaced id, localized nameKey/descriptionKey, a native biome, and normalized x/y coordinates. travelDays applies to both cargo and people. exports and recruits use the existing finite stock and seasonal recruitment contracts. The host accepts at most 32 factions, 64 products and 32 offers per faction; this example deliberately limits each faction to 15 products.

buyFromPlayerPercent determines what the faction pays, rounded per unit to whole gold. Zero prices prohibit the sale. The faction sells at ordinary registry value, buys its own export products, and rejects the exact IDs in refusedResources. The example additionally resolves refusedStockpiles against the composed registry at startup, so raw-material exclusions cover other packs using those primary categories. Artifacts and zero-value resources remain untradable through native rules. initialGold is a one-time purse; seasonalGold adds income on the trade network's shared season.

The API supports faction-only commerce; this example deliberately requires the shared trading core. If an ordinary trade policy is active, the faction joins that policy's existing network while retaining its own prices, exclusions, purse grant and delivery duration. It does not replace completed-city or sandbox policies. The active map policy still follows the existing last-applicable-registration rule.

The player sees delivery duration before ordering in both map tabs and the selected trade screen, and again in successful order feedback. Pending arrivals and shipments retain their existing countdowns. Cargo advances on the shared trade calendar; people advance on the receiving town's local calendar. Existing paid orders keep their recorded due dates if authored travel settings change.