File: Script.c

package info (click to toggle)
openclonk 8.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 169,516 kB
  • sloc: cpp: 180,479; ansic: 108,988; xml: 31,371; python: 1,223; php: 767; makefile: 145; sh: 101; javascript: 34
file content (72 lines) | stat: -rw-r--r-- 1,316 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*--
		Airplane goal
		Author: Maikel
		
		The plane has to be retrieved and transported back to the pilot.
--*/


#include Library_Goal

local is_fulfilled = false;
local is_outro_stated = false;

protected func Initialize()
{
	return inherited(...);
}

public func IsFulfilled()
{
	// already done?
	if (is_fulfilled || is_outro_stated) return is_fulfilled;
	// not done yet. do fulfillment check
	var cabin = FindObject(Find_ID(WoodenCabin));
	if (!cabin)
		return false;
	var plane = FindObject(Find_ID(Airplane));
	if (!plane)
		return false;
	// Airplane has to be brought to the wooden cabin.
	if (ObjectDistance(plane, cabin) < 200)
	{
		is_outro_stated = true;
		StartSequence("Outro", 0, this, plane);
		// wait for end of outro for fulfillment
		return false;
	}
	return false;
}

public func GetDescription(int plr)
{
	var message;
	if (IsFulfilled())
		message = "$MsgGoalFulfilled$";		
	else
		message = "$MsgGoalUnFulfilled$";
	return message;
}

public func Activate(int byplr)
{
	if (IsFulfilled())
		MessageWindow("$MsgGoalFulfilled$", byplr);
	else
		MessageWindow("$MsgGoalUnFulfilled$", byplr);
	return;
}

public func GetShortDescription(int plr)
{
	return "{{Airplane}}"; // TODO
}

public func SetFulfilled()
{
	is_fulfilled = true;
	return true;
}

/*-- Proplist --*/
local Name = "$Name$";