forked from mtcontrib/minetest_mana
Remove commends in init.lua, they are redundant
This commit is contained in:
parent
30b2b302ef
commit
596b824074
43
init.lua
43
init.lua
@ -18,9 +18,6 @@ mana.playerlist = {}
|
|||||||
API functions
|
API functions
|
||||||
]===]
|
]===]
|
||||||
|
|
||||||
--[[ Sets the mana reserves of the specified player
|
|
||||||
It is ensured that the resulting value will always be within the bounds of [0, maxmana]
|
|
||||||
]]
|
|
||||||
function mana.set(playername, value)
|
function mana.set(playername, value)
|
||||||
if value < 0 then
|
if value < 0 then
|
||||||
minetest.log("info", "[mana] Warning: mana.set was called with negative value!")
|
minetest.log("info", "[mana] Warning: mana.set was called with negative value!")
|
||||||
@ -35,9 +32,6 @@ function mana.set(playername, value)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[ Sets the maximum mana of the specified player. The value must be positive or 0.
|
|
||||||
The player's mana reserves will be capped at the new maximum, if neccessary.
|
|
||||||
]]
|
|
||||||
function mana.setmax(playername, value)
|
function mana.setmax(playername, value)
|
||||||
if value < 0 then
|
if value < 0 then
|
||||||
value = 0
|
value = 0
|
||||||
@ -52,26 +46,14 @@ function mana.setmax(playername, value)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Returns the current mana of the specified player
|
|
||||||
function mana.get(playername)
|
function mana.get(playername)
|
||||||
return mana.playerlist[playername].mana
|
return mana.playerlist[playername].mana
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Returns the maximum mana of the specified player
|
|
||||||
function mana.getmax(playername)
|
function mana.getmax(playername)
|
||||||
return mana.playerlist[playername].maxmana
|
return mana.playerlist[playername].maxmana
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[
|
|
||||||
Adds up to the specified amount of mana to the player.
|
|
||||||
If the sum would be greater than the maximum, the new
|
|
||||||
mana amount will be capped at the maximum.
|
|
||||||
|
|
||||||
returns:
|
|
||||||
- true, excess on success, where excess is the amount of mana which
|
|
||||||
was no
|
|
||||||
- false on failure
|
|
||||||
]]
|
|
||||||
function mana.add_up_to(playername, value)
|
function mana.add_up_to(playername, value)
|
||||||
local t = mana.playerlist[playername]
|
local t = mana.playerlist[playername]
|
||||||
if(t ~= nil and value >= 0) then
|
if(t ~= nil and value >= 0) then
|
||||||
@ -90,15 +72,6 @@ function mana.add_up_to(playername, value)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[
|
|
||||||
Adds the specified amount of mana to the player,
|
|
||||||
iff it would not exceed the maximum.
|
|
||||||
|
|
||||||
returns:
|
|
||||||
- true on success, all mana has been added
|
|
||||||
- false on failure, no mana has been added
|
|
||||||
]]
|
|
||||||
function mana.add(playername, value)
|
function mana.add(playername, value)
|
||||||
local t = mana.playerlist[playername]
|
local t = mana.playerlist[playername]
|
||||||
if(t ~= nil and ((t.mana + value) <= t.maxmana) and value >= 0) then
|
if(t ~= nil and ((t.mana + value) <= t.maxmana) and value >= 0) then
|
||||||
@ -110,14 +83,6 @@ function mana.add(playername, value)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[
|
|
||||||
Subtracts the specified amount of mana from the player,
|
|
||||||
iff the player has enough mana reserves.
|
|
||||||
|
|
||||||
returns:
|
|
||||||
- true on success, all mana has been subtracted
|
|
||||||
- false on failure, no mana has been subtracted
|
|
||||||
]]
|
|
||||||
function mana.subtract(playername, value)
|
function mana.subtract(playername, value)
|
||||||
local t = mana.playerlist[playername]
|
local t = mana.playerlist[playername]
|
||||||
if(t ~= nil and t.mana >= value and value >= 0) then
|
if(t ~= nil and t.mana >= value and value >= 0) then
|
||||||
@ -129,14 +94,6 @@ function mana.subtract(playername, value)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[
|
|
||||||
Subtracts up to the specified amount of mana from the player.
|
|
||||||
|
|
||||||
returns:
|
|
||||||
- true, missing on success, where missing is the amount of mana which could not been subtracted
|
|
||||||
- false on failure, no mana has been subtracted
|
|
||||||
]]
|
|
||||||
function mana.subtract_up_to(playername, value)
|
function mana.subtract_up_to(playername, value)
|
||||||
local t = mana.playerlist[playername]
|
local t = mana.playerlist[playername]
|
||||||
if(t ~= nil and value >= 0) then
|
if(t ~= nil and value >= 0) then
|
||||||
|
Loading…
Reference in New Issue
Block a user