Script Dokumentation LS 2015 - VisualPlayerTrigger (Patch 1.3)
scripts/triggers/VisualPlayerTrigger.lua
Copyright (c) 2008-2015 GIANTS Software GmbH, Confidential, All Rights Reserved.
This document is to be published solely by ls-mods.de
1 | -- VisualPlayerTrigger class |
2 | -- |
3 | -- VisualPlayerTriggers consist of a trigger object and two rings (which are children of the trigger object) that rotate around their y axis at different speeds |
4 | -- |
5 | -- Copyright (C) GIANTS Software GmbH, Confidential, All Rights Reserved. |
6 | |
7 | VisualPlayerTrigger = {} |
8 | |
9 | local VisualPlayerTrigger_mt = Class(VisualPlayerTrigger); |
10 | |
11 | function VisualPlayerTrigger:onCreate(id) |
12 | g_currentMission:addUpdateable(VisualPlayerTrigger:new(id)); |
13 | --print("Created VisualPlayerTrigger, id: ", id); |
14 | end; |
15 | |
16 | function VisualPlayerTrigger:new(name) |
17 | local instance = {}; |
18 | setmetatable(instance, VisualPlayerTrigger_mt); |
19 | |
20 | instance.triggerId = name; |
21 | addTrigger(name, "triggerCallback", instance); |
22 | |
23 | instance.ring1 = getChildAt(name, 0); |
24 | instance.ring2 = getChildAt(name, 1); |
25 | |
26 | instance.isEnabled = true; |
27 | |
28 | return instance; |
29 | end; |
30 | |
31 | function VisualPlayerTrigger:delete() |
32 | removeTrigger(self.triggerId); |
33 | end; |
34 | |
35 | function VisualPlayerTrigger:update(dt) |
36 | rotate(self.ring1, 0, 0.0005 * dt, 0); |
37 | rotate(self.ring2, 0, 0.0003 * dt, 0); |
38 | end; |
39 | |
40 | function VisualPlayerTrigger:triggerCallback(triggerId, otherId, onEnter, onLeave, onStay) |
41 | if onEnter and self.isEnabled and g_currentMission.controlPlayer and g_currentMission.player ~= nil and otherId == g_currentMission.player.rootNode then |
42 | --OnMenuStore(); |
43 | g_shopScreen:setShopType(ShopScreen.TYPE_VEHICLES); |
44 | g_gui:showGui("ShopScreen"); |
45 | end; |
46 | end;
|
Copyright (c) 2008-2015 GIANTS Software GmbH, Confidential, All Rights Reserved.
This document is to be published solely by ls-mods.de