Add support for Pova mod (#5)

This commit is contained in:
tenplus1 2023-07-28 20:01:55 +01:00 committed by GitHub
parent 7aad47076e
commit ad3a575257
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -1,4 +1,5 @@
local has_monoids = minetest.global_exists("player_monoids")
local has_pova = minetest.global_exists("pova")
local function freeze(player)
local player_name = player:get_player_name()
@ -6,6 +7,9 @@ local function freeze(player)
player_monoids.speed:add_change(player, 0, "cozy:speed")
player_monoids.jump:add_change(player, 0, "cozy:jump")
player_monoids.gravity:add_change(player, 0, "cozy:gravity")
elseif has_pova then
pova.add_override(player_name, "force", {speed = 0, jump = 0, gravity = 0})
pova.do_override(player)
else
player:set_physics_override({speed = 0, jump = 0, gravity = 0})
end
@ -18,6 +22,9 @@ local function unfreeze(player)
player_monoids.speed:del_change(player, "cozy:speed")
player_monoids.jump:del_change(player, "cozy:jump")
player_monoids.gravity:del_change(player, "cozy:gravity")
elseif has_pova then
pova.del_override(player_name, "force")
pova.do_override(player)
else
player:set_physics_override({speed = 1, jump = 1, gravity = 1})
end

View File

@ -1,4 +1,4 @@
name = cozy
depends = player_api
optional_depends = player_monoids
optional_depends = player_monoids, pova
description = Adds sitting down, and lying down player animations.