diff --git a/Items/items.xml b/Items/items.xml index 688ed13..d5d25df 100644 --- a/Items/items.xml +++ b/Items/items.xml @@ -1,4 +1,4 @@ - + @@ -102,4 +102,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Lua/Autorun/autorun.lua b/Lua/Autorun/autorun.lua index 634a192..c2a5147 100644 --- a/Lua/Autorun/autorun.lua +++ b/Lua/Autorun/autorun.lua @@ -4,9 +4,10 @@ local moduleNames = { "countercomponent", -- "activecountercomponent", "reactorcontrollercomponent", + "enginecontrollercomponent", } -modPath = table.pack(...)[1] .. "/Lua/" +local modPath = table.pack(...)[1] .. "/Lua/" for _, moduleName in ipairs(moduleNames) do dofile(modPath .. moduleName .. ".lua") diff --git a/Lua/enginecontrollercomponent.lua b/Lua/enginecontrollercomponent.lua index a8c2315..88148b1 100644 --- a/Lua/enginecontrollercomponent.lua +++ b/Lua/enginecontrollercomponent.lua @@ -4,7 +4,7 @@ local defaultTable = { velocity_x_in = 0, current_velocity_x_in = 0, set_trm_target = 20, - set_trm_aggression = 600, + set_trm_aggression = 200, set_mode = 1, set_silent = 0, acceleration = 0, @@ -25,6 +25,10 @@ local signalReceived = function(signal, connection) local signalNum = tonumber(signal.value) or defaultTable[connection.Name] + if mem[connection.Name] == signalNum then + return + end + if connection.Name == "current_velocity_x_in" then mem.acceleration = (signalNum - mem.current_velocity_x_in) mem.current_velocity_x_in = signalNum @@ -32,11 +36,6 @@ local signalReceived = function(signal, connection) mem[connection.Name] = signalNum end - -- Skip signals for optimization - if connection.Name ~= "velocity_x_in" then - return - end - local main_force_out local boost_force_out @@ -50,8 +49,7 @@ local signalReceived = function(signal, connection) elseif mem.set_mode == 0 then local absolute_current_velocity = math.abs(mem.current_velocity_x_in) - - if mem.set_trm_target -0.25 < absolute_current_velocity and mem.velocity_x_in * mem.current_velocity_x_in > 0 then + if mem.set_trm_target - 0.25 < absolute_current_velocity and mem.velocity_x_in * mem.current_velocity_x_in > 0 then local target_acceleration = - (absolute_current_velocity * mem.set_trm_aggression) + (mem.set_trm_target * mem.set_trm_aggression) if math.abs(mem.velocity_x_in) > math.abs(target_acceleration) then diff --git a/Texts/en_us.xml b/Texts/en_us.xml index 3e4d91c..d56e206 100644 --- a/Texts/en_us.xml +++ b/Texts/en_us.xml @@ -1,4 +1,4 @@ - + Flip-Flop Component Switches state when receiving 1, forces state to X when receiving -X. @@ -14,4 +14,7 @@ Reactor Controller Component Automatically sets a reactor's Fission Rate and Turbine Output. + + Engine Controller Component + Sets an Engine's thrust according to the selected mode. diff --git a/filelist.xml b/filelist.xml index 48c4d57..517f427 100644 --- a/filelist.xml +++ b/filelist.xml @@ -10,4 +10,5 @@ +