mirror of
https://github.com/APercy/airutils.git
synced 2025-03-15 08:01:22 +00:00
Try to fix most warnings reported by luacheck
This commit is contained in:
parent
0f729daf5e
commit
3040a5c890
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
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
|
|
||||||
if listname == "src" then
|
if listname == "src" then
|
||||||
return stack:get_count()
|
return stack:get_count()
|
||||||
elseif listname == "dst" then
|
elseif listname == "dst" then
|
||||||
|
@ -154,10 +151,6 @@ minetest.register_node( module_name .. ":biofuel_distiller", {
|
||||||
return 0
|
return 0
|
||||||
end
|
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
|
if to_list == "src" then
|
||||||
return count
|
return count
|
||||||
elseif to_list == "dst" then
|
elseif to_list == "dst" then
|
||||||
|
|
|
@ -19,7 +19,6 @@ function airutils.PAPIplace(player,pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
local dir = minetest.dir_to_facedir(player:get_look_dir())
|
local dir = minetest.dir_to_facedir(player:get_look_dir())
|
||||||
local pos1 = vector.new(pos)
|
|
||||||
|
|
||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
if check_protection(pos, player_name) then
|
if check_protection(pos, player_name) then
|
||||||
|
@ -107,11 +106,6 @@ minetest.register_node("airutils:papi",{
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local itmstck=puncher:get_wielded_item()
|
|
||||||
local item_name = ""
|
|
||||||
if itmstck then item_name = itmstck:get_name() end
|
|
||||||
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -161,11 +155,6 @@ minetest.register_node("airutils:papi_right",{
|
||||||
if player_name ~= meta:get_string("owner") then
|
if player_name ~= meta:get_string("owner") then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local itmstck=puncher:get_wielded_item()
|
|
||||||
local item_name = ""
|
|
||||||
if itmstck then item_name = itmstck:get_name() end
|
|
||||||
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -50,8 +50,7 @@ minetest.register_tool("airutils:tug", {
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local is_admin = false
|
local is_admin = minetest.check_player_privs(player, {server=true})
|
||||||
is_admin = minetest.check_player_privs(player, {server=true})
|
|
||||||
|
|
||||||
local pos = player:get_pos()
|
local pos = player:get_pos()
|
||||||
local pname = player:get_player_name()
|
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 function get_smooth(angle_initial, reference, last_ref, value)
|
||||||
local range = reference-last_ref
|
local range = reference-last_ref
|
||||||
local retVal = (value*angle_initial)/range
|
local retVal = (value*angle_initial)/range
|
||||||
retval = angle_initial - retVal
|
local retval = angle_initial - retVal
|
||||||
if retval < 0 then retval = 0 end
|
if retval < 0 then retval = 0 end
|
||||||
return retval
|
return retval
|
||||||
end
|
end
|
||||||
|
@ -115,12 +115,11 @@ minetest.register_entity("airutils:wind_indicator",{
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_rightclick = function(self, clicker)
|
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)
|
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))))
|
minetest.chat_send_player(clicker:get_player_name(),core.colorize('#00ff00', S(" >>> The wind direction now is @1", math.deg(wind_yaw))))
|
||||||
return
|
return
|
||||||
end,
|
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
|
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.set_node(pos, {name = "airutils:wind",param2 = 1 })
|
||||||
minetest.add_entity({x=pos.x, y=pos.y, z=pos.z},"airutils:wind_indicator")
|
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
|
if not (creative and creative.is_enabled_for and creative.is_enabled_for(player_name)) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
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 then return nil, nil end
|
||||||
if not self._vehicle_custom_data.simple_external_attach_entity 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 inv_id = self._vehicle_custom_data.simple_external_attach_invid
|
||||||
|
|
||||||
local pos = self.object:get_pos()
|
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
|
attach_up = attach_up or false
|
||||||
radius = radius or 12
|
radius = radius or 12
|
||||||
if self.object then
|
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
|
if curr_ent then return end
|
||||||
|
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
|
@ -112,7 +111,6 @@ function airutils.restore_external_attach(self)
|
||||||
|
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
local dest_pos = vector.new(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 relative_pos = self._vehicle_custom_data.simple_external_attach_pos
|
||||||
local inv_id = self._vehicle_custom_data.simple_external_attach_invid
|
local inv_id = self._vehicle_custom_data.simple_external_attach_invid
|
||||||
dest_pos = vector.add(dest_pos, relative_pos)
|
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))
|
--minetest.chat_send_all(dump(ent.name))
|
||||||
if ent._inv_id then
|
if ent._inv_id then
|
||||||
--minetest.chat_send_all(">> "..dump(ent._inv_id).." >> "..dump(inv_id))
|
--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))
|
--minetest.chat_send_all("++ "..dump(ent._inv_id).." ++ "..dump(inv_id))
|
||||||
local target_obj = nearby_objects[i]
|
local target_obj = nearby_objects[i]
|
||||||
target_obj:set_pos(dest_pos)
|
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
|
-- max_height: the max ceilling for the airplane
|
||||||
-- wingspan: for ground effect calculation
|
-- wingspan: for ground effect calculation
|
||||||
function airutils.getLiftAccel(self, velocity, accel, longit_speed, roll, curr_pos, in_lift, max_height, wingspan)
|
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
|
if longit_speed == nil then longit_speed = 0 end
|
||||||
wingspan = wingspan or 10
|
wingspan = wingspan or 10
|
||||||
local lift = in_lift
|
local lift = in_lift
|
||||||
|
@ -439,7 +430,7 @@ function airutils.set_paint(self, puncher, itmstck, texture_name)
|
||||||
else
|
else
|
||||||
--painting with dyes
|
--painting with dyes
|
||||||
local split = string.split(item_name, ":")
|
local split = string.split(item_name, ":")
|
||||||
local color, indx, _
|
local indx, _
|
||||||
if split[1] then _,indx = split[1]:find('dye') end
|
if split[1] then _,indx = split[1]:find('dye') end
|
||||||
if indx then
|
if indx then
|
||||||
--[[for clr,_ in pairs(airutils.colors) do
|
--[[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
|
if not airutils._use_signs_api then return end
|
||||||
local l_textures = self.object:get_properties().textures --self.initial_properties.textures
|
local l_textures = self.object:get_properties().textures --self.initial_properties.textures
|
||||||
for _, texture in ipairs(l_textures) do
|
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
|
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)
|
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
|
end
|
||||||
|
@ -606,7 +597,6 @@ minetest.register_chatcommand("ground_effect", {
|
||||||
description = S("Enables/disables the ground effect (for debug purposes)"),
|
description = S("Enables/disables the ground effect (for debug purposes)"),
|
||||||
privs = {server=true},
|
privs = {server=true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local player = minetest.get_player_by_name(name)
|
|
||||||
if minetest.check_player_privs(name, {server=true}) then
|
if minetest.check_player_privs(name, {server=true}) then
|
||||||
if param == "on" or param == "" then
|
if param == "on" or param == "" then
|
||||||
airutils.ground_effect_is_disabled = nil
|
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)"),
|
description = S("Enables/disables the lift printing (for debug purposes)"),
|
||||||
privs = {server=true},
|
privs = {server=true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local player = minetest.get_player_by_name(name)
|
|
||||||
if minetest.check_player_privs(name, {server=true}) then
|
if minetest.check_player_privs(name, {server=true}) then
|
||||||
if param == "on" or param == "" then
|
if param == "on" or param == "" then
|
||||||
airutils.show_lift = name
|
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")
|
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 function set_yaw_by_mouse(self, dir)
|
||||||
local rotation = self.object:get_rotation()
|
local rotation = self.object:get_rotation()
|
||||||
local rot_y = math.deg(rotation.y)
|
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 retval_accel = accel
|
||||||
|
|
||||||
local stop = false
|
local stop = false
|
||||||
local ctrl = nil
|
local ctrl
|
||||||
|
|
||||||
local time_correction = (dtime/airutils.ideal_step)
|
local time_correction = (dtime/airutils.ideal_step)
|
||||||
if time_correction < 1 then time_correction = 1 end
|
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 not self._lat_acceleration then self._lat_acceleration = 0 end
|
||||||
|
|
||||||
if self._engine_running then
|
if self._engine_running then
|
||||||
--engine acceleration calc
|
|
||||||
|
|
||||||
local factor = 1
|
|
||||||
|
|
||||||
--control lift
|
--control lift
|
||||||
local collective_up_max = 1.2
|
local collective_up_max = 1.2
|
||||||
local min_angle = self._min_collective
|
local min_angle = self._min_collective
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
dofile(minetest.get_modpath("airutils") .. DIR_DELIM .. "lib_planes" .. DIR_DELIM .. "global_definitions.lua")
|
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
|
increment = increment or 0.0
|
||||||
--sound
|
--sound
|
||||||
if self.sound_handle then minetest.sound_stop(self.sound_handle) end
|
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
|
end
|
||||||
--self._cmd_snd
|
--self._cmd_snd
|
||||||
if self._snd_last_cmd ~= self._cmd_snd then
|
if self._snd_last_cmd ~= self._cmd_snd then
|
||||||
local increment = 0.0
|
local increment
|
||||||
self._snd_last_cmd = self._cmd_snd
|
self._snd_last_cmd = self._cmd_snd
|
||||||
if self._cmd_snd then increment = 0.1 else increment = 0.0 end
|
if self._cmd_snd then increment = 0.1 else increment = 0.0 end
|
||||||
engineSoundPlay(self, increment, 0.9)
|
engineSoundPlay(self, increment, 0.9)
|
||||||
|
@ -34,7 +34,7 @@ local function engine_set_sound_and_animation(self, is_flying, newpitch, newroll
|
||||||
else
|
else
|
||||||
if is_flying then --autorotation here
|
if is_flying then --autorotation here
|
||||||
if self._snd_last_cmd ~= self._cmd_snd then
|
if self._snd_last_cmd ~= self._cmd_snd then
|
||||||
local increment = 0.0
|
local increment
|
||||||
self._snd_last_cmd = self._cmd_snd
|
self._snd_last_cmd = self._cmd_snd
|
||||||
if self._cmd_snd then increment = 0.1 else increment = 0.0 end
|
if self._cmd_snd then increment = 0.1 else increment = 0.0 end
|
||||||
engineSoundPlay(self, increment, 0.6)
|
engineSoundPlay(self, increment, 0.6)
|
||||||
|
@ -100,7 +100,6 @@ function airutils.logic_heli(self)
|
||||||
local rotation = self.object:get_rotation()
|
local rotation = self.object:get_rotation()
|
||||||
local yaw = rotation.y
|
local yaw = rotation.y
|
||||||
local newyaw=yaw
|
local newyaw=yaw
|
||||||
local pitch = rotation.x
|
|
||||||
local roll = rotation.z
|
local roll = rotation.z
|
||||||
|
|
||||||
local hull_direction = airutils.rot_to_dir(rotation) --minetest.yaw_to_dir(yaw)
|
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 accel = vector.add(longit_drag,later_drag)
|
||||||
local stop = false
|
local stop = false
|
||||||
|
|
||||||
local node_bellow = airutils.nodeatpos(airutils.pos_shift(curr_pos,{y=-1.3}))
|
|
||||||
local is_flying = true
|
local is_flying = true
|
||||||
if self.colinfo then
|
if self.colinfo then
|
||||||
is_flying = (not self.colinfo.touching_ground)
|
is_flying = (not self.colinfo.touching_ground)
|
||||||
|
@ -290,7 +288,7 @@ function airutils.logic_heli(self)
|
||||||
self._last_accell = new_accel
|
self._last_accell = new_accel
|
||||||
self.object:move_to(curr_pos)
|
self.object:move_to(curr_pos)
|
||||||
--airutils.set_acceleration(self.object, new_accel)
|
--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 :/
|
--if new_accel.y > limit then new_accel.y = limit end --it isn't a rocket :/
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
|
@ -11,7 +11,6 @@ function airutils.powerAdjust(self,dtime,factor,dir,max_power)
|
||||||
local max = max_power or 100
|
local max = max_power or 100
|
||||||
local add_factor = factor/2
|
local add_factor = factor/2
|
||||||
add_factor = add_factor * (dtime/airutils.ideal_step) --adjusting the command speed by dtime
|
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 dir == 1 then
|
||||||
if self._power_lever < max 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 longit_speed > 0 then
|
||||||
if ctrl then
|
if ctrl then
|
||||||
if ctrl.right or ctrl.left then
|
if not (ctrl.right or ctrl.left) then
|
||||||
else
|
|
||||||
airutils.rudder_auto_correction(self, longit_speed, dtime)
|
airutils.rudder_auto_correction(self, longit_speed, dtime)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -178,11 +176,9 @@ function airutils.set_pitch(self, dir, dtime)
|
||||||
local multiplier = pitch_factor*(dtime/airutils.ideal_step)
|
local multiplier = pitch_factor*(dtime/airutils.ideal_step)
|
||||||
if dir == -1 then
|
if dir == -1 then
|
||||||
--minetest.chat_send_all("cabrando")
|
--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)
|
self._elevator_angle = math.max(self._elevator_angle-multiplier,-self._elevator_limit)
|
||||||
elseif dir == 1 then
|
elseif dir == 1 then
|
||||||
--minetest.chat_send_all("picando")
|
--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)
|
self._elevator_angle = math.min(self._elevator_angle+multiplier,self._elevator_limit)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -192,11 +188,9 @@ function airutils.set_autopilot_pitch(self, dir, dtime)
|
||||||
local multiplier = pitch_factor*(dtime/airutils.ideal_step)
|
local multiplier = pitch_factor*(dtime/airutils.ideal_step)
|
||||||
if dir == -1 then
|
if dir == -1 then
|
||||||
--minetest.chat_send_all("cabrando")
|
--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)
|
self._elevator_angle = math.max(self._elevator_angle-multiplier,-self._elevator_limit)
|
||||||
elseif dir == 1 then
|
elseif dir == 1 then
|
||||||
--minetest.chat_send_all("picando")
|
--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)
|
self._elevator_angle = math.min(self._elevator_angle+multiplier,self._elevator_limit)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -243,22 +237,12 @@ function airutils.rudder_auto_correction(self, longit_speed, dtime)
|
||||||
end
|
end
|
||||||
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)
|
function airutils.autopilot(self, dtime, hull_direction, longit_speed, accel, curr_pos)
|
||||||
|
|
||||||
local retval_accel = accel
|
local retval_accel = accel
|
||||||
|
|
||||||
if not self._have_auto_pilot then return end
|
if not self._have_auto_pilot then return end
|
||||||
|
|
||||||
local max_autopilot_power = 85
|
|
||||||
local max_attack_angle = 1.8
|
local max_attack_angle = 1.8
|
||||||
|
|
||||||
--climb
|
--climb
|
||||||
|
|
|
@ -30,7 +30,6 @@ function airutils.physics(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.isinliquid then
|
if self.isinliquid then
|
||||||
local accell = {x=0, y=0, z=0}
|
|
||||||
self.water_drag = 0.2
|
self.water_drag = 0.2
|
||||||
self.isinliquid = true
|
self.isinliquid = true
|
||||||
local height = self.height
|
local height = self.height
|
||||||
|
@ -38,7 +37,7 @@ function airutils.physics(self)
|
||||||
-- local balance = self.buoyancy*self.height
|
-- local balance = self.buoyancy*self.height
|
||||||
local buoyacc = airutils.gravity*(self.buoyancy-submergence)
|
local buoyacc = airutils.gravity*(self.buoyancy-submergence)
|
||||||
--local buoyacc = self._baloon_buoyancy*(self.buoyancy-submergence)
|
--local buoyacc = self._baloon_buoyancy*(self.buoyancy-submergence)
|
||||||
accell = {
|
local accell = {
|
||||||
x=-vel.x*self.water_drag,
|
x=-vel.x*self.water_drag,
|
||||||
y=buoyacc-(vel.y*math.abs(vel.y)*0.4),
|
y=buoyacc-(vel.y*math.abs(vel.y)*0.4),
|
||||||
z=-vel.z*self.water_drag
|
z=-vel.z*self.water_drag
|
||||||
|
|
|
@ -280,7 +280,6 @@ function airutils.logic(self)
|
||||||
local rotation = self.object:get_rotation()
|
local rotation = self.object:get_rotation()
|
||||||
local yaw = rotation.y
|
local yaw = rotation.y
|
||||||
local newyaw=yaw
|
local newyaw=yaw
|
||||||
local pitch = rotation.x
|
|
||||||
local roll = rotation.z
|
local roll = rotation.z
|
||||||
local newroll=roll
|
local newroll=roll
|
||||||
newroll = math.floor(newroll/360)
|
newroll = math.floor(newroll/360)
|
||||||
|
@ -411,11 +410,12 @@ function airutils.logic(self)
|
||||||
|
|
||||||
--is an stall, force a recover
|
--is an stall, force a recover
|
||||||
if longit_speed < (self._min_speed+0.5) and climb_rate < -1.5 and is_flying then
|
if longit_speed < (self._min_speed+0.5) and climb_rate < -1.5 and is_flying then
|
||||||
|
--[[
|
||||||
if player and self.driver_name 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
|
end
|
||||||
|
]]--
|
||||||
self._elevator_angle = 0
|
self._elevator_angle = 0
|
||||||
actuator_angle = 0
|
|
||||||
self._angle_of_attack = -1
|
self._angle_of_attack = -1
|
||||||
newpitch = math.rad(self._angle_of_attack)
|
newpitch = math.rad(self._angle_of_attack)
|
||||||
else
|
else
|
||||||
|
@ -516,7 +516,7 @@ function airutils.logic(self)
|
||||||
--end accell
|
--end accell
|
||||||
|
|
||||||
--get disconnected players
|
--get disconnected players
|
||||||
if not self._autoflymode == true then
|
if self._autoflymode ~= true then
|
||||||
airutils.rescueConnectionFailedPassengers(self)
|
airutils.rescueConnectionFailedPassengers(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -732,8 +732,7 @@ function airutils.on_punch(self, puncher, ttime, toolcaps, dir, damage)
|
||||||
damage_vehicle(self, toolcaps, ttime, damage)
|
damage_vehicle(self, toolcaps, ttime, damage)
|
||||||
end
|
end
|
||||||
|
|
||||||
local is_admin = false
|
local is_admin = minetest.check_player_privs(puncher, {server=true})
|
||||||
is_admin = minetest.check_player_privs(puncher, {server=true})
|
|
||||||
if self.owner == nil then
|
if self.owner == nil then
|
||||||
self.owner = name
|
self.owner = name
|
||||||
end
|
end
|
||||||
|
@ -831,9 +830,9 @@ local function get_vehicle(self, player)
|
||||||
local lua_ent = self.object:get_luaentity()
|
local lua_ent = self.object:get_luaentity()
|
||||||
local staticdata = lua_ent:get_staticdata(self)
|
local staticdata = lua_ent:get_staticdata(self)
|
||||||
local obj_name = lua_ent.name
|
local obj_name = lua_ent.name
|
||||||
|
local pos = self.object:get_pos()
|
||||||
|
|
||||||
local stack = ItemStack(obj_name)
|
local stack = ItemStack(obj_name)
|
||||||
local max = stack:get_stack_max()
|
|
||||||
local tool = false
|
local tool = false
|
||||||
if stack:get_stack_max() == 1 then tool = true end
|
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))
|
--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)
|
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))
|
--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
|
if self.owner == name or minetest.check_player_privs(clicker, {protection_bypass=true}) then
|
||||||
|
|
||||||
local itmstck=clicker:get_wielded_item()
|
local itmstck=clicker:get_wielded_item()
|
||||||
local item_name = ""
|
|
||||||
if itmstck then item_name = itmstck:get_name() end
|
|
||||||
|
|
||||||
if itmstck then
|
if itmstck then
|
||||||
if airutils.set_param_paint(self, clicker, itmstck, 2) == true then
|
if airutils.set_param_paint(self, clicker, itmstck, 2) == true then
|
||||||
|
|
|
@ -168,8 +168,6 @@ function airutils.adf_formspec(name)
|
||||||
z = math.floor(ent._adf_destiny.z)
|
z = math.floor(ent._adf_destiny.z)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
|
||||||
--return
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local basic_form = table.concat({
|
local basic_form = table.concat({
|
||||||
|
@ -280,7 +278,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
airutils.attach_pax(ent, player)
|
airutils.attach_pax(ent, player)
|
||||||
end
|
end
|
||||||
if fields.go_out then
|
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?
|
if ent.isinliquid or touching_ground then --isn't flying?
|
||||||
airutils.dettach_pax(ent, player)
|
airutils.dettach_pax(ent, player)
|
||||||
else
|
else
|
||||||
|
@ -308,12 +306,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
if fields.go_out then
|
if fields.go_out then
|
||||||
local touch_point = ent.initial_properties.collisionbox[2]-1.0
|
local touch_point = ent.initial_properties.collisionbox[2]-1.0
|
||||||
-----////
|
-----////
|
||||||
local is_on_ground = false
|
|
||||||
local pos = plane_obj:get_pos()
|
local pos = plane_obj:get_pos()
|
||||||
pos.y = pos.y + touch_point
|
pos.y = pos.y + touch_point
|
||||||
local node_below = minetest.get_node(pos).name
|
local node_below = minetest.get_node(pos).name
|
||||||
local nodedef = minetest.registered_nodes[node_below]
|
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
|
if ent.driver_name == name and ent.owner == ent.driver_name then --just the owner can do this
|
||||||
--minetest.chat_send_all(dump(noded))
|
--minetest.chat_send_all(dump(noded))
|
||||||
|
|
|
@ -25,7 +25,7 @@ function airutils.loadFuel(self, player_name)
|
||||||
self._energy = self._energy + fuel
|
self._energy = self._energy + fuel
|
||||||
if self._energy > self._max_fuel then self._energy = self._max_fuel end
|
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})
|
--self.fuel_gauge:set_attach(self.object,'',self._gauge_fuel_position,{x=0,y=0,z=energy_indicator_angle})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
|
--[[
|
||||||
local function get_pointer(pointer_angle, gauge_center_x, gauge_center_y, full_pointer)
|
local function get_pointer(pointer_angle, gauge_center_x, gauge_center_y, full_pointer)
|
||||||
full_pointer = full_pointer or 1
|
full_pointer = full_pointer or 1
|
||||||
local retval = ""
|
local retval = ""
|
||||||
local ind_pixel = "airutils_ind_box_2.png"
|
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 pointer_rad = math.rad(pointer_angle)
|
||||||
local dim = 2*(pointer_img_size/2)
|
local dim = 2*(pointer_img_size/2)
|
||||||
local pos_x = math.sin(pointer_rad) * dim
|
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
|
end
|
||||||
return retval
|
return retval
|
||||||
end
|
end
|
||||||
|
]]--
|
||||||
|
|
||||||
function airutils.plot_altimeter_gauge(self, scale, place_x, place_y)
|
function airutils.plot_altimeter_gauge(self, scale, place_x, place_y)
|
||||||
local bg_width_height = 100
|
local bg_width_height = 100
|
||||||
|
|
|
@ -17,11 +17,3 @@ dofile(minetest.get_modpath("airutils") .. DIR_DELIM .. "lib_planes" .. DIR_DELI
|
||||||
--
|
--
|
||||||
-- items
|
-- 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)
|
}, true)
|
||||||
self.hp_max = self.hp_max - self._damage_by_wind_speed
|
self.hp_max = self.hp_max - self._damage_by_wind_speed
|
||||||
if self.driver_name then
|
if self.driver_name then
|
||||||
local player_name = self.driver_name
|
|
||||||
airutils.setText(self, self._vehicle_name)
|
airutils.setText(self, self._vehicle_name)
|
||||||
end
|
end
|
||||||
if self.hp_max < 0 then --if acumulated damage is greater than 50, adieu
|
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
|
else
|
||||||
--painting with dyes
|
--painting with dyes
|
||||||
local split = string.split(item_name, ":")
|
local split = string.split(item_name, ":")
|
||||||
local color, indx, _
|
local indx, _
|
||||||
if split[1] then _,indx = split[1]:find('dye') end
|
if split[1] then _,indx = split[1]:find('dye') end
|
||||||
if indx then
|
if indx then
|
||||||
self._skin = ""
|
self._skin = ""
|
||||||
|
@ -879,7 +878,7 @@ end
|
||||||
function airutils.paint_with_mask(self, colstr, target_texture, mask_texture)
|
function airutils.paint_with_mask(self, colstr, target_texture, mask_texture)
|
||||||
if colstr then
|
if colstr then
|
||||||
self._color = colstr
|
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
|
local l_textures = self.initial_properties.textures
|
||||||
for _, texture in ipairs(l_textures) do
|
for _, texture in ipairs(l_textures) do
|
||||||
local indx = texture:find(target_texture)
|
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 _error = setpoint - current_value
|
||||||
local derivative = _error - last_error
|
local derivative = _error - last_error
|
||||||
--local output = kpv*erro + (kpv/Tiv)*I + kpv*Tdv*((erro - erro_passado)/delta_t);
|
--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);
|
integrative = integrative + (((_error + last_error)/delta_t)/2);
|
||||||
local output = kp*_error + (kp/ti)*integrative + kp * td*((_error - last_error)/delta_t)
|
local output = kp*_error + (kp/ti)*integrative + kp * td*((_error - last_error)/delta_t)
|
||||||
last_error = _error
|
last_error = _error
|
||||||
|
@ -927,7 +926,6 @@ function airutils.add_smoke_trail(self, smoke_type)
|
||||||
end
|
end
|
||||||
|
|
||||||
if self._smoke_spawner == nil then
|
if self._smoke_spawner == nil then
|
||||||
local radius = 1
|
|
||||||
self._smoke_spawner = minetest.add_particlespawner({
|
self._smoke_spawner = minetest.add_particlespawner({
|
||||||
amount = 3,
|
amount = 3,
|
||||||
time = 0,
|
time = 0,
|
||||||
|
@ -1044,7 +1042,7 @@ function airutils.add_blast_damage(pos, radius, damage_cal)
|
||||||
}, nil)
|
}, nil)
|
||||||
end
|
end
|
||||||
for _, item in pairs(entity_drops) do
|
for _, item in pairs(entity_drops) do
|
||||||
add_drop(drops, item)
|
add_drop(drops, item) -- !!! accessing undefined variable add_drop, drops
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1179,7 +1177,6 @@ end
|
||||||
|
|
||||||
function airutils.seats_update(self)
|
function airutils.seats_update(self)
|
||||||
if self.object then
|
if self.object then
|
||||||
local pos = self.object:get_pos()
|
|
||||||
if self._passengers_base then
|
if self._passengers_base then
|
||||||
local max_seats = table.getn(self._passengers_base)
|
local max_seats = table.getn(self._passengers_base)
|
||||||
for i=1, max_seats do
|
for i=1, max_seats do
|
||||||
|
@ -1324,8 +1321,6 @@ function airutils.destroyed_save_static_data(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
function airutils.destroyed_on_activate(self, staticdata, dtime_s)
|
function airutils.destroyed_on_activate(self, staticdata, dtime_s)
|
||||||
local pos = self.object:get_pos()
|
|
||||||
|
|
||||||
if staticdata ~= "" and staticdata ~= nil then
|
if staticdata ~= "" and staticdata ~= nil then
|
||||||
local data = minetest.deserialize(staticdata) or {}
|
local data = minetest.deserialize(staticdata) or {}
|
||||||
self.owner = data.stored_owner
|
self.owner = data.stored_owner
|
||||||
|
@ -1354,7 +1349,6 @@ local function check_shared_by_time(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
function airutils.destroyed_open_inventory(self, clicker)
|
function airutils.destroyed_open_inventory(self, clicker)
|
||||||
local message = ""
|
|
||||||
if not clicker or not clicker:is_player() then
|
if not clicker or not clicker:is_player() then
|
||||||
return
|
return
|
||||||
end
|
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 shared_by_time = check_shared_by_time(self)
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
|
|
||||||
local is_admin = false
|
local is_admin = minetest.check_player_privs(puncher, {server=true})
|
||||||
is_admin = minetest.check_player_privs(puncher, {server=true})
|
|
||||||
if shared_by_time == false then
|
if shared_by_time == false then
|
||||||
if self.owner and self.owner ~= name and self.owner ~= "" then
|
if self.owner and self.owner ~= name and self.owner ~= "" then
|
||||||
if is_admin == false then return end
|
if is_admin == false then return end
|
||||||
|
|
|
@ -174,7 +174,7 @@ function airutils.stepfunc(self,dtime,colinfo)
|
||||||
if self.logic then
|
if self.logic then
|
||||||
if self.view_range then self:sensefunc() end
|
if self.view_range then self:sensefunc() end
|
||||||
self:logic()
|
self:logic()
|
||||||
execute_queues(self)
|
execute_queues(self) -- !!! accessing undefined variable execute_queues
|
||||||
end
|
end
|
||||||
|
|
||||||
self.lastvelocity = self.object:get_velocity()
|
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",
|
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"}
|
"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 skinsdb_mod_path = minetest.get_modpath("skinsdb")
|
||||||
local backup = "airutils:bcp_last_skin"
|
|
||||||
local curr_skin = "airutils:skin"
|
|
||||||
|
|
||||||
minetest.register_chatcommand("au_uniform", {
|
minetest.register_chatcommand("au_uniform", {
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
|
@ -99,7 +97,7 @@ function airutils.set_player_skin(player, skin)
|
||||||
else
|
else
|
||||||
--remove texture
|
--remove texture
|
||||||
local old_texture = player_meta:get_string("backup")
|
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
|
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")
|
old_texture = player:get_attribute("set_skin:player_skin")
|
||||||
end
|
end
|
||||||
|
|
4
text.lua
4
text.lua
|
@ -58,7 +58,7 @@ local function clamp_characters(text, max_lenght)
|
||||||
local c = ""
|
local c = ""
|
||||||
for i = 1, #new_string, 1 do
|
for i = 1, #new_string, 1 do
|
||||||
c = string.sub(new_string,i,i)
|
c = string.sub(new_string,i,i)
|
||||||
if not (c == control_char) then
|
if c ~= control_char then
|
||||||
count = count + 1
|
count = count + 1
|
||||||
end
|
end
|
||||||
curr_index = i
|
curr_index = i
|
||||||
|
@ -71,7 +71,7 @@ local function clamp_characters(text, max_lenght)
|
||||||
local control_order_curr_intex = 0
|
local control_order_curr_intex = 0
|
||||||
for i = 1, #cutstring, 1 do
|
for i = 1, #cutstring, 1 do
|
||||||
c = string.sub(cutstring,i,i)
|
c = string.sub(cutstring,i,i)
|
||||||
if not (c == control_char) then
|
if c ~= control_char then
|
||||||
outputstring = outputstring .. (c or "")
|
outputstring = outputstring .. (c or "")
|
||||||
else
|
else
|
||||||
control_order_curr_intex = control_order_curr_intex + 1
|
control_order_curr_intex = control_order_curr_intex + 1
|
||||||
|
|
|
@ -48,7 +48,7 @@ local function getTexturesFromItem(itemDef)
|
||||||
end
|
end
|
||||||
|
|
||||||
--function to remove duplicates and invalid for textlist
|
--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 hash = {}
|
||||||
local result = {}
|
local result = {}
|
||||||
for _,v in ipairs(list_to_test) do
|
for _,v in ipairs(list_to_test) do
|
||||||
|
@ -63,7 +63,7 @@ function filter_texture_names(list_to_test)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Function to list all loaded textures
|
-- Function to list all loaded textures
|
||||||
function listLoadedTextures()
|
local function listLoadedTextures()
|
||||||
local loadedTextures = {}
|
local loadedTextures = {}
|
||||||
|
|
||||||
--nodes
|
--nodes
|
||||||
|
|
Loading…
Add table
Reference in a new issue