added seats and new collision detection from inside
This commit is contained in:
parent
d359b5adca
commit
9378533ee4
@ -229,8 +229,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
if fields.anchor == "true" then
|
if fields.anchor == "true" then
|
||||||
local max_speed_anchor = 0.6
|
local max_speed_anchor = 0.6
|
||||||
if ent._longit_speed then
|
if ent._longit_speed then
|
||||||
if math.abs(ent._longit_speed) < max_speed_anchor then
|
local is_admin = minetest.check_player_privs(player, {server=true}) --force stop by admins
|
||||||
|
if (math.abs(ent._longit_speed) < max_speed_anchor and self.isonground) or is_admin then
|
||||||
ent.anchored = true
|
ent.anchored = true
|
||||||
ent.object:set_acceleration(vector.new())
|
ent.object:set_acceleration(vector.new())
|
||||||
ent.object:set_velocity(vector.new())
|
ent.object:set_velocity(vector.new())
|
||||||
|
11
init.lua
11
init.lua
@ -12,10 +12,10 @@ ap_airship.max_seats = 2
|
|||||||
ap_airship.pilot_base_pos = {x=0.0,y=-29,z=170}
|
ap_airship.pilot_base_pos = {x=0.0,y=-29,z=170}
|
||||||
ap_airship.passenger_pos = {
|
ap_airship.passenger_pos = {
|
||||||
[1] = {x=0.0,y=0,z=60},
|
[1] = {x=0.0,y=0,z=60},
|
||||||
[2] = {x=-11,y=0,z=20},
|
[2] = {x=-32,y=0,z=20},
|
||||||
[3] = {x=11,y=0,z=20},
|
[3] = {x=32,y=0,z=20},
|
||||||
[4] = {x=-11,y=0,z=80},
|
[4] = {x=-32,y=0,z=80},
|
||||||
[5] = {x=11,y=0,z=80},
|
[5] = {x=32,y=0,z=80},
|
||||||
}
|
}
|
||||||
|
|
||||||
ap_airship.canvas_texture = "wool_white.png^[colorize:#f4e7c1:128"
|
ap_airship.canvas_texture = "wool_white.png^[colorize:#f4e7c1:128"
|
||||||
@ -27,6 +27,8 @@ ap_airship.rotor_texture = "ap_airship_helice.png"
|
|||||||
ap_airship.textures = {
|
ap_airship.textures = {
|
||||||
ap_airship.grey_texture, --"ap_airship_painting.png", --balao
|
ap_airship.grey_texture, --"ap_airship_painting.png", --balao
|
||||||
ap_airship.metal_texture, --ponteira nariz
|
ap_airship.metal_texture, --ponteira nariz
|
||||||
|
"ap_airship_brown.png", --mobilia
|
||||||
|
ap_airship.metal_texture, --mobilia
|
||||||
ap_airship.black_texture, -- corpo da bussola
|
ap_airship.black_texture, -- corpo da bussola
|
||||||
ap_airship.metal_texture, -- indicador bussola
|
ap_airship.metal_texture, -- indicador bussola
|
||||||
ap_airship.grey_texture, --"ap_airship_painting.png", --empenagem
|
ap_airship.grey_texture, --"ap_airship_painting.png", --empenagem
|
||||||
@ -46,6 +48,7 @@ ap_airship.textures = {
|
|||||||
ap_airship.black_texture, --piso
|
ap_airship.black_texture, --piso
|
||||||
"ap_airship_alpha_logo.png", --logo
|
"ap_airship_alpha_logo.png", --logo
|
||||||
ap_airship.metal_texture,
|
ap_airship.metal_texture,
|
||||||
|
"wool_red.png",
|
||||||
}
|
}
|
||||||
|
|
||||||
ap_airship.colors ={
|
ap_airship.colors ={
|
||||||
|
Binary file not shown.
BIN
textures/ap_airship_brown.png
Executable file
BIN
textures/ap_airship_brown.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 6.1 KiB |
@ -212,6 +212,14 @@ function ap_airship.textures_copy()
|
|||||||
return tablecopy
|
return tablecopy
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function ap_airship.table_copy(table_here)
|
||||||
|
local tablecopy = {}
|
||||||
|
for k, v in pairs(table_here) do
|
||||||
|
tablecopy[k] = v
|
||||||
|
end
|
||||||
|
return tablecopy
|
||||||
|
end
|
||||||
|
|
||||||
local function paint(self)
|
local function paint(self)
|
||||||
local l_textures = ap_airship.textures_copy()
|
local l_textures = ap_airship.textures_copy()
|
||||||
for _, texture in ipairs(l_textures) do
|
for _, texture in ipairs(l_textures) do
|
||||||
|
57
walk_map.lua
57
walk_map.lua
@ -15,17 +15,65 @@ function ap_airship.reclamp(value, min, max)
|
|||||||
return retVal
|
return retVal
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function is_obstacle_zone(pos, start_point, end_point)
|
||||||
|
local retVal = ap_airship.table_copy(pos)
|
||||||
|
|
||||||
|
local min_x = 0
|
||||||
|
local min_z = 0
|
||||||
|
local max_x = 0
|
||||||
|
local max_z = 0
|
||||||
|
|
||||||
|
if start_point.x <= end_point.x then min_x = start_point.x else min_x = end_point.x end
|
||||||
|
if start_point.z <= end_point.z then min_z = start_point.z else min_z = end_point.z end
|
||||||
|
if start_point.x > end_point.x then max_x = start_point.x else max_x = end_point.x end
|
||||||
|
if start_point.z > end_point.z then max_z = start_point.z else max_z = end_point.z end
|
||||||
|
|
||||||
|
local mid_x = (max_x - min_x)/2
|
||||||
|
local mid_z = (max_z - min_z)/2
|
||||||
|
|
||||||
|
if pos.x < max_x and pos.x > min_x+mid_x and
|
||||||
|
pos.z < max_z and pos.z > min_z then
|
||||||
|
retVal.x = max_x + 1
|
||||||
|
return retVal
|
||||||
|
end
|
||||||
|
if pos.x > min_x and pos.x <= min_x+mid_x and
|
||||||
|
pos.z < max_z and pos.z > min_z then
|
||||||
|
retVal.x = min_x - 1
|
||||||
|
return retVal
|
||||||
|
end
|
||||||
|
|
||||||
|
if pos.z < max_z and pos.z > min_z+mid_z and
|
||||||
|
pos.x > min_x and pos.x < max_x then
|
||||||
|
retVal.z = max_z + 1
|
||||||
|
return retVal
|
||||||
|
end
|
||||||
|
if pos.z > min_z and pos.z <= min_z+mid_z and
|
||||||
|
pos.x > min_x and pos.x < max_x then
|
||||||
|
retVal.z = min_z - 1
|
||||||
|
return retVal
|
||||||
|
end
|
||||||
|
|
||||||
|
return retVal
|
||||||
|
end
|
||||||
|
|
||||||
function ap_airship.cabin_map(pos, dpos)
|
function ap_airship.cabin_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 = is_obstacle_zone(new_pos, {x=12, z=153}, {x=2.5, z=143})
|
||||||
|
new_pos = is_obstacle_zone(new_pos, {x=-12, z=153}, {x=-2.5, z=143})
|
||||||
|
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})
|
||||||
|
|
||||||
--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)
|
||||||
new_pos.y = -29
|
new_pos.y = -29
|
||||||
new_pos.x = ap_airship.clamp(new_pos.x, -8.42, 8.42)
|
new_pos.x = ap_airship.clamp(new_pos.x, -8.42, 8.42)
|
||||||
|
|
||||||
--minetest.chat_send_all("x: "..new_pos.x.." - z: "..new_pos.z)
|
minetest.chat_send_all("x: "..new_pos.x.." - z: "..new_pos.z)
|
||||||
return new_pos
|
return new_pos
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -55,6 +103,12 @@ function ap_airship.passengers_deck_map(pos, dpos)
|
|||||||
--limiting upper deck
|
--limiting upper deck
|
||||||
new_pos.z = ap_airship.clamp(new_pos.z, 3, 109)
|
new_pos.z = ap_airship.clamp(new_pos.z, 3, 109)
|
||||||
new_pos.x = ap_airship.clamp(new_pos.x, -43, 43)
|
new_pos.x = ap_airship.clamp(new_pos.x, -43, 43)
|
||||||
|
|
||||||
|
new_pos = is_obstacle_zone(new_pos, {x=30, z=10}, {x=2, z=48})
|
||||||
|
new_pos = is_obstacle_zone(new_pos, {x=-30, z=10}, {x=-2, z=48})
|
||||||
|
|
||||||
|
new_pos = is_obstacle_zone(new_pos, {x=30, z=55}, {x=2, z=90})
|
||||||
|
new_pos = is_obstacle_zone(new_pos, {x=-30, z=55}, {x=-2, z=90})
|
||||||
end
|
end
|
||||||
new_pos.y = 0
|
new_pos.y = 0
|
||||||
|
|
||||||
@ -105,6 +159,7 @@ function ap_airship.navigate_deck(pos, dpos, player)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
--minetest.chat_send_all(dump(pos_d))
|
||||||
|
|
||||||
return pos_d
|
return pos_d
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user