File: motion_lock.cfg

package info (click to toggle)
frogatto-data 1.3.1%2Bdfsg-3
  • links: PTS, VCS
  • area: non-free
  • in suites: bookworm, bullseye
  • size: 254,432 kB
  • sloc: xml: 584; python: 396; perl: 249; sh: 126; ruby: 69; makefile: 30
file content (114 lines) | stat: -rw-r--r-- 3,087 bytes parent folder | download | duplicates (3)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114

#Note regarding use of motion_lock controller:
#	Colours range between one and five, visually. Logically, any value works even if it is not displayed.
#	A motion lock's 'unlocked' event is fired, once, when all of it's matching colours are lit.
#	The event is fired regardless of which order the controllers were hit in.
{
id: "motion_lock",
next_animation: "'normal'",
always_active: false,
properties: {
	colour: "def(obj) [set(obj.red, vars.red*50), set(obj.green, vars.green*50), set(obj.blue, vars.blue*50)]",
},
vars: {
	red: 5,
	green: 3,
	blue: 5,
},
on_end_anim: "animation('normal')",
zorder: -5,
timer_frequency: 3,
on_timer: "if(length(midpoint_x, midpoint_y, level.player.midpoint_x, level.player.midpoint_y) < 35, fire_event('triggered'))",
on_triggered: "if(not vars.light, [
		add_object(obj),
		colour(obj),
		set(vars.light, obj),
		fire_event('check_lit'),
		] where obj = object('motion_lock.dim', midpoint_x, midpoint_y, facing))",
on_check_lit: "[
		if(find(match_sensors, 'match', not match.vars.light),
			map(all_sensors, 'sensor', if(not sensor in match_sensors, fire_event(sensor, 'off'))),
			map(all_sensors, 'sensor', if(not sensor in match_sensors, fire_event(sensor, 'off'), fire_event(sensor, 'on')))
		) where match_sensors = filter(all_sensors, 'sensor', sensor.vars.red=red_value and sensor.vars.blue=blu_value and sensor.vars.green=gre_value)
		where all_sensors = filter(level.chars, 'char', char.type = 'motion_lock')
		where red_value = vars.red
		where blu_value = vars.blue
		where gre_value = vars.green]",
on_off: "if(vars.light.type = 'motion_lock.dim', [
		fire_event(vars.light, 'nix'),
		set(vars.light, null),
		])",
on_on: "if(vars.light.type = 'motion_lock.dim', [
		schedule(25, [
			fire_event(vars.light, 'nix'),
			add_object(obj)]),
		colour(obj),
		set(vars.light, obj),
		fire_event('unlocked'),
		] where obj = object('motion_lock.bright', midpoint_x, midpoint_y, facing))",
on_unlocked: "if(vars.linked_object, 
		fire_event(
			get_object(level, vars.linked_object), 
			'button_pressed'))",
editor_info: {
	category: "controllers",
	help: "When all locks of this type in the level are
			active, trigger the linked_object.",
	var: {
		name: "linked_object",
		type: "label",
	},
},
animation: {
	id: "normal",
	image: "experimental/wall_switch.png",
	x: 24,
	y: 5,
	w: 14,
	h: 14,
	collide: [0,0,28,28],
	frames: 1,
	duration: 1000,
},
object_type: [
	{
		id: "dim",
		next_animation: "'normal'",
		always_active: false,
		on_end_anim: "animation('normal')",
		zorder: -4,
		on_triggered: "[]",
		on_nix: "die()",
		animation: {
			id: "normal",
			image: "experimental/wall_switch.png",
			x: 7,
			y: 5,
			w: 14,
			h: 14,
			collide: [0,0,28,28],
			frames: 1,
			duration: 1000,
		},
	},
	{
		id: "bright",
		next_animation: "'normal'",
		always_active: false,
		on_end_anim: "animation('normal')",
		zorder: -4,
		on_triggered: "[]",
		animation: {
			id: "normal",
			image: "experimental/wall_switch.png",
			x: 7,
			y: 22,
			w: 14,
			h: 14,
			collide: [0,0,28,28],
			frames: 1,
			duration: 1000,
		},
	},
],
}