From a56384fea717a541de1733d1f01ef22ae8282b3b Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Tue, 23 May 2023 14:48:13 +0100 Subject: [PATCH] add pova effects to lb --- README.md | 2 +- depends.txt | 1 + lb_special.lua | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++ mod.conf | 2 +- 4 files changed, 57 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 52727c6..9b95121 100644 --- a/README.md +++ b/README.md @@ -30,4 +30,4 @@ Changelog: - 1.5 - Filled chests can now add tools with custom wear levels, code tidy and tweaks - 1.6 - Add support for mineclone2 game, tweak and tidy code, add new screenshot -Lucky Blocks: 266 (depending on mods enabled) +Lucky Blocks: 268 (depending on mods enabled) diff --git a/depends.txt b/depends.txt index 9691d97..dc30314 100644 --- a/depends.txt +++ b/depends.txt @@ -4,3 +4,4 @@ screwdriver? intllib? mcl_core? mcl_sounds? +pova? diff --git a/lb_special.lua b/lb_special.lua index 7cc7c50..dd539bb 100644 --- a/lb_special.lua +++ b/lb_special.lua @@ -397,3 +397,57 @@ if lucky_block.mod_def then }} }) end + + +-- pova mod effects +if minetest.get_modpath("pova") then + + -- slowmo effect + local function slowmo(pos, player, def) + + local name = player:get_player_name() + + minetest.chat_send_player(name, + lucky_block.green .. S("You suddenly feel sluggish, take 30 seconds!")) + + pova.add_override(name, "lb_sluggish", {speed = -0.9}) + pova.do_override(player) + + minetest.after(30, function(player) + + local name = player:get_player_name() + + if name then + pova.del_override(name, "lb_sluggish") + pova.do_override(player) + end + end, player) + end + + -- high jump effect + local function highfly(pos, player, def) + + local name = player:get_player_name() + + minetest.chat_send_player(name, + lucky_block.green .. S("You suddenly feel lighter, wait 30 seconds!")) + + pova.add_override(name, "lb_lighter", {jump = 4}) + pova.do_override(player) + + minetest.after(30, function(player) + + local name = player:get_player_name() + + if name then + pova.del_override(name, "lb_lighter") + pova.do_override(player) + end + end, player) + end + + lucky_block:add_blocks({ + {"cus", slowmo}, + {"cus", highfly} + }) +end diff --git a/mod.conf b/mod.conf index 2dc7207..6f2ee87 100644 --- a/mod.conf +++ b/mod.conf @@ -1,4 +1,4 @@ name = lucky_block depends = -optional_depends = default, mcl_core, mcl_sounds, tnt, screwdriver, intllib +optional_depends = default, mcl_core, mcl_sounds, tnt, screwdriver, intllib, pova description = Adds lucky blocks into the game which may give good, bad, hurtful items when open :)