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