export const CHUNK_SIZE = 16;
export const REGION_CHUNKS = 4;
export const SPRITE_SIZE_PX = 16;
export const PIVOT_FROM_BOTTOM_PX = 8;
export const VISIBLE_CHUNK_RADIUS = 1;

/** If an entity has a path but has not left its tile for this long, repath. */
export const NAV_STUCK_MS = 5000;

export const DEFAULT_CHUNK_LOADER = Object.freeze({
	simulationRadiusChunks: 1,
	regionLoadRadius: 1
});

export const CHUNK_RUNTIME_STATE = Object.freeze({
	dormant: "dormant",
	simulating: "simulating"
});

export const REGION_RUNTIME_STATE = Object.freeze({
	unloaded: "unloaded",
	resident: "resident"
});

export const WORLD_YEAR_OFFSET = 1200;

export const DEFAULT_WORLD_SETTINGS = Object.freeze({
	walkTilesPerSecond: 2,
	simulationTickHz: 20,
	shopPriceLerpDurationMs: 60 * 60 * 1000,
	/** Sparse map of itemId → seed value overrides (string keys). Missing = item def seedValue. */
	itemSeedValues: Object.freeze({}),
	groundItemDespawnDurationMs: 10 * 60 * 1000,
	regionUnloadGracePeriodMs: 30 * 1000,
	defaultGroundTypeId: 1,
	characterDeletionDelayMs: 24 * 60 * 60 * 1000,
	nightDarkness: 0.72,
	chatMaxCharacters: 100,
	bloomThreshold: 0.35,
	bloomSoftKnee: 0.3,
	bloomIntensity: 1.35,
	bloomBlurSize: 3,
	bloomSaturation: 1.15,
	bloomColorPreserve: 0.35,
	bloomDilate: 2,
	bloomScales: 2,
	bloomHalfRes: 1,
	pigeonTakeoffTilesPerSec: 3,
	pigeonCruiseTilesPerSec: 8,
	pigeonLandingTilesPerSec: 3,
	pigeonPhaseTiles: 5
});

export const GAIT = Object.freeze({
	walk: "walk",
	run: "run"
});

export const SEX = Object.freeze({
	male: "male",
	female: "female"
});

export const MessageType = Object.freeze({
	hello: "HELLO",
	session: "SESSION",
	error: "ERROR",
	characterList: "CHARACTER_LIST",
	createCharacter: "CREATE_CHARACTER",
	selectCharacter: "SELECT_CHARACTER",
	scheduleDeleteCharacter: "SCHEDULE_DELETE_CHARACTER",
	cancelDeleteCharacter: "CANCEL_DELETE_CHARACTER",
	leaveWorld: "LEAVE_WORLD",
	forceLogout: "FORCE_LOGOUT",
	enterWorld: "ENTER_WORLD",
	moveTo: "MOVE_TO",
	setGait: "SET_GAIT",
	chunkSnapshot: "CHUNK_SNAPSHOT",
	chunkDelta: "CHUNK_DELTA",
	unsubscribeChunk: "UNSUBSCRIBE_CHUNK",
	entitySpawn: "ENTITY_SPAWN",
	entityMove: "ENTITY_MOVE",
	entityDespawn: "ENTITY_DESPAWN",
	worldStatus: "WORLD_STATUS",
	editorLoadChunk: "EDITOR_LOAD_CHUNK",
	editorChunk: "EDITOR_CHUNK",
	editorSaveChunk: "EDITOR_SAVE_CHUNK",
	editorSaveSettings: "EDITOR_SAVE_SETTINGS",
	editorLoadSettings: "EDITOR_LOAD_SETTINGS",
	editorSettings: "EDITOR_SETTINGS",
	editorApplyRevision: "EDITOR_APPLY_REVISION",
	editorRevisionApplied: "EDITOR_REVISION_APPLIED",
	friendRequest: "FRIEND_REQUEST",
	friendAccept: "FRIEND_ACCEPT",
	friendDecline: "FRIEND_DECLINE",
	friendRemove: "FRIEND_REMOVE",
	friends: "FRIENDS",
	chatSay: "CHAT_SAY",
	chatBubble: "CHAT_BUBBLE",
	dropItem: "DROP_ITEM",
	pickupItem: "PICKUP_ITEM",
	equipItem: "EQUIP_ITEM",
	unequipItem: "UNEQUIP_ITEM",
	inventory: "INVENTORY",
	groundItemAppear: "GROUND_ITEM_APPEAR",
	groundItemDespawn: "GROUND_ITEM_DESPAWN",
	entityAppearance: "ENTITY_APPEARANCE",
	openBank: "OPEN_BANK",
	bankSnapshot: "BANK_SNAPSHOT",
	bankDeposit: "BANK_DEPOSIT",
	bankWithdraw: "BANK_WITHDRAW",
	getBlankCheques: "GET_BLANK_CHEQUES",
	returnBlankCheques: "RETURN_BLANK_CHEQUES",
	writeCheque: "WRITE_CHEQUE",
	redeemCheque: "REDEEM_CHEQUE",
	claimInheritance: "CLAIM_INHERITANCE",
	attack: "ATTACK",
	cancelAttack: "CANCEL_ATTACK",
	interact: "INTERACT",
	combatSwing: "COMBAT_SWING",
	combatHit: "COMBAT_HIT",
	combatMiss: "COMBAT_MISS",
	combatBlock: "COMBAT_BLOCK",
	playerDied: "PLAYER_DIED",
	respawn: "RESPAWN",
	playerRespawned: "PLAYER_RESPAWNED",
	follow: "FOLLOW",
	cancelFollow: "CANCEL_FOLLOW",
	sendPigeon: "SEND_PIGEON",
	pigeonDispatched: "PIGEON_DISPATCHED",
	pigeonDelivered: "PIGEON_DELIVERED",
	searchCharacter: "SEARCH_CHARACTER",
	characterSearchResult: "CHARACTER_SEARCH_RESULT",
	writeLetter: "WRITE_LETTER",
	editLetter: "EDIT_LETTER",
	openLetter: "OPEN_LETTER",
	skills: "SKILLS",
	stamina: "STAMINA",
	eatItem: "EAT_ITEM",
	startCraft: "START_CRAFT",
	cancelCraft: "CANCEL_CRAFT",
	craftResult: "CRAFT_RESULT",
	openCauldron: "OPEN_CAULDRON",
	cauldronSnapshot: "CAULDRON_SNAPSHOT",
	cauldronSetSlot: "CAULDRON_SET_SLOT",
	cauldronInsert: "CAULDRON_INSERT",
	cauldronAction: "CAULDRON_ACTION",
	cauldronBottle: "CAULDRON_BOTTLE",
	cauldronClear: "CAULDRON_CLEAR",
	cauldronSaveRecipe: "CAULDRON_SAVE_RECIPE",
	cauldronClose: "CAULDRON_CLOSE",
	mine: "MINE",
	cancelGather: "CANCEL_GATHER",
	gatherSwing: "GATHER_SWING",
	gatherComplete: "GATHER_COMPLETE",
	openFurnace: "OPEN_FURNACE",
	openStation: "OPEN_STATION",
	stationOpen: "STATION_OPEN",
	tileShove: "TILE_SHOVE",
	itemBubble: "ITEM_BUBBLE",
	shopOpen: "SHOP_OPEN",
	shopClosed: "SHOP_CLOSED",
	closeShop: "CLOSE_SHOP",
	buyFromShop: "BUY_FROM_SHOP",
	sellToShop: "SELL_TO_SHOP"
});

