forked from minetest-mods/player_monoids
Compare commits
No commits in common. "master" and "nalc-1.0" have entirely different histories.
|
@ -43,7 +43,6 @@ mymod.speed_monoid = player_monoids.make_monoid({
|
||||||
for _, speed in pairs(tab) do
|
for _, speed in pairs(tab) do
|
||||||
res = res * speed
|
res = res * speed
|
||||||
end
|
end
|
||||||
return res
|
|
||||||
end,
|
end,
|
||||||
identity = 1,
|
identity = 1,
|
||||||
apply = function(speed, player)
|
apply = function(speed, player)
|
||||||
|
@ -112,7 +111,6 @@ newmod.speed_boosts = player_monoids.make_monoid({
|
||||||
for _, speed in pairs(tab) do
|
for _, speed in pairs(tab) do
|
||||||
res = math.max(res, speed)
|
res = math.max(res, speed)
|
||||||
end
|
end
|
||||||
return res
|
|
||||||
end,
|
end,
|
||||||
identity = 1,
|
identity = 1,
|
||||||
apply = ???
|
apply = ???
|
||||||
|
|
2
description.txt
Normal file
2
description.txt
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
player_monoids is a library for managing global player state, such as physics
|
||||||
|
overrides or player visual size.
|
6
mod.conf
6
mod.conf
|
@ -1,5 +1 @@
|
||||||
name = player_monoids
|
name=player_monoids
|
||||||
description = """
|
|
||||||
A library for managing global player state,
|
|
||||||
such as physics overrides or player visual size.
|
|
||||||
"""
|
|
|
@ -63,6 +63,7 @@ player_monoids.jump = monoid({
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
-- Gravity monoid. Effect values are gravity multipliers.
|
-- Gravity monoid. Effect values are gravity multipliers.
|
||||||
player_monoids.gravity = monoid({
|
player_monoids.gravity = monoid({
|
||||||
combine = mult,
|
combine = mult,
|
||||||
|
@ -75,6 +76,7 @@ player_monoids.gravity = monoid({
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
-- Fly ability monoid. The values are booleans, which are combined by or. A true
|
-- Fly ability monoid. The values are booleans, which are combined by or. A true
|
||||||
-- value indicates having the ability to fly.
|
-- value indicates having the ability to fly.
|
||||||
player_monoids.fly = monoid({
|
player_monoids.fly = monoid({
|
||||||
|
@ -102,6 +104,7 @@ player_monoids.fly = monoid({
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
-- Noclip ability monoid. Works the same as fly monoid.
|
-- Noclip ability monoid. Works the same as fly monoid.
|
||||||
player_monoids.noclip = monoid({
|
player_monoids.noclip = monoid({
|
||||||
combine = function(p, q) return p or q end,
|
combine = function(p, q) return p or q end,
|
||||||
|
|
3
test.lua
3
test.lua
|
@ -4,7 +4,6 @@ local speed = player_monoids.speed
|
||||||
minetest.register_privilege("monoid_master", {
|
minetest.register_privilege("monoid_master", {
|
||||||
description = "Allows testing of player monoids.",
|
description = "Allows testing of player monoids.",
|
||||||
give_to_singleplayer = false,
|
give_to_singleplayer = false,
|
||||||
give_to_admin = true,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
local function test(player)
|
local function test(player)
|
||||||
|
@ -14,8 +13,6 @@ local function test(player)
|
||||||
minetest.chat_send_player(p_name, "Your speed is: " .. speed:value(player))
|
minetest.chat_send_player(p_name, "Your speed is: " .. speed:value(player))
|
||||||
|
|
||||||
minetest.after(3, function()
|
minetest.after(3, function()
|
||||||
local player = minetest.get_player_by_name(p_name)
|
|
||||||
if not player then return end
|
|
||||||
speed:del_change(player, ch_id)
|
speed:del_change(player, ch_id)
|
||||||
minetest.chat_send_player(p_name, "Your speed is: " .. speed:value(player))
|
minetest.chat_send_player(p_name, "Your speed is: " .. speed:value(player))
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user