hopefully fix nil reference error related to propeller transmissions

This commit is contained in:
2026-06-29 14:02:58 -05:00
parent a9f483a05d
commit e13ae84aae

View File

@@ -255,7 +255,7 @@ function PropellerInit()
Thrusters[peripheral.getName(pv)] = { Thrusters[peripheral.getName(pv)] = {
type = "rotator", type = "rotator",
thruster = pv, thruster = pv,
transmission = tv, transmission = peripheral.wrap(tv),
--[[ --[[
NOTE: NOTE:
affectVectors will have values depending on how the thruster's affectVectors will have values depending on how the thruster's
@@ -289,7 +289,7 @@ function PropellerInit()
Thrusters[peripheral.getName(pv)].type = "rotator" Thrusters[peripheral.getName(pv)].type = "rotator"
end end
Thrusters[peripheral.getName(pv)].thruster = pv Thrusters[peripheral.getName(pv)].thruster = pv
Thrusters[peripheral.getName(pv)].transmission = tv Thrusters[peripheral.getName(pv)].transmission = peripheral.wrap(tv)
if Thrusters[peripheral.getName(pv)].affectVectors == nil then if Thrusters[peripheral.getName(pv)].affectVectors == nil then
Thrusters[peripheral.getName(pv)].affectVectors = {} Thrusters[peripheral.getName(pv)].affectVectors = {}
end end
@@ -455,7 +455,7 @@ local function partiallyUpdateThrusters(thrusterList)
local transmissions = peripheral.find(tt) local transmissions = peripheral.find(tt)
for _, t in ipairs(transmissions) do for _, t in ipairs(transmissions) do
if tv.getSubnetworkAnchorId() == t.getSelfId() then if tv.getSubnetworkAnchorId() == t.getSelfId() then
thisThruster.transmission = t thisThruster.transmission = peripheral.getName(t)
end end
end end
end end
@@ -659,7 +659,7 @@ 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 peripheral.getType(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)
end end
@@ -669,7 +669,7 @@ function SetThrusterPower(thruster, power)
thruster.transmission.setTargetSpeed(actualPower) thruster.transmission.setTargetSpeed(actualPower)
end end
if peripheral.getType(thruster.transmission) == "analog_transmission" then if peripheral.getType(peripheral.wrap(thruster.transmission)) == "analog_transmission" then
if (math.ceil(power*15) - power*15) <= 0.5 then if (math.ceil(power*15) - power*15) <= 0.5 then
actualPower = math.ceil(power*15) actualPower = math.ceil(power*15)
end end
@@ -684,7 +684,7 @@ function SetThrusterPower(thruster, power)
actualPower = actualPower - 1 actualPower = actualPower - 1
end end
thruster.transmission.setSignal(actualPower) peripheral.wrap(thruster.transmission).setSignal(actualPower)
end end
end end