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