add nil check for rotator thrusters with nil transmissions
This commit is contained in:
5
main.lua
5
main.lua
@@ -663,6 +663,11 @@ function SetThrusterPower(thruster, power)
|
|||||||
if thruster.type == "rotator" then
|
if thruster.type == "rotator" then
|
||||||
thruster.power = power
|
thruster.power = power
|
||||||
local actualPower = 0
|
local actualPower = 0
|
||||||
|
if thruster.transmission == nil then
|
||||||
|
print("ERROR: SetThrusterPower called with nil transmission for rotator thruster.")
|
||||||
|
print("Thruster: "..thruster.name)
|
||||||
|
return
|
||||||
|
end
|
||||||
if peripheral.getType(peripheral.wrap(thruster.transmission)) == "Create_RotationSpeedController" then
|
if peripheral.getType(peripheral.wrap(thruster.transmission)) == "Create_RotationSpeedController" then
|
||||||
if (math.ceil(power*256) - power*256 <= 0.5) then
|
if (math.ceil(power*256) - power*256 <= 0.5) then
|
||||||
actualPower = math.ceil(power*256)
|
actualPower = math.ceil(power*256)
|
||||||
|
|||||||
Reference in New Issue
Block a user