mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-01-11 18:40:25 +01:00
parent
23545d1bc6
commit
c10173888b
@ -4,7 +4,7 @@ Solar Mana Mod [solarmana]
|
|||||||
A mana regeneration controller: only regenerate mana in sunlight
|
A mana regeneration controller: only regenerate mana in sunlight
|
||||||
or on special nodes.
|
or on special nodes.
|
||||||
|
|
||||||
Version: 0.3.0
|
Version: 0.4.0
|
||||||
Licence: LGPL 2.1 or later
|
Licence: LGPL 2.1 or later
|
||||||
|
|
||||||
Report bugs or request help on the forum topic.
|
Report bugs or request help on the forum topic.
|
||||||
@ -21,6 +21,9 @@ Since many magic users prefer their homes and offices to actually
|
|||||||
have a roof, standing on specific node types (currently wooden
|
have a roof, standing on specific node types (currently wooden
|
||||||
planks and gold blocks) will also regenerate mana.
|
planks and gold blocks) will also regenerate mana.
|
||||||
|
|
||||||
|
Now with support for slower, and negative, regeneration. Just
|
||||||
|
for fun, standing on stone will drain your mana...
|
||||||
|
|
||||||
Dependencies
|
Dependencies
|
||||||
------------
|
------------
|
||||||
* mana: https://forum.minetest.net/viewtopic.php?f=11&t=11154
|
* mana: https://forum.minetest.net/viewtopic.php?f=11&t=11154
|
||||||
|
@ -85,19 +85,28 @@ minetest.register_globalstep(function(dtime)
|
|||||||
-- next, check the block we're standing on.
|
-- next, check the block we're standing on.
|
||||||
pos.y = math.floor(pos_y) - 0.5
|
pos.y = math.floor(pos_y) - 0.5
|
||||||
node = minetest.get_node(pos)
|
node = minetest.get_node(pos)
|
||||||
if mana_from_node[node.name] then
|
local nodemana = mana_from_node[node.name]
|
||||||
regen_to = math.max(regen_to, mana_from_node[node.name])
|
for key, value in pairs(mana_from_node) do
|
||||||
|
if key:split(":")[1] == "group" then
|
||||||
|
local groupname = key:split(":")[2]
|
||||||
|
if minetest.get_node_group(node.name, groupname) > 0 then
|
||||||
|
if nodemana then
|
||||||
|
nodemana = math.max(nodemana, value) -- We get the greater one (if the node is part of 2 or more groups)
|
||||||
|
else
|
||||||
|
nodemana = value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if nodemana then
|
||||||
|
if nodemana > 0 then
|
||||||
|
regen_to = math.max(regen_to, nodemana)
|
||||||
|
else
|
||||||
|
regen_to = regen_to + nodemana -- negative, remember?
|
||||||
|
end
|
||||||
--print("Regen to "..regen_to.." : "..node.name)
|
--print("Regen to "..regen_to.." : "..node.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
for key, value in pairs(mana_from_node) do
|
|
||||||
if key:split(":")[1] == "group" then
|
|
||||||
local groupname = key:split(":")[2]
|
|
||||||
if minetest.get_node_group(node.name, groupname) > 0 then
|
|
||||||
regen_to = math.max(regen_to, value) -- We get the greater one (if the node is part of 2 or more groups)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
mana.setregen(name, regen_to)
|
mana.setregen(name, regen_to)
|
||||||
--print("Regen to "..regen_to.." : "..light_day.."/"..light_now.."/"..light_night)
|
--print("Regen to "..regen_to.." : "..light_day.."/"..light_now.."/"..light_night)
|
||||||
|
Loading…
Reference in New Issue
Block a user