Compare commits

...

20 Commits

Author SHA1 Message Date
Li0n_2 1893a07d10 rename python script to shorter name 2022-08-20 18:13:26 +00:00
Li0n 48cb3b6085 remove unused code and fix some nil error 2022-04-20 20:58:59 +02:00
Li0n 974944704f add some todos, remove superfluous text 2022-02-27 16:48:43 +01:00
Li0n 34b3f58d86 add chat trigger, rename variables to be more descriptive, add more todos 2022-02-27 16:25:30 +01:00
Li0n 451861643a add chatmode/notification rumble 2022-02-26 18:47:57 +01:00
Li0n 8f13ab0792 add chat trigger 2022-02-26 18:09:59 +01:00
Li0n 4c5a76f3e5 simplify pattern matching for numbers 2022-02-26 17:46:52 +01:00
Li0n fc27be1729 fix crash (log nil value) 2022-02-26 16:26:30 +01:00
Li0n 2c25edd378 change python script location 2022-02-26 14:57:08 +01:00
Li0n 4d0e6a8091 remove item from todo list 2022-02-26 00:07:02 +01:00
Li0n 68fbc6024f add feedback to log commands and settings workaround 2022-02-26 00:05:45 +01:00
Li0n 7035c9fb8f fix crash 2022-02-25 23:52:36 +01:00
Li0n 5a0d4f4810 list commands in code for readability 2022-02-25 23:51:15 +01:00
Li0n 3b409de2fa move some local values 2022-02-25 23:46:39 +01:00
Li0n 2709bd0041 add stop and resume command 2022-02-25 23:30:34 +01:00
Li0n 8b497cbeaa make chat logs configurable through commands 2022-02-25 23:15:47 +01:00
Li0n 9f45d53a07 allow decimal numbers in validation process 2022-02-25 22:30:48 +01:00
Li0n cef9f69717 validate settings input strings 2022-02-25 21:55:03 +01:00
Li0n 0c54e58cbc fix conflict from previous commit 2022-02-25 21:00:43 +01:00
Li0n 2645103d73 add settings and commands for max duration and strength 2022-02-25 20:58:58 +01:00
3 changed files with 179 additions and 20 deletions

View File

@ -23,15 +23,13 @@ Type .help all in chat to see what you can do!
installation instructions for the external programs that are intended to be used with this clientside mod:
1) move the minetest_intiface.py file into your minetest directory. this should be in the same directory that has debug.txt in it.
1) make sure you have python 3 installed. for windows users I recommend installing it through the microsoft store: https://www.microsoft.com/store/productId/9PJPW5LDXLZ5
2) make sure you have python 3 installed. for windows users I recommend installing it through the microsoft store: https://www.microsoft.com/store/productId/9PJPW5LDXLZ5
2) open a command prompt.
3) open a command prompt.
3) type "pip install buttplug", press enter, and wait. this will install the buttplug library needed to run this program.
4) type "pip install buttplug", press enter, and wait. this will install the buttplug library needed to run this program.
5) make sure you have Intiface installed to connect to your favourite rumble device. you can install it from here: https://intiface.com/desktop
4) make sure you have Intiface installed to connect to your favourite rumble device. you can install it from here: https://intiface.com/desktop
--------------
@ -41,7 +39,7 @@ How to run the programs as intended:
2) open a command prompt.
3) in the command prompt, navigate to the directory that has the minetest_intiface.py file in it. if you've never used a command line before I recommend asking a friend or google how to do this.
3) in the command prompt, navigate to the directory that has the minetest_intiface.py file in it. this should be in the rumble mod. if you've never used a command line before I recommend asking a friend or google how to do this.
3) type "python3 minetest_intiface.py" and press enter to start running the python code from the minetest directory.

185
init.lua
View File

@ -1,38 +1,199 @@
-- rumble - Client side mod for Minetest
-- Scripted by: Li0n
-- configureable settings:
local rumble_strength_max_standard = 0.5
local rumble_duration_max_standard = 5
-- To do list:
-- max rumble strength setting
-- stop on disconnect
-- 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)
-- log player name only once, after player is initialized.
-- editable table of words to trigger notification rumble
-- command to choose a word/name that triggers notification rumble
-- notification mode: trigger rumble from specific words written by either yourself or others
-- condense on/off commands into single commands. eg .chatlog on and .chatlog off instead of .chatlog_on and .chatlog_off
-- make a GUI for all the settings
-- make a section in the code where all default settings can be changed
local rumble_strength_max = rumble_strength_max_standard
local rumble_duration_max = rumble_duration_max_standard
local log
local log_mode
local local_player_name
local notification_mode
local chat_trigger
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
local no_log_no_chat = function(text)
end
-- step 1 (start)
minetest.register_on_mods_loaded(function()
minetest.display_chat_message("rumble mod loaded. May the rumble be with you!")
log = log_and_chat
log_mode = "log and chat"
end)
-- step 2 (take damage)
minetest.register_on_damage_taken(function(hp)
local rumble_strength_max = 0.5
local rumble_strength = math.min( hp/20, rumble_strength_max )
local rumble_duration_max = 5
local rumble_duration = math.min( hp, rumble_duration_max )
minetest.log("action", "[rumble] ".."queue "..rumble_strength.." "..rumble_duration)
minetest.display_chat_message("[rumble] ".."queue "..rumble_strength.." "..rumble_duration)
log("[rumble] ".."queue "..rumble_strength.." "..rumble_duration)
end)
-- step 3 (die)
minetest.register_on_death(function()
minetest.log("action", "[rumble] instant 0 0")
log("[rumble] instant 0 0")
end)
-- step 4 (disconnect)
minetest.register_on_shutdown(function()
minetest.log("action", "[rumble] instant 0 0")
log("[rumble] instant 0 0")
end)
-- step 5 (chat mode)
minetest.register_on_receiving_chat_message(function(message)
if notification_mode == true and (string.match((message), "^.*<.*>.*$")) and minetest.localplayer ~= nil then
local_player_name = minetest.localplayer:get_name(self)
if not (string.match((message), "^.*"..local_player_name..".*$")) then
if chat_trigger == nil then
log("[rumble] queue 0.2 5")
else
if (string.match((message), "^.*"..chat_trigger..".*$")) then
log("[rumble] queue 0.2 5")
end
end
end
end
end)
-- step 6 (item use test and node place tests)
--minetest.register_on_item_use(function(itemstack, pointed_thing)
-- log("itemstack: "..tostring(itemstack))
-- log("pointed thing: "..dump(pointed_thing))
--end)
-- step 7 (commands)
-- command 1
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)
minetest.display_chat_message("current chat and log mode: "..log_mode)
minetest.display_chat_message("local player name: "..tostring(local_player_name))
if notification_mode == true then
minetest.display_chat_message("notification mode: on")
elseif notification_mode == false then
minetest.display_chat_message("notification mode: off")
end
minetest.display_chat_message("chat trigger: "..tostring(chat_trigger))
end,
})
-- command 2
minetest.register_chatcommand("strength", {
description = "set max rumble strength (from 0 to 1)",
func = function(text)
if (string.match((text), "^%d+%.?%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
end,
})
-- command 3
minetest.register_chatcommand("duration", {
description = "set max rumble duration (in seconds)",
func = function(text)
if (string.match((text), "^%d+%.?%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,
})
-- command 4
minetest.register_chatcommand("chatlog_off", {
description = "disables rumble logs being written into chat",
func = function()
log = log_only
log_mode = "log only"
minetest.display_chat_message("rumble chat turned off")
end,
})
-- command 5
minetest.register_chatcommand("chatlog_on", {
description = "enables rumble logs being written into chat",
func = function()
log = log_and_chat
log_mode = "log and chat"
minetest.display_chat_message("rumble chat turned on")
end,
})
-- command 6
minetest.register_chatcommand("stop", {
description = "pauses logging",
func = function()
log = no_log_no_chat
log_mode = "no log no chat"
minetest.display_chat_message("rumble logging paused")
end,
})
-- command 7
minetest.register_chatcommand("resume", {
description = "resumes the rumble program",
func = function()
log = log_only
log_mode = "log only"
minetest.display_chat_message("rumble logging resumed")
end,
})
-- command 8
minetest.register_chatcommand("notifications_on", {
description = "turns on notification mode: triggers rumble for every received message",
func = function()
notification_mode = true
minetest.display_chat_message("notification mode: on")
end,
})
-- command 9
minetest.register_chatcommand("notifications_off", {
description = "turns off notification mode: does not trigger rumble for received messages",
func = function()
notification_mode = false
minetest.display_chat_message("notification mode: off")
end,
})
-- command 10
minetest.register_chatcommand("chat_trigger", {
description = "if set, will only trigger notification rumbles for a specific word or name typed after the command",
func = function(text)
chat_trigger = text
minetest.display_chat_message("notification trigger: "..tostring(chat_trigger))
end,
})

View File

@ -41,7 +41,7 @@ async def device_added_task(dev: ButtplugClientDevice):
time.sleep(sleep_sec)
with open("debug.txt", 'r') as file:
with open("../../debug.txt", 'r') as file:
for line in follow(file):
pattern = '^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}: ACTION\[Main\]: \[rumble\] (queue|instant) \d+(.\d+)? \d+(.\d+)?$'
if match(pattern, line) is None: