Fixed #61 ship controller script not booting

This commit is contained in:
LemADEC 2015-08-16 22:48:23 +02:00
parent 6841e99e11
commit 405ef74516

View file

@ -115,7 +115,7 @@ function CalcRealDistance()
if IsInHyper then if IsInHyper then
RealDistance = SData.Distance * 100 RealDistance = SData.Distance * 100
MinimumDistance = 1 MinimumDistance = 1
JumpCost = (1000 * Weight) + (1000 * SData.Distance) JumpCost = (1000 * weight) + (1000 * SData.Distance)
else else
if SData.Direction == 1 or SData.Direction == 2 then if SData.Direction == 1 or SData.Direction == 2 then
MinimumDistance = GUp + GDown MinimumDistance = GUp + GDown
@ -128,7 +128,7 @@ function CalcRealDistance()
RealDistance = SData.Distance + MinimumDistance RealDistance = SData.Distance + MinimumDistance
end end
MinimumDistance = MinimumDistance + 1 MinimumDistance = MinimumDistance + 1
JumpCost = (10 * Weight) + (100 * SData.Distance) JumpCost = (10 * weight) + (100 * SData.Distance)
end end
end end
@ -175,7 +175,7 @@ function ShowInfo()
Show("Dimensions:") Show("Dimensions:")
Show(" Front, Right, Up = "..GFront..", "..GRight..", "..GUp) Show(" Front, Right, Up = "..GFront..", "..GRight..", "..GUp)
Show(" Back, Left, Down = "..GBack..", "..GLeft..", "..GDown) Show(" Back, Left, Down = "..GBack..", "..GLeft..", "..GDown)
Show(" Size = "..Weight.." blocks") Show(" Size = "..weight.." blocks")
Show("Warp data:") Show("Warp data:")
ShowDirection() ShowDirection()
local dest = CalcNewCoords(X, Y, Z) local dest = CalcNewCoords(X, Y, Z)
@ -288,7 +288,7 @@ function SetDimensions()
term.write("Setting dimensions...") term.write("Setting dimensions...")
warp.dim_positive(GFront, GRight, GUp) warp.dim_positive(GFront, GRight, GUp)
warp.dim_negative(GBack, GLeft, GDown) warp.dim_negative(GBack, GLeft, GDown)
Weight = warp.getShipSize() weight = warp.getShipSize()
end end
function Summon() function Summon()
@ -410,13 +410,13 @@ X, Y, Z = warp.pos()
repeat repeat
sleep(0.3) sleep(0.3)
isAttached = warp.isAttached() isAttached = warp.isAttached()
until not isAttached until isAttached
print("Ship core linked...") print("Ship core linked...")
repeat repeat
sleep(0.3) sleep(0.3)
Weight = warp.getShipSize() weight = warp.getShipSize()
until Weight ~= nil until weight ~= nil
print("Ship weight updated...") print("Ship weight updated...")
CalcRealDistance() CalcRealDistance()