Added /reply and upgraded conf.lua a lot.

Adding a new command and updating the configuration file is not to bad
:)
This will need to be tested later when I get to my desktop PC.
master
Teodor Spæren 2012-10-15 13:36:24 +02:00
parent 79fcfe95c9
commit 092e90fa2c
4 changed files with 229 additions and 24 deletions

163
.gitignore vendored Normal file
View File

@ -0,0 +1,163 @@
#################
## 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/
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.vspscc
.builds
*.dotCover
## TODO: If you have NuGet Package Restore enabled, uncomment this
#packages/
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
# Visual Studio profiler
*.psess
*.vsp
# ReSharper is a .NET coding add-in
_ReSharper*
# 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
# Others
[Bb]in
[Oo]bj
sql
TestResults
*.Cache
ClientBin
stylecop.*
~$*
*.dbmdl
Generated_Code #added for RIA/Silverlight projects
# 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
############
## Windows
############
# Windows image file caches
Thumbs.db
# Folder config file
Desktop.ini
#############
## Python
#############
*.py[co]
# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
# Installer logs
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
#Translations
*.mo
#Mr Developer
.mr.developer.cfg
# Mac crap
.DS_Store

View File

@ -3,6 +3,9 @@ ABOUT
Redsand is a collection of utilites for servers. It is not aimed at adding new blocks to the game,
but rather add more chat commands and so on.
Another goal is to activly develope a configuration file.
This is a version is made by Teodor Spæren ( TheRedMood )
====
FEATURES
====
@ -15,4 +18,10 @@ COMMANDS
========
/list - List out the players on the server.
/kill - Lower your health to 0.
/msg <target> <msg> - Talk to someone.
/msg <target> <msg> - Talk to someone.
/reply <msg> - Reply to the last person who talked to you.
===
LICENCE
===
READ LICENCE.txt now!

View File

@ -1,26 +1,30 @@
-- Care about small and BIG letters?
careLetters = true
--[[ What do you want to be loaded? ]]--
-- List command
useList = true
listprivs = {shout = true}
useList = true -- List command
useMSG = true -- MSG command
useKill = true -- Kill command
useReply = true -- Reply command
-- Kill command
useKill = true
killprivs = {shout = true}
useMOTD = true -- Message of the day
useDeathMSG = true -- Death messages
useReviveMSG = true -- Revive messages
-- MSG command
useMSG = true
msgprivs = {shout = true}
--[[ GLOBAL OPTIONS ]]--
careLetters = true -- Care about small and BIG letters?
--MOTD
useMOTD = true
MOTD = "Welcome %s! This is the default MOTD."
--[[ Privleges ]]--
listprivs = {shout = true} -- List privleges
killprivs = {shout = true} -- kill privleges
msgprivs = {shout = true} -- msg privleges
replyprivs = {shout = true} -- reply privleges
-- Death message
useDeathMSG = true
DEATH_MSG = "%s left this world :("
--[[ Message strings ]]--
MOTD = "Welcome %s! This is the default MOTD." -- Message of the day
DEATH_MSG = "%s left this world :(" -- Death message
REVIVE_MSG = "Like a Phonix %s rises from the ashes." -- Revive message
-- Revive message
useReviveMSG = true
REVIVE_MSG = "Like a Phonix %s rises from the ashes."
--[[ What do you want after the / ]]--
listcmd = "list"
msgcmd = "msg"
killcmd = "kill"
replycmd = "reply"

View File

@ -1,4 +1,5 @@
dofile(minetest.get_modpath("redsand").."/conf.lua")
lastspoke = {}
-- !!! FUNCTIONS !!! --
@ -32,7 +33,7 @@ end
--[[ List function. ]]--
if useList then
minetest.register_chatcommand("list", {
minetest.register_chatcommand(listcmd, {
params = "", -- short parameter description
description = "List connected players", -- full description
privs = listprivs, -- require the "privs" privilege to run
@ -51,7 +52,7 @@ end
--[[ Kill command ]]---
if useKill then
minetest.register_chatcommand("kill", {
minetest.register_chatcommand(killcmd, {
params = "",
description = "Kills you :(",
privs = killprivs,
@ -64,7 +65,7 @@ end
--[[ MSG command ]]---
if useMSG then
minetest.register_chatcommand("msg", {
minetest.register_chatcommand(msgcmd, {
params = "<target> <text>",
description = "Talk to someone!",
privs = msgprivs,
@ -86,9 +87,37 @@ if useMSG then
-- Sending the message
minetest.chat_send_player(target:get_player_name(), string.format("From %s: %s", name, msg))
-- Register the chat in the target persons lastspoke tabler
lastspoke[target:get_player_name()] = name
end,
})
end
--[[ REPLY command]] --
if useReply then
minetest.register_chatcommand(replycmd, {
params = "<text>",
description = "Reply the last peron that messaged you.",
privs = replyprivs,
func = function(name, param)
-- We need to get the target
target = lastspoke[name]
-- Make sure I don't crash the server.
if not target then
minetest.chat_send_player(name, "No one has spoke to you :(")
elseif param == "" then
minetest.chat_send_player(name, "You need to say something.")
else
-- We need to send the message and update the targets lastspoke[] status.
minetest.chat_send_player(target, string.format("From %s: %s", name, param))
lastspoke[target] = name
end
end,
})
end
-- !!! EVENTS !!! --
--[[ What happens when a player joins? ]]--