Useful functions

From PioneerWiki
Revision as of 19:47, 10 September 2022 by Zonkmachine (talk | contribs) (Timer)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Timer: Defined in src/lua/LuaTimer.cpp

local Comms = require 'Comms'
local Game = require 'Game'
local Event = require 'Event'
local ui = require 'pigui'
local Timer = require 'Timer'

local onShipDocked = function (ship, station)
	if not ship:IsPlayer() then return end

	Timer:CallAt(Game.time+10, function ()
		Comms.Message("This one will be shown last", "Zonkmachine")
	end)
	Timer:CallAt(Game.time+6, function ()
		Comms.Message("This one will be shown in the middle", "Zonkmachine")
	end)
	Timer:CallAt(Game.time+2, function ()
		Comms.Message("This one will be shown first", "Zonkmachine")
	end)
end

Event.Register("onShipDocked", onShipDocked)