[Change] Improved music handling.
This commit is contained in:
		
							parent
							
								
									82f724eb04
								
							
						
					
					
						commit
						d5b80c1522
					
				| @ -7,7 +7,7 @@ | ||||
| --    combat  - Player just got a hostile on screen. | ||||
| --    idle    - Current playing music ran out. | ||||
| --]]-- | ||||
| 
 | ||||
| last = "idle" | ||||
| function choose(str) | ||||
|   if str == "load" then | ||||
|     music.load("machina") | ||||
| @ -25,10 +25,12 @@ function choose(str) | ||||
|     music.load("galacticbattle") | ||||
|     music.play() | ||||
| 
 | ||||
|   elseif str == "idle" then | ||||
|   elseif str == "idle" and last ~= "idle" then | ||||
|     choose(last) -- This should be smarter in the future. | ||||
|   end | ||||
| 
 | ||||
|   last = str -- Save the last string so we can use it. | ||||
|   if last ~= "idle" then | ||||
|     last = str -- Save the last string so we can use it. | ||||
|   end | ||||
| end | ||||
| 
 | ||||
|  | ||||
| @ -371,6 +371,8 @@ static int music_luaInit(void) { | ||||
| 
 | ||||
|   music_lua = luaL_newstate(); | ||||
| 
 | ||||
|   luaL_openlibs(music_lua); | ||||
| 
 | ||||
|   lua_loadSpace(music_lua, 1);  // Space and time are readonly.
 | ||||
|   lua_loadTime(music_lua, 1); | ||||
|   lua_loadRnd(music_lua); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Allanis
						Allanis