added some recomended fixes by Niklp09

This commit is contained in:
Alexsandro Percy 2024-10-05 11:14:15 -03:00
parent d4dae8b104
commit 99f0b94cd9
3 changed files with 11 additions and 9 deletions

View File

@ -875,10 +875,12 @@ function airutils.param_paint(self, colstr, colstr_2)
end
end
function airutils.paint_with_mask(self, colstr, target_texture, mask_texture)
function airutils.paint_with_mask(self, colstr, target_texture, mask_texture, mask_colstr)
if colstr then
self._color = colstr
self._det_color = mask_colstr -- !!! accessing undefined variable mask_colstr
if mask_colstr then
self._det_color = mask_colstr
end
local l_textures = self.initial_properties.textures
for _, texture in ipairs(l_textures) do
local indx = texture:find(target_texture)
@ -891,7 +893,7 @@ function airutils.paint_with_mask(self, colstr, target_texture, mask_texture)
end
end
function airutils.pid_controller(current_value, setpoint, last_error, d_time, kp, ki, kd)
function airutils.pid_controller(current_value, setpoint, last_error, d_time, kp, ki, kd, integrative)
kp = kp or 0
ki = ki or 0.00000000000001
kd = kd or 0.005
@ -903,7 +905,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 -- !!! accessing undefined variable integrative
if integrative == nil then integrative = 0 end
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
@ -1041,9 +1043,9 @@ function airutils.add_blast_damage(pos, radius, damage_cal)
damage_groups = {fleshy = damage},
}, nil)
end
for _, item in pairs(entity_drops) do
--[[for _, item in pairs(entity_drops) do
add_drop(drops, item) -- !!! accessing undefined variable add_drop, drops
end
end]]--
end
end

View File

@ -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) -- !!! accessing undefined variable execute_queues
--execute_queues(self)
end
self.lastvelocity = self.object:get_velocity()

View File

@ -97,11 +97,11 @@ function airutils.set_player_skin(player, skin)
else
--remove texture
local old_texture = player_meta:get_string("backup")
if set_skin then -- !!! accessing undefined variable set_skin
if set_skin then --checking if set_skin is available (not using an optional dependency, just checking if it exists)
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
elseif wardrobe then
elseif wardrobe then --checking if wardrobe is available (not using an optional dependency, just checking if it exists)
if wardrobe.playerSkins then
if wardrobe.playerSkins[name] ~= nil then
old_texture = wardrobe.playerSkins[name]