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,169 @@
--[[
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.
]]
AtreidesReinforcements =
{
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" }
}
}
AtreidesEntryWaypoints = { AtreidesWaypoint1.Location, AtreidesWaypoint2.Location, AtreidesWaypoint3.Location, AtreidesWaypoint4.Location }
AtreidesAttackDelay = DateTime.Seconds(30)
AtreidesAttackWaves =
{
easy = 1,
normal = 5,
hard = 12
}
ToHarvest =
{
easy = 2500,
normal = 3000,
hard = 3500
}
HarkonnenReinforcements = { "light_inf", "light_inf", "light_inf", "trike" }
HarkonnenEntryPath = { HarkonnenWaypoint.Location, HarkonnenRally.Location }
Messages =
{
UserInterface.GetFluentMessage("build-concrete"),
UserInterface.GetFluentMessage("build-wind-trap"),
UserInterface.GetFluentMessage("build-refinery"),
UserInterface.GetFluentMessage("build-silo")
}
CachedResources = -1
Tick = function()
if AtreidesArrived and Atreides.HasNoRequiredUnits() then
Harkonnen.MarkCompletedObjective(KillAtreides)
end
if Harkonnen.Resources > SpiceToHarvest - 1 then
Harkonnen.MarkCompletedObjective(GatherSpice)
end
-- player has no Wind Trap
if (Harkonnen.PowerProvided <= 20 or Harkonnen.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 Harkonnen.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
Media.DisplayMessage(Messages[3], Mentat)
end
if HasPower and Harkonnen.Resources > Harkonnen.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
Media.DisplayMessage(Messages[4], Mentat)
end
if Harkonnen.Resources ~= CachedResources then
local harvestedResources = UserInterface.GetFluentMessage("harvested-resources",
{ ["harvested"] = Harkonnen.Resources, ["goal"] = SpiceToHarvest })
UserInterface.SetMissionText(harvestedResources)
CachedResources = Harkonnen.Resources
end
end
WorldLoaded = function()
Harkonnen = Player.GetPlayer("Harkonnen")
Atreides = Player.GetPlayer("Atreides")
SpiceToHarvest = ToHarvest[Difficulty]
InitObjectives(Harkonnen)
KillHarkonnen = AddPrimaryObjective(Atreides, "")
local harvestSpice = UserInterface.GetFluentMessage("harvest-spice", { ["spice"] = SpiceToHarvest })
GatherSpice = AddPrimaryObjective(Harkonnen, harvestSpice)
KillAtreides = AddSecondaryObjective(Harkonnen, "eliminate-atreides-units-reinforcements")
local checkResourceCapacity = function()
Trigger.AfterDelay(0, function()
if Harkonnen.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(HarkonnenConyard, 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 == Harkonnen end)
if #refs == 0 then
Atreides.MarkCompletedObjective(KillHarkonnen)
else
Trigger.OnAllRemovedFromWorld(refs, function()
Atreides.MarkCompletedObjective(KillHarkonnen)
end)
local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == Harkonnen 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(Harkonnen, "Reinforce")
Reinforcements.Reinforce(Harkonnen, HarkonnenReinforcements, HarkonnenEntryPath)
end)
WavesLeft = AtreidesAttackWaves[Difficulty]
SendReinforcements()
end
SendReinforcements = function()
local units = AtreidesReinforcements[Difficulty]
local delay = Utils.RandomInteger(AtreidesAttackDelay - DateTime.Seconds(2), AtreidesAttackDelay)
AtreidesAttackDelay = AtreidesAttackDelay - (#units * 3 - 3 - WavesLeft) * DateTime.Seconds(1)
if AtreidesAttackDelay < 0 then AtreidesAttackDelay = 0 end
Trigger.AfterDelay(delay, function()
Reinforcements.Reinforce(Atreides, Utils.Random(units), { Utils.Random(AtreidesEntryWaypoints) }, 10, IdleHunt)
WavesLeft = WavesLeft - 1
if WavesLeft == 0 then
Trigger.AfterDelay(DateTime.Seconds(1), function() AtreidesArrived = true end)
else
SendReinforcements()
end
end)
end

Binary file not shown.

View File

@@ -0,0 +1,5 @@
## rules.yaml
briefing =
Mine Spice from the Imperial Basin, before the Atreides try to seize the area. Execute anyone who tries to stop you.
Build Silos to store Spice. Remember to place buildings on concrete foundations to prevent erosion. To build without concrete would be inefficient. Inefficiency will not be tolerated.

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

View File

@@ -0,0 +1,112 @@
MapFormat: 12
RequiresMod: d2k
Title: Harkonnen 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
PlayerReference@Harkonnen:
Name: Harkonnen
Playable: True
LockFaction: True
Faction: harkonnen
LockColor: True
Color: D64A42
Enemies: Atreides, Creeps
PlayerReference@Atreides:
Name: Atreides
LockFaction: True
Faction: atreides
LockColor: True
Color: 5A7394
Enemies: Harkonnen, Creeps
Bot: campaign
Actors:
Actor0: light_inf
Location: 7,2
Owner: Atreides
Actor1: light_inf
Location: 14,3
Owner: Atreides
Actor2: light_inf
Location: 21,3
Owner: Atreides
Actor3: wormspawner
Location: 18,4
Owner: Creeps
Actor4: light_inf
Location: 21,6
Owner: Atreides
Actor5: light_inf
Location: 5,10
Owner: Harkonnen
Actor6: light_inf
Location: 8,12
Owner: Harkonnen
HarkonnenConyard: construction_yard
Location: 7,14
Owner: Harkonnen
Actor8: light_inf
Location: 13,14
Owner: Harkonnen
Actor9: trike
Location: 4,16
Owner: Harkonnen
Actor10: light_inf
Location: 12,17
Owner: Harkonnen
Actor11: light_inf
Location: 7,18
Owner: Harkonnen
Actor12: trike
Location: 11,19
Owner: Harkonnen
Actor13: light_inf
Location: 28,19
Owner: Atreides
HarkonnenRally: waypoint
Owner: Neutral
Location: 12,12
HarkonnenWaypoint: waypoint
Owner: Neutral
Location: 2,12
AtreidesWaypoint1: waypoint
Owner: Neutral
Location: 20,2
AtreidesWaypoint2: waypoint
Owner: Neutral
Location: 18,25
AtreidesWaypoint3: waypoint
Owner: Neutral
Location: 29,21
AtreidesWaypoint4: waypoint
Owner: Neutral
Location: 29,7
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, harkonnen01a.lua
MissionData:
Briefing: briefing
BriefingVideo: H_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