1-- Copyright (C) 2007, 2010 - Bit-Blot
2--
3-- This file is part of Aquaria.
4--
5-- Aquaria is free software; you can redistribute it and/or
6-- modify it under the terms of the GNU General Public License
7-- as published by the Free Software Foundation; either version 2
8-- of the License, or (at your option) any later version.
9--
10-- This program is distributed in the hope that it will be useful,
11-- but WITHOUT ANY WARRANTY; without even the implied warranty of
12-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13--
14-- See the GNU General Public License for more details.
15--
16-- You should have received a copy of the GNU General Public License
17-- along with this program; if not, write to the Free Software
18-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19
20if not v then v = {} end
21if not AQUARIA_VERSION then dofile("scripts/entities/entityinclude.lua") end
22
23v.started 		= false
24v.n 			= 0
25v.timer 			= 999
26v.thingsToSay		= 20
27v.thingSaying		= -1
28v.timeToSay		= 5
29function init(me)
30	v.n = getNaija()
31	node_setCursorActivation(me, true)
32end
33
34local function sayNext()
35	if v.thingSaying == 0 then
36		setControlHint("Use 'E' and 'R' to cycle through the available tiles. Drop a new tile by pressing Spacebar.", 0, 0, 0, 16)
37	elseif v.thingSaying == 1 then
38		setControlHint("You can also cycle already-dropped tiles with 'E' and 'R'.", 0, 0, 0, 16)
39	elseif v.thingSaying == 2 then
40		setControlHint("Not too hard, right? If you need to delete a tile, use Delete or Backspace.", 0, 0, 0, 16)
41	end
42end
43
44function update(me, dt)
45	if getStringFlag("editorhint") ~= node_getName(me) then
46		v.started = false
47		return
48	end
49	if v.started then
50		v.timer = v.timer + dt
51		if v.timer > v.timeToSay then
52			v.timer = 0
53			v.thingSaying = v.thingSaying + 1
54			sayNext()
55		end
56	end
57end
58
59function activate(me)
60	clearControlHint()
61	v.started = true
62	v.thingSaying = -1
63	v.timer = 999
64	setStringFlag("editorhint", node_getName(me))
65end
66
67