various fixes

This commit is contained in:
Alexsandro Percy 2023-03-04 15:58:52 -03:00
parent 232f5df95f
commit 3a45af7c9e
9 changed files with 13 additions and 6 deletions

View file

@ -185,6 +185,7 @@ minetest.register_entity('ap_airship:control_interactor',{
textures = {"ap_airship_alpha.png",}, textures = {"ap_airship_alpha.png",},
}, },
dist_moved = 0, dist_moved = 0,
max_hp = 65535,
on_activate = function(self,std) on_activate = function(self,std)
self.sdata = minetest.deserialize(std) or {} self.sdata = minetest.deserialize(std) or {}
@ -217,6 +218,7 @@ minetest.register_entity('ap_airship:cabin_interactor',{
textures = {"ap_airship_alpha.png",}, textures = {"ap_airship_alpha.png",},
}, },
dist_moved = 0, dist_moved = 0,
max_hp = 65535,
on_activate = function(self,std) on_activate = function(self,std)
self.sdata = minetest.deserialize(std) or {} self.sdata = minetest.deserialize(std) or {}

Binary file not shown.

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View file

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View file

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View file

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View file

@ -98,7 +98,7 @@ function ap_airship.rescueConnectionFailedPassengers(self)
if player then --we have a player! if player then --we have a player!
if player_api.player_attached[self._passengers[i]] == nil then --but isn't attached? if player_api.player_attached[self._passengers[i]] == nil then --but isn't attached?
--minetest.chat_send_all("okay") --minetest.chat_send_all("okay")
if player:get_hp() > 0 then if player:get_hp() >= 0 then
self._passengers[i] = nil --clear the slot first self._passengers[i] = nil --clear the slot first
do_attach(self, player, i) --attach do_attach(self, player, i) --attach
else else
@ -114,10 +114,10 @@ end
-- attach passenger -- attach passenger
function ap_airship.attach_pax(self, player, slot) function ap_airship.attach_pax(self, player, slot)
slot = slot or 0 slot = slot or 0
local name = player:get_player_name()
--verify if is locked to non-owners --verify if is locked to non-owners
if self._passengers_locked == true then if self._passengers_locked == true then
local name = player:get_player_name()
local can_bypass = minetest.check_player_privs(player, {protection_bypass=true}) local can_bypass = minetest.check_player_privs(player, {protection_bypass=true})
local is_shared = false local is_shared = false
if name == self.owner or can_bypass then is_shared = true end if name == self.owner or can_bypass then is_shared = true end
@ -156,6 +156,11 @@ function ap_airship.attach_pax(self, player, slot)
i = t[k] i = t[k]
if self._passengers[i] == nil then if self._passengers[i] == nil then
do_attach(self, player, i) do_attach(self, player, i)
if name == self.owner then
--put the owner on cabin directly
self._passengers_base_pos[i] = {x=0,y=-29,z=150}
self._passengers_base[i]:set_attach(self.object,'',self._passengers_base_pos[i],{x=0,y=0,z=0})
end
break break
end end
end end

View file

@ -42,12 +42,13 @@ local function is_obstacle_zone(pos, start_point, end_point)
return retVal return retVal
end end
if pos.z < max_z and pos.z > min_z+mid_z and local death_zone = 1.5 --to avoid the "slip" when colliding in y direction
if pos.z < max_z + death_zone and pos.z > min_z+mid_z and
pos.x > min_x and pos.x < max_x then pos.x > min_x and pos.x < max_x then
retVal.z = max_z + 1 retVal.z = max_z + 1
return retVal return retVal
end end
if pos.z > min_z and pos.z <= min_z+mid_z and if pos.z > min_z - death_zone and pos.z <= min_z+mid_z and
pos.x > min_x and pos.x < max_x then pos.x > min_x and pos.x < max_x then
retVal.z = min_z - 1 retVal.z = min_z - 1
return retVal return retVal
@ -66,7 +67,6 @@ function ap_airship.cabin_map(pos, dpos)
new_pos = is_obstacle_zone(new_pos, {x=12, z=140}, {x=2.5, z=130}) new_pos = is_obstacle_zone(new_pos, {x=12, z=140}, {x=2.5, z=130})
new_pos = is_obstacle_zone(new_pos, {x=-12, z=140}, {x=-2.5, z=130}) new_pos = is_obstacle_zone(new_pos, {x=-12, z=140}, {x=-2.5, z=130})
new_pos = is_obstacle_zone(new_pos, {x=12, z=127}, {x=2.5, z=117}) new_pos = is_obstacle_zone(new_pos, {x=12, z=127}, {x=2.5, z=117})
new_pos = is_obstacle_zone(new_pos, {x=-12, z=127}, {x=-2.5, z=117})
--limit to the cabin --limit to the cabin
new_pos.z = ap_airship.clamp(new_pos.z, 112, 164) new_pos.z = ap_airship.clamp(new_pos.z, 112, 164)
@ -120,7 +120,7 @@ function ap_airship.ladder_map(pos, dpos)
local orig_pos = ap_airship.copy_vector(pos) local orig_pos = ap_airship.copy_vector(pos)
local position = ap_airship.copy_vector(dpos) local position = ap_airship.copy_vector(dpos)
local new_pos = ap_airship.copy_vector(dpos) local new_pos = ap_airship.copy_vector(dpos)
new_pos.z = ap_airship.clamp(new_pos.z, 112, 118) new_pos.z = ap_airship.clamp(new_pos.z, 112, 117)
new_pos.x = ap_airship.clamp(new_pos.x, -8.42, -2) new_pos.x = ap_airship.clamp(new_pos.x, -8.42, -2)
return new_pos return new_pos