From cd67eb2d19aa8c3a7381c862228dc26b8e60d0bc Mon Sep 17 00:00:00 2001 From: Niklp <89982526+Niklp09@users.noreply.github.com> Date: Mon, 4 Jul 2022 21:48:01 +0200 Subject: [PATCH] fixes #1 (#5) * partially fixes #1 * remove support for "minetestmd" and "wardzones" --- init.lua | 37 ++----------------------------------- mod.conf | 2 +- 2 files changed, 3 insertions(+), 36 deletions(-) diff --git a/init.lua b/init.lua index bf90953..991863e 100644 --- a/init.lua +++ b/init.lua @@ -127,34 +127,8 @@ if minetest.global_exists("areas") then }) end -if minetest.global_exists("minetestd") and minetestd.services.physicsctl.enabled then -minetestd.physicsctl.register_physics_effect("hangglider", - function(player) -- check - return hangglider.use[player:get_player_name()] - end, - function(phys, player) -- blend - local vel_y = player:get_player_velocity().y - phys.gravity = phys.gravity*((vel_y + 3)/20) - if vel_y < 0 and vel_y > -3 then - phys.speed = (math.abs(vel_y/2) + 0.75) - elseif vel_y <= -3 then --Cap our gliding movement speed. - phys.speed = 2.25 - end - phys.jump = 0 - end, - 7 -- effect order -) -end - hangglider.can_fly = function (pname, pos) -- Checks if the player will get shot down at the position - if wardzones then - local zone = wardzones.getZone(pos) - if zone then - return (minetest.check_player_privs(pname, {protection_bypass=true}) or - wardzones.checkPlayerZoneAccess(pname, zone) or not zone["data"]["no_fly"]) - end - end if areas and hangglider.flak then local flak = false local owners = {} @@ -181,7 +155,7 @@ end local physics_attrs = {"jump", "speed", "gravity"} local function apply_physics_override(player, overrides) - if player_monoids then + if minetest.get_modpath("player_monoids") then for _, attr in pairs(physics_attrs) do if overrides[attr] then player_monoids[attr]:add_change(player, overrides[attr], "hangglider:glider") @@ -226,7 +200,6 @@ minetest.register_entity("hangglider:glider", { if not (mrn_name.walkable or mrn_name.liquidtype ~= "none") then canExist = true - if not minetestd then step_v = player:get_velocity().y if step_v < 0 and step_v > -3 then apply_physics_override(player, {speed=math.abs(step_v/2) + 0.75}) @@ -240,7 +213,6 @@ minetest.register_entity("hangglider:glider", { player:get_physics_override().gravity..', '..tostring(hangglider.airbreak[pname])) end apply_physics_override(player, {gravity=((step_v + 3)/20)}) - end end end end @@ -260,12 +232,7 @@ minetest.register_entity("hangglider:glider", { end if not canExist then - if not minetestd then - remove_physics_override(player, { - gravity=1, - jump = 1, - speed = 1,}) - end + remove_physics_override(player, { gravity=1, jump = 1, speed = 1,}) hangglider.use[pname] = false if HUD_Overlay then player:hud_change(hangglider.id[pname], "text", "blank.png") diff --git a/mod.conf b/mod.conf index caf2d3f..34c5994 100644 --- a/mod.conf +++ b/mod.conf @@ -1,4 +1,4 @@ name = hangglider depends = default, wool -optional_depends = minetest_systemd, areas, player_monoids +optional_depends = areas, player_monoids min_minetest_version = 5.0 \ No newline at end of file