Script Dokumentation LS 2015 - Rotator (Patch 1.3)
scripts/objects/Rotator.lua
Copyright (c) 2008-2015 GIANTS Software GmbH, Confidential, All Rights Reserved.
This document is to be published solely by ls-mods.de
1 | --[[ Rotator class |
2 | |
3 | Rotators rotate around their y axis |
4 | Copyright (C) GIANTS Software GmbH, Confidential, All Rights Reserved. |
5 | --]] |
6 | |
7 | Rotator = {} |
8 | |
9 | local Rotator_mt = Class(Rotator); |
10 | |
11 | function Rotator:onCreate(id) |
12 | g_currentMission:addUpdateable(Rotator:new(id)); |
13 | --print("created Rotator, id: ", id); |
14 | end; |
15 | |
16 | function Rotator:new(name) |
17 | local self = {}; |
18 | setmetatable(self, Rotator_mt); |
19 | |
20 | self.axisTable = {0, 0, 0}; |
21 | self.me = name; |
22 | self.speed = Utils.getNoNil(getUserAttribute(name, "speed"), 0.0012); |
23 | local axis = Utils.getNoNil(getUserAttribute(name, "axis"), 3); |
24 | self.axisTable[axis] = 1; |
25 | |
26 | return self; |
27 | end; |
28 | |
29 | function Rotator:delete() |
30 | |
31 | end; |
32 | |
33 | function Rotator:update(dt) |
34 | rotate(self.me, self.axisTable[1] * self.speed * dt, self.axisTable[2] * self.speed * dt, self.axisTable[3] * self.speed * dt); |
35 | end;
|
Copyright (c) 2008-2015 GIANTS Software GmbH, Confidential, All Rights Reserved.
This document is to be published solely by ls-mods.de