Add comments to examples.lua

This commit is contained in:
Wuzzy 2014-07-13 21:19:02 +02:00
parent 58af48a055
commit 3385987106

View File

@ -1,5 +1,6 @@
----- EXAMPLE EFFECT TYPES ----- ----- EXAMPLE EFFECT TYPES -----
-- Makes the user faster
playereffects.register_effect_type("high_speed", "High speed", nil, {"speed"}, playereffects.register_effect_type("high_speed", "High speed", nil, {"speed"},
function(player) function(player)
player:set_physics_override(4,nil,nil) player:set_physics_override(4,nil,nil)
@ -10,6 +11,8 @@ playereffects.register_effect_type("high_speed", "High speed", nil, {"speed"},
player:set_physics_override(1,nil,nil) player:set_physics_override(1,nil,nil)
end end
) )
-- Slows the user down
playereffects.register_effect_type("low_speed", "Low speed", nil, {"speed"}, playereffects.register_effect_type("low_speed", "Low speed", nil, {"speed"},
function(player) function(player)
player:set_physics_override(0.25,nil,nil) player:set_physics_override(0.25,nil,nil)
@ -20,6 +23,8 @@ playereffects.register_effect_type("low_speed", "Low speed", nil, {"speed"},
player:set_physics_override(1,nil,nil) player:set_physics_override(1,nil,nil)
end end
) )
-- Increases the jump height
playereffects.register_effect_type("highjump", "Greater jump height", "playereffects_example_highjump.png", {"jump"}, playereffects.register_effect_type("highjump", "Greater jump height", "playereffects_example_highjump.png", {"jump"},
function(player) function(player)
player:set_physics_override(nil,2,nil) player:set_physics_override(nil,2,nil)
@ -29,6 +34,8 @@ playereffects.register_effect_type("highjump", "Greater jump height", "playereff
player:set_physics_override(nil,1,nil) player:set_physics_override(nil,1,nil)
end end
) )
-- Adds the “fly” privilege
playereffects.register_effect_type("fly", "Fly mode available", "playereffects_example_fly.png", {"fly"}, playereffects.register_effect_type("fly", "Fly mode available", "playereffects_example_fly.png", {"fly"},
function(player) function(player)
local playername = player:get_player_name() local playername = player:get_player_name()
@ -42,6 +49,8 @@ playereffects.register_effect_type("fly", "Fly mode available", "playereffects_e
minetest.set_player_privs(effect.playername, privs) minetest.set_player_privs(effect.playername, privs)
end end
) )
-- Dummy effect for the stree test
playereffects.register_effect_type("stress", "Stress Test Effect", nil, {}, playereffects.register_effect_type("stress", "Stress Test Effect", nil, {},
function(player) function(player)
end, end,
@ -50,6 +59,8 @@ playereffects.register_effect_type("stress", "Stress Test Effect", nil, {},
) )
------ Chat commands for the example effects ------
minetest.register_chatcommand("fast", { minetest.register_chatcommand("fast", {
params = "", params = "",
description = "Makes you fast for a short time.", description = "Makes you fast for a short time.",
@ -83,6 +94,9 @@ minetest.register_chatcommand("fly", {
playereffects.apply_effect_type("fly", 20, minetest.get_player_by_name(name)) playereffects.apply_effect_type("fly", 20, minetest.get_player_by_name(name))
end, end,
}) })
--[[ The stress test applies a shitload of effects at once.
This is used to test the performance of this mod at very large effect numbers. ]]
minetest.register_chatcommand("stresstest", { minetest.register_chatcommand("stresstest", {
params = "[<effects>]", params = "[<effects>]",
descriptions = "Start the stress test for Player Effects with <effects> effects.", descriptions = "Start the stress test for Player Effects with <effects> effects.",