File: Script.c

package info (click to toggle)
openclonk 7.0-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 145,828 kB
  • ctags: 33,094
  • sloc: cpp: 163,891; ansic: 82,846; xml: 29,876; python: 1,203; php: 767; makefile: 138; sh: 77
file content (48 lines) | stat: -rwxr-xr-x 926 bytes parent folder | download
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
/**
	Ladder Control
	Containes the basic functionality for ladders.

	@author Randrian
*/

local next_segment;
local prev_segment;

public func IsLadder() { return true; }

// Returns the segment (start x, start y, end x, end y, angle) on which the clonk can climb.
public func GetLadderData()
{
	// Normally (if not overloaded) interpret the first vertex as start and the second as end.
	return [
		GetX() + GetVertex(0, 0),
		GetY() + GetVertex(0, 1),
		GetX() + GetVertex(1, 0),
		GetY() + GetVertex(1, 1),
		0
	];
}

// Get the connected previous segment.
public func GetPreviousLadder()
{
	return prev_segment;
}

// Get the connected next segment.
public func GetNextLadder()
{
	return next_segment;
}

// Set the connected previous segment.
public func SetPreviousLadder(object ladder)
{
	prev_segment = ladder;
}

// Set the connected next segment.
public func SetNextLadder(object ladder)
{
	next_segment = ladder;
}