Initial upload
This commit is contained in:
commit
cb63ef3a8a
13
README.md
Normal file
13
README.md
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
Invisibility Potion by TenPlus1
|
||||
|
||||
This mod lets you craft an invisibility potion using 1x Nyan Cat and 1x Glass Bottle.
|
||||
|
||||
Use potion to hide yourself AND nametag (0.4.14 dev only) for 5 minutes.
|
||||
|
||||
Server admin can use the '/vanish <name>' command to hide/unhide players or themselves by leaving it blank.
|
||||
|
||||
|
||||
Changelog:
|
||||
|
||||
- 0.1 - Initial Upload
|
2
depends.txt
Normal file
2
depends.txt
Normal file
@ -0,0 +1,2 @@
|
||||
default
|
||||
vessels
|
129
init.lua
Normal file
129
init.lua
Normal file
@ -0,0 +1,129 @@
|
||||
|
||||
invisibility = {}
|
||||
|
||||
-- invisibility potion
|
||||
|
||||
minetest.register_node("invisibility:potion", {
|
||||
description = "Invisibility Potion",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"invisibility_potion.png"},
|
||||
inventory_image = "invisibility_potion.png",
|
||||
wield_image = "invisibility_potion.png",
|
||||
paramtype = "light",
|
||||
stack_max = 1,
|
||||
is_ground_content = false,
|
||||
walkable = false,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
|
||||
},
|
||||
groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
|
||||
on_use = function(itemstack, user)
|
||||
|
||||
local pos = user:getpos()
|
||||
|
||||
-- hide player
|
||||
invisible(user)
|
||||
|
||||
minetest.sound_play("pop", {
|
||||
pos = pos,
|
||||
gain = 1.0,
|
||||
max_hear_distance = 5
|
||||
})
|
||||
|
||||
-- show again 5 minutes later
|
||||
minetest.after(300, function()
|
||||
|
||||
invisible(user)
|
||||
|
||||
minetest.sound_play("pop", {
|
||||
pps = pos,
|
||||
gain = 1.0,
|
||||
max_hear_distance = 5
|
||||
})
|
||||
end)
|
||||
|
||||
-- take item
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
|
||||
itemstack:take_item()
|
||||
|
||||
return {name="vessels:glass_bottle"} -- itemstack
|
||||
end
|
||||
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
output = "invisibility:potion",
|
||||
type = "shapeless",
|
||||
recipe = {"default:nyancat", "vessels:glass_bottle"},
|
||||
})
|
||||
|
||||
-- invisibility function
|
||||
|
||||
invisible = function(player)
|
||||
|
||||
if not player then return false end
|
||||
|
||||
local name = player:get_player_name()
|
||||
|
||||
invisibility[name] = not invisibility[name]
|
||||
|
||||
local prop
|
||||
|
||||
if invisibility[name] then
|
||||
|
||||
-- hide player and name tag
|
||||
prop = {
|
||||
visual_size = {x = 0, y = 0},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0}
|
||||
}
|
||||
|
||||
player:set_nametag_attributes({
|
||||
color = {a = 0, r = 255, g = 255, b = 255}
|
||||
})
|
||||
else
|
||||
-- show player and tag
|
||||
prop = {
|
||||
visual_size = {x = 1, y = 1},
|
||||
collisionbox = {-0.35, -1, -0.35, 0.35, 1, 0.35}
|
||||
}
|
||||
|
||||
player:set_nametag_attributes({
|
||||
color = {a = 255, r = 255, g = 255, b = 255}
|
||||
})
|
||||
end
|
||||
|
||||
player:set_properties(prop)
|
||||
|
||||
end
|
||||
|
||||
-- vanish command (admin only)
|
||||
|
||||
minetest.register_chatcommand("vanish", {
|
||||
params = "<name>",
|
||||
description = "Make player invisible",
|
||||
privs = {server = true},
|
||||
|
||||
func = function(name, param)
|
||||
|
||||
-- player online
|
||||
if param ~= ""
|
||||
and minetest.get_player_by_name(param) then
|
||||
|
||||
name = param
|
||||
|
||||
-- player not online
|
||||
elseif param ~= "" then
|
||||
|
||||
return false, "Player " .. param .. " is not online!"
|
||||
end
|
||||
|
||||
-- hide player entered (default to player using command if blank)
|
||||
invisible( minetest.get_player_by_name(name) )
|
||||
|
||||
end
|
||||
})
|
14
license.txt
Normal file
14
license.txt
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
BIN
screenshot.png
Normal file
BIN
screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
2
sounds/license.txt
Normal file
2
sounds/license.txt
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
Pop sound from www.freesfx.co.uk
|
BIN
sounds/pop.ogg
Normal file
BIN
sounds/pop.ogg
Normal file
Binary file not shown.
BIN
textures/invisibility_potion.png
Normal file
BIN
textures/invisibility_potion.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 167 B |
Loading…
x
Reference in New Issue
Block a user