Copyright (c) 2008-2015 GIANTS Software GmbH, Confidential, All Rights Reserved.
This document is to be published solely by ls-mods.de
1 | -- WishingWellTrigger class |
2 | -- |
3 | -- Copyright (C) GIANTS Software GmbH, Confidential, All Rights Reserved. |
4 | -- |
5 | |
6 | WishingWellTrigger = {} |
7 | |
8 | local WishingWellTrigger_mt = Class(WishingWellTrigger); |
9 | |
10 | function WishingWellTrigger:onCreate(id) |
11 | if g_currentMission:getIsServer() then |
12 | g_currentMission:addNonUpdateable(WishingWellTrigger:new(id)); |
13 | end |
14 | end |
15 | |
16 | function WishingWellTrigger:new(id, mt) |
17 | assert(g_currentMission:getIsServer()); |
18 | if mt == nil then |
19 | mt = WishingWellTrigger_mt; |
20 | end |
21 | local self = {}; |
22 | setmetatable(self, mt); |
23 | |
24 | self.triggerId = id; |
25 | if g_currentMission:getIsServer() then |
26 | addTrigger(id, "triggerCallback", self); |
27 | end |
28 | |
29 | return self; |
30 | end |
31 | |
32 | function WishingWellTrigger:delete() |
33 | if g_currentMission:getIsServer() then |
34 | removeTrigger(self.triggerId); |
35 | end |
36 | end |
37 | |
38 | function WishingWellTrigger:triggerCallback(triggerId, otherActorId, onEnter, onLeave, onStay, otherShapeId) |
39 | if onEnter then |
40 | if g_currentMission.players[otherActorId] ~= nil then |
41 | |
42 | if g_currentMission.missionStats:getTotalValue("foundGoldCoinCount") < 100 then |
43 | g_currentMission.inGameMessage:showMessage(g_i18n:getText("wishingWellDescTitle"), g_i18n:getText("wishingWellDescText"), 0, false); |
44 | else |
45 | if g_currentMission.missionStats.eastState1 ~= 8 then |
46 | playSample(g_currentMission.cashDropSound, 1, 1, 0); |
47 | g_currentMission.inGameMessage:showMessage(g_i18n:getText("wishingWellDoneTitle"), g_i18n:getText("wishingWellDoneText"), 0, false); |
48 | g_currentMission:setSiloAmount(Fillable.FILLTYPE_WHEAT, g_currentMission:getSiloAmount(Fillable.FILLTYPE_WHEAT) + 200000); |
49 | g_currentMission:setSiloAmount(Fillable.FILLTYPE_BARLEY, g_currentMission:getSiloAmount(Fillable.FILLTYPE_BARLEY) + 200000); |
50 | g_currentMission:setSiloAmount(Fillable.FILLTYPE_RAPE, g_currentMission:getSiloAmount(Fillable.FILLTYPE_RAPE) + 200000); |
51 | g_currentMission:setSiloAmount(Fillable.FILLTYPE_MAIZE, g_currentMission:getSiloAmount(Fillable.FILLTYPE_MAIZE) + 200000); |
52 | g_currentMission:setSiloAmount(Fillable.FILLTYPE_POTATO, g_currentMission:getSiloAmount(Fillable.FILLTYPE_POTATO) + 200000); |
53 | g_currentMission:setSiloAmount(Fillable.FILLTYPE_SUGARBEET, g_currentMission:getSiloAmount(Fillable.FILLTYPE_SUGARBEET) + 200000); |
54 | g_currentMission:setSiloAmount(Fillable.FILLTYPE_WOODCHIPS, g_currentMission:getSiloAmount(Fillable.FILLTYPE_WOODCHIPS) + 200000); |
55 | g_currentMission.missionStats.eastState1 = 8; |
56 | end; |
57 | end; |
58 | end |
59 | end |
60 | end
|
Copyright (c) 2008-2015 GIANTS Software GmbH, Confidential, All Rights Reserved.
This document is to be published solely by ls-mods.de