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,49 @@
#region Copyright & License Information
/*
* 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.
*/
#endregion
using Eluant;
using OpenRA.Mods.Cnc.Traits;
using OpenRA.Mods.Common.Scripting;
using OpenRA.Scripting;
using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Scripting
{
[ScriptPropertyGroup("Support Powers")]
public class ChronosphereProperties : ScriptActorProperties, Requires<ChronoshiftPowerInfo>
{
public ChronosphereProperties(ScriptContext context, Actor self)
: base(context, self) { }
[Desc("Chronoshift a group of actors. A duration of 0 will teleport the actors permanently. " +
"If a given cell is unexplored for this power's owner, the closest valid cell will be used instead.")]
public void Chronoshift([ScriptEmmyTypeOverride("{ [actor]: cpos }")] LuaTable unitLocationPairs, int duration = 0, bool killCargo = false)
{
foreach (var kv in unitLocationPairs)
{
Actor actor;
CPos cell;
using (kv.Key)
using (kv.Value)
{
if (!kv.Key.TryGetClrValue(out actor) || !kv.Value.TryGetClrValue(out cell))
throw new LuaException($"Chronoshift requires a table of actor,cpos pairs. Received {kv.Key.WrappedClrType().Name},{kv.Value.WrappedClrType().Name}");
}
var cs = actor.TraitsImplementing<Chronoshiftable>()
.FirstEnabledConditionalTraitOrDefault();
if (cs != null && cs.CanChronoshiftTo(actor, cell))
cs.Teleport(actor, cell, duration, killCargo, Self);
}
}
}
}

View File

@@ -0,0 +1,42 @@
#region Copyright & License Information
/*
* 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.
*/
#endregion
using OpenRA.Mods.Cnc.Traits;
using OpenRA.Scripting;
using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Scripting
{
[ScriptPropertyGroup("Ability")]
public class DisguiseProperties : ScriptActorProperties, Requires<DisguiseInfo>
{
readonly Disguise disguise;
public DisguiseProperties(ScriptContext context, Actor self)
: base(context, self)
{
disguise = Self.Trait<Disguise>();
}
[Desc("Disguises as the target actor.")]
public void DisguiseAs(Actor target)
{
disguise.DisguiseAs(target);
}
[Desc("Disguises as the target type with the specified owner.")]
public void DisguiseAsType(string actorType, Player newOwner)
{
var actorInfo = Self.World.Map.Rules.Actors[actorType];
disguise.DisguiseAs(actorInfo, newOwner);
}
}
}

View File

@@ -0,0 +1,44 @@
#region Copyright & License Information
/*
* 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.
*/
#endregion
using System.Linq;
using Eluant;
using OpenRA.Mods.Cnc.Activities;
using OpenRA.Mods.Cnc.Traits;
using OpenRA.Scripting;
using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Scripting
{
[ScriptPropertyGroup("Ability")]
public class InfiltrateProperties : ScriptActorProperties, Requires<InfiltratesInfo>
{
readonly Infiltrates[] infiltratesTraits;
public InfiltrateProperties(ScriptContext context, Actor self)
: base(context, self)
{
infiltratesTraits = Self.TraitsImplementing<Infiltrates>().ToArray();
}
[Desc("Infiltrate the target actor.")]
public void Infiltrate(Actor target)
{
var infiltrates = infiltratesTraits.FirstOrDefault(x => !x.IsTraitDisabled && x.Info.Types.Overlaps(target.GetEnabledTargetTypes()));
if (infiltrates == null)
throw new LuaException($"{Self} tried to infiltrate invalid target {target}!");
// NB: Scripted actions get no visible targetlines.
Self.QueueActivity(new Infiltrate(Self, Target.FromActor(target), infiltrates, null));
}
}
}

View File

@@ -0,0 +1,36 @@
#region Copyright & License Information
/*
* 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.
*/
#endregion
using System.Linq;
using OpenRA.Mods.Cnc.Traits;
using OpenRA.Scripting;
using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Scripting
{
[ScriptPropertyGroup("Support Powers")]
public class IonCannonProperties : ScriptActorProperties, Requires<IonCannonPowerInfo>
{
readonly IonCannonPower icp;
public IonCannonProperties(ScriptContext context, Actor self)
: base(context, self)
{
icp = self.TraitsImplementing<IonCannonPower>().First();
}
[Desc("Activate the actor's IonCannonPower.")]
public void ActivateIonCannon(CPos target)
{
icp.Activate(Self, Target.FromCell(Self.World, target));
}
}
}