Remove chatplus, it's no longer needed
This commit is contained in:
parent
bd86f8bfef
commit
f44e0903c4
22
mods/chatplus/.gitattributes
vendored
22
mods/chatplus/.gitattributes
vendored
@ -1,22 +0,0 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
|
||||
# Custom for Visual Studio
|
||||
*.cs diff=csharp
|
||||
*.sln merge=union
|
||||
*.csproj merge=union
|
||||
*.vbproj merge=union
|
||||
*.fsproj merge=union
|
||||
*.dbproj merge=union
|
||||
|
||||
# Standard to msysgit
|
||||
*.doc diff=astextplain
|
||||
*.DOC diff=astextplain
|
||||
*.docx diff=astextplain
|
||||
*.DOCX diff=astextplain
|
||||
*.dot diff=astextplain
|
||||
*.DOT diff=astextplain
|
||||
*.pdf diff=astextplain
|
||||
*.PDF diff=astextplain
|
||||
*.rtf diff=astextplain
|
||||
*.RTF diff=astextplain
|
215
mods/chatplus/.gitignore
vendored
215
mods/chatplus/.gitignore
vendored
@ -1,215 +0,0 @@
|
||||
#################
|
||||
## Eclipse
|
||||
#################
|
||||
|
||||
*.pydevproject
|
||||
.project
|
||||
.metadata
|
||||
bin/
|
||||
tmp/
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
local.properties
|
||||
.classpath
|
||||
.settings/
|
||||
.loadpath
|
||||
|
||||
# External tool builders
|
||||
.externalToolBuilders/
|
||||
|
||||
# Locally stored "Eclipse launch configurations"
|
||||
*.launch
|
||||
|
||||
# CDT-specific
|
||||
.cproject
|
||||
|
||||
# PDT-specific
|
||||
.buildpath
|
||||
|
||||
|
||||
#################
|
||||
## Visual Studio
|
||||
#################
|
||||
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
|
||||
# Build results
|
||||
|
||||
[Dd]ebug/
|
||||
[Rr]elease/
|
||||
x64/
|
||||
build/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.log
|
||||
*.scc
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
*.ncrunch*
|
||||
.*crunch*.local.xml
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.Publish.xml
|
||||
*.pubxml
|
||||
|
||||
# NuGet Packages Directory
|
||||
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
|
||||
#packages/
|
||||
|
||||
# Windows Azure Build Output
|
||||
csx
|
||||
*.build.csdef
|
||||
|
||||
# Windows Store app package directory
|
||||
AppPackages/
|
||||
|
||||
# Others
|
||||
sql/
|
||||
*.Cache
|
||||
ClientBin/
|
||||
[Ss]tyle[Cc]op.*
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.[Pp]ublish.xml
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file to a newer
|
||||
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
App_Data/*.mdf
|
||||
App_Data/*.ldf
|
||||
|
||||
#############
|
||||
## Windows detritus
|
||||
#############
|
||||
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Mac crap
|
||||
.DS_Store
|
||||
|
||||
|
||||
#############
|
||||
## Python
|
||||
#############
|
||||
|
||||
*.py[co]
|
||||
|
||||
# Packages
|
||||
*.egg
|
||||
*.egg-info
|
||||
dist/
|
||||
build/
|
||||
eggs/
|
||||
parts/
|
||||
var/
|
||||
sdist/
|
||||
develop-eggs/
|
||||
.installed.cfg
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
.coverage
|
||||
.tox
|
||||
|
||||
#Translations
|
||||
*.mo
|
||||
|
||||
#Mr Developer
|
||||
.mr.developer.cfg
|
@ -1,18 +0,0 @@
|
||||
Chatplus
|
||||
--------
|
||||
|
||||
License: CC-BY-SA to Rubenwardy
|
||||
|
||||
Commands
|
||||
========
|
||||
|
||||
* /ignore [name] - ignore a player
|
||||
* /unignore [name] - unignore a player
|
||||
* /mail [name] [msg] - message a player (online or offline!)
|
||||
* /inbox - open your inbox
|
||||
* /inbox clear - clear your inbox
|
||||
|
||||
HUD
|
||||
===
|
||||
|
||||
This mod adds a new message icon to the HUD. If HUDs are not supported, no icon is added.
|
@ -1,364 +0,0 @@
|
||||
-- Chat Plus
|
||||
-- =========
|
||||
-- Advanced chat functionality
|
||||
-- =========
|
||||
|
||||
chatplus = {
|
||||
log_file = minetest.get_worldpath().."/chatplus-log.txt",
|
||||
_defsettings = {
|
||||
log = true,
|
||||
distance = 0
|
||||
}
|
||||
}
|
||||
|
||||
function chatplus.init()
|
||||
chatplus.load()
|
||||
chatplus.clean_players()
|
||||
|
||||
if not chatplus.players then
|
||||
chatplus.players = {}
|
||||
end
|
||||
chatplus.count = 0
|
||||
chatplus.loggedin = {}
|
||||
chatplus._handlers = {}
|
||||
end
|
||||
|
||||
function chatplus.setting(name)
|
||||
local get = minetest.setting_get("chatplus_"..name)
|
||||
if get then
|
||||
return get
|
||||
elseif chatplus._defsettings[name]~= nil then
|
||||
return chatplus._defsettings[name]
|
||||
else
|
||||
minetest.log("[Chatplus] Setting chatplus_"..name.." not found!")
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
function chatplus.load()
|
||||
-- Initialize the log
|
||||
if chatplus.setting("log") then
|
||||
chatplus.log_handle = io.open(chatplus.log_file,"a+")
|
||||
if not chatplus.log_handle then
|
||||
minetest.log("error","Unable to open chat plus log file: "..chatplus.log_file)
|
||||
else
|
||||
minetest.log("action","Logging chat plus to: "..chatplus.log_file)
|
||||
end
|
||||
end
|
||||
|
||||
-- Load player data
|
||||
minetest.log("[Chatplus] Loading data")
|
||||
local file = io.open(minetest.get_worldpath().."/chatplus.txt", "r")
|
||||
if file then
|
||||
local table = minetest.deserialize(file:read("*all"))
|
||||
file:close()
|
||||
if type(table) == "table" then
|
||||
chatplus.players = table
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function chatplus.save()
|
||||
minetest.log("[Chatplus] Saving data")
|
||||
|
||||
local file = io.open(minetest.get_worldpath().."/chatplus.txt", "w")
|
||||
if file then
|
||||
file:write(minetest.serialize(chatplus.players))
|
||||
file:close()
|
||||
end
|
||||
end
|
||||
|
||||
function chatplus.clean_players()
|
||||
if not chatplus.players then
|
||||
chatplus.players = {}
|
||||
return
|
||||
end
|
||||
|
||||
minetest.log("[Chatplus] Cleaning player lists")
|
||||
for key,value in pairs(chatplus.players) do
|
||||
if value.messages then
|
||||
value.inbox = value.messages
|
||||
value.messages = nil
|
||||
end
|
||||
|
||||
if (
|
||||
(not value.inbox or #value.inbox==0) and
|
||||
(not value.ignore or #value.ignore==0)
|
||||
) then
|
||||
minetest.log("Deleting blank player "..key)
|
||||
value[key] = nil
|
||||
end
|
||||
end
|
||||
chatplus.save()
|
||||
minetest.log("[Chatplus] Clean complete")
|
||||
end
|
||||
|
||||
function chatplus.poke(name,player)
|
||||
local function check(name,value)
|
||||
if not chatplus.players[name][value] then
|
||||
chatplus.players[name][value] = {}
|
||||
end
|
||||
end
|
||||
if not chatplus.players[name] then
|
||||
chatplus.players[name] = {}
|
||||
end
|
||||
check(name,"ignore")
|
||||
check(name,"messages")
|
||||
|
||||
chatplus.players[name].enabled = true
|
||||
|
||||
if player then
|
||||
if player=="end" then
|
||||
chatplus.players[name].enabled = false
|
||||
chatplus.loggedin[name] = nil
|
||||
else
|
||||
if not chatplus.loggedin[name] then
|
||||
chatplus.loggedin[name] = {}
|
||||
end
|
||||
chatplus.loggedin[name].player = player
|
||||
end
|
||||
end
|
||||
|
||||
chatplus.save()
|
||||
|
||||
return chatplus.players[name]
|
||||
end
|
||||
|
||||
function chatplus.register_handler(func,place)
|
||||
if not place then
|
||||
table.insert(chatplus._handlers,func)
|
||||
else
|
||||
table.insert(chatplus._handlers,place,func)
|
||||
end
|
||||
end
|
||||
|
||||
function chatplus.send(from,msg)
|
||||
-- Log chat message
|
||||
if chatplus.log_handle ~= nil then
|
||||
chatplus.log_handle:write(
|
||||
os.date("%d/%m/%Y %I:%M%p")..
|
||||
" <"..from.."> "..
|
||||
msg..
|
||||
"\r\n"
|
||||
)
|
||||
chatplus.log_handle:flush()
|
||||
end
|
||||
|
||||
-- Loop through senders
|
||||
for key,value in pairs(chatplus.loggedin) do
|
||||
local res = nil
|
||||
for i=1,#chatplus._handlers do
|
||||
if chatplus._handlers[i] then
|
||||
res = chatplus._handlers[i](from,key,msg)
|
||||
|
||||
if res ~= nil then
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if (res == nil or res == true) and key~=from then
|
||||
minetest.chat_send_player(key,"<"..from.."> "..msg,false)
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
-- Minetest callbacks
|
||||
minetest.register_on_chat_message(chatplus.send)
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
local _player = chatplus.poke(player:get_player_name(),player)
|
||||
|
||||
if chatplus.log_handle ~= nil then
|
||||
chatplus.log_handle:write(os.date("%d/%m/%Y %I:%M%p").." "..player:get_player_name().." joined\r\n")
|
||||
chatplus.log_handle:flush()
|
||||
end
|
||||
|
||||
-- inbox stuff!
|
||||
if _player.inbox and #_player.inbox>0 then
|
||||
minetest.after(10,minetest.chat_send_player,player:get_player_name(),"("..#_player.inbox..") You have mail! Type /inbox to recieve")
|
||||
end
|
||||
end)
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
chatplus.poke(player:get_player_name(),"end")
|
||||
if chatplus.log_handle ~= nil then
|
||||
chatplus.log_handle:write(os.date("%d/%m/%Y %I:%M%p").." "..player:get_player_name().." disconnected\r\n")
|
||||
chatplus.log_handle:flush()
|
||||
end
|
||||
end)
|
||||
|
||||
-- Init
|
||||
chatplus.init()
|
||||
|
||||
-- Ignoring
|
||||
chatplus.register_handler(function(from,to,msg)
|
||||
if chatplus.players[to] and chatplus.players[to].ignore and chatplus.players[to].ignore[from]==true then
|
||||
return false
|
||||
end
|
||||
return nil
|
||||
end)
|
||||
|
||||
minetest.register_chatcommand("ignore", {
|
||||
params = "name",
|
||||
description = "ignore: Ignore a player",
|
||||
func = function(name, param)
|
||||
chatplus.poke(name)
|
||||
if not chatplus.players[name].ignore[param]==true then
|
||||
chatplus.players[name].ignore[param]=true
|
||||
minetest.chat_send_player(name,param.." has been ignored")
|
||||
chatplus.save()
|
||||
else
|
||||
minetest.chat_send_player(name,"Player "..param.." is already ignored.")
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("unignore", {
|
||||
params = "name",
|
||||
description = "unignore: Unignore a player",
|
||||
func = function(name, param)
|
||||
chatplus.poke(name)
|
||||
if chatplus.players[name].ignore[param]==true then
|
||||
chatplus.players[name].ignore[param]=false
|
||||
minetest.chat_send_player(name,param.." has been unignored")
|
||||
chatplus.save()
|
||||
else
|
||||
minetest.chat_send_player(name,"Player "..param.." is already unignored.")
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
-- inbox
|
||||
function chatplus.showInbox(name)
|
||||
if not chatplus.players[name] then
|
||||
return false
|
||||
end
|
||||
|
||||
local player = chatplus.players[name]
|
||||
|
||||
if not player.inbox or #player.inbox==0 then
|
||||
minetest.chat_send_player(name,"Your inbox is empty!")
|
||||
return false
|
||||
end
|
||||
|
||||
minetest.chat_send_player(name,"("..#player.inbox..") You have mail:")
|
||||
for i=1,#player.inbox do
|
||||
minetest.chat_send_player(name,player.inbox[i],false)
|
||||
end
|
||||
minetest.chat_send_player(name,"("..#player.inbox..")",false)
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("inbox", {
|
||||
params = "clear?",
|
||||
description = "inbox: print the items in your inbox",
|
||||
func = function(name, param)
|
||||
if param == "clear" then
|
||||
local player = chatplus.poke(name)
|
||||
player.inbox = {}
|
||||
chatplus.save()
|
||||
minetest.chat_send_player(name,"Inbox cleared")
|
||||
else
|
||||
chatplus.showInbox(name)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("mail", {
|
||||
params = "name msg",
|
||||
description = "mail: add a message to a player's inbox",
|
||||
func = function(name, param)
|
||||
chatplus.poke(name)
|
||||
local to, msg = string.match(param, "([%a%d_]+) (.+)")
|
||||
|
||||
if not to or not msg then
|
||||
minetest.chat_send_player(name,"mail: <playername> <msg>",false)
|
||||
return
|
||||
end
|
||||
|
||||
minetest.log("To: "..to..", From: "..name..", MSG: "..msg)
|
||||
if chatplus.log_handle ~= nil then
|
||||
chatplus.log_handle:write(os.date("%d/%m/%Y %I:%M%p").." To: "..to..", From: "..name..", MSG: "..msg)
|
||||
chatplus.log_handle:flush()
|
||||
end
|
||||
|
||||
if chatplus.players[to] then
|
||||
table.insert(chatplus.players[to].inbox,os.date("%d/%m/%Y %I:%M%p").." <"..name..">: "..msg)
|
||||
minetest.chat_send_player(name,"Message sent")
|
||||
chatplus.save()
|
||||
else
|
||||
minetest.chat_send_player(name,"Player "..to.." does not exist")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
chatplus.count = chatplus.count + dtime
|
||||
if chatplus.count > 5 then
|
||||
chatplus.count = 0
|
||||
-- loop through player list
|
||||
for key,value in pairs(chatplus.players) do
|
||||
if (
|
||||
chatplus.loggedin and
|
||||
chatplus.loggedin[key] and
|
||||
chatplus.loggedin[key].player and
|
||||
value and
|
||||
value.inbox and
|
||||
chatplus.loggedin[key].player.hud_add and
|
||||
chatplus.loggedin[key].lastcount ~= #value.inbox
|
||||
) then
|
||||
if chatplus.loggedin[key].msgicon then
|
||||
chatplus.loggedin[key].player:hud_remove(chatplus.loggedin[key].msgicon)
|
||||
end
|
||||
|
||||
if chatplus.loggedin[key].msgicon2 then
|
||||
chatplus.loggedin[key].player:hud_remove(chatplus.loggedin[key].msgicon2)
|
||||
end
|
||||
|
||||
if #value.inbox>0 then
|
||||
chatplus.loggedin[key].msgicon = chatplus.loggedin[key].player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
name = "MailIcon",
|
||||
position = {x=0.52, y=0.52},
|
||||
text="chatplus_mail.png",
|
||||
scale = {x=1,y=1},
|
||||
alignment = {x=0.5, y=0.5},
|
||||
})
|
||||
chatplus.loggedin[key].msgicon2 = chatplus.loggedin[key].player:hud_add({
|
||||
hud_elem_type = "text",
|
||||
name = "MailText",
|
||||
position = {x=0.55, y=0.52},
|
||||
text=#value.inbox,
|
||||
scale = {x=1,y=1},
|
||||
alignment = {x=0.5, y=0.5},
|
||||
})
|
||||
end
|
||||
chatplus.loggedin[key].lastcount = #value.inbox
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
chatplus.register_handler(function(from,to,msg)
|
||||
if chatplus.setting("distance") <= 0 then
|
||||
return nil
|
||||
end
|
||||
|
||||
local from_o = minetest.get_player_by_name(from)
|
||||
local to_o = minetest.get_player_by_name(to)
|
||||
|
||||
if not from_o or not to_o then
|
||||
return nil
|
||||
end
|
||||
|
||||
if (
|
||||
chatplus.setting("distance") ~= 0 and
|
||||
chatplus.setting("distance") ~= nil and
|
||||
(vector.distance(from_o:getpos(),to_o:getpos()) > tonumber(chatplus.setting("distance")))
|
||||
)then
|
||||
return false
|
||||
end
|
||||
return nil
|
||||
end)
|
Binary file not shown.
Before Width: | Height: | Size: 270 B |
Loading…
x
Reference in New Issue
Block a user