Compare commits
1 Commits
master
...
add-settin
Author | SHA1 | Date |
---|---|---|
Li0n | 73789dd741 |
28
init.lua
28
init.lua
|
@ -12,16 +12,23 @@
|
|||
-- 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_standard = minetest.settings:get("rumble_strength_max_setting")
|
||||
local rumble_duration_max_standard = minetest.settings:get("rumble_duration_max_setting")
|
||||
local rumble_duration_max
|
||||
local rumble_strength_max
|
||||
|
||||
|
||||
-- step 1 (start)
|
||||
minetest.register_on_mods_loaded(function()
|
||||
minetest.display_chat_message("rumble mod loaded. May the rumble be with you!")
|
||||
rumble_duration_max = rumble_strength_max_standard
|
||||
rumble_strength_max = rumble_duration_max_standard
|
||||
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)
|
||||
|
@ -36,3 +43,20 @@ end)
|
|||
minetest.register_on_shutdown(function()
|
||||
minetest.log("action", "[rumble] instant 0 0")
|
||||
end)
|
||||
|
||||
-- step 5 (commands)
|
||||
minetest.register_chatcommand("set_strength_max", {
|
||||
description = "set max rumble strength (between 0 and 1)",
|
||||
func = function(text)
|
||||
rumble_strength_max = (text)
|
||||
minetest.display_chat_message(rumble_strength_max)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("set_duration_max", {
|
||||
description = "set max rumble duration (in seconds)",
|
||||
func = function(text)
|
||||
rumble_duration_max = (text)
|
||||
minetest.display_chat_message(rumble_duration_max)
|
||||
end,
|
||||
})
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
# Sets the max rumble strength. 0 is off and 1 is full strength.
|
||||
rumble_strength_max_setting (max rumble strength) int 0 0.5 1
|
||||
|
||||
# Sets the max rumble duration in seconds.
|
||||
rumble_strength_max_setting (max rumble strength) int 0 5
|
Loading…
Reference in New Issue