Compare commits
5 Commits
fc0efd94fb
...
f4a0c31301
Author | SHA1 | Date |
---|---|---|
Wuzzy | f4a0c31301 | |
Wuzzy | 838d1df687 | |
Wuzzy | 374d9742f8 | |
Wuzzy | 93477205a4 | |
Wuzzy | 3b8097e44a |
2
API.md
2
API.md
|
@ -1,4 +1,4 @@
|
|||
API documentation for Mana 1.1.0
|
||||
API documentation for Mana 1.2.0
|
||||
================================
|
||||
|
||||
## Introduction
|
||||
|
|
|
@ -1,18 +1,16 @@
|
|||
Mana mod [mana]
|
||||
===============
|
||||
Version: 1.1.0
|
||||
Note: This mod uses semantic versioning, as defined by version 2.0.0 of the SemVer standard.
|
||||
See: <http://semver.org/>
|
||||
# Mana [mana]
|
||||
|
||||
Description
|
||||
===========
|
||||
* Version: 1.2.0
|
||||
* Note: This mod uses semantic versioning, as defined by version 2.0.0 of the SemVer standard. See: <http://semver.org/>
|
||||
|
||||
## Description
|
||||
This mod adds basic support for mana to Minetest.
|
||||
|
||||
Each player will have an additional attribute: Mana. To be precise:
|
||||
|
||||
- Current mana reserves: How much mana the player currently has
|
||||
- Maximum possible mana: How much mana the player can have at maximum
|
||||
- Mana regeneration amont: How much mana will be generated each “mana tick” (default 0.2 seconds)
|
||||
* Current mana reserves: How much mana the player currently has
|
||||
* Maximum possible mana: How much mana the player can have at maximum
|
||||
* Mana regeneration amont: How much mana will be generated each “mana tick” (default 0.2 seconds)
|
||||
|
||||
By default, each player spawns with 0/200 mana, and regenerates 1 mana per fifth of a second. All
|
||||
these values can be configured with the server settings (`minetest.conf`) and it is highly advised to do
|
||||
|
@ -25,15 +23,14 @@ The mod provides a simple API to set, get, add and subtract the mana (and maximu
|
|||
for setting the regeneration amount. Note that this mod itself does *not* change the gameplay in a meaningful
|
||||
way. You should install other mods which use the Mana mod as a dependency.
|
||||
|
||||
The API documentation is in the file API.md.
|
||||
The API documentation is in the file `API.md`.
|
||||
|
||||
If the mod “HUD bars” [hudbars] is installed, a blue bar will be added to the HUD showing the player's mana reserves.
|
||||
If the mod “HUD bars” [`hudbars`] is installed, a blue bar will be added to the HUD showing the player's mana reserves.
|
||||
It currently only works with version 0.3.0 of this mod.
|
||||
|
||||
Otherwise, the mana is just shown as text.
|
||||
|
||||
Configuration
|
||||
=============
|
||||
## Configuration
|
||||
|
||||
This mod can be configured with minetest.conf! The following settings are accepted:
|
||||
|
||||
|
@ -43,10 +40,9 @@ This mod can be configured with minetest.conf! The following settings are accept
|
|||
regen value per mana tick. Default: `0.2`. This value must be positive, also try to avoid very small values
|
||||
as those could probably stress your machine a lot.
|
||||
|
||||
|
||||
License information
|
||||
===================
|
||||
* textures/mana_icon.png: CC-BY by Buch <http://opengameart.org/users/Buch>.
|
||||
* textures/mana_bgicon.png: CC-BY, originally by Buch <http://opengameart.org/users/Buch>, modified by Wuzzy.
|
||||
* textures/mana_bar.png: WTFPL by Wuzzy.
|
||||
* `textures/mana_icon.png`: [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/) by [Buch](http://opengameart.org/users/Buch).
|
||||
* `textures/mana_bgicon.png`: CC BY 3.0, originally by Buch, modified by Wuzzy.
|
||||
* `textures/mana_bar.png`: [WTFPL](http://www.wtfpl.net/txt/copying/) by Wuzzy.
|
||||
* Everything else: WTFPL.
|
13
init.lua
13
init.lua
|
@ -11,10 +11,9 @@ License: WTFPL
|
|||
|
||||
local S
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
S = intllib.Getter()
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
S = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
|
||||
end
|
||||
|
||||
mana = {}
|
||||
|
@ -26,17 +25,17 @@ mana.settings.default_regen = 1
|
|||
mana.settings.regen_timer = 0.2
|
||||
|
||||
do
|
||||
local default_max = tonumber(minetest.setting_get("mana_default_max"))
|
||||
local default_max = tonumber(minetest.settings:get("mana_default_max"))
|
||||
if default_max ~= nil then
|
||||
mana.settings.default_max = default_max
|
||||
end
|
||||
|
||||
local default_regen = tonumber(minetest.setting_get("mana_default_regen"))
|
||||
local default_regen = tonumber(minetest.settings:get("mana_default_regen"))
|
||||
if default_regen ~= nil then
|
||||
mana.settings.default_regen = default_regen
|
||||
end
|
||||
|
||||
local regen_timer = tonumber(minetest.setting_get("mana_regen_timer"))
|
||||
local regen_timer = tonumber(minetest.settings:get("mana_regen_timer"))
|
||||
if regen_timer ~= nil then
|
||||
mana.settings.regen_timer = regen_timer
|
||||
end
|
||||
|
@ -291,7 +290,7 @@ if minetest.get_modpath("hudbars") ~= nil then
|
|||
|
||||
else
|
||||
function mana.manastring(playername)
|
||||
return string.format(S("Mana: %d/%d"), mana.get(playername), mana.getmax(playername))
|
||||
return S("Mana: @1/@2", mana.get(playername), mana.getmax(playername))
|
||||
end
|
||||
|
||||
function mana.hud_add(playername)
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
Mana = Mana
|
||||
Mana: %d/%d = Mana: %d/%d
|
||||
Mana: @1/@2 = Mana: @1/@2
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
Mana
|
||||
Mana: %d/%d
|
||||
Mana =
|
||||
Mana: @1/@2 =
|
||||
|
|
Loading…
Reference in New Issue