make chat logs configurable through commands
This commit is contained in:
parent
9f45d53a07
commit
8b497cbeaa
51
init.lua
51
init.lua
|
@ -1,45 +1,54 @@
|
||||||
-- rumble - Client side mod for Minetest
|
-- rumble - Client side mod for Minetest
|
||||||
-- Scripted by: Li0n
|
-- Scripted by: Li0n
|
||||||
|
|
||||||
|
|
||||||
-- To do list:
|
|
||||||
-- chatcommand to start and stop logging
|
|
||||||
-- chatcommand to toggle to write what is being logged into the chat
|
|
||||||
-- sadist mode
|
|
||||||
-- tnt griefer mode
|
|
||||||
-- move python program to a different directory
|
|
||||||
-- chat mode: trigger from specific words written by either yourself (humiliation) or others (degradation)
|
|
||||||
|
|
||||||
-- configureable settings:
|
-- configureable settings:
|
||||||
local rumble_strength_max_standard = 0.5
|
local rumble_strength_max_standard = 0.5
|
||||||
local rumble_duration_max_standard = 5
|
local rumble_duration_max_standard = 5
|
||||||
|
|
||||||
|
-- To do list:
|
||||||
|
-- chatcommand to start and stop logging
|
||||||
|
-- sadist mode
|
||||||
|
-- tnt griefer mode
|
||||||
|
-- move python program to a different directory
|
||||||
|
-- chat mode: trigger from specific words written by either yourself (humiliation) or others (degradation)
|
||||||
|
|
||||||
|
|
||||||
local rumble_strength_max
|
local rumble_strength_max
|
||||||
local rumble_duration_max
|
local rumble_duration_max
|
||||||
|
local log
|
||||||
|
|
||||||
|
local log_only = function(text)
|
||||||
|
minetest.log("action", text)
|
||||||
|
end
|
||||||
|
|
||||||
|
local log_and_chat = function(text)
|
||||||
|
minetest.log("action", text)
|
||||||
|
minetest.display_chat_message(text)
|
||||||
|
end
|
||||||
|
|
||||||
-- step 1 (start)
|
-- step 1 (start)
|
||||||
minetest.register_on_mods_loaded(function()
|
minetest.register_on_mods_loaded(function()
|
||||||
minetest.display_chat_message("rumble mod loaded. May the rumble be with you!")
|
minetest.display_chat_message("rumble mod loaded. May the rumble be with you!")
|
||||||
rumble_strength_max = rumble_strength_max_standard
|
rumble_strength_max = rumble_strength_max_standard
|
||||||
rumble_duration_max = rumble_duration_max_standard
|
rumble_duration_max = rumble_duration_max_standard
|
||||||
|
log = log_and_chat
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- step 2 (take damage)
|
-- step 2 (take damage)
|
||||||
minetest.register_on_damage_taken(function(hp)
|
minetest.register_on_damage_taken(function(hp)
|
||||||
local rumble_strength = math.min( hp/20, rumble_strength_max )
|
local rumble_strength = math.min( hp/20, rumble_strength_max )
|
||||||
local rumble_duration = math.min( hp, rumble_duration_max )
|
local rumble_duration = math.min( hp, rumble_duration_max )
|
||||||
minetest.log("action", "[rumble] ".."queue "..rumble_strength.." "..rumble_duration)
|
log("[rumble] ".."queue "..rumble_strength.." "..rumble_duration)
|
||||||
minetest.display_chat_message("[rumble] ".."queue "..rumble_strength.." "..rumble_duration)
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- step 3 (die)
|
-- step 3 (die)
|
||||||
minetest.register_on_death(function()
|
minetest.register_on_death(function()
|
||||||
minetest.log("action", "[rumble] instant 0 0")
|
log("[rumble] instant 0 0")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- step 4 (disconnect)
|
-- step 4 (disconnect)
|
||||||
minetest.register_on_shutdown(function()
|
minetest.register_on_shutdown(function()
|
||||||
minetest.log("action", "[rumble] instant 0 0")
|
log("[rumble] instant 0 0")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- step 5 (commands)
|
-- step 5 (commands)
|
||||||
|
@ -74,3 +83,17 @@ minetest.register_chatcommand("settings", {
|
||||||
minetest.display_chat_message("max rumble duration: "..rumble_duration_max)
|
minetest.display_chat_message("max rumble duration: "..rumble_duration_max)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_chatcommand("chat_off", {
|
||||||
|
description = "disables rumble logs being written into chat",
|
||||||
|
func = function()
|
||||||
|
log = log_only
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_chatcommand("chat_on", {
|
||||||
|
description = "enables rumble logs being written into chat",
|
||||||
|
func = function()
|
||||||
|
log = log_and_chat
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
Loading…
Reference in New Issue