Interiors

Usage guide of world.interiors: houses, shops, inns, dungeons and caves as cells reached through doors; the interiors collection, settings and defaults, locks and keys, service, verbs, events, hooks and saves.

Source: module-kits:kits/world_interiors/usage/en.mdView Markdown source

Also read offline — CLI: grip-forge docs world-interiorsMCP tool: gripforge_docs { "topic": "world-interiors" }

Interiors and doors (world.interiors) #

Houses, shops, inns, dungeons and caves as cells apart from the open world, each with doors that link an outside point to an inside point. Readable offline: gripforge docs world-interiors, or the MCP tool gripforge_docs (topic world-interiors).

What it is for #

An interior is a document of the interiors collection. At start, the kit places a door entity at the outside point and at the inside point of every door and registers it with the interaction kit. When the player interacts with one, the kit sends the player to the other side: first the transition (the screen fades through black), then the move, with the events interior.entered or interior.left. A locked door needs its key item in the inventory. The current cell is published as a variable, so streaming, music and weather kits can react to the player being indoors. The kit does not build the interior: you place its geometry at its spawn point (usually far from the outside, or below it).

Turn it on #

{ "id": "world.interiors", "config": { "transitionSeconds": 0.6, "spawnDoors": true } }

It requires game.engine. Doors are used through interaction.system, and keys are read from inventory.items. When a character kit is present the player is moved with character.control.teleport, otherwise by changing the entity transform.

First example #

<!-- test: kits/game_engine/host/tests/parity.rs::rust_host_matches_the_typescript_traces (fixture world.interiors.doors) --> The fixture installs the kit and runs scripts that send the player into an interior through a named door, back out through the door they came by (or a named one), and unlock a door.

{ "type": "enter_interior", "interior": "tavern", "door": "back" }
{ "type": "leave_interior" }
{ "type": "unlock_door", "interior": "vault", "door": "hatch" }

An interior to go with it:

{ "id": "tavern", "name": "The Sleeping Giant", "kind": "inn", "spawn": [0, -200, 0],
  "doors": [{ "id": "front", "outside": [42, 0, 18], "inside": [0, -200, 4], "insideYaw": 3.14 }] }

Settings and defaults #

SettingTypeDefaultMeaning
transitionSecondsnumber0.6fade through black when passing a door, 0 to 5 (0: instant)
enterLabelstringEnter {name}prompt on an outside door; {name} is the interior name
leaveLabelstringLeave {name}prompt on an inside door
lockedLabelstring{name} (locked)prompt on a locked door the player has no key for
spawnDoorsbooleantruespawn a door entity at every door point (kind door, model slot door)

The interiors collection #

KeyMeaning
id, namerequired; the id is what scripts and the variable world.cell use
spawnrequired; [x, y, z] where the interior stands
yaworientation on arrival
kindhouse, shop, inn, dungeon, cave, temple or other
doorsrequired, at least one: { id, outside, inside, outsideYaw?, insideYaw?, locked?, key?, label? }
musica music name kept with the interior

locked doors open when the player holds the item named by key; unlock removes the lock for good.

Services, variables, verbs, events, hooks #

  • world.interiors (service): interiors() lists { id, name, kind }; current() the interior id or null; inside() whether the player is indoors; enter(id, door?) (the first door by default) and leave(door?) (the door used to come in by default) answer false when refused, locked, or already outside; doors() lists { interior, door, locked, outsideEntity, insideEntity }; unlock(interior, door) answers false when refused.
  • Variables: world.cell (outside or the interior id) and world.inside (a boolean).
  • Verbs: enter_interior (interior, optional door), leave_interior (optional door), unlock_door (interior, door); condition in_interior (optionally with an interior id). An archetype component door { interior, door, side } makes any entity a door.
  • interior.transition (event): from, to, seconds, just before the player moves.
  • interior.entered, interior.left (events): interior, door.
  • interior.locked (event): a locked door was tried without its key (interior, door, key).
  • interior.unlocked (event): a door was unlocked for good.
  • interior.refused (event): a hook cancelled the action; payload interior, door, action (enter, leave or unlock), reason (default refused). Nothing moved.
  • interior.enter (hook): { interior, door, locked, key }, asked before the lock is checked. Change locked to false to let the player in without the key (a master key, a story beat), or to true to keep them out; cancel to refuse.
  • interior.leave (hook): { interior, door }, cancellable (a fight to finish first).
  • interior.unlock (hook): { interior, door }, cancellable.
{ "id": "closed-at-night", "hook": "interior.enter", "match": { "interior": "tavern" },
  "if": [{ "var": "night", "op": "==", "value": true }], "cancel": true, "reason": "closed_at_night" }

Modding #

A mod can change the five settings, add, patch or remove interiors documents, and tap the three hooks. Without a tap the kit plays as before.

Saves #

The save keeps the current cell, the last door used and the doors unlocked for good. After a load the variables and the prompts are published again.

Engines #

Web and the native player. The transition is an overlay (transition) drawn as a ui.webui fragment. There is no separate Godot, Unity or Unreal delivery.

When it does not do what you expect #

  • No door to interact with: spawnDoors is off, or the interaction kit is not installed.
  • A locked door never opens: the player does not hold the key item, or a tap of interior.enter keeps locked true.
  • enter() answers false: the door is locked, a hook cancelled it (see interior.refused), or the interior is unknown.
  • leave_interior does nothing and logs a warning: the player is already outside.
  • unlock_door logs "unknown door": the interior or door id does not match the collection.

Limits #

The kit moves the player; it does not build interiors, light them or stream them. Only the player goes through a door.

Versions #

Kit 1.1.1 (service contract 1.0.0). The three hooks, the event interior.refused and the moddable settings since 1.1.0.