Server rules

These switches control what the game itself allows players to do on your server.

The game's interactions

kcds.players.Interactions covers the game's single-player prompts. Most start switched off on a KCDS server until a resource turns them on, for everyone or for one player.

NameWhat it controlsStarts
horseWhistlethe companion key's whistle that calls the player's horseoff
playerTalk"Talk" and focus chat on another playeroff
trespassbeing inside private and prohibited areas (see below)off
cookingthe prompt and use key at the game's fireson
smokingthe prompt and use key at smokehouses and drying rackson
npcChatterthe barks and lines of NPCson
pointingthe B key points the arm; see Animationson
npcTalk"Talk" on an NPC, the game's own dialoguealways off
npcChatfocus chat on an NPC, where the game provokes and insultsalways off

npcTalk and npcChat cannot be turned on, because the game's NPC conversations crashed players' games (issue #627).

kcds.players.Interactions.set('horseWhistle', true);
player.setInteraction('playerTalk', true); // this player only; null returns to the server setting

With Interactions.set('smoking', false), the use key does nothing at smokehouses and drying racks, so your own hints are the only prompts there. To stop players gutting animals, call kcds.characters.Npc.setHarvestTable({}); see NPCs.

Private areas

The game's map marks some areas as private or prohibited, such as houses and the town jail, and warns a player inside ("You're in a private area!", "You are trespassing"). If you allow a player there, the warning stays off and the game's AI is told not to react to them.

guard.setTrespassAllowed(true); // this player only
guard.setTrespassAllowed(null); // back to the server setting
kcds.players.Interactions.set('trespass', true); // everyone without their own setting

To open a single place, turn this on when a player enters it and off when they leave, using Area.

To remove only the warning, call kcds.world.RestrictedAreaMarker.setEnabled(false). That affects everyone, and the game's AI still reacts as usual.

Camera

kcds.ui.ThirdPerson.setMode('disabled'); // 'allowed' is the default (F5 switches), or 'forced'
kcds.ui.Freecam.setEnabled(false); // the game's photo mode on F1

A scripted shot moves one player's camera to a point and later returns it:

const { Vector3 } = kcds.math;

kcds.ui.Camera.startShot(player, {
  position: new Vector3(100, 200, 25),
  lookAt: new Vector3(110, 210, 12),
  fov: 50,
  seconds: 3,
});

setTimeout(() => kcds.ui.Camera.endShot(player), 8000);

Other switches

SettingEffect
kcds.world.CombatMarker.setEnabled(false)hides the crossed swords under the compass in a fight
kcds.players.Needs.setEnabled(true)turns on sleep and food needs, which are off by default
kcds.players.Pickpocketing.setEnabled(...)see Dice and pickpocketing
kcds.players.Inventory.setStolenMarks(...)see Dice and pickpocketing

Rules for one player

See Players for player.setPace(...) (no running or sprinting), setCuffed, putInPillory, kick and setKnockoutVision.

Reference: Interactions, ThirdPerson, Freecam, Camera, CombatMarker, RestrictedAreaMarker.