[invisibility] Update to Git patch f045c7c:
https://github.com/AntumDeluge/mtmod-invisibility/tree/f045c7cmaster
parent
f98e630e40
commit
bad938e3d5
|
@ -71,7 +71,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
|
|||
* player_visuals/
|
||||
* [character_creator][] ([MIT / CC-BY-SA][lic.character_creator]) -- version: [6a0e6aa Git][ver.character_creator]
|
||||
* [hidename][] ([MIT][lic.hidename]) -- version [bb52dbc Git][ver.hidename]
|
||||
* [invisibility][] ([MIT][lic.invisibility]) -- version: [bf4156b Git][ver.invisibility] *2016-08-19*
|
||||
* [invisibility][] ([MIT][lic.invisibility]) -- version: [bf4156b Git][ver.invisibility] *2016-08-19* ([patched][patch.invisibility])
|
||||
* [playeranim][] ([BSD 2-Clause][lic.playeranim]) - version [0ca8e5a Git][ver.playeranim] *2016-12-07*
|
||||
* [wardrobe][] ([WTFPL][lic.wtfpl]) -- version: [1.1-2-c48b011 Git][ver.wardrobe] *2015-05-21*
|
||||
* protection/
|
||||
|
@ -499,6 +499,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
|
|||
[patch.hud]: https://github.com/AntumDeluge/mtmod-hud/tree/6846e20
|
||||
[patch.ilights]: https://github.com/AntumDeluge/mtmod-ilights/tree/f610d75
|
||||
[patch.inventory_plus]: https://github.com/AntumDeluge/mtmp-inventory_plus/tree/3c81158
|
||||
[patch.invisibility]: https://github.com/AntumDeluge/mtmod-invisibility/tree/f045c7c
|
||||
[patch.kpgmobs]: https://github.com/AntumDeluge/mtmod-kpgmobs/tree/0773e37
|
||||
[patch.mesecons]: https://github.com/AntumDeluge/mtmp-mesecons/tree/32a4823
|
||||
[patch.minetest]: https://github.com/AntumDeluge/mtgame-minetest/tree/914595e
|
||||
|
|
|
@ -3,79 +3,6 @@ invisibility = {}
|
|||
|
||||
local effect_time = 300 -- 5 minutes
|
||||
|
||||
-- invisibility function
|
||||
|
||||
local toggle_invisible = function(player, toggle)
|
||||
|
||||
if not player then return false end
|
||||
|
||||
local name = player:get_player_name()
|
||||
|
||||
invisibility[name] = toggle
|
||||
|
||||
local prop
|
||||
|
||||
if toggle == true 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
|
||||
|
||||
local player = minetest.get_player_by_name(name)
|
||||
|
||||
-- hide / show player
|
||||
if invisibility[name] then
|
||||
|
||||
toggle_invisible(player, nil)
|
||||
else
|
||||
toggle_invisible(player, true)
|
||||
end
|
||||
|
||||
end
|
||||
})
|
||||
|
||||
-- reset player invisibility if they go offline
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
|
@ -160,7 +87,7 @@ minetest.register_node("invisibility:potion", {
|
|||
end)
|
||||
|
||||
-- take potion, return empty bottle (and rest of potion stack)
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if not minetest.settings:get_bool("creative_mode") then
|
||||
|
||||
local item_count = user:get_wielded_item():get_count()
|
||||
local inv = user:get_inventory()
|
||||
|
@ -194,3 +121,76 @@ minetest.register_craft( {
|
|||
type = "shapeless",
|
||||
recipe = {"default:nyancat_rainbow", "vessels:glass_bottle"},
|
||||
})
|
||||
|
||||
-- invisibility function
|
||||
|
||||
local toggle_invisible = function(player, toggle)
|
||||
|
||||
if not player then return false end
|
||||
|
||||
local name = player:get_player_name()
|
||||
|
||||
invisibility[name] = toggle
|
||||
|
||||
local prop
|
||||
|
||||
if toggle == true 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
|
||||
|
||||
local player = minetest.get_player_by_name(name)
|
||||
|
||||
-- hide / show player
|
||||
if invisibility[name] then
|
||||
|
||||
toggle_invisible(player, nil)
|
||||
else
|
||||
toggle_invisible(player, true)
|
||||
end
|
||||
|
||||
end
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue