completely rewrite mod
This commit is contained in:
parent
fff53836d2
commit
9add103ea1
70
init.lua
70
init.lua
|
@ -1,77 +1,21 @@
|
|||
-- rumble - Client side mod for Minetest
|
||||
-- Scripted by: Li0n
|
||||
|
||||
local modname = minetest.get_current_modname()
|
||||
local damage_taken = "["..modname.."]".." damage_taken "
|
||||
local player_died = "["..modname.."]".." player_died"
|
||||
local local_hp_change = "["..modname.."]".." hp_change "
|
||||
local tnt_explode = "["..modname.."]".." tnt_explode "
|
||||
-- local rightclick =
|
||||
-- todo add max rumble strength setting
|
||||
|
||||
-- step 1 (start)
|
||||
minetest.register_on_mods_loaded(function()
|
||||
minetest.display_chat_message(modname.." mod loaded. May the rumble be with you!")
|
||||
return false
|
||||
end)
|
||||
|
||||
-- step 2 (get hurt)
|
||||
-- step 2 (take damage)
|
||||
minetest.register_on_damage_taken(function(hp)
|
||||
minetest.display_chat_message(damage_taken..tostring(hp))
|
||||
minetest.log("action", damage_taken..tostring(hp))
|
||||
return false
|
||||
local rumble_strength = hp/20
|
||||
local rumble_duration = hp
|
||||
minetest.log("action", "[rumble] ".."queue ".."..rumble_strength.." "..rumble_duration)
|
||||
end)
|
||||
|
||||
-- step 3 (die)
|
||||
minetest.register_on_death(function()
|
||||
minetest.display_chat_message(player_died)
|
||||
minetest.log("action", player_died)
|
||||
return false
|
||||
end)
|
||||
|
||||
-- step 4 (track hp level)
|
||||
minetest.register_on_hp_modification(function(hp)
|
||||
minetest.display_chat_message(local_hp_change..tostring(hp))
|
||||
minetest.log("action", local_hp_change..tostring(hp))
|
||||
return false
|
||||
end)
|
||||
|
||||
-- step 5 (griefer mode)
|
||||
-- minetest.register_on_item_use(function(item, pointed_thing)
|
||||
-- minetest.display_chat_message(tnt_explode..dump2(item)..dump2(pointed_thing))
|
||||
-- minetest.log("action", tnt_explode..dump2(item)..dump2(pointed_thing))
|
||||
-- return false
|
||||
-- end)
|
||||
|
||||
-- minetest.register_on_receiving_chat_message(function(message))`
|
||||
-- * Called always when a client receive a message
|
||||
-- * Return `true` to mark the message as handled, which means that it will not be shown to chat
|
||||
|
||||
-- * `minetest.register_on_dignode(function(pos, node))`
|
||||
-- * Called when the local player digs a node
|
||||
-- * Newest functions are called first
|
||||
-- * If any function returns true, the node isn't dug
|
||||
|
||||
-- * `minetest.register_on_placenode(function(pointed_thing, node))`
|
||||
-- * Called when a node has been placed
|
||||
|
||||
-- * `minetest.register_on_item_use(function(item, pointed_thing))`
|
||||
-- * Called when the local player uses an item.
|
||||
-- * Newest functions are called first.
|
||||
-- * If any function returns true, the item use is not sent to server.
|
||||
|
||||
-- * `minetest.after(time, func, ...)`
|
||||
-- * Call the function `func` after `time` seconds, may be fractional
|
||||
-- * Optional: Variable number of arguments that are passed to `func`
|
||||
-- * `minetest.get_us_time()`
|
||||
-- * Returns time with microsecond precision. May not return wall time.
|
||||
-- * `minetest.get_timeofday()`
|
||||
-- * Returns the time of day: `0` for midnight, `0.5` for midday
|
||||
|
||||
-- * `minetest.get_player_names()`
|
||||
-- * Returns list of player names on server (nil if CSM_RF_READ_PLAYERINFO is enabled by server)
|
||||
|
||||
-- * `minetest.register_on_shutdown(function())`
|
||||
-- * Called before client shutdown
|
||||
-- * **Warning**: If the client terminates abnormally (i.e. crashes), the registered
|
||||
-- callbacks **will likely not be run**. Data should be saved at
|
||||
-- semi-frequent intervals as well as on server shutdown.
|
||||
minetest.log("action", "[rumble] instant 0 0")
|
||||
end)
|
Loading…
Reference in New Issue