5 * Created by Alyssa Milburn on Sat Dec 2 2006.
6 * Copyright (c) 2006 Alyssa Milburn. All rights reserved.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
23 * TODO: this code is a first attempt and might be completely wrong
26 bool Lift::fireScript(unsigned short event
, Agent
*from
, caosVar one
, caosVar two
) {
27 if (event
== 1 || event
== 2) {
28 if (!liftAvailable()) return false; // TODO: hack to make sure the lifts aren't activated when not ready
31 // if we need to select a new callbutton.. TODO: this is hacky
32 if (y
+ cabinbottom
== callbuttony
[currentbutton
]) {
34 if (currentbutton
+ 1 == callbuttony
.size()) return false;
36 } else if (event
== 2) {
37 if (currentbutton
== 0) return false;
42 return Agent::fireScript(event
, from
, one
, two
);
50 if (yvec
.getInt() != 0) {
51 // TODO: we should align to agent bottom rather than cabin bottom if LACB is set to 0 (c2)
53 // are we beyond the call button y point?
55 (yvec
.getInt() < 0 && y
+ cabinbottom
<= callbuttony
[currentbutton
]) || // upwards
56 (yvec
.getInt() > 0 && y
+ cabinbottom
>= callbuttony
[currentbutton
]) // downwards
58 // stop movement (and make sure we're in the right spot)
60 y
= callbuttony
[currentbutton
] - cabinbottom
;
62 // send deactivate event