mirror of
https://github.com/APercy/airutils.git
synced 2025-03-15 08:01:22 +00:00
Merge pull request #22 from Niklp09/luacheck
Try to fix most warnings reported by luacheck
This commit is contained in:
commit
d4dae8b104
25 changed files with 194 additions and 251 deletions
46
.luacheckrc
Normal file
46
.luacheckrc
Normal file
|
@ -0,0 +1,46 @@
|
|||
-- Disable some (non critical) warnings
|
||||
-- unused = false
|
||||
unused_args = false
|
||||
redefined = false
|
||||
|
||||
globals = {
|
||||
"airutils",
|
||||
}
|
||||
|
||||
read_globals = {
|
||||
"DIR_DELIM",
|
||||
"ItemStack",
|
||||
"PseudoRandom",
|
||||
"basic_machines",
|
||||
"biomass",
|
||||
"climate_api",
|
||||
"core",
|
||||
"creative",
|
||||
"default",
|
||||
"dump",
|
||||
"emote",
|
||||
"math",
|
||||
"mcl_formspec",
|
||||
"mcl_player",
|
||||
"minetest",
|
||||
"player_api",
|
||||
"signs_lib",
|
||||
"skins",
|
||||
"string",
|
||||
"technic",
|
||||
"vector",
|
||||
"wardrobe",
|
||||
}
|
||||
|
||||
-- Per file options
|
||||
files["airutils_biofuel.lua"] = {
|
||||
globals = {"basic_machines.grinder_recipes"},
|
||||
}
|
||||
|
||||
files["lib_planes/utilities.lua"] = {
|
||||
globals = {"player_api.player_attached.?", "mcl_player.player_attached.?"}
|
||||
}
|
||||
|
||||
files["pilot_skin_manager.lua"] = {
|
||||
globals = {"skins.skin_class.apply_skin_to_player"}
|
||||
}
|
|
@ -138,9 +138,6 @@ minetest.register_node( module_name .. ":biofuel_distiller", {
|
|||
return 0
|
||||
end
|
||||
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
|
||||
if listname == "src" then
|
||||
return stack:get_count()
|
||||
elseif listname == "dst" then
|
||||
|
@ -154,10 +151,6 @@ minetest.register_node( module_name .. ":biofuel_distiller", {
|
|||
return 0
|
||||
end
|
||||
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local stack = inv:get_stack(from_list, from_index)
|
||||
|
||||
if to_list == "src" then
|
||||
return count
|
||||
elseif to_list == "dst" then
|
||||
|
|
|
@ -19,7 +19,6 @@ function airutils.PAPIplace(player,pos)
|
|||
end
|
||||
|
||||
local dir = minetest.dir_to_facedir(player:get_look_dir())
|
||||
local pos1 = vector.new(pos)
|
||||
|
||||
local player_name = player:get_player_name()
|
||||
if check_protection(pos, player_name) then
|
||||
|
@ -45,7 +44,7 @@ function airutils.togglePapiSide(pos, node, clicker, itemstack)
|
|||
local dir=node.param2
|
||||
if node.name == "airutils:papi_right" then
|
||||
core.set_node(pos, {name="airutils:papi", param2=dir})
|
||||
meta:set_string("infotext", S("PAPI") .. " - " .. S("left side") .. "\r" .. S("Owned by: @1",player_name))
|
||||
meta:set_string("infotext", S("PAPI") .. " - " .. S("left side") .. "\r" .. S("Owned by: @1",player_name))
|
||||
elseif node.name == "airutils:papi" then
|
||||
core.set_node(pos, {name="airutils:papi_right", param2=dir})
|
||||
meta:set_string("infotext", S("PAPI") .. " - " .. S("right side") .. "\r" .. S("Owned by: @1",player_name))
|
||||
|
@ -107,11 +106,6 @@ minetest.register_node("airutils:papi",{
|
|||
return
|
||||
end
|
||||
end
|
||||
|
||||
local itmstck=puncher:get_wielded_item()
|
||||
local item_name = ""
|
||||
if itmstck then item_name = itmstck:get_name() end
|
||||
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -123,7 +117,7 @@ function airutils.remove_papi(pos)
|
|||
local dir=node.param2
|
||||
if node.name == "airutils:papi_right" then
|
||||
core.set_node(pos, {name="airutils:papi", param2=dir})
|
||||
meta:set_string("infotext", "PAPI - left side\rOwned by: "..player_name)
|
||||
meta:set_string("infotext", "PAPI - left side\rOwned by: "..player_name)
|
||||
end
|
||||
|
||||
meta:set_string("owner", player_name)
|
||||
|
@ -161,11 +155,6 @@ minetest.register_node("airutils:papi_right",{
|
|||
if player_name ~= meta:get_string("owner") then
|
||||
return
|
||||
end
|
||||
|
||||
local itmstck=puncher:get_wielded_item()
|
||||
local item_name = ""
|
||||
if itmstck then item_name = itmstck:get_name() end
|
||||
|
||||
end,
|
||||
})
|
||||
|
||||
|
|
|
@ -50,8 +50,7 @@ minetest.register_tool("airutils:tug", {
|
|||
return
|
||||
end
|
||||
|
||||
local is_admin = false
|
||||
is_admin = minetest.check_player_privs(player, {server=true})
|
||||
local is_admin = minetest.check_player_privs(player, {server=true})
|
||||
|
||||
local pos = player:get_pos()
|
||||
local pname = player:get_player_name()
|
||||
|
|
|
@ -47,7 +47,7 @@ airutils.wind_selection_box = {
|
|||
local function get_smooth(angle_initial, reference, last_ref, value)
|
||||
local range = reference-last_ref
|
||||
local retVal = (value*angle_initial)/range
|
||||
retval = angle_initial - retVal
|
||||
local retval = angle_initial - retVal
|
||||
if retval < 0 then retval = 0 end
|
||||
return retval
|
||||
end
|
||||
|
@ -115,12 +115,11 @@ minetest.register_entity("airutils:wind_indicator",{
|
|||
end,
|
||||
|
||||
on_rightclick = function(self, clicker)
|
||||
local wind = airutils.get_wind(pos, 2.0)
|
||||
local wind = airutils.get_wind(self.object:get_pos(), 2.0)
|
||||
local wind_yaw = minetest.dir_to_yaw(wind)
|
||||
minetest.chat_send_player(clicker:get_player_name(),core.colorize('#00ff00', S(" >>> The wind direction now is @1", math.deg(wind_yaw))))
|
||||
return
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
@ -156,7 +155,6 @@ minetest.register_node("airutils:wind",{
|
|||
if not minetest.is_protected(pos, player_name) and not minetest.is_protected(pos, player_name) then
|
||||
minetest.set_node(pos, {name = "airutils:wind",param2 = 1 })
|
||||
minetest.add_entity({x=pos.x, y=pos.y, z=pos.z},"airutils:wind_indicator")
|
||||
local meta = minetest.get_meta(pos)
|
||||
if not (creative and creative.is_enabled_for and creative.is_enabled_for(player_name)) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
|
|
|
@ -29,7 +29,6 @@ function airutils.get_attached_entity(self)
|
|||
if not self._vehicle_custom_data then return nil, nil end
|
||||
if not self._vehicle_custom_data.simple_external_attach_entity then return nil, nil end
|
||||
|
||||
local entity_name = self._vehicle_custom_data.simple_external_attach_entity
|
||||
local inv_id = self._vehicle_custom_data.simple_external_attach_invid
|
||||
|
||||
local pos = self.object:get_pos()
|
||||
|
@ -85,7 +84,7 @@ function airutils.simple_external_attach(self, relative_pos, entity_name, radius
|
|||
attach_up = attach_up or false
|
||||
radius = radius or 12
|
||||
if self.object then
|
||||
local curr_ent, curr_obj = airutils.get_attached_entity(self)
|
||||
local curr_ent, _ = airutils.get_attached_entity(self)
|
||||
if curr_ent then return end
|
||||
|
||||
local pos = self.object:get_pos()
|
||||
|
@ -112,7 +111,6 @@ function airutils.restore_external_attach(self)
|
|||
|
||||
local pos = self.object:get_pos()
|
||||
local dest_pos = vector.new(pos)
|
||||
local entity_name = self._vehicle_custom_data.simple_external_attach_entity
|
||||
local relative_pos = self._vehicle_custom_data.simple_external_attach_pos
|
||||
local inv_id = self._vehicle_custom_data.simple_external_attach_invid
|
||||
dest_pos = vector.add(dest_pos, relative_pos)
|
||||
|
@ -126,7 +124,7 @@ function airutils.restore_external_attach(self)
|
|||
--minetest.chat_send_all(dump(ent.name))
|
||||
if ent._inv_id then
|
||||
--minetest.chat_send_all(">> "..dump(ent._inv_id).." >> "..dump(inv_id))
|
||||
if ent._inv_id == inv_id and (not (ent._inv_id == self._inv_id)) then
|
||||
if ent._inv_id == inv_id and ent._inv_id ~= self._inv_id then
|
||||
--minetest.chat_send_all("++ "..dump(ent._inv_id).." ++ "..dump(inv_id))
|
||||
local target_obj = nearby_objects[i]
|
||||
target_obj:set_pos(dest_pos)
|
||||
|
|
15
init.lua
15
init.lua
|
@ -300,15 +300,6 @@ end
|
|||
-- max_height: the max ceilling for the airplane
|
||||
-- wingspan: for ground effect calculation
|
||||
function airutils.getLiftAccel(self, velocity, accel, longit_speed, roll, curr_pos, in_lift, max_height, wingspan)
|
||||
local new_velocity = vector.new(velocity)
|
||||
if not self._min_collective then --ignore if it is an helicopter
|
||||
--add wind to the lift calcs
|
||||
local wind = airutils.get_wind(curr_pos, 5)
|
||||
local accel_wind = vector.subtract(accel, wind) --why? because I need to fake more speed when against the wind to gain lift
|
||||
local vel_wind = vector.multiply(accel_wind, self.dtime)
|
||||
new_velocity = vector.add(new_velocity, vel_wind)
|
||||
end
|
||||
|
||||
if longit_speed == nil then longit_speed = 0 end
|
||||
wingspan = wingspan or 10
|
||||
local lift = in_lift
|
||||
|
@ -439,7 +430,7 @@ function airutils.set_paint(self, puncher, itmstck, texture_name)
|
|||
else
|
||||
--painting with dyes
|
||||
local split = string.split(item_name, ":")
|
||||
local color, indx, _
|
||||
local indx, _
|
||||
if split[1] then _,indx = split[1]:find('dye') end
|
||||
if indx then
|
||||
--[[for clr,_ in pairs(airutils.colors) do
|
||||
|
@ -469,7 +460,7 @@ function airutils._set_name(self)
|
|||
if not airutils._use_signs_api then return end
|
||||
local l_textures = self.object:get_properties().textures --self.initial_properties.textures
|
||||
for _, texture in ipairs(l_textures) do
|
||||
indx = texture:find('airutils_name_canvas.png')
|
||||
local indx = texture:find('airutils_name_canvas.png')
|
||||
if indx then
|
||||
l_textures[_] = "airutils_name_canvas.png^"..airutils.convert_text_to_texture(self._ship_name, self._name_color or 0, self._name_hor_aligment or 0.8)
|
||||
end
|
||||
|
@ -606,7 +597,6 @@ minetest.register_chatcommand("ground_effect", {
|
|||
description = S("Enables/disables the ground effect (for debug purposes)"),
|
||||
privs = {server=true},
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if minetest.check_player_privs(name, {server=true}) then
|
||||
if param == "on" or param == "" then
|
||||
airutils.ground_effect_is_disabled = nil
|
||||
|
@ -626,7 +616,6 @@ minetest.register_chatcommand("show_lift", {
|
|||
description = S("Enables/disables the lift printing (for debug purposes)"),
|
||||
privs = {server=true},
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if minetest.check_player_privs(name, {server=true}) then
|
||||
if param == "on" or param == "" then
|
||||
airutils.show_lift = name
|
||||
|
|
|
@ -4,29 +4,6 @@ local S = airutils.S
|
|||
|
||||
dofile(minetest.get_modpath("airutils") .. DIR_DELIM .. "lib_planes" .. DIR_DELIM .. "utilities.lua")
|
||||
|
||||
local function floating_auto_correction(self, dtime)
|
||||
local factor = 1
|
||||
local range = 0.03 --above and bellow
|
||||
|
||||
if self._wing_configuration > self._stable_collective + range or
|
||||
self._wing_configuration < self._stable_collective - range then
|
||||
return
|
||||
end
|
||||
|
||||
--minetest.chat_send_player(self.driver_name, "antes: " .. self._air_float)
|
||||
if self._wing_configuration > self._stable_collective then factor = -1 end
|
||||
local time_correction = (dtime/airutils.ideal_step)
|
||||
if time_correction < 1 then time_correction = 1 end
|
||||
local intensity = 1
|
||||
local correction = (intensity*factor) * time_correction
|
||||
|
||||
local new_wing_configuration = self._wing_configuration + correction
|
||||
|
||||
self._wing_configuration = new_wing_configuration
|
||||
|
||||
--minetest.chat_send_all(dump(self._wing_configuration))
|
||||
end
|
||||
|
||||
local function set_yaw_by_mouse(self, dir)
|
||||
local rotation = self.object:get_rotation()
|
||||
local rot_y = math.deg(rotation.y)
|
||||
|
@ -62,7 +39,7 @@ function airutils.heli_control(self, dtime, hull_direction, longit_speed, longit
|
|||
local retval_accel = accel
|
||||
|
||||
local stop = false
|
||||
local ctrl = nil
|
||||
local ctrl
|
||||
|
||||
local time_correction = (dtime/airutils.ideal_step)
|
||||
if time_correction < 1 then time_correction = 1 end
|
||||
|
@ -80,10 +57,6 @@ function airutils.heli_control(self, dtime, hull_direction, longit_speed, longit
|
|||
if not self._lat_acceleration then self._lat_acceleration = 0 end
|
||||
|
||||
if self._engine_running then
|
||||
--engine acceleration calc
|
||||
|
||||
local factor = 1
|
||||
|
||||
--control lift
|
||||
local collective_up_max = 1.2
|
||||
local min_angle = self._min_collective
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
dofile(minetest.get_modpath("airutils") .. DIR_DELIM .. "lib_planes" .. DIR_DELIM .. "global_definitions.lua")
|
||||
|
||||
function engineSoundPlay(self, increment, base)
|
||||
local function engineSoundPlay(self, increment, base)
|
||||
increment = increment or 0.0
|
||||
--sound
|
||||
if self.sound_handle then minetest.sound_stop(self.sound_handle) end
|
||||
|
@ -24,7 +24,7 @@ local function engine_set_sound_and_animation(self, is_flying, newpitch, newroll
|
|||
end
|
||||
--self._cmd_snd
|
||||
if self._snd_last_cmd ~= self._cmd_snd then
|
||||
local increment = 0.0
|
||||
local increment
|
||||
self._snd_last_cmd = self._cmd_snd
|
||||
if self._cmd_snd then increment = 0.1 else increment = 0.0 end
|
||||
engineSoundPlay(self, increment, 0.9)
|
||||
|
@ -34,7 +34,7 @@ local function engine_set_sound_and_animation(self, is_flying, newpitch, newroll
|
|||
else
|
||||
if is_flying then --autorotation here
|
||||
if self._snd_last_cmd ~= self._cmd_snd then
|
||||
local increment = 0.0
|
||||
local increment
|
||||
self._snd_last_cmd = self._cmd_snd
|
||||
if self._cmd_snd then increment = 0.1 else increment = 0.0 end
|
||||
engineSoundPlay(self, increment, 0.6)
|
||||
|
@ -100,7 +100,6 @@ function airutils.logic_heli(self)
|
|||
local rotation = self.object:get_rotation()
|
||||
local yaw = rotation.y
|
||||
local newyaw=yaw
|
||||
local pitch = rotation.x
|
||||
local roll = rotation.z
|
||||
|
||||
local hull_direction = airutils.rot_to_dir(rotation) --minetest.yaw_to_dir(yaw)
|
||||
|
@ -118,7 +117,6 @@ function airutils.logic_heli(self)
|
|||
local accel = vector.add(longit_drag,later_drag)
|
||||
local stop = false
|
||||
|
||||
local node_bellow = airutils.nodeatpos(airutils.pos_shift(curr_pos,{y=-1.3}))
|
||||
local is_flying = true
|
||||
if self.colinfo then
|
||||
is_flying = (not self.colinfo.touching_ground)
|
||||
|
@ -290,7 +288,7 @@ function airutils.logic_heli(self)
|
|||
self._last_accell = new_accel
|
||||
self.object:move_to(curr_pos)
|
||||
--airutils.set_acceleration(self.object, new_accel)
|
||||
local limit = self._climb_speed
|
||||
--local limit = self._climb_speed
|
||||
--if new_accel.y > limit then new_accel.y = limit end --it isn't a rocket :/
|
||||
|
||||
else
|
||||
|
|
|
@ -11,7 +11,6 @@ function airutils.powerAdjust(self,dtime,factor,dir,max_power)
|
|||
local max = max_power or 100
|
||||
local add_factor = factor/2
|
||||
add_factor = add_factor * (dtime/airutils.ideal_step) --adjusting the command speed by dtime
|
||||
local power_index = self._power_lever
|
||||
|
||||
if dir == 1 then
|
||||
if self._power_lever < max then
|
||||
|
@ -150,8 +149,7 @@ function airutils.control(self, dtime, hull_direction, longit_speed, longit_drag
|
|||
|
||||
if longit_speed > 0 then
|
||||
if ctrl then
|
||||
if ctrl.right or ctrl.left then
|
||||
else
|
||||
if not (ctrl.right or ctrl.left) then
|
||||
airutils.rudder_auto_correction(self, longit_speed, dtime)
|
||||
end
|
||||
else
|
||||
|
@ -178,11 +176,9 @@ function airutils.set_pitch(self, dir, dtime)
|
|||
local multiplier = pitch_factor*(dtime/airutils.ideal_step)
|
||||
if dir == -1 then
|
||||
--minetest.chat_send_all("cabrando")
|
||||
if self._elevator_angle > 0 then pitch_factor = pitch_factor * 2 end
|
||||
self._elevator_angle = math.max(self._elevator_angle-multiplier,-self._elevator_limit)
|
||||
elseif dir == 1 then
|
||||
--minetest.chat_send_all("picando")
|
||||
if self._angle_of_attack < 0 then pitch_factor = 1 end --lets reduce the command power to avoid accidents
|
||||
self._elevator_angle = math.min(self._elevator_angle+multiplier,self._elevator_limit)
|
||||
end
|
||||
end
|
||||
|
@ -192,11 +188,9 @@ function airutils.set_autopilot_pitch(self, dir, dtime)
|
|||
local multiplier = pitch_factor*(dtime/airutils.ideal_step)
|
||||
if dir == -1 then
|
||||
--minetest.chat_send_all("cabrando")
|
||||
if self._elevator_angle > 0 then pitch_factor = pitch_factor * 2 end
|
||||
self._elevator_angle = math.max(self._elevator_angle-multiplier,-self._elevator_limit)
|
||||
elseif dir == 1 then
|
||||
--minetest.chat_send_all("picando")
|
||||
if self._angle_of_attack < 0 then pitch_factor = 1 end --lets reduce the command power to avoid accidents
|
||||
self._elevator_angle = math.min(self._elevator_angle+multiplier,self._elevator_limit)
|
||||
end
|
||||
end
|
||||
|
@ -243,22 +237,12 @@ function airutils.rudder_auto_correction(self, longit_speed, dtime)
|
|||
end
|
||||
end
|
||||
|
||||
--obsolete, will be removed
|
||||
function getAdjustFactor(curr_y, desired_y)
|
||||
local max_difference = 0.1
|
||||
local adjust_factor = 0.5
|
||||
local difference = math.abs(curr_y - desired_y)
|
||||
if difference > max_difference then difference = max_difference end
|
||||
return (difference * adjust_factor) / max_difference
|
||||
end
|
||||
|
||||
function airutils.autopilot(self, dtime, hull_direction, longit_speed, accel, curr_pos)
|
||||
|
||||
local retval_accel = accel
|
||||
|
||||
if not self._have_auto_pilot then return end
|
||||
|
||||
local max_autopilot_power = 85
|
||||
local max_attack_angle = 1.8
|
||||
|
||||
--climb
|
||||
|
|
|
@ -30,7 +30,6 @@ function airutils.physics(self)
|
|||
end
|
||||
|
||||
if self.isinliquid then
|
||||
local accell = {x=0, y=0, z=0}
|
||||
self.water_drag = 0.2
|
||||
self.isinliquid = true
|
||||
local height = self.height
|
||||
|
@ -38,7 +37,7 @@ function airutils.physics(self)
|
|||
-- local balance = self.buoyancy*self.height
|
||||
local buoyacc = airutils.gravity*(self.buoyancy-submergence)
|
||||
--local buoyacc = self._baloon_buoyancy*(self.buoyancy-submergence)
|
||||
accell = {
|
||||
local accell = {
|
||||
x=-vel.x*self.water_drag,
|
||||
y=buoyacc-(vel.y*math.abs(vel.y)*0.4),
|
||||
z=-vel.z*self.water_drag
|
||||
|
|
|
@ -280,7 +280,6 @@ function airutils.logic(self)
|
|||
local rotation = self.object:get_rotation()
|
||||
local yaw = rotation.y
|
||||
local newyaw=yaw
|
||||
local pitch = rotation.x
|
||||
local roll = rotation.z
|
||||
local newroll=roll
|
||||
newroll = math.floor(newroll/360)
|
||||
|
@ -411,11 +410,12 @@ function airutils.logic(self)
|
|||
|
||||
--is an stall, force a recover
|
||||
if longit_speed < (self._min_speed+0.5) and climb_rate < -1.5 and is_flying then
|
||||
--[[
|
||||
if player and self.driver_name then
|
||||
--minetest.chat_send_player(self.driver_name,core.colorize('#ff0000', " >>> STALL"))
|
||||
minetest.chat_send_player(self.driver_name,core.colorize('#ff0000', " >>> STALL"))
|
||||
end
|
||||
]]--
|
||||
self._elevator_angle = 0
|
||||
actuator_angle = 0
|
||||
self._angle_of_attack = -1
|
||||
newpitch = math.rad(self._angle_of_attack)
|
||||
else
|
||||
|
@ -516,7 +516,7 @@ function airutils.logic(self)
|
|||
--end accell
|
||||
|
||||
--get disconnected players
|
||||
if not self._autoflymode == true then
|
||||
if self._autoflymode ~= true then
|
||||
airutils.rescueConnectionFailedPassengers(self)
|
||||
end
|
||||
|
||||
|
@ -732,8 +732,7 @@ function airutils.on_punch(self, puncher, ttime, toolcaps, dir, damage)
|
|||
damage_vehicle(self, toolcaps, ttime, damage)
|
||||
end
|
||||
|
||||
local is_admin = false
|
||||
is_admin = minetest.check_player_privs(puncher, {server=true})
|
||||
local is_admin = minetest.check_player_privs(puncher, {server=true})
|
||||
if self.owner == nil then
|
||||
self.owner = name
|
||||
end
|
||||
|
@ -831,9 +830,9 @@ local function get_vehicle(self, player)
|
|||
local lua_ent = self.object:get_luaentity()
|
||||
local staticdata = lua_ent:get_staticdata(self)
|
||||
local obj_name = lua_ent.name
|
||||
local pos = self.object:get_pos()
|
||||
|
||||
local stack = ItemStack(obj_name)
|
||||
local max = stack:get_stack_max()
|
||||
local tool = false
|
||||
if stack:get_stack_max() == 1 then tool = true end
|
||||
|
||||
|
@ -886,8 +885,6 @@ function airutils.on_rightclick(self, clicker)
|
|||
|
||||
--minetest.chat_send_all(dump(self.driver_name))
|
||||
|
||||
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('name '.. dump(name) .. ' - pilot: ' .. dump(self.driver_name) .. ' - pax: ' .. dump(copilot_name))
|
||||
|
@ -946,8 +943,6 @@ function airutils.on_rightclick(self, clicker)
|
|||
if self.owner == name or minetest.check_player_privs(clicker, {protection_bypass=true}) then
|
||||
|
||||
local itmstck=clicker:get_wielded_item()
|
||||
local item_name = ""
|
||||
if itmstck then item_name = itmstck:get_name() end
|
||||
|
||||
if itmstck then
|
||||
if airutils.set_param_paint(self, clicker, itmstck, 2) == true then
|
||||
|
|
|
@ -101,7 +101,7 @@ function airutils.pilot_formspec(name)
|
|||
end
|
||||
|
||||
if ent._have_manual then
|
||||
basic_form = basic_form.."button[6,5.2;4,1;manual;" .. S("Manual") .. "]"
|
||||
basic_form = basic_form.."button[6,5.2;4,1;manual;" .. S("Manual") .. "]"
|
||||
expand_form = true
|
||||
end
|
||||
|
||||
|
@ -168,8 +168,6 @@ function airutils.adf_formspec(name)
|
|||
z = math.floor(ent._adf_destiny.z)
|
||||
end
|
||||
end
|
||||
else
|
||||
--return
|
||||
end
|
||||
|
||||
local basic_form = table.concat({
|
||||
|
@ -280,7 +278,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
airutils.attach_pax(ent, player)
|
||||
end
|
||||
if fields.go_out then
|
||||
local touching_ground, liquid_below = airutils.check_node_below(plane_obj, 2.5)
|
||||
local touching_ground, _ = airutils.check_node_below(plane_obj, 2.5)
|
||||
if ent.isinliquid or touching_ground then --isn't flying?
|
||||
airutils.dettach_pax(ent, player)
|
||||
else
|
||||
|
@ -308,12 +306,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
if fields.go_out then
|
||||
local touch_point = ent.initial_properties.collisionbox[2]-1.0
|
||||
-----////
|
||||
local is_on_ground = false
|
||||
local pos = plane_obj:get_pos()
|
||||
pos.y = pos.y + touch_point
|
||||
local node_below = minetest.get_node(pos).name
|
||||
local nodedef = minetest.registered_nodes[node_below]
|
||||
is_on_ground = not nodedef or nodedef.walkable or false -- unknown nodes are solid
|
||||
local is_on_ground = not nodedef or nodedef.walkable or false -- unknown nodes are solid
|
||||
|
||||
if ent.driver_name == name and ent.owner == ent.driver_name then --just the owner can do this
|
||||
--minetest.chat_send_all(dump(noded))
|
||||
|
|
|
@ -25,7 +25,7 @@ function airutils.loadFuel(self, player_name)
|
|||
self._energy = self._energy + fuel
|
||||
if self._energy > self._max_fuel then self._energy = self._max_fuel end
|
||||
|
||||
local energy_indicator_angle = airutils.get_gauge_angle(self._energy)
|
||||
--local energy_indicator_angle = airutils.get_gauge_angle(self._energy)
|
||||
--self.fuel_gauge:set_attach(self.object,'',self._gauge_fuel_position,{x=0,y=0,z=energy_indicator_angle})
|
||||
end
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
--[[
|
||||
local function get_pointer(pointer_angle, gauge_center_x, gauge_center_y, full_pointer)
|
||||
full_pointer = full_pointer or 1
|
||||
local retval = ""
|
||||
local ind_pixel = "airutils_ind_box_2.png"
|
||||
|
||||
pointer_img_size = 8
|
||||
local pointer_img_size = 8
|
||||
local pointer_rad = math.rad(pointer_angle)
|
||||
local dim = 2*(pointer_img_size/2)
|
||||
local pos_x = math.sin(pointer_rad) * dim
|
||||
|
@ -33,6 +34,7 @@ local function get_pointer(pointer_angle, gauge_center_x, gauge_center_y, full_p
|
|||
end
|
||||
return retval
|
||||
end
|
||||
]]--
|
||||
|
||||
function airutils.plot_altimeter_gauge(self, scale, place_x, place_y)
|
||||
local bg_width_height = 100
|
||||
|
|
|
@ -17,11 +17,3 @@ dofile(minetest.get_modpath("airutils") .. DIR_DELIM .. "lib_planes" .. DIR_DELI
|
|||
--
|
||||
-- items
|
||||
--
|
||||
|
||||
settings = Settings(minetest.get_worldpath() .. "/settings.conf")
|
||||
local function fetch_setting(name)
|
||||
local sname = name
|
||||
return settings and settings:get(sname) or minetest.settings:get(sname)
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -535,7 +535,6 @@ function airutils.testImpact(self, velocity, position)
|
|||
}, true)
|
||||
self.hp_max = self.hp_max - self._damage_by_wind_speed
|
||||
if self.driver_name then
|
||||
local player_name = self.driver_name
|
||||
airutils.setText(self, self._vehicle_name)
|
||||
end
|
||||
if self.hp_max < 0 then --if acumulated damage is greater than 50, adieu
|
||||
|
@ -751,7 +750,7 @@ function airutils.set_param_paint(self, puncher, itmstck, mode)
|
|||
else
|
||||
--painting with dyes
|
||||
local split = string.split(item_name, ":")
|
||||
local color, indx, _
|
||||
local indx, _
|
||||
if split[1] then _,indx = split[1]:find('dye') end
|
||||
if indx then
|
||||
self._skin = ""
|
||||
|
@ -879,7 +878,7 @@ end
|
|||
function airutils.paint_with_mask(self, colstr, target_texture, mask_texture)
|
||||
if colstr then
|
||||
self._color = colstr
|
||||
self._det_color = mask_colstr
|
||||
self._det_color = mask_colstr -- !!! accessing undefined variable mask_colstr
|
||||
local l_textures = self.initial_properties.textures
|
||||
for _, texture in ipairs(l_textures) do
|
||||
local indx = texture:find(target_texture)
|
||||
|
@ -904,7 +903,7 @@ function airutils.pid_controller(current_value, setpoint, last_error, d_time, kp
|
|||
local _error = setpoint - current_value
|
||||
local derivative = _error - last_error
|
||||
--local output = kpv*erro + (kpv/Tiv)*I + kpv*Tdv*((erro - erro_passado)/delta_t);
|
||||
if integrative == nil then integrative = 0 end
|
||||
if integrative == nil then integrative = 0 end -- !!! accessing undefined variable integrative
|
||||
integrative = integrative + (((_error + last_error)/delta_t)/2);
|
||||
local output = kp*_error + (kp/ti)*integrative + kp * td*((_error - last_error)/delta_t)
|
||||
last_error = _error
|
||||
|
@ -927,7 +926,6 @@ function airutils.add_smoke_trail(self, smoke_type)
|
|||
end
|
||||
|
||||
if self._smoke_spawner == nil then
|
||||
local radius = 1
|
||||
self._smoke_spawner = minetest.add_particlespawner({
|
||||
amount = 3,
|
||||
time = 0,
|
||||
|
@ -1044,7 +1042,7 @@ function airutils.add_blast_damage(pos, radius, damage_cal)
|
|||
}, nil)
|
||||
end
|
||||
for _, item in pairs(entity_drops) do
|
||||
add_drop(drops, item)
|
||||
add_drop(drops, item) -- !!! accessing undefined variable add_drop, drops
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1179,7 +1177,6 @@ end
|
|||
|
||||
function airutils.seats_update(self)
|
||||
if self.object then
|
||||
local pos = self.object:get_pos()
|
||||
if self._passengers_base then
|
||||
local max_seats = table.getn(self._passengers_base)
|
||||
for i=1, max_seats do
|
||||
|
@ -1324,8 +1321,6 @@ function airutils.destroyed_save_static_data(self)
|
|||
end
|
||||
|
||||
function airutils.destroyed_on_activate(self, staticdata, dtime_s)
|
||||
local pos = self.object:get_pos()
|
||||
|
||||
if staticdata ~= "" and staticdata ~= nil then
|
||||
local data = minetest.deserialize(staticdata) or {}
|
||||
self.owner = data.stored_owner
|
||||
|
@ -1354,7 +1349,6 @@ local function check_shared_by_time(self)
|
|||
end
|
||||
|
||||
function airutils.destroyed_open_inventory(self, clicker)
|
||||
local message = ""
|
||||
if not clicker or not clicker:is_player() then
|
||||
return
|
||||
end
|
||||
|
@ -1386,8 +1380,7 @@ function airutils.destroyed_on_punch(self, puncher, ttime, toolcaps, dir, damage
|
|||
local shared_by_time = check_shared_by_time(self)
|
||||
local pos = self.object:get_pos()
|
||||
|
||||
local is_admin = false
|
||||
is_admin = minetest.check_player_privs(puncher, {server=true})
|
||||
local is_admin = minetest.check_player_privs(puncher, {server=true})
|
||||
if shared_by_time == false then
|
||||
if self.owner and self.owner ~= name and self.owner ~= "" then
|
||||
if is_admin == false then return end
|
||||
|
|
|
@ -174,7 +174,7 @@ function airutils.stepfunc(self,dtime,colinfo)
|
|||
if self.logic then
|
||||
if self.view_range then self:sensefunc() end
|
||||
self:logic()
|
||||
execute_queues(self)
|
||||
execute_queues(self) -- !!! accessing undefined variable execute_queues
|
||||
end
|
||||
|
||||
self.lastvelocity = self.object:get_velocity()
|
||||
|
|
|
@ -3,8 +3,6 @@ local S = airutils.S
|
|||
airutils.pilot_textures = {"pilot_clothes1.png","pilot_clothes2.png","pilot_clothes3.png","pilot_clothes4.png",
|
||||
"pilot_novaskin_girl.png","pilot_novaskin_girl_steampunk.png","pilot_novaskin_girl_2.png","pilot_novaskin_girl_steampunk_2.png"}
|
||||
local skinsdb_mod_path = minetest.get_modpath("skinsdb")
|
||||
local backup = "airutils:bcp_last_skin"
|
||||
local curr_skin = "airutils:skin"
|
||||
|
||||
minetest.register_chatcommand("au_uniform", {
|
||||
func = function(name, param)
|
||||
|
@ -99,7 +97,7 @@ function airutils.set_player_skin(player, skin)
|
|||
else
|
||||
--remove texture
|
||||
local old_texture = player_meta:get_string("backup")
|
||||
if set_skin then
|
||||
if set_skin then -- !!! accessing undefined variable set_skin
|
||||
if player:get_attribute("set_skin:player_skin") ~= nil and player:get_attribute("set_skin:player_skin") ~= "" then
|
||||
old_texture = player:get_attribute("set_skin:player_skin")
|
||||
end
|
||||
|
|
4
text.lua
4
text.lua
|
@ -58,7 +58,7 @@ local function clamp_characters(text, max_lenght)
|
|||
local c = ""
|
||||
for i = 1, #new_string, 1 do
|
||||
c = string.sub(new_string,i,i)
|
||||
if not (c == control_char) then
|
||||
if c ~= control_char then
|
||||
count = count + 1
|
||||
end
|
||||
curr_index = i
|
||||
|
@ -71,7 +71,7 @@ local function clamp_characters(text, max_lenght)
|
|||
local control_order_curr_intex = 0
|
||||
for i = 1, #cutstring, 1 do
|
||||
c = string.sub(cutstring,i,i)
|
||||
if not (c == control_char) then
|
||||
if c ~= control_char then
|
||||
outputstring = outputstring .. (c or "")
|
||||
else
|
||||
control_order_curr_intex = control_order_curr_intex + 1
|
||||
|
|
|
@ -48,7 +48,7 @@ local function getTexturesFromItem(itemDef)
|
|||
end
|
||||
|
||||
--function to remove duplicates and invalid for textlist
|
||||
function filter_texture_names(list_to_test)
|
||||
local function filter_texture_names(list_to_test)
|
||||
local hash = {}
|
||||
local result = {}
|
||||
for _,v in ipairs(list_to_test) do
|
||||
|
@ -63,7 +63,7 @@ function filter_texture_names(list_to_test)
|
|||
end
|
||||
|
||||
-- Function to list all loaded textures
|
||||
function listLoadedTextures()
|
||||
local function listLoadedTextures()
|
||||
local loadedTextures = {}
|
||||
|
||||
--nodes
|
||||
|
|
Loading…
Add table
Reference in a new issue