* partially fixes #1

* remove support for "minetestmd" and "wardzones"
This commit is contained in:
Niklp 2022-07-04 21:48:01 +02:00 committed by GitHub
parent bbde71805a
commit cd67eb2d19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 36 deletions

View File

@ -127,34 +127,8 @@ if minetest.global_exists("areas") then
}) })
end 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) hangglider.can_fly = function (pname, pos)
-- Checks if the player will get shot down at the position -- 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 if areas and hangglider.flak then
local flak = false local flak = false
local owners = {} local owners = {}
@ -181,7 +155,7 @@ end
local physics_attrs = {"jump", "speed", "gravity"} local physics_attrs = {"jump", "speed", "gravity"}
local function apply_physics_override(player, overrides) 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 for _, attr in pairs(physics_attrs) do
if overrides[attr] then if overrides[attr] then
player_monoids[attr]:add_change(player, overrides[attr], "hangglider:glider") 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 if not (mrn_name.walkable or mrn_name.liquidtype ~= "none") then
canExist = true canExist = true
if not minetestd then
step_v = player:get_velocity().y step_v = player:get_velocity().y
if step_v < 0 and step_v > -3 then if step_v < 0 and step_v > -3 then
apply_physics_override(player, {speed=math.abs(step_v/2) + 0.75}) apply_physics_override(player, {speed=math.abs(step_v/2) + 0.75})
@ -243,7 +216,6 @@ minetest.register_entity("hangglider:glider", {
end end
end end
end end
end
if not hangglider.can_fly(pname,pos) then if not hangglider.can_fly(pname,pos) then
if not self.warned then -- warning shot if not self.warned then -- warning shot
self.warned = 0 self.warned = 0
@ -260,12 +232,7 @@ minetest.register_entity("hangglider:glider", {
end end
if not canExist then if not canExist then
if not minetestd then remove_physics_override(player, { gravity=1, jump = 1, speed = 1,})
remove_physics_override(player, {
gravity=1,
jump = 1,
speed = 1,})
end
hangglider.use[pname] = false hangglider.use[pname] = false
if HUD_Overlay then if HUD_Overlay then
player:hud_change(hangglider.id[pname], "text", "blank.png") player:hud_change(hangglider.id[pname], "text", "blank.png")

View File

@ -1,4 +1,4 @@
name = hangglider name = hangglider
depends = default, wool depends = default, wool
optional_depends = minetest_systemd, areas, player_monoids optional_depends = areas, player_monoids
min_minetest_version = 5.0 min_minetest_version = 5.0