1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-24 17:50:37 +01:00

Updated fail mod : added sounds

This commit is contained in:
LeMagnesium 2015-01-23 20:05:47 +01:00
parent cc128f5713
commit 7a3ac10994
5 changed files with 36 additions and 6 deletions

View File

@ -4,6 +4,10 @@ Minetest Mod Fail
Minetest's mod Fail. Based on an idea By Mg (@LeMagnesium). Minetest's mod Fail. Based on an idea By Mg (@LeMagnesium).
Future features : Future features :
- Cookies' support - Create a use for cookies and FailPoints
- Create a use for the cookies and the FailPoints
- Create a way to materialize cookies and FailPoints - Create a way to materialize cookies and FailPoints
Version:
0.0 : Intial code, basic mod
0.1 : Added options about output stream for the messages and player's presence check
0.2 : Added sounds by Cyberpangolin, played when a FP/CK command is launched

View File

@ -55,11 +55,18 @@ minetest.register_chatcommand("cookie", {
return return
end end
minetest.chat_send_player(name,"=== FP_DEBUG_LINES SENT ===") minetest.chat_send_player(name,"=== CK_DEBUG_LINES SENT ===")
print("=== CK_DEBUG_LINES ===")
local send_admin = function(msg) local send_admin = function(msg)
minetest.chat_send_player(name,msg) minetest.chat_send_player(name,msg)
end end
send_admin("CK File")
if pntf ~= nil then
send_admin("Found")
else
send_admin("Missing!")
end
table.foreach(data,print) table.foreach(data,print)
return return
@ -125,8 +132,13 @@ minetest.register_chatcommand("cookie", {
minetest.log("action","[FailPoints] "..name.." has given a CooKie to "..param) minetest.log("action","[FailPoints] "..name.." has given a CooKie to "..param)
minetest.log("action","[FailPoints] "..param.." now own "..data.cookies[param].."CKs") minetest.log("action","[FailPoints] "..param.." now own "..data.cookies[param].."CKs")
minetest.log("action","[FailPoints] "..name.." now own "..(data.cookies[name] or 0).."CKs") minetest.log("action","[FailPoints] "..name.." now own "..(data.cookies[name] or 0).."CKs")
minetest.sound_play({
name = "cookie",
to_player = param,
gain = 0.1
})
local message_reason = "." local message_reason = "."
if param2 ~= "" then if param2 ~= nil then
local m_table = paramlist local m_table = paramlist
table.remove(m_table,1) table.remove(m_table,1)
message_reason = " because " message_reason = " because "

View File

@ -9,6 +9,8 @@
"Congratulation, you win a failpoint." "Congratulation, you win a failpoint."
License GPLv2
]]-- ]]--
-- The FailPoint mod by Mg. -- The FailPoint mod by Mg.
@ -18,7 +20,7 @@ data = {}
data.fp_file = minetest.get_worldpath().."/failpoints" data.fp_file = minetest.get_worldpath().."/failpoints"
data.failpoints = {} data.failpoints = {}
data.fp_version = 0.1 data.fp_version = 0.2
-- fp_create priv to create failpoints -- fp_create priv to create failpoints
minetest.register_privilege("fp_create","Is able to create FailPoints and give them to anybody else") minetest.register_privilege("fp_create","Is able to create FailPoints and give them to anybody else")
@ -102,10 +104,17 @@ minetest.register_chatcommand("fail", {
end end
minetest.chat_send_player(name,"=== FP_DEBUG_LINES SENT ===") minetest.chat_send_player(name,"=== FP_DEBUG_LINES SENT ===")
print("=== FP_DEBUG_LINES ===")
local send_admin = function(msg) local send_admin = function(msg)
minetest.chat_send_player(name,msg) minetest.chat_send_player(name,msg)
end end
send_admin("FP File")
if pntf ~= nil then
send_admin("Found")
else
send_admin("Missing!")
end
table.foreach(data,print) table.foreach(data,print)
return return
@ -172,7 +181,7 @@ minetest.register_chatcommand("fail", {
minetest.log("action","[FailPoints] "..param.." now own "..data.failpoints[param].."FPs") minetest.log("action","[FailPoints] "..param.." now own "..data.failpoints[param].."FPs")
minetest.log("action","[FailPoints] "..name.." now own "..(data.failpoints[name] or 0).."FPs") minetest.log("action","[FailPoints] "..name.." now own "..(data.failpoints[name] or 0).."FPs")
local message_reason = "." local message_reason = "."
if param2 ~= "" then if param2 ~= nil then
local m_table = paramlist local m_table = paramlist
table.remove(m_table,1) table.remove(m_table,1)
message_reason = " because " message_reason = " because "
@ -181,6 +190,11 @@ minetest.register_chatcommand("fail", {
end end
end end
data.send_func(param,"Congratulations "..param..", you win a failpoint" .. message_reason) data.send_func(param,"Congratulations "..param..", you win a failpoint" .. message_reason)
minetest.sound_play({
name = "failpoint",
to_player = param,
gain = 1.0
})
minetest.chat_send_player(name,"FP sent.") minetest.chat_send_player(name,"FP sent.")
end end
end end

BIN
mods/fail/sounds/cookie.ogg Normal file

Binary file not shown.

Binary file not shown.