Clean up some whitespace

This commit is contained in:
Jordan Irwin 2019-03-03 21:33:49 -08:00
parent 37758517ea
commit c30697805b

View File

@ -35,7 +35,7 @@
-- Reduced airbreak penalty severity -- Reduced airbreak penalty severity
-- gave glider limited durability. -- gave glider limited durability.
-- Improved gravity adjustment function. -- Improved gravity adjustment function.
-- Changed airbreaking process -- Changed airbreaking process
-- Removed airbreak penalty, as any 'advantage' seems minimal after new adjustments -- Removed airbreak penalty, as any 'advantage' seems minimal after new adjustments
-- Removed airbreak until minetest devs are smart enough to implement better serverside players. -- Removed airbreak until minetest devs are smart enough to implement better serverside players.
-- Simplified liquid check. -- Simplified liquid check.
@ -77,7 +77,7 @@ minetest.register_entity("hangglider:airstopper", { --A one-instant entity that
if player:is_player() then if player:is_player() then
local pname = player:get_player_name() local pname = player:get_player_name()
canExist = true canExist = true
if player:get_player_velocity().y < 0.5 and player:get_player_velocity().y > -0.5 then if player:get_player_velocity().y < 0.5 and player:get_player_velocity().y > -0.5 then
--Let go when the player actually stops, as that's the whole point. --Let go when the player actually stops, as that's the whole point.
if hangglider.use[pname] then if hangglider.use[pname] then
if moveModelUp then if moveModelUp then
@ -110,7 +110,7 @@ if areas then
if not id then if not id then
return false, "Invalid usage, see /help area_flak." return false, "Invalid usage, see /help area_flak."
end end
if not areas:isAreaOwner(id, name) then if not areas:isAreaOwner(id, name) then
return false, "Area "..id.." does not exist" return false, "Area "..id.." does not exist"
.." or is not owned by you." .." or is not owned by you."
@ -125,9 +125,9 @@ if areas then
end end
if minetestd and minetestd.services.physicsctl.enabled then if minetestd and minetestd.services.physicsctl.enabled then
minetestd.physicsctl.register_physics_effect("hangglider", minetestd.physicsctl.register_physics_effect("hangglider",
function(player) -- check function(player) -- check
return hangglider.use[player:get_player_name()] return hangglider.use[player:get_player_name()]
end, end,
function(phys, player) -- blend function(phys, player) -- blend
local vel_y = player:get_player_velocity().y local vel_y = player:get_player_velocity().y
@ -152,8 +152,8 @@ hangglider.can_fly = function (pname, pos)
return (minetest.check_player_privs(pname, {protection_bypass=true}) or wardzones.checkPlayerZoneAccess(pname, zone) or not zone["data"]["no_fly"]) return (minetest.check_player_privs(pname, {protection_bypass=true}) or wardzones.checkPlayerZoneAccess(pname, zone) or not zone["data"]["no_fly"])
end end
end end
if areas and minetest.is_protected(vector.round(pos), pname) then if areas and minetest.is_protected(vector.round(pos), pname) then
if hangglider.flak then if hangglider.flak then
for id, area in pairs(areas:getAreasAtPos(pos)) do for id, area in pairs(areas:getAreasAtPos(pos)) do
if area.flak then if area.flak then
return false return false
@ -218,7 +218,7 @@ minetest.register_entity("hangglider:glider", {
if mrn_name then if mrn_name then
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 if not minetestd then
step_v = player:get_player_velocity().y step_v = player:get_player_velocity().y
if step_v < 0 and step_v > -3 then if step_v < 0 and step_v > -3 then
@ -233,7 +233,7 @@ minetest.register_entity("hangglider:glider", {
end end
--[[local vel = player:get_player_velocity() --[[local vel = player:get_player_velocity()
if debug then player:hud_change(hangglider.debug[pname].id, "text", vel.y..', '..grav..', '..tostring(hangglider.airbreak[pname])) end if debug then player:hud_change(hangglider.debug[pname].id, "text", vel.y..', '..grav..', '..tostring(hangglider.airbreak[pname])) end
player:set_physics_override({gravity = (vel.y + 2.0)/20}) player:set_physics_override({gravity = (vel.y + 2.0)/20})
]]end ]]end
end end
@ -253,7 +253,7 @@ minetest.register_entity("hangglider:glider", {
end end
end end
if not canExist then if not canExist then
if not minetestd then if not minetestd then
remove_physics_override(player, { remove_physics_override(player, {
gravity=1, gravity=1,
@ -268,9 +268,9 @@ minetest.register_entity("hangglider:glider", {
end end
end end
end end
if not canExist then if not canExist then
self.object:set_detach() self.object:set_detach()
self.object:remove() self.object:remove()
end end
end end
}) })
@ -300,7 +300,7 @@ minetest.register_on_joinplayer(function(player)
alignment = {x=1, y=1}, alignment = {x=1, y=1},
offset = {x=0, y=0} offset = {x=0, y=0}
}) end }) end
if debug then if debug then
hangglider.debug[pname] = {id = player:hud_add({hud_elem_type = "text", hangglider.debug[pname] = {id = player:hud_add({hud_elem_type = "text",
position = {x=0.5, y=0.1}, position = {x=0.5, y=0.1},
text = "-", text = "-",
@ -344,7 +344,7 @@ minetest.register_tool("hangglider:hangglider", {
player:set_attach( stopper, "", {x=0,y=0,z=0}, {x=0,y=0,z=0}) player:set_attach( stopper, "", {x=0,y=0,z=0}, {x=0,y=0,z=0})
end, stopper, player) end, stopper, player)
end]] end]]
if not airbreak then if not airbreak then
if moveModelUp then if moveModelUp then
minetest.add_entity(pos, "hangglider:glider"):set_attach(player, "", {x=0,y=10,z=0}, {x=0,y=0,z=0}) minetest.add_entity(pos, "hangglider:glider"):set_attach(player, "", {x=0,y=10,z=0}, {x=0,y=0,z=0})
else else
@ -354,7 +354,7 @@ minetest.register_tool("hangglider:hangglider", {
hangglider.use[pname] = true hangglider.use[pname] = true
apply_physics_override(player, {jump = 0}) apply_physics_override(player, {jump = 0})
-- if minetest 0.4.x use this: -- if minetest 0.4.x use this:
-- if minetest 5.x use this: -- if minetest 5.x use this:
-- minetest.add_entity(player:get_pos(), "hangglider:glider"):set_attach(player, "", {x=0,y=10,z=0}, {x=0,y=0,z=0}) -- minetest.add_entity(player:get_pos(), "hangglider:glider"):set_attach(player, "", {x=0,y=10,z=0}, {x=0,y=0,z=0})
itemstack:set_wear(itemstack:get_wear() + 255) itemstack:set_wear(itemstack:get_wear() + 255)