Initial commit: OpenRA game engine
Some checks failed
Continuous Integration / Linux (.NET 8.0) (push) Has been cancelled
Continuous Integration / Windows (.NET 8.0) (push) Has been cancelled

Fork from OpenRA/OpenRA with one-click launch script (start-ra.cmd)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
let5sne.win10
2026-01-10 21:46:54 +08:00
commit 9cf6ebb986
4065 changed files with 635973 additions and 0 deletions

View File

@@ -0,0 +1,168 @@
--[[
Copyright (c) The OpenRA Developers and Contributors
This file is part of OpenRA, which is free software. It is made
available to you under the terms of the GNU General Public License
as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version. For more
information, see COPYING.
]]
HarkonnenReinforcements =
{
easy =
{
{ "light_inf", "light_inf" }
},
normal =
{
{ "light_inf", "light_inf" },
{ "light_inf", "light_inf", "light_inf" },
{ "light_inf", "trike" }
},
hard =
{
{ "light_inf", "light_inf" },
{ "trike", "trike" },
{ "light_inf", "light_inf", "light_inf" },
{ "light_inf", "trike" },
{ "trike", "trike" }
}
}
HarkonnenEntryWaypoints = { HarkonnenWaypoint1.Location, HarkonnenWaypoint2.Location, HarkonnenWaypoint3.Location, HarkonnenWaypoint4.Location }
HarkonnenAttackDelay = DateTime.Seconds(30)
HarkonnenAttackWaves =
{
easy = 1,
normal = 5,
hard = 12
}
ToHarvest =
{
easy = 2500,
normal = 3000,
hard = 3500
}
AtreidesReinforcements = { "light_inf", "light_inf", "light_inf" }
AtreidesEntryPath = { AtreidesWaypoint.Location, AtreidesRally.Location }
Messages =
{
UserInterface.GetFluentMessage("build-concrete"),
UserInterface.GetFluentMessage("build-wind-trap"),
UserInterface.GetFluentMessage("build-refinery"),
UserInterface.GetFluentMessage("build-silo")
}
CachedResources = -1
Tick = function()
if HarkonnenArrived and Harkonnen.HasNoRequiredUnits() then
Atreides.MarkCompletedObjective(KillHarkonnen)
end
if Atreides.Resources > SpiceToHarvest - 1 then
Atreides.MarkCompletedObjective(GatherSpice)
end
-- player has no Wind Trap
if (Atreides.PowerProvided <= 20 or Atreides.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then
HasPower = false
Media.DisplayMessage(Messages[2], Mentat)
else
HasPower = true
end
-- player has no Refinery and no Silos
if HasPower and Atreides.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
Media.DisplayMessage(Messages[3], Mentat)
end
if HasPower and Atreides.Resources > Atreides.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
Media.DisplayMessage(Messages[4], Mentat)
end
if Atreides.Resources ~= CachedResources then
local harvestedResources = UserInterface.GetFluentMessage("harvested-resources",
{ ["harvested"] = Atreides.Resources, ["goal"] = SpiceToHarvest })
UserInterface.SetMissionText(harvestedResources)
CachedResources = Atreides.Resources
end
end
WorldLoaded = function()
Atreides = Player.GetPlayer("Atreides")
Harkonnen = Player.GetPlayer("Harkonnen")
SpiceToHarvest = ToHarvest[Difficulty]
InitObjectives(Atreides)
KillAtreides = AddPrimaryObjective(Harkonnen, "")
local harvestSpice = UserInterface.GetFluentMessage("harvest-spice", { ["spice"] = SpiceToHarvest })
GatherSpice = AddPrimaryObjective(Atreides, harvestSpice)
KillHarkonnen = AddSecondaryObjective(Atreides, "eliminate-harkonnen-units-reinforcements")
local checkResourceCapacity = function()
Trigger.AfterDelay(0, function()
if Atreides.ResourceCapacity < SpiceToHarvest then
Media.DisplayMessage(UserInterface.GetFluentMessage("not-enough-silos"), Mentat)
Trigger.AfterDelay(DateTime.Seconds(3), function()
Harkonnen.MarkCompletedObjective(KillAtreides)
end)
end
end)
end
Trigger.OnRemovedFromWorld(AtreidesConyard, function()
-- Mission already failed, no need to check the other conditions as well
if checkResourceCapacity() then
return
end
local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == Atreides end)
if #refs == 0 then
Harkonnen.MarkCompletedObjective(KillAtreides)
else
Trigger.OnAllRemovedFromWorld(refs, function()
Harkonnen.MarkCompletedObjective(KillAtreides)
end)
local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == Atreides end)
Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
end
end)
Media.DisplayMessage(Messages[1], Mentat)
Trigger.AfterDelay(DateTime.Seconds(25), function()
Media.PlaySpeechNotification(Atreides, "Reinforce")
Reinforcements.Reinforce(Atreides, AtreidesReinforcements, AtreidesEntryPath)
end)
WavesLeft = HarkonnenAttackWaves[Difficulty]
SendReinforcements()
end
SendReinforcements = function()
local units = HarkonnenReinforcements[Difficulty]
local delay = Utils.RandomInteger(HarkonnenAttackDelay - DateTime.Seconds(2), HarkonnenAttackDelay)
HarkonnenAttackDelay = HarkonnenAttackDelay - (#units * 3 - 3 - WavesLeft) * 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)
WavesLeft = WavesLeft - 1
if WavesLeft == 0 then
Trigger.AfterDelay(DateTime.Seconds(1), function() HarkonnenArrived = true end)
else
SendReinforcements()
end
end)
end

Binary file not shown.

View File

@@ -0,0 +1,7 @@
## rules.yaml
briefing =
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.
You will have to learn the subtleties of mining as you go. Remember to build Silos to store Spice; without storage, you cannot gather more. 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.

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

View File

@@ -0,0 +1,117 @@
MapFormat: 12
RequiresMod: d2k
Title: Atreides 01a
Author: Westwood Studios
Tileset: ARRAKIS
MapSize: 32,28
Bounds: 2,2,28,24
Visibility: MissionSelector
Categories: Campaign
LockPreview: True
Players:
PlayerReference@Neutral:
Name: Neutral
OwnsWorld: True
NonCombatant: True
Faction: Random
PlayerReference@Creeps:
Name: Creeps
NonCombatant: True
Faction: Random
Enemies: Atreides, Harkonnen
PlayerReference@Atreides:
Name: Atreides
Playable: true
Faction: atreides
LockFaction: true
Color: 5A7394
LockColor: true
Enemies: Harkonnen, Creeps
PlayerReference@Harkonnen:
Name: Harkonnen
Faction: harkonnen
LockFaction: true
Color: D64A42
LockColor: true
Enemies: Atreides, Creeps
Bot: campaign
Actors:
Actor0: trike
Location: 15,8
Owner: Atreides
Actor1: light_inf
Location: 13,9
Owner: Atreides
Actor2: light_inf
Location: 25,9
Owner: Harkonnen
Actor3: light_inf
Location: 16,10
Owner: Atreides
Actor4: trike
Location: 9,11
Owner: Atreides
Actor6: light_inf
Location: 15,11
Owner: Atreides
Actor7: trike
Location: 9,13
Owner: Atreides
Actor8: light_inf
Location: 15,13
Owner: Atreides
Actor9: light_inf
Location: 14,14
Owner: Atreides
Facing: 512
Actor10: light_inf
Location: 12,19
Owner: Harkonnen
Actor11: light_inf
Location: 29,19
Owner: Harkonnen
Actor12: light_inf
Location: 19,20
Owner: Harkonnen
Actor13: spicebloom.spawnpoint
Location: 24,20
Owner: Neutral
Actor14: wormspawner
Location: 7,23
Owner: Creeps
AtreidesConyard: construction_yard
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
Rules: d2k|rules/campaign-rules.yaml, d2k|rules/campaign-tooltips.yaml, d2k|rules/campaign-palettes.yaml, rules.yaml
FluentMessages: d2k|fluent/lua.ftl, d2k|fluent/campaign.ftl, map.ftl

View File

@@ -0,0 +1,61 @@
Player:
PlayerResources:
DefaultCash: 2300
World:
LuaScript:
Scripts: campaign.lua, utils.lua, atreides01a.lua
MissionData:
Briefing: briefing
BriefingVideo: A_BR01_E.VQA
MapOptions:
TechLevel: low
ScriptLobbyDropdown@difficulty:
ID: difficulty
Label: dropdown-difficulty.label
Description: dropdown-difficulty.description
Values:
easy: options-difficulty.easy
normal: options-difficulty.normal
hard: options-difficulty.hard
Default: easy
upgrade.conyard:
Buildable:
Prerequisites: ~disabled
upgrade.barracks:
Buildable:
Prerequisites: ~disabled
upgrade.light:
Buildable:
Prerequisites: ~disabled
upgrade.heavy:
Buildable:
Prerequisites: ~disabled
concreteb:
Buildable:
Prerequisites: ~disabled
barracks:
Buildable:
Prerequisites: ~disabled
light_factory:
Buildable:
Prerequisites: ~disabled
heavy_factory:
Buildable:
Prerequisites: ~disabled
medium_gun_turret:
Buildable:
Prerequisites: ~disabled
wall:
Buildable:
Prerequisites: ~disabled