Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
constants.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5#pragma once
6
7/*
8 All kinds of constants.
9
10 Cross-platform compatibility stuff should go in porting.h.
11
12 Some things here are legacy.
13*/
14
15/*
16 Network Protocol
17*/
18
19#define PEER_ID_INEXISTENT 0
20#define PEER_ID_SERVER 1
21
22// Define for simulating the quirks of sending through internet.
23// Causes the socket class to deliberately drop random packets.
24// This disables unit testing of socket and connection.
25#define INTERNET_SIMULATOR 0
26#define INTERNET_SIMULATOR_PACKET_LOSS 10 // 10 = easy, 4 = hard
27
28#define CONNECTION_TIMEOUT 30
29
30/*
31 Server
32*/
33
34// This many blocks are sent when player is building
35#define LIMITED_MAX_SIMULTANEOUS_BLOCK_SENDS 0
36// Override for the previous one when distance of block is very low
37#define BLOCK_SEND_DISABLE_LIMITS_MAX_D 1
38
39/*
40 Client/Server
41*/
42
43// Limit maximum dtime in client/server step(...) and for collision detection
44#define DTIME_LIMIT 2.5f
45
46/*
47 Map-related things
48*/
49
50// The absolute working limit is (2^15 - viewing_range).
51// I really don't want to make every algorithm to check if it's going near
52// the limit or not, so this is lower.
53// This is the maximum value the setting map_generation_limit can be
54#define MAX_MAP_GENERATION_LIMIT (31007)
55
56// Size of node in floating-point units
57// The original idea behind this is to disallow plain casts between
58// floating-point and integer positions, which potentially give wrong
59// results. (negative coordinates, values between nodes, ...)
60// Use floatToInt(p, BS) and intToFloat(p, BS).
61#define BS 10.0f
62
63// Dimension of a MapBlock in nodes
64#define MAP_BLOCKSIZE 16
65
66// Player step height in nodes
67#define PLAYER_DEFAULT_STEPHEIGHT 0.6f
68
69// Arbitrary volume limit for working with contiguous areas (in nodes)
70// needs to safely fit in the VoxelArea class; used by e.g. VManips
71#define MAX_WORKING_VOLUME 150000000UL
72
73/*
74 Old stuff that shouldn't be hardcoded
75*/
76
77// Size of player's main inventory
78#define PLAYER_INVENTORY_SIZE (8 * 4)
79
80// Default maximum health points of a player
81#define PLAYER_MAX_HP_DEFAULT 20
82
83// Default maximal breath of a player
84#define PLAYER_MAX_BREATH_DEFAULT 10
85
86/*
87 Misc
88*/
89
90// Number of different files to try to save a player to if the first fails
91// (because of a case-insensitive filesystem)
92// TODO: Use case-insensitive player names instead of this hack.
93#define PLAYER_FILE_ALTERNATE_TRIES 1000
94
95// For screenshots a serial number is appended to the filename + datetimestamp
96// if filename + datetimestamp is not unique.
97// This is the maximum number of attempts to try and add a serial to the end of
98// the file attempting to ensure a unique filename
99#define SCREENSHOT_MAX_SERIAL_TRIES 1000
100
101#define TTF_DEFAULT_FONT_SIZE (16)