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,77 @@
#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.Collections.Generic;
using OpenRA.GameRules;
using OpenRA.Graphics;
using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Effects
{
public class DropPodImpact : IProjectile
{
readonly Target target;
readonly Animation entryAnimation;
readonly Player firedBy;
readonly string entryPalette;
readonly WeaponInfo weapon;
readonly WPos launchPos;
int weaponDelay;
bool impacted = false;
public DropPodImpact(Player firedBy, WeaponInfo weapon, World world, WPos launchPos, in Target target,
int delay, string entryEffect, string entrySequence, string entryPalette)
{
this.target = target;
this.firedBy = firedBy;
this.weapon = weapon;
this.entryPalette = entryPalette;
weaponDelay = delay;
this.launchPos = launchPos;
entryAnimation = new Animation(world, entryEffect);
entryAnimation.PlayThen(entrySequence, () => Finish(world));
if (weapon.Report != null && weapon.Report.Length > 0)
Game.Sound.Play(SoundType.World, weapon.Report, world, launchPos);
}
public void Tick(World world)
{
entryAnimation.Tick();
if (!impacted && weaponDelay-- <= 0)
{
var warheadArgs = new WarheadArgs
{
Weapon = weapon,
Source = target.CenterPosition,
SourceActor = firedBy.PlayerActor,
WeaponTarget = target
};
weapon.Impact(target, warheadArgs);
impacted = true;
}
}
public IEnumerable<IRenderable> Render(WorldRenderer wr)
{
return entryAnimation.Render(launchPos, wr.Palette(entryPalette));
}
void Finish(World world)
{
world.AddFrameEndTask(w => w.Remove(this));
}
}
}

View File

@@ -0,0 +1,73 @@
#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.Collections.Generic;
using OpenRA.GameRules;
using OpenRA.Graphics;
using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Effects
{
public class IonCannon : IProjectile
{
readonly Target target;
readonly Animation anim;
readonly Player firedBy;
readonly string palette;
readonly WeaponInfo weapon;
int weaponDelay;
bool impacted = false;
public IonCannon(Player firedBy, WeaponInfo weapon, World world, WPos launchPos, in Target target, string effect, string sequence, string palette, int delay)
{
this.target = target;
this.firedBy = firedBy;
this.weapon = weapon;
this.palette = palette;
weaponDelay = delay;
anim = new Animation(world, effect);
anim.PlayThen(sequence, () => Finish(world));
if (weapon.Report != null && weapon.Report.Length > 0)
Game.Sound.Play(SoundType.World, weapon.Report, world, launchPos);
}
public void Tick(World world)
{
anim.Tick();
if (!impacted && weaponDelay-- <= 0)
{
var warheadArgs = new WarheadArgs
{
Weapon = weapon,
Source = target.CenterPosition,
SourceActor = firedBy.PlayerActor,
WeaponTarget = target
};
weapon.Impact(target, warheadArgs);
impacted = true;
}
}
public IEnumerable<IRenderable> Render(WorldRenderer wr)
{
return anim.Render(target.CenterPosition, wr.Palette(palette));
}
void Finish(World world)
{
world.AddFrameEndTask(w => w.Remove(this));
}
}
}

View File

@@ -0,0 +1,99 @@
#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.Collections.Generic;
using OpenRA.GameRules;
using OpenRA.Graphics;
using OpenRA.Mods.Cnc.Graphics;
using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Projectiles
{
[Desc("Instant-hit projectile used to create electricity-like effects.")]
public class TeslaZapInfo : IProjectileInfo
{
public readonly string Image = "litning";
[SequenceReference(nameof(Image))]
[Desc("Sprite sequence to play at the center.")]
public readonly string BrightSequence = "bright";
[SequenceReference(nameof(Image))]
[Desc("Sprite sequence to play at the borders.")]
public readonly string DimSequence = "dim";
[PaletteReference]
[Desc("The palette used to draw this electric zap.")]
public readonly string Palette = "effect";
[Desc("How many sprite sequences to play at the center.")]
public readonly int BrightZaps = 1;
[Desc("How many sprite sequences to play at the borders.")]
public readonly int DimZaps = 2;
[Desc("How long (in ticks) to play the sprite sequences.")]
public readonly int Duration = 2;
[Desc("How long (in ticks) until applying damage. Can't be longer than `" + nameof(Duration) + "`")]
public readonly int DamageDuration = 1;
[Desc("Follow the targeted actor when it moves.")]
public readonly bool TrackTarget = true;
[Desc("Controls Z sorting.")]
public readonly int ZOffset = 0;
public IProjectile Create(ProjectileArgs args) { return new TeslaZap(this, args); }
}
public class TeslaZap : IProjectile, ISync
{
readonly ProjectileArgs args;
readonly TeslaZapInfo info;
TeslaZapRenderable zap;
int ticksUntilRemove;
int damageDuration;
[VerifySync]
WPos target;
public TeslaZap(TeslaZapInfo info, ProjectileArgs args)
{
this.args = args;
this.info = info;
ticksUntilRemove = info.Duration;
damageDuration = info.DamageDuration > info.Duration ? info.Duration : info.DamageDuration;
target = args.PassiveTarget;
}
public void Tick(World world)
{
if (ticksUntilRemove-- <= 0)
world.AddFrameEndTask(w => w.Remove(this));
// Zap tracks target
if (info.TrackTarget && args.GuidedTarget.IsValidFor(args.SourceActor))
target = args.Weapon.TargetActorCenter ? args.GuidedTarget.CenterPosition : args.GuidedTarget.Positions.ClosestToIgnoringPath(args.Source);
if (damageDuration-- > 0)
args.Weapon.Impact(Target.FromPos(target), new WarheadArgs(args));
}
public IEnumerable<IRenderable> Render(WorldRenderer wr)
{
zap = new TeslaZapRenderable(args.Source, info.ZOffset, target - args.Source,
info.Image, info.BrightSequence, info.BrightZaps, info.DimSequence, info.DimZaps, info.Palette);
yield return zap;
}
}
}