Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if warpdriveCommons then os.unloadAPI("warpdriveCommons") end
- if not os.loadAPI("warpdrive/warpdriveCommons") then error("missing warpdriveCommons") end
- local w = warpdriveCommons.w
- local data
- ----------- Ship support
- local ship
- local ship_front = 0
- local ship_right = 0
- local ship_up = 0
- local ship_back = 0
- local ship_left = 0
- local ship_down = 0
- local ship_isInHyper = false
- local ship_x, ship_y, ship_z = 0, 0, 0
- local ship_xTarget, ship_yTarget, ship_zTarget = 0, 0, 0
- local ship_actualDistance = 0
- local ship_energyRequired = 0
- local ship_movement = { 0, 0, 0 }
- local ship_rotationSteps = 0
- local ship_indexPlayer = 0
- local ship_arrayPlayers = { }
- local ship_indexTarget = 0
- function ship_read(parData)
- data = parData
- end
- function ship_name(parName)
- if ship == nil or ship.isInterfaced() == nil then
- return ''
- end
- return ship.name(parName)
- end
- function ship_boot()
- if ship == nil or ship.isInterfaced() == nil then
- return
- end
- w.setColorNormal()
- w.writeLn("Booting Ship")
- w.write("- acquiring parameters: ")
- ship_front, ship_right, ship_up = ship.dim_positive()
- ship_back, ship_left, ship_down = ship.dim_negative()
- ship_isInHyper = ship.isInHyperspace()
- ship_movement = { ship.movement() }
- ship_rotationSteps = ship.rotationSteps()
- w.setColorSuccess()
- w.writeLn("ok")
- w.setColorNormal()
- w.write("- checking assembly : ")
- local timeout = 10
- local isValid, message
- repeat
- isValid, message = ship.getAssemblyStatus()
- w.sleep(0.05)
- timeout = timeout - 1
- until isValid == true or timeout < 0
- if timeout < 0 then
- w.setColorWarning()
- w.writeLn("failed")
- w.writeLn(message)
- w.setColorNormal()
- w.sleep(6)
- -- don't reboot as the player might need to set new dimensions to fix it
- else
- w.setColorSuccess()
- w.writeLn("passed")
- end
- w.sleep(0.2)
- w.setColorNormal()
- w.write("- celestial position : ")
- timeout = 10
- local pos
- repeat
- pos = ship.getLocalPosition()
- w.sleep(0.05)
- timeout = timeout - 1
- until pos ~= nil or timeout < 0
- if timeout < 0 then
- w.setColorWarning()
- w.writeLn("failed")
- w.writeLn("")
- w.writeLn("Something is wrong here, rebooting...")
- w.setColorNormal()
- w.sleep(2)
- w.reboot()
- else
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement