2022-02-11 01:26:20 +01:00
|
|
|
-- rumble - Client side mod for Minetest
|
|
|
|
-- Scripted by: Li0n
|
|
|
|
|
2022-02-25 00:22:40 +01:00
|
|
|
|
|
|
|
-- To do list:
|
|
|
|
-- chatcommand to start and stop logging
|
|
|
|
-- chatcommand 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)
|
2022-02-11 01:26:20 +01:00
|
|
|
|
2022-02-25 20:58:58 +01:00
|
|
|
-- configureable settings:
|
|
|
|
local rumble_strength_max_standard = 0.5
|
|
|
|
local rumble_duration_max_standard = 5
|
|
|
|
|
|
|
|
local rumble_strength_max
|
|
|
|
local rumble_duration_max
|
|
|
|
|
|
|
|
-- step 1 (start)
|
|
|
|
minetest.register_on_mods_loaded(function()
|
|
|
|
minetest.display_chat_message("rumble mod loaded. May the rumble be with you!")
|
|
|
|
rumble_strength_max = rumble_strength_max_standard
|
|
|
|
rumble_duration_max = rumble_duration_max_standard
|
2022-02-11 01:26:20 +01:00
|
|
|
end)
|
|
|
|
|
2022-02-19 19:41:17 +01:00
|
|
|
-- step 2 (take damage)
|
2022-02-11 01:26:20 +01:00
|
|
|
minetest.register_on_damage_taken(function(hp)
|
2022-02-25 00:36:09 +01:00
|
|
|
local rumble_strength = math.min( hp/20, rumble_strength_max )
|
|
|
|
local rumble_duration = math.min( hp, rumble_duration_max )
|
2022-02-19 19:47:52 +01:00
|
|
|
minetest.log("action", "[rumble] ".."queue "..rumble_strength.." "..rumble_duration)
|
2022-02-25 00:37:07 +01:00
|
|
|
minetest.display_chat_message("[rumble] ".."queue "..rumble_strength.." "..rumble_duration)
|
2022-02-11 01:26:20 +01:00
|
|
|
end)
|
|
|
|
|
|
|
|
-- step 3 (die)
|
|
|
|
minetest.register_on_death(function()
|
2022-02-19 19:41:17 +01:00
|
|
|
minetest.log("action", "[rumble] instant 0 0")
|
2022-02-25 00:55:51 +01:00
|
|
|
end)
|
|
|
|
|
|
|
|
-- step 4 (disconnect)
|
|
|
|
minetest.register_on_shutdown(function()
|
|
|
|
minetest.log("action", "[rumble] instant 0 0")
|
|
|
|
end)
|
2022-02-25 20:58:58 +01:00
|
|
|
|
|
|
|
-- step 5 (commands)
|
|
|
|
minetest.register_chatcommand("strength", {
|
|
|
|
description = "set max rumble strength (between 0 and 1)",
|
|
|
|
func = function(text)
|
2022-02-25 21:55:03 +01:00
|
|
|
if (string.match((text), "^%d+$")) then
|
|
|
|
rumble_strength_max = (text)
|
|
|
|
minetest.display_chat_message("max rumble strength set to "..rumble_strength_max)
|
|
|
|
else
|
|
|
|
minetest.display_chat_message(minetest.colorize("#FF0", "error: value after .strength should be a positive number"))
|
|
|
|
end
|
2022-02-25 20:58:58 +01:00
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_chatcommand("duration", {
|
|
|
|
description = "set max rumble duration (in seconds)",
|
|
|
|
func = function(text)
|
2022-02-25 21:55:03 +01:00
|
|
|
if (string.match((text), "^%d+$")) then
|
|
|
|
rumble_duration_max = (text)
|
|
|
|
minetest.display_chat_message("max rumble duration set to "..rumble_duration_max)
|
|
|
|
else
|
|
|
|
minetest.display_chat_message(minetest.colorize("#FF0", "error: value after .duration should be a positive number"))
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_chatcommand("settings", {
|
|
|
|
description = "shows current values of settings",
|
|
|
|
func = function()
|
|
|
|
minetest.display_chat_message("max rumble strength: "..rumble_strength_max)
|
|
|
|
minetest.display_chat_message("max rumble duration: "..rumble_duration_max)
|
2022-02-25 20:58:58 +01:00
|
|
|
end,
|
|
|
|
})
|