mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-01-23 16:30:19 +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,
|
end,
|
||||||
on_punch = function(pos, node, puncher, pointed_thing)
|
on_punch = function(pos, node, puncher, pointed_thing)
|
||||||
if runes.datas.handlers[runedef.name].on_punch then
|
if runes.datas.handlers[runedef.name].on_punch then
|
||||||
runes.datas.handlers[runedef.name].on_punch(pos, node, puncher, pointed_thing)
|
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
|
||||||
end,
|
end,
|
||||||
--[[after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
--[[after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||||
|
@ -39,13 +39,25 @@ is_owner_online = function(pos)
|
|||||||
if meta:get_string("owner") ~= nil then
|
if meta:get_string("owner") ~= nil then
|
||||||
return minetest.get_player_by_name(meta:get_string("owner")) ~= nil
|
return minetest.get_player_by_name(meta:get_string("owner")) ~= nil
|
||||||
else
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
go_to_me = function(pos, node, digger)
|
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())
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -75,9 +87,8 @@ end
|
|||||||
runes.functions.connect("project","use",projection)
|
runes.functions.connect("project","use",projection)
|
||||||
runes.functions.connect("damager","use",damage_around)
|
runes.functions.connect("damager","use",damage_around)
|
||||||
runes.functions.connect("earthquake","use",earthquake)
|
runes.functions.connect("earthquake","use",earthquake)
|
||||||
runes.functions.connect("gotome","place",add_owner)
|
runes.functions.connect("gotome","punch",go_to_me)
|
||||||
runes.functions.connect("gotome","dig",go_to_me)
|
runes.functions.connect("gotome","can_dig",is_owner)
|
||||||
runes.functions.connect("gotome","can_dig",is_owner_online)
|
|
||||||
runes.functions.connect("megamana","use",set_manamax)
|
runes.functions.connect("megamana","use",set_manamax)
|
||||||
|
|
||||||
-- And globalsteps
|
-- And globalsteps
|
||||||
|
@ -3,41 +3,42 @@
|
|||||||
runes.datas.items = {
|
runes.datas.items = {
|
||||||
["project"] = {
|
["project"] = {
|
||||||
description = "Projection rune",
|
description = "Projection rune",
|
||||||
img = "default_dirt.png",
|
img = "runes_projection.png",
|
||||||
type = "craftitem",
|
type = "craftitem",
|
||||||
needed_mana = 30
|
needed_mana = 30
|
||||||
},
|
},
|
||||||
["damager"] = {
|
["damager"] = {
|
||||||
description = "Damaging rune",
|
description = "Damaging rune",
|
||||||
img = "default_lava.png",
|
img = "runes_damaging.png",
|
||||||
type = "craftitem",
|
type = "craftitem",
|
||||||
needed_mana = 190
|
needed_mana = 190
|
||||||
},
|
},
|
||||||
["earthquake"] = {
|
["earthquake"] = {
|
||||||
description = "Earth Quake rune",
|
description = "Earth Quake rune",
|
||||||
img = "default_apple.png",
|
img = "runes_earthquake.png",
|
||||||
type = "craftitem",
|
type = "craftitem",
|
||||||
needed_mana = 80
|
needed_mana = 80
|
||||||
},
|
},
|
||||||
["simple_heal"] = {
|
["simple_heal"] = {
|
||||||
description = "Simple healing rune",
|
description = "Simple healing rune",
|
||||||
img = "default_water.png",
|
img = "runes_simple_heal.png",
|
||||||
type = "cube"
|
type = "cube"
|
||||||
},
|
},
|
||||||
["improved_heal"] = {
|
["improved_heal"] = {
|
||||||
description = "Improved healing rune",
|
description = "Improved healing rune",
|
||||||
img = "default_acid.png",
|
img = "runes_improved_heal.png",
|
||||||
type = "cube"
|
type = "cube"
|
||||||
},
|
},
|
||||||
["perfect_heal"] = {
|
["perfect_heal"] = {
|
||||||
description = "Perfect healing rune",
|
description = "Perfect healing rune",
|
||||||
img = "default_lava.png",
|
img = "runes_perfect_heal.png",
|
||||||
type = "cube"
|
type = "cube"
|
||||||
},
|
},
|
||||||
["gotome"] = {
|
["gotome"] = {
|
||||||
description = "Go to me rune",
|
description = "Go to me rune",
|
||||||
img = "default_wood.png",
|
img = "runes_go_to_me.png",
|
||||||
type = "cube"
|
type = "cube",
|
||||||
|
needed_mana = 50
|
||||||
},
|
},
|
||||||
["megamana"] = {
|
["megamana"] = {
|
||||||
description = "Mega Mana",
|
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