Merge pull request #6880 from Mailaender/lua-music
Added Media.PlayMusic to the Lua API
This commit is contained in:
@@ -5,6 +5,7 @@ Container@MUSIC_PANEL:
|
||||
Width: 360
|
||||
Height: 435
|
||||
Children:
|
||||
LogicTicker@SONG_WATCHER:
|
||||
Label@TITLE:
|
||||
Width: 360
|
||||
Y: 0-25
|
||||
|
||||
@@ -56,8 +56,13 @@ CheckForBase = function()
|
||||
return #baseBuildings >= 3
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
initialSong = "aoi"
|
||||
PlayMusic = function()
|
||||
Media.PlayMusic(initialSong, PlayMusic)
|
||||
initialSong = nil
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
player = Player.GetPlayer("GDI")
|
||||
enemy = Player.GetPlayer("Nod")
|
||||
|
||||
@@ -73,6 +78,9 @@ WorldLoaded = function()
|
||||
|
||||
Trigger.OnPlayerWon(player, function()
|
||||
Media.PlaySpeechNotification(player, "Win")
|
||||
Trigger.AfterDelay(DateTime.Seconds(1), function()
|
||||
Media.PlayMusic("win1")
|
||||
end)
|
||||
end)
|
||||
|
||||
Trigger.OnPlayerLost(player, function()
|
||||
@@ -85,6 +93,8 @@ WorldLoaded = function()
|
||||
ReinforceWithLandingCraft(MCVReinforcements, lstStart.Location + CVec.New(2, 0), lstEnd.Location + CVec.New(2, 0), mcvTarget.Location)
|
||||
Reinforce(InfantryReinforcements)
|
||||
|
||||
PlayMusic()
|
||||
|
||||
Trigger.OnIdle(Gunboat, function() SetGunboatPath(Gunboat) end)
|
||||
|
||||
SendNodPatrol()
|
||||
|
||||
@@ -424,9 +424,6 @@ Rules:
|
||||
-SpawnMPUnits:
|
||||
-MPStartLocations:
|
||||
-CrateSpawner:
|
||||
PlayMusicOnMapLoad:
|
||||
Music: aoi
|
||||
Loop: false
|
||||
LuaScript:
|
||||
Scripts: gdi01.lua
|
||||
ObjectivesPanel:
|
||||
|
||||
@@ -992,9 +992,6 @@ Rules:
|
||||
-CrateSpawner:
|
||||
MenuPaletteEffect:
|
||||
Effect: Desaturated
|
||||
PlayMusicOnMapLoad:
|
||||
Music: map1
|
||||
Loop: true
|
||||
LuaScript:
|
||||
Scripts: shellmap.lua
|
||||
LST:
|
||||
|
||||
@@ -17,6 +17,7 @@ WorldLoaded = function()
|
||||
for i, unit in ipairs(units) do
|
||||
LoopTrack(unit, CPos.New(8, unit.Location.Y), CPos.New(87, unit.Location.Y))
|
||||
end
|
||||
PlayMusic()
|
||||
end
|
||||
|
||||
LoopTrack = function(actor, left, right)
|
||||
@@ -25,6 +26,10 @@ LoopTrack = function(actor, left, right)
|
||||
actor.CallFunc(function() LoopTrack(actor, left, right) end)
|
||||
end
|
||||
|
||||
PlayMusic = function()
|
||||
Media.PlayMusic("map1", PlayMusic)
|
||||
end
|
||||
|
||||
LoadTransport = function(transport, passenger)
|
||||
transport.LoadPassenger(Actor.Create(passenger, false, { Owner = transport.Owner, Facing = transport.Facing }))
|
||||
end
|
||||
@@ -16,4 +16,5 @@ WorldLoaded = function()
|
||||
atreides = Player.GetPlayer("Atreides")
|
||||
|
||||
InsertHarvester()
|
||||
Media.PlayMusic("score")
|
||||
end
|
||||
|
||||
@@ -5,6 +5,7 @@ Background@MUSIC_PANEL:
|
||||
Width: 360
|
||||
Height: 450
|
||||
Children:
|
||||
LogicTicker@SONG_WATCHER:
|
||||
ScrollPanel@MUSIC_LIST:
|
||||
X: 15
|
||||
Y: 45
|
||||
|
||||
@@ -162,4 +162,6 @@ WorldLoaded = function()
|
||||
SendSovietUnits(Entry5.Location, UnitTypes, 50)
|
||||
SendSovietUnits(Entry6.Location, UnitTypes, 50)
|
||||
SendSovietUnits(Entry7.Location, BeachUnitTypes, 15)
|
||||
|
||||
Media.PlayMusic()
|
||||
end
|
||||
|
||||
@@ -40,7 +40,8 @@ Rules:
|
||||
-StartGameNotification:
|
||||
-SpawnMPUnits:
|
||||
-MPStartLocations:
|
||||
LoadWidgetAtGameStart:
|
||||
LuaScript:
|
||||
Scripts: shellmap.lua
|
||||
|
||||
Sequences:
|
||||
|
||||
|
||||
7
mods/ts/maps/blank-shellmap/shellmap.lua
Normal file
7
mods/ts/maps/blank-shellmap/shellmap.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
PlayMusic = function()
|
||||
Media.PlayMusic("maps", PlayMusic)
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
PlayMusic()
|
||||
end
|
||||
Reference in New Issue
Block a user