diff --git a/OpenRA.Mods.RA/Scripting/LuaScriptEvents.cs b/OpenRA.Mods.RA/Scripting/LuaScriptEvents.cs index b5da934217..f321920777 100644 --- a/OpenRA.Mods.RA/Scripting/LuaScriptEvents.cs +++ b/OpenRA.Mods.RA/Scripting/LuaScriptEvents.cs @@ -15,11 +15,12 @@ namespace OpenRA.Mods.RA.Scripting { public class LuaScriptEventsInfo : TraitInfo { } - public class LuaScriptEvents : INotifyKilled, INotifyAddedToWorld, INotifyRemovedFromWorld + public class LuaScriptEvents : INotifyKilled, INotifyAddedToWorld, INotifyRemovedFromWorld, INotifyCapture { public event Action OnKilled = (self, e) => { }; public event Action OnAddedToWorld = self => { }; public event Action OnRemovedFromWorld = self => { }; + public event Action OnCaptured = (self, captor, oldOwner, newOwner) => { }; public void Killed(Actor self, AttackInfo e) { @@ -35,5 +36,10 @@ namespace OpenRA.Mods.RA.Scripting { OnRemovedFromWorld(self); } + + public void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner) + { + OnCaptured(self, captor, oldOwner, newOwner); + } } } diff --git a/mods/cnc/maps/nod03a/map.bin b/mods/cnc/maps/nod03a/map.bin new file mode 100644 index 0000000000..e993e43515 Binary files /dev/null and b/mods/cnc/maps/nod03a/map.bin differ diff --git a/mods/cnc/maps/nod03a/map.yaml b/mods/cnc/maps/nod03a/map.yaml new file mode 100644 index 0000000000..7c532ca922 --- /dev/null +++ b/mods/cnc/maps/nod03a/map.yaml @@ -0,0 +1,667 @@ +Selectable: True + +MapFormat: 6 + +RequiresMod: cnc + +Title: Sudanese Prison Break (a) + +Description: GDI has established a prison camp, where they are detaining some of the local political leaders. Kane wishes to liberate these victims. Destroy the GDI forces and capture the prison, do not destroy it. + +Author: Westwood Studios + +Tileset: DESERT + +MapSize: 64,64 + +Bounds: 13,16,42,33 + +UseAsShellmap: False + +Type: Campaign + +Options: + Crates: False + Fog: False + Shroud: True + AllyBuildRadius: False + FragileAlliances: False + StartingCash: 4000 + ConfigurableStartingUnits: False + +Players: + PlayerReference@Neutral: + Name: Neutral + OwnsWorld: True + NonCombatant: True + Race: gdi + Allies: GDI + Enemies: Nod + PlayerReference@GDI: + Name: GDI + Race: gdi + ColorRamp: 31,222,183 + Allies: GDI + Enemies: Nod + PlayerReference@Nod: + Name: Nod + Playable: True + AllowBots: False + Required: True + LockRace: True + Race: nod + LockColor: True + ColorRamp: 3,255,127 + LockSpawn: True + LockTeam: True + Allies: Nod + Enemies: GDI + +Actors: + Actor0: sbag + Location: 30,23 + Owner: Neutral + Actor1: sbag + Location: 29,23 + Owner: Neutral + Actor2: sbag + Location: 28,23 + Owner: Neutral + Actor3: sbag + Location: 22,23 + Owner: Neutral + Actor4: sbag + Location: 21,23 + Owner: Neutral + Actor5: sbag + Location: 20,23 + Owner: Neutral + Actor6: sbag + Location: 19,23 + Owner: Neutral + Actor7: sbag + Location: 30,22 + Owner: Neutral + Actor8: sbag + Location: 19,22 + Owner: Neutral + Actor9: sbag + Location: 30,21 + Owner: Neutral + Actor10: sbag + Location: 19,21 + Owner: Neutral + Actor11: sbag + Location: 18,21 + Owner: Neutral + Actor12: sbag + Location: 17,21 + Owner: Neutral + Actor13: sbag + Location: 30,20 + Owner: Neutral + Actor14: sbag + Location: 17,20 + Owner: Neutral + Actor15: sbag + Location: 16,20 + Owner: Neutral + Actor16: sbag + Location: 15,20 + Owner: Neutral + Actor17: sbag + Location: 14,20 + Owner: Neutral + Actor18: sbag + Location: 13,20 + Owner: Neutral + Actor19: sbag + Location: 30,19 + Owner: Neutral + Actor20: sbag + Location: 17,19 + Owner: Neutral + Actor21: sbag + Location: 13,19 + Owner: Neutral + Actor22: sbag + Location: 30,18 + Owner: Neutral + Actor23: sbag + Location: 13,18 + Owner: Neutral + Actor24: sbag + Location: 30,17 + Owner: Neutral + Actor25: sbag + Location: 17,17 + Owner: Neutral + Actor26: sbag + Location: 13,17 + Owner: Neutral + Actor27: sbag + Location: 30,16 + Owner: Neutral + Actor28: sbag + Location: 29,16 + Owner: Neutral + Actor29: sbag + Location: 28,16 + Owner: Neutral + Actor30: sbag + Location: 27,16 + Owner: Neutral + Actor31: sbag + Location: 26,16 + Owner: Neutral + Actor32: sbag + Location: 25,16 + Owner: Neutral + Actor33: sbag + Location: 24,16 + Owner: Neutral + Actor34: sbag + Location: 23,16 + Owner: Neutral + Actor35: sbag + Location: 22,16 + Owner: Neutral + Actor36: sbag + Location: 21,16 + Owner: Neutral + Actor37: sbag + Location: 20,16 + Owner: Neutral + Actor38: sbag + Location: 19,16 + Owner: Neutral + Actor39: sbag + Location: 18,16 + Owner: Neutral + Actor40: sbag + Location: 17,16 + Owner: Neutral + Actor41: sbag + Location: 16,16 + Owner: Neutral + Actor42: sbag + Location: 15,16 + Owner: Neutral + Actor43: sbag + Location: 14,16 + Owner: Neutral + Actor44: sbag + Location: 13,16 + Owner: Neutral + Actor45: t18 + Location: 29,23 + Owner: Neutral + Actor46: t08 + Location: 43,17 + Owner: Neutral + Actor47: t08 + Location: 40,17 + Owner: Neutral + Actor48: t18 + Location: 42,18 + Owner: Neutral + Actor49: t18 + Location: 37,17 + Owner: Neutral + Actor50: t18 + Location: 25,42 + Owner: Neutral + Actor51: t18 + Location: 16,40 + Owner: Neutral + Actor52: t08 + Location: 39,37 + Owner: Neutral + Actor53: t08 + Location: 22,35 + Owner: Neutral + Actor54: t08 + Location: 15,38 + Owner: Neutral + Actor55: t18 + Location: 38,31 + Owner: Neutral + Actor56: pyle + Location: 25,20 + Owner: GDI + Health: 1 + Facing: 0 + Actor57: fact + Location: 27,20 + Owner: GDI + Health: 1 + Facing: 0 + Actor58: silo + Location: 23,17 + Owner: GDI + Health: 1 + Facing: 0 + Actor59: silo + Location: 23,19 + Owner: GDI + Health: 1 + Facing: 0 + Actor60: proc + Location: 20,17 + Owner: GDI + Health: 1 + Facing: 0 + Actor61: nuke + Location: 25,17 + Owner: GDI + Health: 1 + Facing: 0 + Actor62: nuke + Location: 27,17 + Owner: GDI + Health: 1 + Facing: 0 + Actor63: gtwr + Location: 28,24 + Owner: GDI + Health: 1 + Facing: 0 + Actor64: v24 + Location: 20,41 + Owner: Neutral + Health: 1 + Facing: 0 + Actor65: v26 + Location: 43,18 + Owner: Neutral + Health: 1 + Facing: 0 + Actor66: v24 + Location: 37,16 + Owner: Neutral + Health: 1 + Facing: 0 + Actor67: v20 + Location: 13,37 + Owner: Neutral + Health: 1 + Facing: 0 + Actor68: v21 + Location: 13,39 + Owner: Neutral + Health: 1 + Facing: 0 + Actor69: v22 + Location: 13,41 + Owner: Neutral + Health: 1 + Facing: 0 + Actor70: v24 + Location: 15,36 + Owner: Neutral + Health: 1 + Facing: 0 + Actor71: v25 + Location: 17,41 + Owner: Neutral + Health: 1 + Facing: 0 + Actor72: v26 + Location: 16,38 + Owner: Neutral + Health: 1 + Facing: 0 + Actor73: v19 + Location: 27,42 + Owner: GDI + Health: 1 + Facing: 0 + Actor74: v19 + Location: 29,42 + Owner: Neutral + Health: 1 + Facing: 0 + Actor75: v20 + Location: 39,17 + Owner: Neutral + Health: 1 + Facing: 0 + Actor76: v21 + Location: 43,16 + Owner: Neutral + Health: 1 + Facing: 0 + TechCenter: miss + Location: 14,17 + Owner: GDI + Health: 1 + Facing: 0 + Actor78: v22 + Location: 39,16 + Owner: Neutral + Health: 1 + Facing: 0 + Actor79: v26 + Location: 37,19 + Owner: Neutral + Health: 1 + Facing: 0 + Actor80: bike + Location: 52,38 + Owner: Nod + Health: 1 + Facing: 128 + Actor82: jeep + Location: 21,22 + Owner: GDI + Health: 1 + Facing: 128 + Actor83: jeep + Location: 20,22 + Owner: GDI + Health: 1 + Facing: 128 + Actor84: jeep + Location: 18,17 + Owner: GDI + Health: 1 + Facing: 128 + Actor86: mcv + Location: 50,36 + Owner: Nod + Health: 1 + Facing: 128 + Actor87: bike + Location: 51,38 + Owner: Nod + Health: 1 + Facing: 128 + Actor89: jeep + Location: 29,34 + Owner: GDI + Health: 1 + Facing: 96 + Actor90: bggy + Location: 48,38 + Owner: Nod + Health: 1 + Facing: 128 + Actor92: bggy + Location: 49,38 + Owner: Nod + Health: 1 + Facing: 128 + TibFieldHumvee01: jeep + Location: 52,19 + Owner: GDI + Actor95: e1 + Location: 33,20 + Owner: GDI + Health: 1 + Facing: 128 + SubCell: 2 + Actor96: e1 + Location: 34,19 + Owner: GDI + Health: 1 + Facing: 128 + SubCell: 3 + VillageGuard01: e1 + Location: 38,22 + Owner: GDI + Health: 1 + Facing: 96 + SubCell: 2 + VillageGuard02: e1 + Location: 38,22 + Owner: GDI + Health: 1 + Facing: 96 + SubCell: 3 + Actor99: e1 + Location: 14,44 + Owner: GDI + Health: 1 + Facing: 0 + SubCell: 1 + Actor100: e1 + Location: 33,31 + Owner: GDI + Health: 1 + Facing: 96 + SubCell: 4 + Actor101: e1 + Location: 34,23 + Owner: GDI + Health: 1 + Facing: 96 + SubCell: 2 + Actor102: c1 + Location: 19,40 + Owner: Neutral + Health: 1 + Facing: 96 + SubCell: 1 + Actor103: c3 + Location: 19,39 + Owner: Neutral + Health: 1 + Facing: 96 + SubCell: 3 + Actor104: c5 + Location: 15,42 + Owner: Neutral + Health: 1 + Facing: 32 + SubCell: 2 + Actor105: c6 + Location: 14,37 + Owner: Neutral + Health: 0.5976563 + Facing: 96 + SubCell: 1 + Actor106: c7 + Location: 15,41 + Owner: Neutral + Health: 1 + Facing: 224 + SubCell: 0 + VillageGuard03: e1 + Location: 39,22 + Owner: GDI + Health: 1 + Facing: 160 + SubCell: 3 + Actor108: e1 + Location: 34,31 + Owner: GDI + Health: 1 + Facing: 96 + SubCell: 3 + Actor109: e1 + Location: 34,25 + Owner: GDI + Health: 1 + Facing: 160 + SubCell: 2 + Actor110: e1 + Location: 48,39 + Owner: Nod + Health: 1 + Facing: 128 + SubCell: 4 + Actor111: e1 + Location: 39,31 + Owner: GDI + Health: 1 + Facing: 0 + SubCell: 3 + Actor112: e1 + Location: 40,37 + Owner: GDI + Health: 1 + Facing: 96 + SubCell: 0 + Actor113: e1 + Location: 49,39 + Owner: Nod + Health: 1 + Facing: 128 + SubCell: 3 + Actor116: e2 + Location: 34,22 + Owner: GDI + Health: 1 + Facing: 96 + SubCell: 3 + Actor117: e2 + Location: 34,23 + Owner: GDI + Health: 1 + Facing: 160 + SubCell: 4 + Actor118: e2 + Location: 42,18 + Owner: GDI + Health: 1 + Facing: 128 + SubCell: 4 + Actor119: e2 + Location: 33,19 + Owner: GDI + Health: 1 + Facing: 128 + SubCell: 0 + Actor122: e3 + Location: 51,39 + Owner: Nod + Health: 1 + Facing: 128 + SubCell: 4 + Actor123: e3 + Location: 52,39 + Owner: Nod + Health: 1 + Facing: 128 + SubCell: 1 + AttackWaveSpawnA: waypoint + Location: 45,16 + Owner: Neutral + PlayerBase: waypoint + Location: 50,38 + Owner: Neutral + AttackWaveSpawnC: waypoint + Location: 33,16 + Owner: Neutral + AttackWaveSpawnB: waypoint + Location: 44,48 + Owner: Neutral + CellTrig: waypoint + Location: 32,47 + Owner: Neutral + +Smudges: + +Rules: + Player: + -ConquestVictoryConditions: + World: + -CrateSpawner: + -SpawnMPUnits: + -MPStartLocations: + LuaScriptInterface: + LuaScripts: mission.lua + NUK2: + Buildable: + Owner: None + AFLD: + Buildable: + Owner: None + HPAD: + Buildable: + Owner: None + FIX: + Buildable: + Owner: None + TMPL: + Buildable: + Owner: None + GUN: + Buildable: + Owner: None + SAM: + Buildable: + Owner: None + OBLI: + Buildable: + Owner: None + GTWR: + Buildable: + Owner: None + BRIK: + Buildable: + Owner: None + WEAP: + Buildable: + Owner: None + EYE: + Buildable: + Owner: None + ATWR: + Buildable: + Owner: None + HQ: + Buildable: + Owner: None + E4: + Buildable: + Owner: None + E5: + Buildable: + Owner: None + MISS: + Tooltip: + Name: Prison + Capturable: + HQ.NOAIRSTRIKE: + RequiresPower: + CanPowerDown: + Inherits: ^Building + Valued: + Cost: 1000 + Tooltip: + Name: Communications Center + Description: Provides an overview of the battlefield.\n Requires power to operate. + ProvidesCustomPrerequisite: + Prerequisite: anyhq + Buildable: + BuildPaletteOrder: 70 + Prerequisites: proc + Owner: gdi,nod + Building: + Power: -40 + Footprint: x_ xx + Dimensions: 2,2 + Health: + HP: 750 + RevealsShroud: + Range: 10 + Bib: + ProvidesRadar: + RenderDetectionCircle: + DetectCloaked: + Range: 8 + RenderBuilding: + Image: hq + +Sequences: + +VoxelSequences: + +Weapons: + +Voices: + +Notifications: + +Translations: diff --git a/mods/cnc/maps/nod03a/mission.lua b/mods/cnc/maps/nod03a/mission.lua new file mode 100644 index 0000000000..ab8fae4894 --- /dev/null +++ b/mods/cnc/maps/nod03a/mission.lua @@ -0,0 +1,50 @@ +FirstAttackWave = { "e1", "e1", "e1", "e2", } +SecondThirdAttackWave = { "e1", "e1", "e2", } + +MissionAccomplished = function() + Mission.MissionOver({ player }, nil, false) + Media.PlayMovieFullscreen("desflees.vqa") +end + +MissionFailed = function() + Mission.MissionOver(nil, { player }, false) + Media.PlayMovieFullscreen("flag.vqa") +end + +SendFirstAttackWave = function() + for FirstAttackWaveCount = 1, 4 do + local waveunit = Actor.Create(FirstAttackWave[FirstAttackWaveCount], { Owner = enemy, Location = AttackWaveSpawnA.Location }) + Actor.AttackMove(waveunit, PlayerBase.Location) + end +end + +SendSecondAttackWave = function() + for SecondAttackWaveCount = 1, 3 do + local waveunit = Actor.Create(SecondThirdAttackWave[SecondAttackWaveCount], { Owner = enemy, Location = AttackWaveSpawnB.Location }) + Actor.AttackMove(waveunit, PlayerBase.Location) + end +end + +SendThirdAttackWave = function() + for ThirdAttackWaveCount = 1, 3 do + local waveunit = Actor.Create(SecondThirdAttackWave[ThirdAttackWaveCount], { Owner = enemy, Location = AttackWaveSpawnC.Location }) + Actor.AttackMove(waveunit, PlayerBase.Location) + end +end + +WorldLoaded = function() + player = OpenRA.GetPlayer("Nod") + enemy = OpenRA.GetPlayer("GDI") + Media.PlayMovieFullscreen("nod3.vqa") + OpenRA.RunAfterDelay(25 * 20, SendFirstAttackWave) + OpenRA.RunAfterDelay(25 * 50, SendSecondAttackWave) + OpenRA.RunAfterDelay(25 * 100, SendThirdAttackWave) + Actor.OnCaptured(TechCenter, MissionAccomplished) + Actor.OnKilled(TechCenter, MissionFailed) +end + +Tick = function() + if Mission.RequiredUnitsAreDestroyed(player) then + MissionFailed() + end +end diff --git a/mods/common/lua/actor.lua b/mods/common/lua/actor.lua index 7e7dfd383c..da9a5c4c96 100644 --- a/mods/common/lua/actor.lua +++ b/mods/common/lua/actor.lua @@ -155,6 +155,10 @@ Actor.OnRemovedFromWorld = function(actor, eh) Actor.Trait(actor, "LuaScriptEvents").OnRemovedFromWorld:Add(eh) end +Actor.OnCaptured = function(actor, eh) + Actor.Trait(actor, "LuaScriptEvents").OnCaptured:Add(eh) +end + Actor.ActorsWithTrait = function(className) local ret = { } for item in Utils.Enumerate(Internal.ActorsWithTrait(className)) do @@ -173,4 +177,4 @@ end Actor.Trait = function(actor, className) return Internal.Trait(actor, className) -end \ No newline at end of file +end