mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-11-19 16:50:31 +01:00
Added work for "go to me" rune
- Added mana dicreaser on on_punch calls (cube only :s) - Added is_owner handler - Moved a texture name to the good name - Added values in needed_mana for go_to_me rune
This commit is contained in:
parent
274c874f35
commit
eae5700e6b
@ -52,7 +52,12 @@ runes.functions.register_rune = function(parameters)
|
||||
end,
|
||||
on_punch = function(pos, node, puncher, pointed_thing)
|
||||
if runes.datas.handlers[runedef.name].on_punch then
|
||||
if mana.get(puncher:get_player_name()) >= runedef.needed_mana then
|
||||
runes.datas.handlers[runedef.name].on_punch(pos, node, puncher, pointed_thing)
|
||||
mana.subtract(puncher:get_player_name(),runedef.needed_mana)
|
||||
else
|
||||
minetest.chat_send_player(puncher:get_player_name(),"Not enough mana (needed : " .. runedef.needed_mana ..")")
|
||||
end
|
||||
end
|
||||
end,
|
||||
--[[after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
|
@ -39,13 +39,25 @@ is_owner_online = function(pos)
|
||||
if meta:get_string("owner") ~= nil then
|
||||
return minetest.get_player_by_name(meta:get_string("owner")) ~= nil
|
||||
else
|
||||
return true
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
is_owner = function(pos, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if meta:get_string("owner") ~= nil and player:get_player_name() then
|
||||
return meta:get_string("owner") == player:get_player_name()
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
go_to_me = function(pos, node, digger)
|
||||
if digger then
|
||||
if digger and is_owner_online(pos) and not (minetest.get_meta(pos):get_string("owner") == digger:get_player_name()) then
|
||||
digger:setpos(minetest.get_player_by_name(minetest.get_meta(pos):get_string("owner")):getpos())
|
||||
mana.subtract(minetest.get_meta(pos):get_string("owner"), 5)
|
||||
else
|
||||
mana.add(digger:get_player_name(),50)
|
||||
end
|
||||
end
|
||||
|
||||
@ -75,9 +87,8 @@ end
|
||||
runes.functions.connect("project","use",projection)
|
||||
runes.functions.connect("damager","use",damage_around)
|
||||
runes.functions.connect("earthquake","use",earthquake)
|
||||
runes.functions.connect("gotome","place",add_owner)
|
||||
runes.functions.connect("gotome","dig",go_to_me)
|
||||
runes.functions.connect("gotome","can_dig",is_owner_online)
|
||||
runes.functions.connect("gotome","punch",go_to_me)
|
||||
runes.functions.connect("gotome","can_dig",is_owner)
|
||||
runes.functions.connect("megamana","use",set_manamax)
|
||||
|
||||
-- And globalsteps
|
||||
|
@ -3,41 +3,42 @@
|
||||
runes.datas.items = {
|
||||
["project"] = {
|
||||
description = "Projection rune",
|
||||
img = "default_dirt.png",
|
||||
img = "runes_projection.png",
|
||||
type = "craftitem",
|
||||
needed_mana = 30
|
||||
},
|
||||
["damager"] = {
|
||||
description = "Damaging rune",
|
||||
img = "default_lava.png",
|
||||
img = "runes_damaging.png",
|
||||
type = "craftitem",
|
||||
needed_mana = 190
|
||||
},
|
||||
["earthquake"] = {
|
||||
description = "Earth Quake rune",
|
||||
img = "default_apple.png",
|
||||
img = "runes_earthquake.png",
|
||||
type = "craftitem",
|
||||
needed_mana = 80
|
||||
},
|
||||
["simple_heal"] = {
|
||||
description = "Simple healing rune",
|
||||
img = "default_water.png",
|
||||
img = "runes_simple_heal.png",
|
||||
type = "cube"
|
||||
},
|
||||
["improved_heal"] = {
|
||||
description = "Improved healing rune",
|
||||
img = "default_acid.png",
|
||||
img = "runes_improved_heal.png",
|
||||
type = "cube"
|
||||
},
|
||||
["perfect_heal"] = {
|
||||
description = "Perfect healing rune",
|
||||
img = "default_lava.png",
|
||||
img = "runes_perfect_heal.png",
|
||||
type = "cube"
|
||||
},
|
||||
["gotome"] = {
|
||||
description = "Go to me rune",
|
||||
img = "default_wood.png",
|
||||
type = "cube"
|
||||
img = "runes_go_to_me.png",
|
||||
type = "cube",
|
||||
needed_mana = 50
|
||||
},
|
||||
["megamana"] = {
|
||||
description = "Mega Mana",
|
||||
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
Loading…
Reference in New Issue
Block a user