File: Script.c

package info (click to toggle)
openclonk 8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 169,484 kB
  • sloc: cpp: 180,478; ansic: 108,988; xml: 31,371; python: 1,223; php: 767; makefile: 139; sh: 101
file content (60 lines) | stat: -rw-r--r-- 1,133 bytes parent folder | download | duplicates (5)
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
/**
	Ropeladder Segment

	@author Randrian	
*/

#include Library_Ladder

local index;
local angle;

public func SetAngle(int new_angle) 
{ 
	angle = new_angle;
}

// Called from the ladder object to set a master and the segment index.
public func SetMaster(object new_master, int new_index, ...) 
{
	// First perform setting the master in the library function.
	_inherited(new_master, new_index, ...);
	index = new_index;
	return;
}

// Returns whether the ladder can be climbed.
public func CanNotBeClimbed(bool is_climbing)
{
	var test_height = 10;
	if (is_climbing) 
		test_height = 8;

	if (GBackSolid(1, test_height) && GBackSolid(-1, test_height)) 
		return true;
	if (Inside(angle, 45, 315) && GBackSolid(0, test_height))
		return true;
	return false;
}

public func GetLadderData()
{
	if (master)
		return master->~GetLadderData(index);
	return _inherited(...);
}

public func OnLadderGrab(object clonk)
{
	if (master)
		master->OnLadderGrab(clonk, index);
}

public func OnLadderClimb(clonk)
{
	if (master)
		master->OnLadderClimb(clonk, index);
}

// Main ladder object is saved
func SaveScenarioObject() { return false; }