-
Notifications
You must be signed in to change notification settings - Fork 0
/
scenario_00_customElements.lua
39 lines (31 loc) · 1.84 KB
/
scenario_00_customElements.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
-- Name: Custom Elements wrapper
-- Description: Demo mission for Custom Elements wrapper module
-- Type: Basic
--- Scenario
-- @script scenario_10_empty
require("utils.lua")
require("utils_customElements.lua")
function init()
player = PlayerSpaceship():setFaction("Human Navy"):setTemplate("Atlantis"):setRotation(200)
print("before")
customElements:closeAllMessagesUponClose(true)
customElements:addCustomButton(player, "Engineering", "add", "Add",
function()
customElements:addCustomButton(player, "Engineering", "test", "test",
function() print("test clicked") end)
end)
customElements:addCustomButton(player, "Engineering", "del", "Del", function() customElements:removeCustom(player, "test") end)
customElements:addCustomButton(player, "Engineering", "msg", "Msg",
function()
customElements:addCustomMessageWithCallback(player, "Engineering", "testmsg", "Lorem Ipsum",
function()
print("message fired")
customElements:removeCustom(player, "testmsg")
end)
end)
print("after")
end
function update(delta)
customElements:addCustomInfo(player, "Engineering", "eng_info", string.format("Shields active: %s", tostring(player:getShieldsActive())))
-- No victory condition
end