Implement modlib-based configuration
parent
e6d050ed04
commit
7ac030b4b3
36
Readme.md
36
Readme.md
|
@ -36,12 +36,32 @@ Relies on multiple hacks and thus imposes the following limitations on other mod
|
|||
* `respawn_timer.bone_names_by_model["<filename>.<ext>"] = { "Bone_1", "Bone_2", ... }` including standard bone names if used
|
||||
* If both bone position and rotation are set to `{ x = 0, y = 0, z = 0 }`, the bone will be ignored
|
||||
|
||||
Respawning can be done using `respawn_timer.respawn(player_ref)`, the timer can be modified by altering the exposed table
|
||||
Respawning can be done using `respawn_timer.respawn(player_ref)`.
|
||||
|
||||
```lua
|
||||
respawn_timer.timer = {
|
||||
name = "Respawn",
|
||||
duration = 5,
|
||||
color = "FF00FF"
|
||||
}
|
||||
```
|
||||
## Configuration
|
||||
|
||||
<!--modlib:conf:2-->
|
||||
### `timer`
|
||||
#### `color`
|
||||
Timer fill color as hex string
|
||||
|
||||
* Type: string
|
||||
* Default: `FF00FF`
|
||||
* > 000000
|
||||
* < FFFFFF
|
||||
|
||||
#### `duration`
|
||||
Timer duration in seconds
|
||||
|
||||
* Type: number
|
||||
* Default: `5`
|
||||
* > 0
|
||||
* < 6000
|
||||
|
||||
#### `name`
|
||||
Timer caption
|
||||
|
||||
* Type: string
|
||||
* Default: `Respawn`
|
||||
|
||||
<!--modlib:conf-->
|
7
main.lua
7
main.lua
|
@ -1,9 +1,6 @@
|
|||
local modname = minetest.get_current_modname()
|
||||
timer = {
|
||||
name = "Respawn",
|
||||
duration = 5,
|
||||
color = "FF00FF"
|
||||
}
|
||||
conf = modlib.mod.configuration()
|
||||
local timer = conf.timer
|
||||
bone_names_by_model = {
|
||||
default = {"Head", "Body", "Arm_Right", "Arm_Left", "Leg_Right", "Leg_Left"}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
return {
|
||||
type = "table",
|
||||
entries = {
|
||||
timer = {
|
||||
type = "table",
|
||||
entries = {
|
||||
name = {
|
||||
description = "Timer caption",
|
||||
type = "string",
|
||||
default = "Respawn"
|
||||
},
|
||||
duration = {
|
||||
description = "Timer duration in seconds",
|
||||
type = "number",
|
||||
range = {
|
||||
min = 0,
|
||||
max = 6e3
|
||||
},
|
||||
default = 5
|
||||
},
|
||||
color = {
|
||||
description = "Timer fill color as hex string",
|
||||
type = "string",
|
||||
range = {
|
||||
min = "000000",
|
||||
max = "FFFFFF"
|
||||
},
|
||||
default = "FF00FF"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
[*respawn_timer.timer]
|
||||
# Timer fill color as hex string
|
||||
respawn_timer.timer.color (Respawn timer Timer Color) string FF00FF
|
||||
# Timer duration in seconds
|
||||
respawn_timer.timer.duration (Respawn timer Timer Duration) float 5
|
||||
# Timer caption
|
||||
respawn_timer.timer.name (Respawn timer Timer Name) string Respawn
|
Loading…
Reference in New Issue