Move to modpack and /effect command
|
@ -46,6 +46,8 @@ potions = {
|
||||||
air = function(sname, name, fname, time, sdata, flags)
|
air = function(sname, name, fname, time, sdata, flags)
|
||||||
local def = {
|
local def = {
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
|
local potions_e = potions.players[user:get_player_name()]
|
||||||
|
potions_e.air = potions_e.air + (sdata.time or 0)
|
||||||
for i=0, (sdata.time or 0) do
|
for i=0, (sdata.time or 0) do
|
||||||
minetest.after(i, function()
|
minetest.after(i, function()
|
||||||
local br = user:get_breath()
|
local br = user:get_breath()
|
||||||
|
@ -57,6 +59,10 @@ potions = {
|
||||||
br = math.min(11, br)
|
br = math.min(11, br)
|
||||||
br = math.max(0, br)
|
br = math.max(0, br)
|
||||||
user:set_breath(br)
|
user:set_breath(br)
|
||||||
|
|
||||||
|
if i==(sdata.time or 0) then
|
||||||
|
potions_e.air = potions_e.air - (sdata.time or 0)
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
|
@ -510,3 +516,17 @@ end)
|
||||||
--end)
|
--end)
|
||||||
|
|
||||||
--dofile(minetest.get_modpath("potions").."/table.lua")
|
--dofile(minetest.get_modpath("potions").."/table.lua")
|
||||||
|
|
||||||
|
minetest.register_chatcommand("effect", {
|
||||||
|
params = "none",
|
||||||
|
description = "get effect info",
|
||||||
|
func = function(name, param)
|
||||||
|
minetest.chat_send_player(name, "effects:")
|
||||||
|
local potions_e = potions.players[name]
|
||||||
|
if potions_e~=nil then
|
||||||
|
for potion_name, val in pairs(potions_e) do
|
||||||
|
minetest.chat_send_player(name, potion_name .. "=" .. val)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
Before Width: | Height: | Size: 214 B After Width: | Height: | Size: 214 B |
Before Width: | Height: | Size: 206 B After Width: | Height: | Size: 206 B |
Before Width: | Height: | Size: 200 B After Width: | Height: | Size: 200 B |
Before Width: | Height: | Size: 254 B After Width: | Height: | Size: 254 B |
Before Width: | Height: | Size: 254 B After Width: | Height: | Size: 254 B |
Before Width: | Height: | Size: 264 B After Width: | Height: | Size: 264 B |
Before Width: | Height: | Size: 258 B After Width: | Height: | Size: 258 B |
Before Width: | Height: | Size: 253 B After Width: | Height: | Size: 253 B |
Before Width: | Height: | Size: 257 B After Width: | Height: | Size: 257 B |
Before Width: | Height: | Size: 214 B After Width: | Height: | Size: 214 B |
Before Width: | Height: | Size: 206 B After Width: | Height: | Size: 206 B |
Before Width: | Height: | Size: 200 B After Width: | Height: | Size: 200 B |