diff --git a/OpenRA.sln b/OpenRA.sln index 7d5e41ea73..5815fbea1f 100644 --- a/OpenRA.sln +++ b/OpenRA.sln @@ -63,6 +63,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Red Alert Lua scripts", "Re mods\ra\maps\survival02\survival02.lua = mods\ra\maps\survival02\survival02.lua EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Dune 2000 Lua scripts", "Dune 2000 Lua scripts", "{06B1AE07-DDB0-4287-8700-A8CD9A0E652E}" + ProjectSection(SolutionItems) = preProject + mods\d2k\maps\atreides-01a\atreides01a.lua = mods\d2k\maps\atreides-01a\atreides01a.lua + mods\d2k\maps\shellmap\shellmap.lua = mods\d2k\maps\shellmap\shellmap.lua + EndProjectSection +EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "System Lua scripts", "System Lua scripts", "{A4D6AEA4-8009-4256-903B-8D227E50452B}" ProjectSection(SolutionItems) = preProject lua\sandbox.lua = lua\sandbox.lua diff --git a/mods/d2k/maps/atreides-01a/atreides01a.lua b/mods/d2k/maps/atreides-01a/atreides01a.lua new file mode 100644 index 0000000000..d6fdcf8fce --- /dev/null +++ b/mods/d2k/maps/atreides-01a/atreides01a.lua @@ -0,0 +1,160 @@ + +HarkonnenReinforcements = { } +HarkonnenReinforcements["Easy"] = +{ + { "rifle", "rifle" } +} + +HarkonnenReinforcements["Normal"] = +{ + { "rifle", "rifle" }, + { "rifle", "rifle", "rifle" }, + { "rifle", "trike" }, +} + +HarkonnenReinforcements["Hard"] = +{ + { "rifle", "rifle" }, + { "trike", "trike" }, + { "rifle", "rifle", "rifle" }, + { "rifle", "trike" }, + { "trike", "trike" } +} + +HarkonnenEntryWaypoints = { HarkonnenWaypoint1.Location, HarkonnenWaypoint2.Location, HarkonnenWaypoint3.Location, HarkonnenWaypoint4.Location } +HarkonnenAttackDelay = DateTime.Seconds(30) +HarkonnenAttackWaves = 1 + +AtreidesReinforcements = { "rifle", "rifle", "rifle" } +AtreidesEntryPath = { AtreidesWaypoint.Location, AtreidesRally.Location } + +Messages = +{ + "Build a concrete foundation before placing your buildings.", + "Build a Wind Trap for power.", + "Build a Refinery to collect Spice.", + "Build a Silo to store additional Spice." +} + +ToHarvest = 2500 + +IdleHunt = function(actor) + if not actor.IsDead then + Trigger.OnIdle(actor, actor.Hunt) + end +end + +Tick = function() + if HarkonnenArrived and harkonnen.HasNoRequiredUnits() then + player.MarkCompletedObjective(KillHarkonnen) + end + + if player.Resources > ToHarvest - 1 then + player.MarkCompletedObjective(GatherSpice) + end + + -- player has no Wind Trap + if (player.PowerProvided <= 20 or player.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then + HasPower = false + Media.DisplayMessage(Messages[2], "") + else + HasPower = true + end + + -- player has no Refinery and no Silos + if HasPower and player.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then + Media.DisplayMessage(Messages[3], "") + end + + if HasPower and player.Resources > player.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then + Media.DisplayMessage(Messages[4], "") + end + + UserInterface.SetMissionText("Harvested resources: " .. player.Resources .. "/" .. ToHarvest, color) +end + +WorldLoaded = function() + player = Player.GetPlayer("Atreides") + harkonnen = Player.GetPlayer("Harkonnen") + + color = HSLColor.New(170, 255, 200) + + if Map.Difficulty == "Normal" then + HarkonnenAttackWaves = 5 + ToHarvest = 3000 + elseif Map.Difficulty == "Hard" then + HarkonnenAttackWaves = 12 + ToHarvest = 3500 + end + + InitObjectives() + + Trigger.OnRemovedFromWorld(AtreidesConyard, function() + local refs = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor) + return actor.Type == "refinery" + end) + + if #refs == 0 then + harkonnen.MarkCompletedObjective(KillAtreides) + else + Trigger.OnAllRemovedFromWorld(refs, function() + harkonnen.MarkCompletedObjective(KillAtreides) + end) + end + end) + + Media.DisplayMessage(Messages[1], "") + + Trigger.AfterDelay(DateTime.Seconds(25), function() + Media.PlaySpeechNotification(player, "Reinforce") + Reinforcements.Reinforce(player, AtreidesReinforcements, AtreidesEntryPath) + end) + + SendReinforcements() +end + +SendReinforcements = function() + local units = HarkonnenReinforcements[Map.Difficulty] + local delay = Utils.RandomInteger(HarkonnenAttackDelay - DateTime.Seconds(2), HarkonnenAttackDelay) + HarkonnenAttackDelay = HarkonnenAttackDelay - (#units * 3 - 3 - HarkonnenAttackWaves) * DateTime.Seconds(1) + if HarkonnenAttackDelay < 0 then HarkonnenAttackDelay = 0 end + + Trigger.AfterDelay(delay, function() + Reinforcements.Reinforce(harkonnen, Utils.Random(units), { Utils.Random(HarkonnenEntryWaypoints) }, 10, IdleHunt) + + HarkonnenAttackWaves = HarkonnenAttackWaves - 1 + if HarkonnenAttackWaves == 0 then + Trigger.AfterDelay(DateTime.Seconds(1), function() HarkonnenArrived = true end) + else + SendReinforcements() + end + end) +end + +InitObjectives = function() + Trigger.OnObjectiveAdded(player, function(p, id) + Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") + end) + + KillAtreides = harkonnen.AddPrimaryObjective("Kill all Atreides units.") + GatherSpice = player.AddPrimaryObjective("Harvest " .. tostring(ToHarvest) .. " Solaris worth of Spice.") + KillHarkonnen = player.AddSecondaryObjective("Eliminate all Harkonnen units and reinforcements\nin the area.") + + Trigger.OnObjectiveCompleted(player, function(p, id) + Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") + end) + Trigger.OnObjectiveFailed(player, function(p, id) + Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") + end) + + Trigger.OnPlayerLost(player, function() + Trigger.AfterDelay(DateTime.Seconds(1), function() + Media.PlaySpeechNotification(player, "Lose") + end) + end) + Trigger.OnPlayerWon(player, function() + Trigger.AfterDelay(DateTime.Seconds(1), function() + Media.PlaySpeechNotification(player, "Win") + end) + end) +end diff --git a/mods/d2k/maps/atreides-01a/map.bin b/mods/d2k/maps/atreides-01a/map.bin new file mode 100644 index 0000000000..bdb4e3bcdb Binary files /dev/null and b/mods/d2k/maps/atreides-01a/map.bin differ diff --git a/mods/d2k/maps/atreides-01a/map.png b/mods/d2k/maps/atreides-01a/map.png new file mode 100644 index 0000000000..c91cd2edac Binary files /dev/null and b/mods/d2k/maps/atreides-01a/map.png differ diff --git a/mods/d2k/maps/atreides-01a/map.yaml b/mods/d2k/maps/atreides-01a/map.yaml new file mode 100644 index 0000000000..53efc9a86d --- /dev/null +++ b/mods/d2k/maps/atreides-01a/map.yaml @@ -0,0 +1,179 @@ +MapFormat: 7 + +RequiresMod: d2k + +Title: Atreides 01a + +Description: Harvest Spice from the Imperial Basin. Construct a Spice Refinery and defend it against the Harkonnen troops scattered throughout the basin. You have been assigned only limited offensive forces - use them wisely.\n\nYou will have to learn the subtleties of mining as you go, but remember to build Silos to store the Spice. When you run out of storage space you can not gather more Spice. Also, any building without adequate concrete foundation will need immediate repair and be vulnerable to erosive damage from the harsh environment. Your greatest adversary may be the elements. Good luck.\n + +Author: Westwood Studios + +Tileset: ARRAKIS + +MapSize: 32,28 + +Bounds: 2,2,28,24 + +Visibility: MissionSelector + +Type: Campaign + +Videos: + Briefing: a_br01_e.vqa + +Options: + Crates: False + Creeps: True + Fog: True + Shroud: True + AllyBuildRadius: False + FragileAlliances: False + StartingCash: 2300 + ConfigurableStartingUnits: False + ShortGame: False + TechLevel: Low + Difficulties: Easy, Normal, Hard + +Players: + PlayerReference@Neutral: + Name: Neutral + OwnsWorld: True + NonCombatant: True + Race: Random + PlayerReference@Creeps: + Name: Creeps + NonCombatant: True + Race: Random + PlayerReference@Atreides: + Name: Atreides + Playable: true + Race: atreides + LockRace: true + ColorRamp: 170,255,127 + LockColor: true + Enemies: Harkonnen + PlayerReference@Harkonnen: + Name: Harkonnen + Race: harkonnen + LockRace: true + ColorRamp: 0,255,127 + LockColor: true + Enemies: Atreides + +Actors: + Actor0: trike + Location: 15,8 + Owner: Atreides + Actor1: rifle + Location: 13,9 + Owner: Atreides + Actor2: rifle + Location: 25,9 + Owner: Harkonnen + Actor3: rifle + Location: 16,10 + Owner: Atreides + Actor4: trike + Location: 9,11 + Owner: Atreides + Actor6: rifle + Location: 15,11 + Owner: Atreides + Actor7: trike + Location: 9,13 + Owner: Atreides + Actor8: rifle + Location: 15,13 + Owner: Atreides + Actor9: rifle + Location: 14,14 + Owner: Atreides + Facing: 128 + Actor10: rifle + Location: 12,19 + Owner: Harkonnen + Actor11: rifle + Location: 29,19 + Owner: Harkonnen + Actor12: rifle + Location: 19,20 + Owner: Harkonnen + Actor13: spicebloom + Location: 24,20 + Owner: Neutral + Actor14: wormspawner + Location: 7,23 + Owner: Creeps + AtreidesConyard: conyard + Location: 11,11 + Owner: Atreides + HarkonnenWaypoint1: waypoint + Location: 20,2 + Owner: Neutral + HarkonnenWaypoint2: waypoint + Location: 29,10 + Owner: Neutral + HarkonnenWaypoint3: waypoint + Location: 24,25 + Owner: Neutral + HarkonnenWaypoint4: waypoint + Location: 2,20 + Owner: Neutral + AtreidesWaypoint: waypoint + Location: 2,8 + Owner: Neutral + AtreidesRally: waypoint + Location: 13,13 + Owner: Neutral + +Smudges: + +Rules: + Player: + -ConquestVictoryConditions: + MissionObjectives: + EarlyGameOver: true + World: + -CrateSpawner: + -SpawnMPUnits: + -MPStartLocations: + LuaScript: + Scripts: atreides01a.lua + ObjectivesPanel: + PanelName: MISSION_OBJECTIVES + WormManager: + Minimum: 1 + Maximum: 1 + conyard: + Production: + Produces: Building + concreteb: + Buildable: + Prerequisites: ~disabled + barracks: + Buildable: + Prerequisites: ~disabled + light: + Buildable: + Prerequisites: ~disabled + heavy: + Buildable: + Prerequisites: ~disabled + guntower: + Buildable: + Prerequisites: ~disabled + wall: + Buildable: + Prerequisites: ~disabled + +Sequences: + +VoxelSequences: + +Weapons: + +Voices: + +Notifications: + +Translations: diff --git a/mods/d2k/missions.yaml b/mods/d2k/missions.yaml new file mode 100644 index 0000000000..40634d409c --- /dev/null +++ b/mods/d2k/missions.yaml @@ -0,0 +1,3 @@ +Atreides Campaign: + ./mods/d2k/maps/atreides-01a + diff --git a/mods/d2k/mod.yaml b/mods/d2k/mod.yaml index 76f981f112..3d55f46541 100644 --- a/mods/d2k/mod.yaml +++ b/mods/d2k/mod.yaml @@ -178,6 +178,9 @@ Fonts: Font:./mods/common/FreeSansBold.ttf Size:10 +Missions: + ./mods/d2k/missions.yaml + SupportsMapsFrom: d2k SpriteFormats: R8, ShpTD, TmpRA