Script Dokumentation LS 2015 - MilktruckFillTrigger (Patch 1.3)
scripts/triggers/MilktruckFillTrigger.lua
Copyright (c) 2008-2015 GIANTS Software GmbH, Confidential, All Rights Reserved.
This document is to be published solely by ls-mods.de
1 | -- MilktruckFillTrigger class |
2 | -- |
3 | -- Copyright (C) GIANTS Software GmbH, Confidential, All Rights Reserved. |
4 | |
5 | MilktruckFillTrigger = {} |
6 | |
7 | local MilktruckFillTrigger_mt = Class(MilktruckFillTrigger); |
8 | |
9 | function MilktruckFillTrigger:onCreate(id) |
10 | if g_currentMission:getIsServer() then |
11 | g_currentMission:addNonUpdateable(MilktruckFillTrigger:new(id)); |
12 | --print("Created MilktruckFillTrigger, id: ", id); |
13 | end; |
14 | end; |
15 | |
16 | function MilktruckFillTrigger:new(id) |
17 | local self = {}; |
18 | setmetatable(self, MilktruckFillTrigger_mt); |
19 | |
20 | self.triggerId = id; |
21 | if g_currentMission:getIsServer() then |
22 | addTrigger(id, "triggerCallback", self); |
23 | |
24 | self.animalTypeName = Utils.getNoNil(getUserAttribute(id, "animalTypeName"), "cow"); |
25 | end; |
26 | |
27 | return self; |
28 | end; |
29 | |
30 | function MilktruckFillTrigger:delete() |
31 | if g_currentMission:getIsServer() then |
32 | removeTrigger(self.triggerId); |
33 | end; |
34 | end; |
35 | |
36 | function MilktruckFillTrigger:triggerCallback(triggerId, otherActorId, onEnter, onLeave, onStay, otherShapeId) |
37 | if onEnter then |
38 | local object = g_currentMission:getNodeObject(otherShapeId); |
39 | if object ~= nil then |
40 | if object.milktruckStopNode ~= nil and object.milktruckStopNode == otherShapeId then |
41 | object:onEnteredMilktruckFillTrigger(self, self.animalTypeName); |
42 | end; |
43 | end; |
44 | end; |
45 | end;
|
Copyright (c) 2008-2015 GIANTS Software GmbH, Confidential, All Rights Reserved.
This document is to be published solely by ls-mods.de