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 (64 lines) | stat: -rw-r--r-- 1,216 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
61
62
63
64
/**
	LavaCore Shell
	Protects the lava core and provides a solidmask for the clonk to walk on.

	@author Win, Maikel
*/

local size;

public func InitAttach(object parent)
{
	SetAction("Attach", parent);
	SetSize(BoundBy(parent->GetCon(), parent.SizeLimitMin, parent.SizeLimitMax));
	return;
}

public func SetSize(int to_size)
{
	size = to_size;	
	// Rotate core to match solidmask.
	var r = -70;
	var fsin = Sin(r, 10 * size), fcos = Cos(r, 10 * size);
	SetObjDrawTransform(+fcos, +fsin, 0, -fsin, +fcos, 0);
	return;
}

public func AddSolidMask()
{	
	var solid_size = 2 * ((size * 20 / 100 + 2) / 2) + 4;
	solid_size = BoundBy(solid_size, 4, 28);
	var solid_x = (1 + solid_size / 2) * (solid_size - 4);
	SetSolidMask(solid_x, 0, solid_size * 2, solid_size * 2, 28 - solid_size, 28 - solid_size);
	return;
}

public func RemoveSolidMask()
{
	SetSolidMask();
	return;
}


/*-- Saving --*/

public func SaveScenarioObject() { return false; }


/*-- Properties --*/

local Name = "$Name$";
local Description = "$Description$";
local Plane = 425;

local ActMap = {
	Attach = {
		Prototype = Action,
		Name = "Attach",
		Procedure = DFA_ATTACH,
		Length = 1,
		Delay = 0,
		FacetBase = 1,
		NextAction = "Attach",
	}
};