Fix luacheck warnings
This commit is contained in:
parent
c580d948e3
commit
3850959f06
@ -3,10 +3,9 @@ allow_defined_top = true
|
||||
|
||||
globals = {
|
||||
"minetest",
|
||||
"mobkit",
|
||||
"airutils",
|
||||
"core",
|
||||
"player_api",
|
||||
"player_monoids",
|
||||
"math.sign",
|
||||
}
|
||||
|
||||
@ -22,4 +21,3 @@ read_globals = {
|
||||
"default", "sfinv", "creative",
|
||||
}
|
||||
|
||||
ignore = {"611"}
|
||||
|
@ -17,7 +17,6 @@ function steampunk_blimp.powerAdjust(self,dtime,factor,dir,max_power)
|
||||
local max = max_power or 100
|
||||
local add_factor = factor/2
|
||||
add_factor = add_factor * (dtime/steampunk_blimp.ideal_step) --adjusting the command speed by dtime
|
||||
local power_index = self._power_lever
|
||||
|
||||
if dir == 1 then
|
||||
if self._power_lever < max then
|
||||
@ -42,12 +41,11 @@ function steampunk_blimp.control(self, dtime, hull_direction, longit_speed, acce
|
||||
player = minetest.get_player_by_name(self.driver_name)
|
||||
end
|
||||
local retval_accel = accel;
|
||||
|
||||
|
||||
-- player control
|
||||
local ctrl = nil
|
||||
if player and self._at_control == true then
|
||||
ctrl = player:get_player_control()
|
||||
local max_speed_anchor = 0.2
|
||||
|
||||
if self.anchored == false then
|
||||
local factor = 1
|
||||
@ -60,8 +58,6 @@ function steampunk_blimp.control(self, dtime, hull_direction, longit_speed, acce
|
||||
end
|
||||
elseif ctrl.down then
|
||||
steampunk_blimp.powerAdjust(self, dtime, factor, -1)
|
||||
else
|
||||
--self.object:set_animation_frame_speed(steampunk_blimp.iddle_rotation)
|
||||
end
|
||||
else
|
||||
--anchor away, so stop!
|
||||
@ -107,8 +103,7 @@ function steampunk_blimp.control(self, dtime, hull_direction, longit_speed, acce
|
||||
|
||||
if longit_speed > 0 then
|
||||
if ctrl then
|
||||
if ctrl.right or ctrl.left then
|
||||
else
|
||||
if not ctrl.right or not ctrl.left then
|
||||
steampunk_blimp.rudder_auto_correction(self, longit_speed, dtime)
|
||||
end
|
||||
else
|
||||
|
@ -12,11 +12,11 @@ function steampunk_blimp.physics(self)
|
||||
z=vel.z*friction}
|
||||
self.object:set_velocity(vel)
|
||||
end
|
||||
|
||||
|
||||
-- bounciness
|
||||
if self.springiness and self.springiness > 0 then
|
||||
local vnew = vector.new(vel)
|
||||
|
||||
|
||||
if not self.collided then -- ugly workaround for inconsistent collisions
|
||||
for _,k in ipairs({'y','z','x'}) do
|
||||
if vel[k]==0 and abs(self.lastvelocity[k])> 0.1 then
|
||||
@ -24,7 +24,7 @@ function steampunk_blimp.physics(self)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if not vector.equals(vel,vnew) then
|
||||
self.collided = true
|
||||
else
|
||||
@ -46,23 +46,19 @@ function steampunk_blimp.physics(self)
|
||||
|
||||
--buoyancy
|
||||
local surface = nil
|
||||
local surfnodename = nil
|
||||
local spos = airutils.get_stand_pos(self)
|
||||
spos.y = spos.y+0.01
|
||||
-- get surface height
|
||||
local snodepos = airutils.get_node_pos(spos)
|
||||
local surfnode = airutils.nodeatpos(spos)
|
||||
while surfnode and (surfnode.drawtype == 'liquid' or surfnode.drawtype == 'flowingliquid') do
|
||||
surfnodename = surfnode.name
|
||||
surface = snodepos.y +0.5
|
||||
if surface > spos.y+self.height then break end
|
||||
snodepos.y = snodepos.y+1
|
||||
surfnode = airutils.nodeatpos(snodepos)
|
||||
end
|
||||
|
||||
local new_velocity = nil
|
||||
|
||||
local accell = {x=0, y=0, z=0}
|
||||
local accell
|
||||
self.water_drag = 0.1
|
||||
self.object:move_to(self.object:get_pos())
|
||||
local time_correction = (self.dtime/steampunk_blimp.ideal_step)
|
||||
@ -95,5 +91,5 @@ function steampunk_blimp.physics(self)
|
||||
--minetest.chat_send_all("_baloon_buoyancy: "..self._baloon_buoyancy.." - dtime: "..self.dtime.." - ideal: "..steampunk_blimp.ideal_step)
|
||||
airutils.set_acceleration(self.object,{x=0,y=y_accel,z=0})
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
70
entities.lua
70
entities.lua
@ -25,12 +25,12 @@ initial_properties = {
|
||||
self.sdata = minetest.deserialize(std) or {}
|
||||
if self.sdata.remove then self.object:remove() end
|
||||
end,
|
||||
|
||||
|
||||
get_staticdata=function(self)
|
||||
self.sdata.remove=true
|
||||
return minetest.serialize(self.sdata)
|
||||
end,
|
||||
|
||||
|
||||
})
|
||||
|
||||
--
|
||||
@ -47,12 +47,12 @@ minetest.register_entity('steampunk_blimp:stand_base',{
|
||||
textures = {"steampunk_blimp_alpha.png",},
|
||||
},
|
||||
dist_moved = 0,
|
||||
|
||||
|
||||
on_activate = function(self,std)
|
||||
self.sdata = minetest.deserialize(std) or {}
|
||||
if self.sdata.remove then self.object:remove() end
|
||||
end,
|
||||
|
||||
|
||||
get_staticdata=function(self)
|
||||
self.sdata.remove=true
|
||||
return minetest.serialize(self.sdata)
|
||||
@ -182,7 +182,7 @@ minetest.register_entity("steampunk_blimp:blimp", {
|
||||
self._passenger_is_sit = steampunk_blimp.copy_vector({})
|
||||
self._passengers_base = steampunk_blimp.copy_vector({})
|
||||
self._passengers_base_pos = steampunk_blimp.copy_vector({})
|
||||
for i = 1,steampunk_blimp.max_seats,1
|
||||
for i = 1,steampunk_blimp.max_seats,1
|
||||
do
|
||||
self._passenger_is_sit[i] = 0
|
||||
self._passengers_base_pos[i] = steampunk_blimp.copy_vector(steampunk_blimp.passenger_pos[i])
|
||||
@ -199,7 +199,7 @@ minetest.register_entity("steampunk_blimp:blimp", {
|
||||
|
||||
airutils.actfunc(self, staticdata, dtime_s)
|
||||
|
||||
self.object:set_armor_groups({immortal=1})
|
||||
self.object:set_armor_groups({immortal=1})
|
||||
|
||||
local inv = minetest.get_inventory({type = "detached", name = self._inv_id})
|
||||
-- if the game was closed the inventories have to be made anew, instead of just reattached
|
||||
@ -216,11 +216,11 @@ minetest.register_entity("steampunk_blimp:blimp", {
|
||||
self.dtime = math.min(dtime,0.2)
|
||||
self.colinfo = colinfo
|
||||
self.height = airutils.get_box_height(self)
|
||||
|
||||
|
||||
-- physics comes first
|
||||
local vel = self.object:get_velocity()
|
||||
|
||||
if colinfo then
|
||||
|
||||
if colinfo then
|
||||
self.isonground = colinfo.touching_ground
|
||||
else
|
||||
if self.lastvelocity.y==0 and vel.y==0 then
|
||||
@ -229,25 +229,24 @@ minetest.register_entity("steampunk_blimp:blimp", {
|
||||
self.isonground = false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
self:physics()
|
||||
|
||||
if self.logic then
|
||||
self:logic()
|
||||
end
|
||||
|
||||
|
||||
self.lastvelocity = self.object:get_velocity()
|
||||
self.time_total=self.time_total+self.dtime
|
||||
end,
|
||||
logic = function(self)
|
||||
|
||||
|
||||
local accel_y = self.object:get_acceleration().y
|
||||
local rotation = self.object:get_rotation()
|
||||
local yaw = rotation.y
|
||||
local newyaw=yaw
|
||||
local pitch = rotation.x
|
||||
local newpitch = pitch
|
||||
local roll = rotation.z
|
||||
local curr_pos = self.object:get_pos()
|
||||
local newyaw
|
||||
local newpitch
|
||||
|
||||
local hull_direction = minetest.yaw_to_dir(yaw)
|
||||
local nhdir = {x=hull_direction.z,y=0,z=-hull_direction.x} -- lateral unit vector
|
||||
@ -269,7 +268,6 @@ minetest.register_entity("steampunk_blimp:blimp", {
|
||||
LATER_DRAG_FACTOR*-1*steampunk_blimp.sign(later_speed))
|
||||
local accel = vector.add(longit_drag,later_drag)
|
||||
|
||||
local curr_pos = self.object:get_pos()
|
||||
self._last_pos = curr_pos
|
||||
self.object:move_to(curr_pos)
|
||||
|
||||
@ -278,15 +276,15 @@ minetest.register_entity("steampunk_blimp:blimp", {
|
||||
--[[local is_flying = true
|
||||
if node_below and node_below.drawtype ~= 'airlike' then is_flying = false end]]--
|
||||
|
||||
local is_attached = false
|
||||
local player = nil
|
||||
--[[local is_attached = false
|
||||
if self.driver_name then
|
||||
player = minetest.get_player_by_name(self.driver_name)
|
||||
|
||||
local player = minetest.get_player_by_name(self.driver_name)
|
||||
|
||||
if player then
|
||||
is_attached = steampunk_blimp.checkAttach(self, player)
|
||||
end
|
||||
end
|
||||
]]--
|
||||
|
||||
if self.owner == "" then return end
|
||||
--[[if relative_longit_speed == 0 and is_flying == false and is_attached == false and self._engine_running == false then
|
||||
@ -315,7 +313,7 @@ minetest.register_entity("steampunk_blimp:blimp", {
|
||||
self._rudder_angle / 30 * turn_rate * steampunk_blimp.sign(relative_longit_speed)
|
||||
|
||||
steampunk_blimp.engine_step(self, accel)
|
||||
|
||||
|
||||
--roll adjust
|
||||
---------------------------------
|
||||
local sdir = minetest.yaw_to_dir(newyaw)
|
||||
@ -347,7 +345,7 @@ minetest.register_entity("steampunk_blimp:blimp", {
|
||||
--in movement
|
||||
self._roll_state = nil
|
||||
newroll = (prsr*math.rad(rollfactor))*later_speed
|
||||
if self._last_roll ~= nil then
|
||||
if self._last_roll ~= nil then
|
||||
if math.sign(newroll) ~= math.sign(self._last_roll) then
|
||||
steampunk_blimp.play_rope_sound(self)
|
||||
end
|
||||
@ -359,7 +357,7 @@ minetest.register_entity("steampunk_blimp:blimp", {
|
||||
-- end roll
|
||||
|
||||
if steampunk_blimp.wind_enabled then
|
||||
local wind_yaw = minetest.dir_to_yaw(wind_speed)
|
||||
--local wind_yaw = minetest.dir_to_yaw(wind_speed)
|
||||
--minetest.chat_send_all("x: "..wind_speed.x.. " - z: "..wind_speed.z.." - yaw: "..math.deg(wind_yaw).. " - orig: "..wind_yaw)
|
||||
|
||||
if self.anchored == false and self.isonground == false then
|
||||
@ -390,13 +388,13 @@ minetest.register_entity("steampunk_blimp:blimp", {
|
||||
if not puncher or not puncher:is_player() then
|
||||
return
|
||||
end
|
||||
local is_admin = false
|
||||
local is_admin
|
||||
is_admin = minetest.check_player_privs(puncher, {server=true})
|
||||
local name = puncher:get_player_name()
|
||||
if self.owner == nil then
|
||||
self.owner = name
|
||||
end
|
||||
|
||||
|
||||
local is_attached = steampunk_blimp.checkAttach(self, puncher)
|
||||
|
||||
local itmstck=puncher:get_wielded_item()
|
||||
@ -442,10 +440,9 @@ minetest.register_entity("steampunk_blimp:blimp", {
|
||||
end
|
||||
|
||||
if is_attached == false then
|
||||
local i = 0
|
||||
local has_passengers = false
|
||||
for i = steampunk_blimp.max_seats,1,-1
|
||||
do
|
||||
for i = steampunk_blimp.max_seats,1,-1
|
||||
do
|
||||
if self._passengers[i] ~= nil then
|
||||
has_passengers = true
|
||||
break
|
||||
@ -480,11 +477,10 @@ minetest.register_entity("steampunk_blimp:blimp", {
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
end,
|
||||
|
||||
on_rightclick = function(self, clicker)
|
||||
local message = ""
|
||||
if not clicker or not clicker:is_player() then
|
||||
return
|
||||
end
|
||||
@ -495,10 +491,6 @@ minetest.register_entity("steampunk_blimp:blimp", {
|
||||
self.owner = name
|
||||
end
|
||||
|
||||
local touching_ground, liquid_below = airutils.check_node_below(self.object, 2.5)
|
||||
local is_on_ground = self.isinliquid or touching_ground or liquid_below
|
||||
local is_under_water = airutils.check_is_under_water(self.object)
|
||||
|
||||
--minetest.chat_send_all('passengers: '.. dump(self._passengers))
|
||||
--=========================
|
||||
-- form to pilot
|
||||
@ -512,8 +504,8 @@ minetest.register_entity("steampunk_blimp:blimp", {
|
||||
|
||||
--check error after being shot for any other mod
|
||||
if is_attached == false then
|
||||
for i = steampunk_blimp.max_seats,1,-1
|
||||
do
|
||||
for i = steampunk_blimp.max_seats,1,-1
|
||||
do
|
||||
if self._passengers[i] == name then
|
||||
self._passengers[i] = nil --clear the wrong information
|
||||
break
|
||||
@ -579,8 +571,8 @@ minetest.register_entity("steampunk_blimp:blimp", {
|
||||
else
|
||||
--first lets clean the boat slots
|
||||
--note that when it happens, the "rescue" function will lost the historic
|
||||
for i = steampunk_blimp.max_seats,1,-1
|
||||
do
|
||||
for i = steampunk_blimp.max_seats,1,-1
|
||||
do
|
||||
if self._passengers[i] ~= nil then
|
||||
local old_player = minetest.get_player_by_name(self._passengers[i])
|
||||
if not old_player then self._passengers[i] = nil end
|
||||
|
27
forms.lua
27
forms.lua
@ -37,7 +37,7 @@ function steampunk_blimp.pilot_formspec(name)
|
||||
|
||||
basic_form = basic_form.."checkbox[1,5.6;take_control;Take the Control;"..take_control.."]"
|
||||
basic_form = basic_form.."checkbox[1,6.2;anchor;Anchor away;"..anchor.."]"
|
||||
|
||||
|
||||
basic_form = basic_form.."label[1,7.0;Disembark:]"
|
||||
basic_form = basic_form.."button[1,7.2;2,1;disembark_l;<< Left]"
|
||||
basic_form = basic_form.."button[3,7.2;2,1;disembark_r;Right >>]"
|
||||
@ -109,8 +109,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
end
|
||||
if fields.take then
|
||||
ent._at_control = true
|
||||
for i = 5,1,-1
|
||||
do
|
||||
for i = 5,1,-1
|
||||
do
|
||||
if ent._passengers[i] == name then
|
||||
ent._passengers_base_pos[i] = vector.new(steampunk_blimp.pilot_base_pos)
|
||||
ent._passengers_base[i]:set_attach(ent.object,'',steampunk_blimp.pilot_base_pos,{x=0,y=0,z=0})
|
||||
@ -199,8 +199,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if fields.take_control == "true" then
|
||||
if ent.driver_name == nil or ent.driver_name == "" then
|
||||
ent._at_control = true
|
||||
for i = steampunk_blimp.max_seats,1,-1
|
||||
do
|
||||
for i = steampunk_blimp.max_seats,1,-1
|
||||
do
|
||||
if ent._passengers[i] == name then
|
||||
ent._passengers_base_pos[i] = vector.new(steampunk_blimp.pilot_base_pos)
|
||||
ent._passengers_base[i]:set_attach(ent.object,'',steampunk_blimp.pilot_base_pos,{x=0,y=0,z=0})
|
||||
@ -240,9 +240,6 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
|
||||
steampunk_blimp.dettach_pax(ent, player, "r")
|
||||
|
||||
end
|
||||
if fields.bring then
|
||||
|
||||
end
|
||||
if fields.anchor then
|
||||
if fields.anchor == "true" then
|
||||
@ -285,7 +282,7 @@ minetest.register_chatcommand("blimp_share", {
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local target_player = minetest.get_player_by_name(param)
|
||||
local attached_to = player:get_attach()
|
||||
|
||||
|
||||
if attached_to ~= nil and target_player ~= nil then
|
||||
local seat = attached_to:get_attach()
|
||||
if seat ~= nil then
|
||||
@ -328,7 +325,7 @@ minetest.register_chatcommand("blimp_remove", {
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local attached_to = player:get_attach()
|
||||
|
||||
|
||||
if attached_to ~= nil then
|
||||
local seat = attached_to:get_attach()
|
||||
if seat ~= nil then
|
||||
@ -365,7 +362,7 @@ minetest.register_chatcommand("blimp_list", {
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local attached_to = player:get_attach()
|
||||
|
||||
|
||||
if attached_to ~= nil then
|
||||
local seat = attached_to:get_attach()
|
||||
if seat ~= nil then
|
||||
@ -396,7 +393,7 @@ minetest.register_chatcommand("blimp_lock", {
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local attached_to = player:get_attach()
|
||||
|
||||
|
||||
if attached_to ~= nil then
|
||||
local seat = attached_to:get_attach()
|
||||
if seat ~= nil then
|
||||
@ -428,7 +425,7 @@ minetest.register_chatcommand("blimp_logo", {
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local attached_to = player:get_attach()
|
||||
|
||||
|
||||
if attached_to ~= nil then
|
||||
local seat = attached_to:get_attach()
|
||||
if seat ~= nil then
|
||||
@ -467,8 +464,8 @@ minetest.register_chatcommand("blimp_eject", {
|
||||
local entity = seat:get_luaentity()
|
||||
if entity then
|
||||
if entity.name == "steampunk_blimp:blimp" then
|
||||
for i = 5,1,-1
|
||||
do
|
||||
for i = 5,1,-1
|
||||
do
|
||||
if entity._passengers[i] == name then
|
||||
steampunk_blimp.dettach_pax(entity, player, "l")
|
||||
break
|
||||
|
@ -51,7 +51,7 @@ function steampunk_blimp.load_fuel(self, player)
|
||||
|
||||
--local energy_indicator_angle = steampunk_blimp.get_pointer_angle(self._energy, steampunk_blimp.MAX_FUEL)
|
||||
end
|
||||
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
@ -59,7 +59,7 @@ function steampunk_blimp.load_fuel(self, player)
|
||||
end
|
||||
|
||||
function steampunk_blimp.load_water(self, player)
|
||||
local inv = player:get_inventory()
|
||||
--local inv = player:get_inventory()
|
||||
|
||||
local itmstck=player:get_wielded_item()
|
||||
local item_name = ""
|
||||
@ -69,7 +69,7 @@ function steampunk_blimp.load_water(self, player)
|
||||
local water = steampunk_blimp.contains(steampunk_blimp.water, item_name)
|
||||
if water then
|
||||
if self._water_level < steampunk_blimp.MAX_WATER then
|
||||
local itemstack = ItemStack(item_name .. " 1")
|
||||
local itemstack
|
||||
--inv:remove_item("main", itemstack)
|
||||
|
||||
local indx = item_name:find('bucket:bucket')
|
||||
@ -78,11 +78,14 @@ function steampunk_blimp.load_water(self, player)
|
||||
--inv:add_item("main", itemstack)
|
||||
player:set_wielded_item(itemstack)
|
||||
end
|
||||
if not itemstack then
|
||||
itemstack = ItemStack(item_name .. " 1")
|
||||
end
|
||||
|
||||
self._water_level = self._water_level + water.amount
|
||||
if self._water_level > steampunk_blimp.MAX_WATER then self._water_level = steampunk_blimp.MAX_WATER end
|
||||
end
|
||||
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
|
2
hud.lua
2
hud.lua
@ -104,7 +104,7 @@ function steampunk_blimp.update_hud(player, coal, water, pressure, power_lever)
|
||||
scale = { x = 0.5, y = 0.5},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
|
||||
|
||||
ids["throttle"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
|
4
init.lua
4
init.lua
@ -124,11 +124,11 @@ minetest.register_craftitem("steampunk_blimp:blimp", {
|
||||
if pointed_thing.type ~= "node" then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
local pointed_pos = pointed_thing.under
|
||||
--local node_below = minetest.get_node(pointed_pos).name
|
||||
--local nodedef = minetest.registered_nodes[node_below]
|
||||
|
||||
|
||||
pointed_pos.y=pointed_pos.y+3
|
||||
local blimp = minetest.add_entity(pointed_pos, "steampunk_blimp:blimp")
|
||||
if blimp and placer then
|
||||
|
@ -74,8 +74,8 @@ end
|
||||
function steampunk_blimp.check_passenger_is_attached(self, name)
|
||||
local is_attached = false
|
||||
if is_attached == false then
|
||||
for i = steampunk_blimp.max_seats,1,-1
|
||||
do
|
||||
for i = steampunk_blimp.max_seats,1,-1
|
||||
do
|
||||
if self._passengers[i] == name then
|
||||
is_attached = true
|
||||
break
|
||||
@ -91,8 +91,8 @@ function steampunk_blimp.rescueConnectionFailedPassengers(self)
|
||||
if self._disconnection_check_time > 1 then
|
||||
--minetest.chat_send_all(dump(self._passengers))
|
||||
self._disconnection_check_time = 0
|
||||
for i = steampunk_blimp.max_seats,1,-1
|
||||
do
|
||||
for i = steampunk_blimp.max_seats,1,-1
|
||||
do
|
||||
if self._passengers[i] then
|
||||
local player = minetest.get_player_by_name(self._passengers[i])
|
||||
if player then --we have a player!
|
||||
@ -101,8 +101,6 @@ function steampunk_blimp.rescueConnectionFailedPassengers(self)
|
||||
if player:get_hp() > 0 then
|
||||
self._passengers[i] = nil --clear the slot first
|
||||
do_attach(self, player, i) --attach
|
||||
else
|
||||
--steampunk_blimp.dettachPlayer(self, player)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -151,9 +149,8 @@ function steampunk_blimp.attach_pax(self, player, slot)
|
||||
|
||||
--minetest.chat_send_all(dump(t))
|
||||
|
||||
local i=0
|
||||
for k,v in ipairs(t) do
|
||||
i = t[k]
|
||||
local i = t[k] or 0
|
||||
if self._passengers[i] == nil then
|
||||
do_attach(self, player, i)
|
||||
--minetest.chat_send_all(i)
|
||||
@ -169,8 +166,8 @@ function steampunk_blimp.dettach_pax(self, player, side)
|
||||
steampunk_blimp.remove_hud(player)
|
||||
|
||||
-- passenger clicked the object => driver gets off the vehicle
|
||||
for i = steampunk_blimp.max_seats,1,-1
|
||||
do
|
||||
for i = steampunk_blimp.max_seats,1,-1
|
||||
do
|
||||
if self._passengers[i] == name then
|
||||
self._passengers[i] = nil
|
||||
self._passengers_base_pos[i] = steampunk_blimp.copy_vector(steampunk_blimp.passenger_pos[i])
|
||||
@ -291,7 +288,7 @@ function steampunk_blimp.destroy(self, overload)
|
||||
if overload then
|
||||
local stack = ItemStack(self.item)
|
||||
local item_def = stack:get_definition()
|
||||
|
||||
|
||||
if item_def.overload_drop then
|
||||
for _,item in pairs(item_def.overload_drop) do
|
||||
minetest.add_item({x=pos.x+math.random()-0.5,y=pos.y,z=pos.z+math.random()-0.5},item)
|
||||
@ -332,8 +329,8 @@ function steampunk_blimp.checkAttach(self, player)
|
||||
if player then
|
||||
local player_attach = player:get_attach()
|
||||
if player_attach then
|
||||
for i = steampunk_blimp.max_seats,1,-1
|
||||
do
|
||||
for i = steampunk_blimp.max_seats,1,-1
|
||||
do
|
||||
if player_attach == self._passengers_base[i] then
|
||||
retVal = true
|
||||
break
|
||||
|
19
walk_map.lua
19
walk_map.lua
@ -18,10 +18,7 @@ end
|
||||
local function is_obstacle_zone(pos, start_point, end_point)
|
||||
local retVal = steampunk_blimp.table_copy(pos)
|
||||
|
||||
local min_x = 0
|
||||
local min_z = 0
|
||||
local max_x = 0
|
||||
local max_z = 0
|
||||
local min_x, min_z, max_x, max_z
|
||||
|
||||
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
|
||||
@ -62,7 +59,7 @@ function steampunk_blimp.boat_upper_deck_map(pos, dpos)
|
||||
local orig_pos = steampunk_blimp.copy_vector(pos)
|
||||
local position = steampunk_blimp.copy_vector(dpos)
|
||||
local new_pos = steampunk_blimp.copy_vector(dpos)
|
||||
|
||||
|
||||
new_pos.z = steampunk_blimp.clamp(new_pos.z, -47, -16)
|
||||
new_pos = is_obstacle_zone(new_pos, {x=4, z=-28}, {x=-4, z=-20}) --timao
|
||||
new_pos = is_obstacle_zone(new_pos, {x=-30, z=-24}, {x=4, z=-12})
|
||||
@ -93,7 +90,6 @@ local function is_ladder_zone(pos)
|
||||
end
|
||||
|
||||
function steampunk_blimp.boat_lower_deck_map(pos, dpos)
|
||||
local orig_pos = steampunk_blimp.copy_vector(pos)
|
||||
local position = steampunk_blimp.copy_vector(dpos)
|
||||
local new_pos = steampunk_blimp.copy_vector(dpos)
|
||||
new_pos.z = steampunk_blimp.clamp(new_pos.z, -29, 45)
|
||||
@ -190,7 +186,6 @@ endis_obstacle_zone(new_pos, {x=30, z=55}, {x=2, z=90})
|
||||
end]]--
|
||||
|
||||
function steampunk_blimp.ladder_map(pos, dpos)
|
||||
local orig_pos = steampunk_blimp.copy_vector(pos)
|
||||
local position = steampunk_blimp.copy_vector(dpos)
|
||||
local new_pos = steampunk_blimp.copy_vector(dpos)
|
||||
new_pos.z = steampunk_blimp.clamp(new_pos.z, -18, -12)
|
||||
@ -213,7 +208,7 @@ end]]--
|
||||
function steampunk_blimp.navigate_deck(pos, dpos, player)
|
||||
local pos_d = dpos
|
||||
local ladder_zone = is_ladder_zone(pos)
|
||||
|
||||
|
||||
local upper_deck_y = 20.821
|
||||
local lower_deck_y = 0
|
||||
if player then
|
||||
@ -269,7 +264,7 @@ local function get_result_pos(self, player, index)
|
||||
|
||||
local speed = 0.4
|
||||
|
||||
dir = vector.new(ctrl.up and -1 or ctrl.down and 1 or 0, 0, ctrl.left and 1 or ctrl.right and -1 or 0)
|
||||
local dir = vector.new(ctrl.up and -1 or ctrl.down and 1 or 0, 0, ctrl.left and 1 or ctrl.right and -1 or 0)
|
||||
dir = vector.normalize(dir)
|
||||
dir = vector.rotate(dir, {x = 0, y = -direction, z = 0})
|
||||
|
||||
@ -300,8 +295,8 @@ end
|
||||
function steampunk_blimp.move_persons(self)
|
||||
--self._passenger = nil
|
||||
if self.object == nil then return end
|
||||
|
||||
for i = steampunk_blimp.max_seats,1,-1
|
||||
|
||||
for i = steampunk_blimp.max_seats,1,-1
|
||||
do
|
||||
local player = nil
|
||||
if self._passengers[i] then player = minetest.get_player_by_name(self._passengers[i]) end
|
||||
@ -342,8 +337,6 @@ function steampunk_blimp.move_persons(self)
|
||||
player:set_attach(self._passengers_base[i], "", {x = 0, y = 3.6, z = 0}, {x = 0, y = y_rot, z = 0})
|
||||
airutils.sit(player)
|
||||
end
|
||||
else
|
||||
--self._passengers[i] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user