diff --git a/mods/other/playerplus/depends.txt b/mods/other/playerplus/depends.txt deleted file mode 100644 index b5f672e..0000000 --- a/mods/other/playerplus/depends.txt +++ /dev/null @@ -1,4 +0,0 @@ -default? -3d_armor? -player_monoids? -pova? diff --git a/mods/other/playerplus/init.lua b/mods/other/playerplus/init.lua index 779b112..1d823cc 100644 --- a/mods/other/playerplus/init.lua +++ b/mods/other/playerplus/init.lua @@ -13,10 +13,6 @@ playerplus = {} -- detect minetest 5.0 local mt50 = minetest.registered_nodes["default:permafrost"] --- cache if player_monoids mod active? -local monoids = minetest.get_modpath("player_monoids") -local pova_mod = minetest.get_modpath("pova") - -- get node but use fallback for nil or unknown local node_ok = function(pos, fallback) @@ -32,7 +28,6 @@ local node_ok = function(pos, fallback) end -local armor_mod = minetest.get_modpath("3d_armor") local time = 0 @@ -85,16 +80,6 @@ if name and playerplus[name] then playerplus[name].nod_feet = node_ok({ x = pos.x, y = pos.y + 0.2, z = pos.z}) - -- get player physics - def = player:get_physics_override() - - if armor_mod and armor and armor.def then - -- get player physics from armor - def.speed = armor.def[name].speed or def.speed - def.jump = armor.def[name].jump or def.jump - def.gravity = armor.def[name].gravity or def.gravity - end - -- are we standing on any nodes that speed player up? nfast = nil if playerplus[name].nod_stand == "default:ice" then @@ -110,78 +95,33 @@ if name and playerplus[name] then -- apply speed changes if nfast and not playerplus[name].nfast then - if monoids then - playerplus[name].nfast = player_monoids.speed:add_change( - player, def.speed + 0.4) - elseif pova_mod then - pova.add_override(name, "playerplus:nfast", {speed = 0.4}) - pova.do_override(player) - else - def.speed = def.speed + 0.4 - end + physics.set(name, "playerplus:nfast", {speed = 1.2}) playerplus[name].nfast = true elseif not nfast and playerplus[name].nfast then - if monoids then - player_monoids.speed:del_change(player, playerplus[name].nfast) - playerplus[name].nfast = nil - elseif pova_mod then - pova.del_override(name, "playerplus:nfast") - pova.do_override(player) - else - def.speed = def.speed - 0.4 - end + physics.remove(name, "playerplus:nfast") playerplus[name].nfast = nil end -- apply slowdown changes if nslow and not playerplus[name].nslow then - if monoids then - playerplus[name].nslow = player_monoids.speed:add_change( - player, def.speed - 0.3) - elseif pova_mod then - pova.add_override(name, "playerplus:nslow", {speed = -0.3}) - pova.do_override(player) - else - def.speed = def.speed - 0.3 - end + physics.set(name, "playerplus:nslow", {speed = 0.85}) playerplus[name].nslow = true elseif not nslow and playerplus[name].nslow then - if monoids then - player_monoids.speed:del_change(player, playerplus[name].nslow) - playerplus[name].nslow = nil - elseif pova_mod then - pova.del_override(name, "playerplus:nslow") - pova.do_override(player) - else - def.speed = def.speed + 0.3 - end + physics.remove(name, "playerplus:nslow") playerplus[name].nslow = nil end - -- set player physics - if not monoids and not pova_mod then - - player:set_physics_override({ - speed = def.speed, - jump = def.jump, - gravity = def.gravity - }) - end ---[[ - print ("Speed: " .. def.speed - .. " / Jump: " .. def.jump - .. " / Gravity: " .. def.gravity) -]] -- Is player suffocating inside a normal node without no_clip privs? local ndef = minetest.registered_nodes[playerplus[name].nod_head] - if ndef.walkable == true + if not ctf_match.is_in_build_time() + and ndef.walkable == true and ndef.drowning == 0 and ndef.damage_per_second <= 0 and ndef.groups.disable_suffocation ~= 1 @@ -253,6 +193,14 @@ if minetest.settings:get_bool("player_knockback") == true then local punchy = function( player, hitter, time_from_last_punch, tool_capabilities, dir, damage) + -- disable knockback during build time + if ctf_match.is_in_build_time() then return end + + -- check if player and hitter are in the same team + if ctf.player(player:get_player_name()).team == ctf.player(hitter:get_player_name()).team then + return + end + if not dir then return end -- check if player has 'no_knockback' privelage @@ -281,6 +229,16 @@ local punchy = function( end damage = damage + (tool_capabilities.damage_groups[group] or 0) * tmp + + -- limit knockback + if damage > 8 then + damage = 8 + end + end + + -- disable knockback for swords + if tool_capabilities.damage_groups["sword"] then + damage = 0 end -- check for knockback value diff --git a/mods/other/playerplus/mod.conf b/mods/other/playerplus/mod.conf index 60ad6fb..bf8c979 100644 --- a/mods/other/playerplus/mod.conf +++ b/mods/other/playerplus/mod.conf @@ -1,4 +1,4 @@ name = playerplus -depends = -optional_depends = default, 3d_armor, player_monoids, pova +depends = ctf_match, physics, ctf +optional_depends = default description = Add speed effects, suffocation and cactus damage to players.