shipannunciator.lua
ShipAnnunciator = {}
function ShipAnnunciator:new()
ShipAnnunciator.__index = ShipAnnunciator
local self = setmetatable({}, ShipAnnunciator)
self.container = Geyser.Label:new({ name = self._instanceName..".container", x = elementX, y = elementY, width = 395, height = 256 } )
self.container:setStyleSheet([[background-color: #222222;]])
self.rowingLabel = Geyser.Label:new({ name = self._instanceName..".rowingLabel", x = 0, y = 0, width = 132, height = 64 }, self.container )
self.rowingLabel:setBackgroundImage( cloudDir .. [[GUI\images\sailing\rowing.png]] )
self.rowingLabel:setStyleSheet([[background-color: #00000000;]])
self.sailsLabel = Geyser.Label:new({ name = self._instanceName..".sailsLabel", x = 132, y = 0, width = 131, height = 64 }, self.container )
self.sailsLabel:setBackgroundImage( cloudDir .. [[GUI\images\sailing\sails.png]] )
self.sailsLabel:setStyleSheet([[background-color: #00000000;]])
self.anchorLabel = Geyser.Label:new({ name = self._instanceName..".anchorLabel", x = 263, y = 0, width = 132, height = 64 }, self.container )
self.anchorLabel:setBackgroundImage( cloudDir .. [[GUI\images\sailing\anchor.png]] )
self.anchorLabel:setStyleSheet([[background-color: #00000000;]])
self.gangplankLabel = Geyser.Label:new({ name = self._instanceName..".gangplankLabel", x = 263, y = 64, width = 132, height = 64 }, self.container )
self.gangplankLabel:setBackgroundImage( cloudDir .. [[GUI\images\sailing\gangplank.png]] )
self.gangplankLabel:setStyleSheet([[background-color: #00000000;]])
self.apLabel = Geyser.Label:new({ name = self._instanceName..".apLabel", x = 0, y = 128, width = 132, height = 64 }, self.container )
self.apLabel:setBackgroundImage( cloudDir .. [[GUI\images\sailing\ap_on.png]] )
self.apLabel:setStyleSheet([[background-color: #00000000;]])
self.windboostLabel = Geyser.Label:new({ name = self._instanceName..".windboostLabel", x = 0, y = 64, width = 132, height = 64 }, self.container )
self.windboostLabel:setBackgroundImage( cloudDir .. [[GUI\images\sailing\windboost.png]] )
self.windboostLabel:setStyleSheet([[background-color: #00000000;]])
self.shieldLabel = Geyser.Label:new({ name = self._instanceName..".shieldLabel", x = 132, y = 64, width = 131, height = 64 }, self.container )
self.shieldLabel:setBackgroundImage( cloudDir .. [[GUI\images\sailing\shield.png]] )
self.shieldLabel:setStyleSheet([[background-color: #00000000;]])
self.insDriftLabel = Geyser.Label:new({ name = self._instanceName..".insDriftLabel", x = 0, y = 192, width = 132, height = 64 }, self.container )
self.insDriftLabel:setBackgroundImage( cloudDir .. [[GUI\images\sailing\ins_drift.png]] )
self.insDriftLabel:setStyleSheet([[background-color: #00000000;]])
self.grappledLabel = Geyser.Label:new({ name = self._instanceName..".grappledLabel", x = 132, y = 128, width = 131, height = 64 }, self.container )
self.grappledLabel:setBackgroundImage( cloudDir .. [[GUI\images\sailing\grappled.png]] )
self.grappledLabel:setStyleSheet([[background-color: #00000000;]])
self.leakDetectLabel = Geyser.Label:new({ name = self._instanceName..".leakDetectLabel", x = 263, y = 128, width = 132, height = 64 }, self.container )
self.leakDetectLabel:setBackgroundImage( cloudDir .. [[GUI\images\sailing\leak.png]] )
self.leakDetectLabel:setStyleSheet([[background-color: #00000000;]])
self.fireLabel = Geyser.Label:new({ name = self._instanceName..".fireLabel", x = 132, y = 192, width = 131, height = 64 }, self.container )
self.fireLabel:setBackgroundImage( cloudDir .. [[GUI\images\sailing\fire.png]] )
self.fireLabel:setStyleSheet([[background-color: #00000000;]])
self.abandonShipLabel = Geyser.Label:new({ name = self._instanceName..".abandonShipLabel", x = 263, y = 192, width = 132, height = 64 }, self.container )
self.abandonShipLabel:setBackgroundImage( cloudDir .. [[GUI\images\sailing\abandon_ship.png]] )
self.abandonShipLabel:setStyleSheet([[background-color: #00000000;]])
self.container:show()
self.rowingLabel:hide()
self.sailsLabel:hide()
self.anchorLabel:hide()
self.gangplankLabel:hide()
self.apLabel:hide()
self.windboostLabel:hide()
self.shieldLabel:hide()
self.insDriftLabel:hide()
self.grappledLabel:hide()
self.leakDetectLabel:hide()
self.fireLabel:hide()
self.abandonShipLabel:hide()
return self
end
function ShipAnnunciator:setVisible(element, showElement)
if showElement then
element:show()
else
element:hide()
end
end
function ShipAnnunciator:updateAnnunciator()
self.setVisible( self.rowingLabel, self.isRowing() )
self.setVisible( self.sailingLabel, (self.sailSetting() > 0))
self.setVisible( self.anchorLabel, (not self.isAnchorRaised()) )
self:setVisible( self.windboostLabel, ship.windboost )
self:setVisible( self.shieldLabel, ship.shield )
self:setVisible( self.gangplankLabel, ship.windboost )
self:setVisible( self.apLabel, ship.autopilotEnabled)
if uacs.easting >= 0 and uacs.southing >= 0 and uacs.error >= 5 then
shipAnnunciator.insDriftLabel:show()
else
shipAnnunciator.insDriftLabel:hide()
end
self:setVisible( self.fireLabel, ship.fire )
self:setVisible( self.abandonShipLabel, ship.abandonShip )
end