forked from mtcontrib/hangglider
Fix mixed spaces+tabs
This commit is contained in:
parent
e923729c9c
commit
cd48ef801f
46
init.lua
46
init.lua
|
@ -125,27 +125,27 @@ local function apply_physics_override(player, overrides)
|
||||||
if overrides.gravity and overrides.gravity < 0 then
|
if overrides.gravity and overrides.gravity < 0 then
|
||||||
overrides.gravity = 0
|
overrides.gravity = 0
|
||||||
end
|
end
|
||||||
if has_player_monoids then
|
if has_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")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
player:set_physics_override(overrides)
|
player:set_physics_override(overrides)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function remove_physics_override(player, overrides)
|
local function remove_physics_override(player, overrides)
|
||||||
for _, attr in pairs(physics_attrs) do
|
for _, attr in pairs(physics_attrs) do
|
||||||
if overrides[attr] then
|
if overrides[attr] then
|
||||||
if has_player_monoids then
|
if has_player_monoids then
|
||||||
player_monoids[attr]:del_change(player, "hangglider:glider")
|
player_monoids[attr]:del_change(player, "hangglider:glider")
|
||||||
else
|
else
|
||||||
player:set_physics_override({[attr] = 1})
|
player:set_physics_override({[attr] = 1})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local step_v
|
local step_v
|
||||||
|
@ -186,19 +186,19 @@ minetest.register_entity("hangglider:glider", {
|
||||||
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
|
||||||
hangglider.shot_sound(pos)
|
hangglider.shot_sound(pos)
|
||||||
minetest.chat_send_player(pname, "Protected area! You will be shot down in " ..
|
minetest.chat_send_player(pname, "Protected area! You will be shot down in " ..
|
||||||
warning_time .. " seconds by anti-aircraft guns!")
|
warning_time .. " seconds by anti-aircraft guns!")
|
||||||
end
|
end
|
||||||
self.warned = self.warned + dtime
|
self.warned = self.warned + dtime
|
||||||
if self.warned > warning_time then -- shoot down
|
if self.warned > warning_time then -- shoot down
|
||||||
player:set_hp(1)
|
player:set_hp(1)
|
||||||
player:get_inventory():remove_item("main", ItemStack("hangglider:hangglider"))
|
player:get_inventory():remove_item("main", ItemStack("hangglider:hangglider"))
|
||||||
hangglider.shot_sound(pos)
|
hangglider.shot_sound(pos)
|
||||||
canExist = false
|
canExist = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not canExist then
|
if not canExist then
|
||||||
remove_physics_override(player, {gravity = 1, jump = 1, speed = 1})
|
remove_physics_override(player, {gravity = 1, jump = 1, speed = 1})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user