mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-01-11 18:40:25 +01:00
[runes] Remove popper rune and add prankster glyph
- Remove that useless call to `minetest.register_on_globalstep` in mods/runes/handlers.lua, and with it the popper rune, to replace it by a glyph - For #179
This commit is contained in:
parent
ce5460a187
commit
333c57bbeb
@ -99,7 +99,7 @@ minetest.register_craftitem("runes:recharge_wand", {
|
||||
mana.subtract(user:get_player_name(), 20)
|
||||
msg = "Rune recharged"
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.chat_send_player(user:get_player_name(), msg)
|
||||
end,
|
||||
})
|
||||
@ -137,7 +137,7 @@ minetest.register_craftitem("runes:info_wand", {
|
||||
|
||||
local formspec = "size[7,7]" ..
|
||||
"label[0,0; Rune informations :]" ..
|
||||
"button_exit[3, 6.6; 1, 0.6; rune_info_exit; Exit]" ..
|
||||
"button_exit[3, 6.6; 1, 0.6; rune_info_exit; Exit]" ..
|
||||
"textlist[0, 0.5; 6.8, 5.9; runes_info;" ..
|
||||
"Rune : " .. rname .. "," ..
|
||||
"Charge : " .. metas["charge"] .. "/" .. runes.glyphs[rname].max_charge .. "," ..
|
||||
@ -226,7 +226,7 @@ register_glyph("watchdog", {
|
||||
local collisionbox = ref:get_properties().collisionbox
|
||||
local refpos = ref:getpos()
|
||||
refpos.y = refpos.y + (((collisionbox[4] or 0) - (collisionbox[3] or 0)) / 2)
|
||||
|
||||
|
||||
local vel = vector.subtract(refpos, pos)
|
||||
minetest.add_particlespawner({
|
||||
amount = 30,
|
||||
@ -275,7 +275,7 @@ register_glyph("manasucker", {
|
||||
end
|
||||
|
||||
meta:set_int("mana", u)
|
||||
end
|
||||
end
|
||||
end,
|
||||
on_timer = function(pos, elapsed)
|
||||
local meta = minetest.get_meta(pos)
|
||||
@ -301,7 +301,7 @@ register_glyph("manasucker", {
|
||||
local collisionbox = ref:get_properties().collisionbox
|
||||
local refpos = ref:getpos()
|
||||
refpos.y = refpos.y + (((collisionbox[4] or 0) - (collisionbox[3] or 0)) / 2)
|
||||
|
||||
|
||||
local vel = vector.subtract(pos, refpos)
|
||||
minetest.add_particlespawner({
|
||||
amount = 30,
|
||||
@ -356,3 +356,48 @@ register_glyph("spontafire", {
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
register_glyph("prankster", {
|
||||
description = "Prankster Glyph",
|
||||
texture = "runes_glyph_prankster.png",
|
||||
initial_charge = 600,
|
||||
maximum_charge = 1200,
|
||||
mana_cost = 20,
|
||||
},{
|
||||
groups = {snappy = 1},
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(5)
|
||||
end,
|
||||
on_timer = function(pos, elapsed)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local charge = meta:get_int("charge")
|
||||
|
||||
for _, ref in pairs(minetest.get_objects_inside_radius(pos, 10)) do
|
||||
if charge >= runes.glyphs["prankster"].mana_cost and ref:is_player() and ref:get_player_name() ~= meta:get_string("master") then
|
||||
local thieff = math.random(1,32)
|
||||
local inv = ref:get_inventory()
|
||||
if inv then
|
||||
local stolen = inv:get_stack("main", thieff)
|
||||
inv:set_stack("main", thieff, nil)
|
||||
if stolen:get_count() > 0 then
|
||||
local pos = ref:getpos()
|
||||
local obj = minetest.add_item({x = pos.x, y = pos.y + 2.5, z = pos.z}, stolen)
|
||||
if obj then
|
||||
obj:setvelocity({x = math.random(-5,5), y = math.random(3,5), z = math.random(-5,5)})
|
||||
end
|
||||
charge = charge - runes.glyphs["prankster"].mana_cost
|
||||
minetest.chat_send_player(ref:get_player_name(), "The Prankster attacked you and stole " .. stolen:get_count() .. " "
|
||||
.. (minetest.registered_items[stolen:get_name()].description or " of something")
|
||||
)
|
||||
else
|
||||
minetest.chat_send_player(ref:get_player_name(), "The Prankster attacked you but failed at stealing from you..")
|
||||
end
|
||||
else
|
||||
minetest.log("Inventory retrieval failed")
|
||||
end
|
||||
end
|
||||
end
|
||||
meta:set_int("charge", charge)
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
@ -104,31 +104,3 @@ runes.functions.connect("earthquake","use",earthquake)
|
||||
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
|
||||
|
||||
-- Is in
|
||||
minetest.register_globalstep(function(dtime)
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local playerpos = player:getpos()
|
||||
local underpos = {x=playerpos.x,y=playerpos.y,z=playerpos.z}
|
||||
local undernode = minetest.get_node(underpos)
|
||||
local meta = minetest.get_meta(underpos)
|
||||
local inv = meta:get_inventory()
|
||||
|
||||
if undernode.name == "runes:rune_popper" then --and player:get_player_name() ~= meta:get_string("owner") then
|
||||
if minetest.get_player_by_name(meta:get_string("owner")) and mana.get(meta:get_string("owner")) > 10 then
|
||||
local thieff = math.random(1,32)
|
||||
local stolen = player:get_inventory():get_stack("main", thieff)
|
||||
player:get_inventory():set_stack("main", thieff, nil)
|
||||
if stolen:get_count() > 0 then
|
||||
local obj = minetest.add_item({x = underpos.x, y = underpos.y + 2.5, z = underpos.z}, stolen)
|
||||
if obj then
|
||||
obj:setvelocity({x = math.random(-5,5), y = math.random(3,5), z = math.random(-5,5)})
|
||||
end
|
||||
mana.set(meta:get_string("owner"), mana.get(meta:get_string("owner"))-10)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
@ -55,15 +55,6 @@ runes.datas.items = {
|
||||
},
|
||||
type = "craftitem"
|
||||
},
|
||||
["popper"] = {
|
||||
description = "Popper",
|
||||
img = {
|
||||
["minor"] = "default_grass.png",
|
||||
["medium"] = "default_grass.png",
|
||||
["major"] = "default_grass.png"
|
||||
},
|
||||
type = "plate"
|
||||
},
|
||||
}
|
||||
|
||||
for key, value in pairs(runes.datas.items) do
|
||||
|
@ -1,5 +1,5 @@
|
||||
-- Scrolls for Runes Redo
|
||||
--
|
||||
--
|
||||
|
||||
runes.scrolls = {}
|
||||
|
||||
@ -39,3 +39,9 @@ register_scroll("spontafire", "knowledge", {
|
||||
texture = "runes_scroll_spontafire.png",
|
||||
description = "Spontaneous Fire Knowledge Scroll",
|
||||
})
|
||||
|
||||
register_scroll("prankster", "knowledge", {
|
||||
glyph = "runes:glyph_prankster",
|
||||
texture = "runes_scroll_prankster.png",
|
||||
description = "Prankster Knowledge Scroll",
|
||||
})
|
||||
|
BIN
mods/runes/textures/runes_glyph_prankster.png
Normal file
BIN
mods/runes/textures/runes_glyph_prankster.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 176 B |
BIN
mods/runes/textures/runes_scroll_prankster.png
Normal file
BIN
mods/runes/textures/runes_scroll_prankster.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 227 B |
Loading…
Reference in New Issue
Block a user