[docs] Sorted attribute lists.

master
Quentin Bazin 2020-03-12 13:48:11 +01:00
parent 292595e0fa
commit 81c98d664a
7 changed files with 399 additions and 397 deletions

View File

@ -4,8 +4,8 @@
```lua
mod:biome {
id = "desert",
name = "Desert",
id = "desert", -- mandatory
name = "Desert", -- mandatory
params = {
temperature = -0.3,
@ -39,134 +39,6 @@ mod:biome {
## Attributes
### `id`
ID of the biome. **Mandatory field.**
Example:
```lua
id = "biome_desert"
```
IDs are usually of the form `mod:biome` but the `mod:` prefix is prepended automatically so it's not needed.
### `name`
Label of the biome. **Mandatory field.**
Example:
```lua
name = "Desert"
```
This label is the name that will appear everywhere in the game.
### `params`
Parameters used to generate the biome.
Example:
```lua
params = {
temperature = -0.3,
precipitation = -0.7
}
```
Current valid parameters are:
- `temperature`
- `precipitation`
### `top_block`
String ID of the block used on the top of the terrain.
Example:
```lua
top_block = "default:grass"
```
### `ground_block`
String ID of the block used for the upper part of the terrain, under `top_block`.
Example:
```lua
ground_block = "default:dirt"
```
### `deep_block`
String ID of the block used for the lower part of the terrain, below `ground_block`.
Example:
```lua
deep_block = "default:stone"
```
### `beach_block`
String ID of the block used around and under `liquid_block`.
Example:
```lua
beach_block = "default:sand"
```
### `liquid_block`
String ID of the block used to make lakes under `SEALEVEL` (see EngineConfig.hpp).
Example:
```lua
liquid_block = "default:water"
```
### `portal_block`
String ID of the block used to generate portal center.
Example:
```lua
portal_block = "default:portal"
```
**Note:** This attribute is temporary and will get removed soon.
### `portal_frame_block`
String ID of the block used to generate portal frame.
Example:
```lua
portal_frame_block = "default:obsidian"
```
**Note:** This attribute is temporary and will get removed soon.
### `trees`
Table that defines tree placement.
Example:
```lua
trees = {
{
type = "default:oak",
probability = 0.01
},
{
type = "default:cactus",
probability = 0.001
}
}
```
Possible attributes:
- `type`: String ID of the tree definition
- `probability`: Probability to spawn this tree
### `flora`
Table that defines flora placement.
@ -192,6 +64,28 @@ Possible attributes:
- `spawn_on`: What the block below must be
- `probability`: Probability to spawn `block`
### `id`
ID of the biome. **Mandatory field.**
Example:
```lua
id = "biome_desert"
```
IDs are usually of the form `mod:biome` but the `mod:` prefix is prepended automatically so it's not needed.
### `name`
Label of the biome. **Mandatory field.**
Example:
```lua
name = "Desert"
```
This label is the name that will appear everywhere in the game.
### `ores`
Table that defines ore placement.
@ -212,3 +106,111 @@ Possible attributes:
- `probability`: Probability to spawn an ore vein with that block
- `size`: Ore vein size
### `params`
Parameters used to generate the biome.
Example:
```lua
params = {
temperature = -0.3,
precipitation = -0.7
}
```
Current valid parameters are:
- `temperature`
- `precipitation`
### `trees`
Table that defines tree placement.
Example:
```lua
trees = {
{
type = "default:oak",
probability = 0.01
},
{
type = "default:cactus",
probability = 0.001
}
}
```
Possible attributes:
- `type`: String ID of the tree definition
- `probability`: Probability to spawn this tree
### Blocks
#### `top_block`
String ID of the block used on the top of the terrain.
Example:
```lua
top_block = "default:grass"
```
#### `ground_block`
String ID of the block used for the upper part of the terrain, under `top_block`.
Example:
```lua
ground_block = "default:dirt"
```
#### `deep_block`
String ID of the block used for the lower part of the terrain, below `ground_block`.
Example:
```lua
deep_block = "default:stone"
```
#### `beach_block`
String ID of the block used around and under `liquid_block`.
Example:
```lua
beach_block = "default:sand"
```
#### `liquid_block`
String ID of the block used to make lakes under `SEALEVEL` (see EngineConfig.hpp).
Example:
```lua
liquid_block = "default:water"
```
#### `portal_block`
String ID of the block used to generate portal center.
Example:
```lua
portal_block = "default:portal"
```
**Note:** This attribute is temporary and will get removed soon.
#### `portal_frame_block`
String ID of the block used to generate portal frame.
Example:
```lua
portal_frame_block = "default:obsidian"
```
**Note:** This attribute is temporary and will get removed soon.

View File

@ -12,6 +12,58 @@ mod:block {
## Attributes
### `bounding_box`
Bounding box of the box.
Example:
```lua
bounding_box = {0, 0, 0, 1, 1, 1} -- this is default value
```
Format is `{x, y, z, width, depth, height}`. Note that OpenMiner uses Z axis as up.
The bounding box determines collisions with the block, as well as the selection box that will be displayed when looking at the block.
Note: This is what affects the temporary `boundingbox` draw type.
### `color_multiplier`
Color multiplier of the grayscale parts of the block texture.
Example:
```lua
color_multiplier = {1, 1, 1, 1} -- full white, this is the default value
```
Only the pure gray parts (red == green == blue) will be affected by this multiplier.
### `draw_type`
Draw type of the block, see [Draw types](#draw-types) for more details.
Example:
```lua
draw_type = "solid" -- this is the default value
```
### `hardness`
Hardness of the block, affects mining speed.
Example:
```lua
hardness = 0.5
```
Default value is `1.0`, any value under this will increase mining speed, and any value above will decrease mining speed.
### `harvest_requirements`
Set which tools are more effective.
**Note:** This attribute would need more doc but it'll probably get removed soon.
### `id`
ID of the block. **Mandatory field.**
@ -23,6 +75,45 @@ id = "cobblestone"
IDs are usually of the form `mod:block` but the `mod:` prefix is prepended automatically so it's not needed.
### `is_light_source`
Defines if the block is the light source or not.
Example:
```lua
is_light_source = false -- this is the default value
```
### `is_opaque`
Defines if the block let the light pass or not.
Example:
```lua
is_opaque = true -- this is the default value
```
### `is_rotatable`
Defines if the block should face the player when placed, like the furnace for example
Example:
```lua
is_rotatable = false -- this is the default value
```
### `item_drop`
Item stack that is given to the player when breaking the block.
Example:
```lua
item_drop = {
id = "default:cobblestone",
amount = 1
} -- this is the default drop of a 'default:cobblestone' block
```
### `name`
Label of the block. **Mandatory field.**
@ -60,112 +151,27 @@ The textures will be loaded from `mods/<your-mod>/textures/blocks`
**Note:** Currently, you can only use textures of the exact same size (16x16, 32x32) than the other block/item textures in the game.
### `harvest_requirements`
Set which tools are more effective.
**Note:** This attribute would need more doc but it'll probably get removed soon.
### `hardness`
Hardness of the block, affects mining speed.
Example:
```lua
hardness = 0.5
```
Default value is `1.0`, any value under this will increase mining speed, and any value above will decrease mining speed.
### `is_opaque`
Defines if the block let the light pass or not.
Example:
```lua
is_opaque = true -- this is the default value
```
### `is_light_source`
Defines if the block is the light source or not.
Example:
```lua
is_light_source = false -- this is the default value
```
### `is_rotatable`
Defines if the block should face the player when placed, like the furnace for example
Example:
```lua
is_rotatable = false -- this is the default value
```
### `bounding_box`
Bounding box of the box.
Example:
```lua
bounding_box = {0, 0, 0, 1, 1, 1} -- this is default value
```
Format is `{x, y, z, width, depth, height}`. Note that OpenMiner uses Z axis as up.
The bounding box determines collisions with the block, as well as the selection box that will be displayed when looking at the block.
Note: This is what affects the temporary `boundingbox` draw type.
### `draw_type`
Draw type of the block, see [Draw types](#draw-types) for more details.
Example:
```lua
draw_type = "solid" -- this is the default value
```
### `item_drop`
Item stack that is given to the player when breaking the block.
Example:
```lua
item_drop = {
id = "default:cobblestone",
amount = 1
} -- this is the default drop of a 'default:cobblestone' block
```
### `color_multiplier`
Color multiplier of the grayscale parts of the block texture.
Example:
```lua
color_multiplier = {1, 1, 1, 1} -- full white, this is the default value
```
Only the pure gray parts (red == green == blue) will be affected by this multiplier.
## Draw types
The draw type changes how the block is rendered.
### `solid`
### `boundingbox`
This draw type is the default draw type of the blocks.
NB: Temporary draw type.
It renders a basic textured cube of size 1x1x1.
Allow drawing a block of the size of the `bounding_box`.
### `xshape`
### `cactus`
Draws two textured quads that form an X shape.
Using the `bounding_box` attribute, will draw a # shape instead of a cube.
Useful for flora, tallgrass, mushrooms, etc...
Useful for `cactus` block.
### `glass`
Draw type used for glass-type blocks. Also works for portals.
Almost the same as the `liquid` draw type, except that back-face culling is enabled.
### `leaves`
@ -181,33 +187,20 @@ Makes a single mesh with all the connected blocks of the same type in a chunk.
It will be rendered without back-face culling (this is why you can see water surface while being inside).
### `glass`
### `solid`
Draw type used for glass-type blocks. Also works for portals.
This draw type is the default draw type of the blocks.
Almost the same as the `liquid` draw type, except that back-face culling is enabled.
It renders a basic textured cube of size 1x1x1.
### `cactus`
### `xshape`
Using the `bounding_box` attribute, will draw a # shape instead of a cube.
Draws two textured quads that form an X shape.
Useful for `cactus` block.
### `boundingbox`
NB: Temporary draw type.
Allow drawing a block of the size of the `bounding_box`.
Useful for flora, tallgrass, mushrooms, etc...
## Functions
### `on_block_placed`
Parameters:
- `pos` (`ivec3`): position of the block
- `world` (`World`): instance of `ServerWorld`
### `on_block_activated`
Parameters:
@ -221,6 +214,13 @@ Parameters:
- `screen_height` (`u16`): height of the screen
- `gui_scale` (`u8`): current scaling setting
### `on_block_placed`
Parameters:
- `pos` (`ivec3`): position of the block
- `world` (`World`): instance of `ServerWorld`
### `on_tick`
Parameters:

View File

@ -4,8 +4,8 @@
```lua
mod:dimension {
id = "overworld",
name = "Overworld",
id = "overworld", -- mandatory
name = "Overworld", -- mandatory
biomes = {"default:grassland", "default:desert"},
@ -15,6 +15,15 @@ mod:dimension {
## Attributes
### `biomes`
Table containing all the string IDs of the possible biomes for this dimension.
Example:
```lua
biomes = {"default:grassland", "default:desert"}
```
### `id`
ID of the dimension. **Mandatory field.**
@ -37,15 +46,6 @@ name = "Nether"
This label is the name that will appear everywhere in the game.
### `biomes`
Table containing all the string IDs of the possible biomes for this dimension.
Example:
```lua
biomes = {"default:grassland", "default:desert"}
```
### `sky`
String ID of the sky definition used for this dimension.

View File

@ -4,14 +4,38 @@
```lua
mod:item {
id = "myitem",
name = "My Item",
id = "myitem", -- mandatory
name = "My Item", -- mandatory
tiles = "myitem.png",
}
```
## Attributes
### `burn_time`
Burn time of a fuel item.
Example:
```lua
burn_time = 200 -- example value for a coal item, default is 0
```
### `harvest_capability`
For a tool, set which blocks are easier to mine.
**Note:** This attribute would need more doc but it'll probably get removed soon.
### `is_fuel`
Defines if the item is valid furnace fuel or not.
Example:
```lua
is_fuel = false -- this is the default value
```
### `id`
ID of the item. **Mandatory field.**
@ -23,6 +47,15 @@ id = "stick"
IDs are usually of the form `mod:item` but the `mod:` prefix is prepended automatically so it's not needed.
### `mining_speed`
For a tool, speed at which it mines the block.
Example:
```lua
mining_speed = 1 -- this is the default value
```
### `name`
Label of the item. **Mandatory field.**
@ -47,36 +80,3 @@ The textures will be loaded from `mods/<your-mod>/textures/items`
**Note:** Currently, you can only use textures of the exact same size (16x16, 32x32) than the other block/item textures in the game.
### `harvest_capability`
For a tool, set which blocks are easier to mine.
**Note:** This attribute would need more doc but it'll probably get removed soon.
### `mining_speed`
For a tool, speed at which it mines the block.
Example:
```lua
mining_speed = 1 -- this is the default value
```
### `is_fuel`
Defines if the item is valid furnace fuel or not.
Example:
```lua
is_fuel = false -- this is the default value
```
### `burn_time`
Burn time of a fuel item.
Example:
```lua
burn_time = 200 -- example value for a coal item, default is 0
```

View File

@ -140,6 +140,81 @@ gui:image {
## C++ classes in Lua
### Block
- `u16 id()`
- `u16 data()`
- `string string_id()`
- `string label()`
- `stirng mod_name()`
- `bool is_opaque()`
### BlockData
- `Inventory *inventory`
- `BlockMetadata *meta`
- `bool use_alt_tiles`
### BlockMetadata
- `string get_string(string attribute)`
- `void set_string(string attribute, string value)`
- `int get_int(string attribute)`
- `void set_int(string attribute, int value)`
### Chunk
- `u16 get_block(int x, int y, int z)`
- `void set_block(int x, int y, int z, u16 block)`
- `u16 get_data(int x, int y, int z)`
- `void set_data(int x, int y, int z, u16 data)`
- `BlockData *add_block_data(int x, int y, int z, int inventoryWidth, int inventoryHeight)`
- `BlockData *get_block_data(int x, int y, int z)`
### ClientInfo
- `u16 id()`
### Inventory
- `void add_stack(string name, u16 amount)`
- `ItemStack get_stack(u16 x, u16 y)`
- `void set_stack(u16 x, u16 y, string name, u16 amount)`
### Item
- `u16 id()`
- `string name()`
- `u16 burn_time()`
- `bool is_fuel()`
### ItemStack
- `u16 amount()`
- `Item item()`
### ivec3
- `int x`
- `int y`
- `int z`
### Player
- `Inventory *inventory()`
- `double x()`
- `double y()`
- `double z()`
- `void set_position(double x, double y, double z)`
- `u16 dimension()`
- `void set_dimension(u16 dimension)`
- `u16 client_id()`
### Recipe
- `string type()`
- `ItemStack result()`
### Registry
- `Block get_block(u16 id)`
@ -159,6 +234,11 @@ gui:image {
- `Biome[] biomes()`
- `Dimension[] dimensions()`
### ServerCommandHandler
- `void send_player_change_dimension(u16 clientID, int x, int y, int z, u16 dimension, ClientInfo client)`
- `void send_chat_message(u16 senderID, string message, ClientInfo client)`
### World
- `u16 get_block(int x, int y, int z)`
@ -168,83 +248,3 @@ gui:image {
- `BlockData *add_block_data(int x, int y, int z, int inventoryWidth, int inventoryHeight)`
- `BlockData *get_block_data(int x, int y, int z)`
### Chunk
- `u16 get_block(int x, int y, int z)`
- `void set_block(int x, int y, int z, u16 block)`
- `u16 get_data(int x, int y, int z)`
- `void set_data(int x, int y, int z, u16 data)`
- `BlockData *add_block_data(int x, int y, int z, int inventoryWidth, int inventoryHeight)`
- `BlockData *get_block_data(int x, int y, int z)`
### BlockData
- `Inventory *inventory`
- `BlockMetadata *meta`
- `bool use_alt_tiles`
### Block
- `u16 id()`
- `u16 data()`
- `string string_id()`
- `string label()`
- `stirng mod_name()`
- `bool is_opaque()`
### Player
- `Inventory *inventory()`
- `double x()`
- `double y()`
- `double z()`
- `void set_position(double x, double y, double z)`
- `u16 dimension()`
- `void set_dimension(u16 dimension)`
- `u16 client_id()`
### Inventory
- `void add_stack(string name, u16 amount)`
- `ItemStack get_stack(u16 x, u16 y)`
- `void set_stack(u16 x, u16 y, string name, u16 amount)`
### Recipe
- `string type()`
- `ItemStack result()`
### ItemStack
- `u16 amount()`
- `Item item()`
### Item
- `u16 id()`
- `string name()`
- `u16 burn_time()`
- `bool is_fuel()`
### ivec3
- `int x`
- `int y`
- `int z`
### BlockMetadata
- `string get_string(string attribute)`
- `void set_string(string attribute, string value)`
- `int get_int(string attribute)`
- `void set_int(string attribute, int value)`
### ClientInfo
- `u16 id()`
### ServerCommandHandler
- `void send_player_change_dimension(u16 clientID, int x, int y, int z, u16 dimension, ClientInfo client)`
- `void send_chat_message(u16 senderID, string message, ClientInfo client)`

View File

@ -4,7 +4,7 @@
```lua
mod:sky {
id = "sky_overworld",
id = "sky_overworld", -- mandatory
color = {
day = {50, 153, 204},
@ -18,17 +18,6 @@ mod:sky {
## Attributes
### `id`
ID of the sky. **Mandatory field.**
Example:
```lua
id = "sky_nether"
```
IDs are usually of the form `mod:sky` but the `mod:` prefix is prepended automatically so it's not needed.
### `color`
Sky color.
@ -57,3 +46,14 @@ fog_color = {
Possible values:
- `day`: Fog color at midday
### `id`
ID of the sky. **Mandatory field.**
Example:
```lua
id = "sky_nether"
```
IDs are usually of the form `mod:sky` but the `mod:` prefix is prepended automatically so it's not needed.

View File

@ -4,7 +4,7 @@
```lua
mod:tree {
id = "oak",
id = "tree_oak", -- mandatory
log_block = "default:oak_wood",
leaves_block = "default:oak_leaves",
@ -18,6 +18,15 @@ mod:tree {
## Attributes
### `has_leaves`
Defines if the tree has leaves or not.
Example:
```lua
has_leaves = true -- this is the default value
```
### `id`
ID of the tree. **Mandatory field.**
@ -29,15 +38,6 @@ id = "tree_oak"
IDs are usually of the form `mod:tree` but the `mod:` prefix is prepended automatically so it's not needed.
### `log_block`
String ID of the block used as a log.
Example:
```lua
log_block = "default:oak_wood"
```
### `leaves_block`
String ID of the block used as leaves if `has_leaves` is set to `true`.
@ -47,13 +47,13 @@ Example:
leaves_block = "default:oak_leaves"
```
### `has_leaves`
### `log_block`
Defines if the tree has leaves or not.
String ID of the block used as a log.
Example:
```lua
has_leaves = true -- this is the default value
log_block = "default:oak_wood"
```
### `trunk_height`