Un-hardcodes pip/tag/group palettes.
-Palette for decorations can now be defined under SelectionDecorations trait. -Adds pip types Ammo and AmmoEmpty. -LimitedAmmo PipTypes are now customizable. -Adds art, sequences and rules entries for TS mod decorations that were missing/using a wrong palette. -Adds PrimaryBuilding trait to TS weapon factories and helipads.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||
* 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. For more information,
|
||||
@@ -15,18 +15,25 @@ namespace OpenRA.Traits
|
||||
{
|
||||
public class SelectionDecorationsInfo : ITraitInfo
|
||||
{
|
||||
public object Create(ActorInitializer init) { return new SelectionDecorations(init.self); }
|
||||
public readonly string Palette = "chrome";
|
||||
|
||||
public object Create(ActorInitializer init) { return new SelectionDecorations(init.self, this); }
|
||||
}
|
||||
|
||||
public class SelectionDecorations : IPostRenderSelection
|
||||
{
|
||||
// depends on the order of pips in TraitsInterfaces.cs!
|
||||
static readonly string[] pipStrings = { "pip-empty", "pip-green", "pip-yellow", "pip-red", "pip-gray", "pip-blue" };
|
||||
static readonly string[] pipStrings = { "pip-empty", "pip-green", "pip-yellow", "pip-red", "pip-gray", "pip-blue", "pip-ammo", "pip-ammoempty" };
|
||||
static readonly string[] tagStrings = { "", "tag-fake", "tag-primary" };
|
||||
|
||||
public SelectionDecorationsInfo Info;
|
||||
Actor self;
|
||||
|
||||
public SelectionDecorations(Actor self) { this.self = self; }
|
||||
public SelectionDecorations(Actor self, SelectionDecorationsInfo info)
|
||||
{
|
||||
this.self = self;
|
||||
Info = info;
|
||||
}
|
||||
|
||||
public void RenderAfterWorld(WorldRenderer wr)
|
||||
{
|
||||
@@ -51,11 +58,12 @@ namespace OpenRA.Traits
|
||||
if (group == null) return;
|
||||
|
||||
var pipImages = new Animation("pips");
|
||||
var pal = wr.Palette(Info.Palette);
|
||||
pipImages.PlayFetchIndex("groups", () => (int)group);
|
||||
pipImages.Tick();
|
||||
|
||||
var pos = wr.Viewport.WorldToViewPx(basePosition) - (0.5f * pipImages.Image.size).ToInt2() + new int2(9, 5);
|
||||
Game.Renderer.SpriteRenderer.DrawSprite(pipImages.Image, pos, wr.Palette("chrome"));
|
||||
Game.Renderer.SpriteRenderer.DrawSprite(pipImages.Image, pos, pal);
|
||||
}
|
||||
|
||||
void DrawPips(WorldRenderer wr, Actor self, int2 basePosition)
|
||||
@@ -73,7 +81,7 @@ namespace OpenRA.Traits
|
||||
var pipSize = pipImages.Image.size.ToInt2();
|
||||
var pipxyBase = wr.Viewport.WorldToViewPx(basePosition) + new int2(1 - pipSize.X / 2, - (3 + pipSize.Y / 2));
|
||||
var pipxyOffset = new int2(0, 0);
|
||||
var pal = wr.Palette("chrome");
|
||||
var pal = wr.Palette(Info.Palette);
|
||||
var width = self.Bounds.Value.Width;
|
||||
|
||||
foreach (var pips in pipSources)
|
||||
@@ -108,7 +116,7 @@ namespace OpenRA.Traits
|
||||
return;
|
||||
|
||||
var tagImages = new Animation("pips");
|
||||
var pal = wr.Palette("chrome");
|
||||
var pal = wr.Palette(Info.Palette);
|
||||
var tagxyOffset = new int2(0, 6);
|
||||
var tagBase = wr.Viewport.WorldToViewPx(basePosition);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ using OpenRA.Primitives;
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
// depends on the order of pips in WorldRenderer.cs!
|
||||
public enum PipType { Transparent, Green, Yellow, Red, Gray, Blue };
|
||||
public enum PipType { Transparent, Green, Yellow, Red, Gray, Blue, Ammo, AmmoEmpty };
|
||||
public enum TagType { None, Fake, Primary };
|
||||
public enum Stance { Enemy, Neutral, Ally };
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||
* 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. For more information,
|
||||
@@ -19,6 +19,8 @@ namespace OpenRA.Mods.RA
|
||||
public readonly int Ammo = 0;
|
||||
[Desc("Defaults to value in Ammo.")]
|
||||
public readonly int PipCount = 0;
|
||||
public readonly PipType PipType = PipType.Green;
|
||||
public readonly PipType PipTypeEmpty = PipType.Transparent;
|
||||
[Desc("Time to reload measured in ticks.")]
|
||||
public readonly int ReloadTicks = 25 * 2;
|
||||
|
||||
@@ -60,7 +62,7 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
var pips = Info.PipCount != 0 ? Info.PipCount : Info.Ammo;
|
||||
return Exts.MakeArray(pips,
|
||||
i => (ammo * pips) / Info.Ammo > i ? PipType.Green : PipType.Transparent);
|
||||
i => (ammo * pips) / Info.Ammo > i ? Info.PipType : Info.PipTypeEmpty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BIN
mods/ts/bits/ammopips.shp
Normal file
BIN
mods/ts/bits/ammopips.shp
Normal file
Binary file not shown.
BIN
mods/ts/bits/pipsra.shp
Normal file
BIN
mods/ts/bits/pipsra.shp
Normal file
Binary file not shown.
@@ -30,6 +30,8 @@ DPOD:
|
||||
LimitedAmmo:
|
||||
Ammo: 5
|
||||
PipCount: 5
|
||||
PipType: Ammo
|
||||
PipTypeEmpty: AmmoEmpty
|
||||
AutoTarget:
|
||||
RenderSprites:
|
||||
RenderVoxels:
|
||||
@@ -97,6 +99,8 @@ ORCA:
|
||||
LimitedAmmo:
|
||||
Ammo: 5
|
||||
PipCount: 5
|
||||
PipType: Ammo
|
||||
PipTypeEmpty: AmmoEmpty
|
||||
AutoTarget:
|
||||
RenderSprites:
|
||||
RenderVoxels:
|
||||
@@ -132,6 +136,8 @@ ORCAB:
|
||||
LimitedAmmo:
|
||||
Ammo: 2
|
||||
PipCount: 2
|
||||
PipType: Ammo
|
||||
PipTypeEmpty: AmmoEmpty
|
||||
AutoTarget:
|
||||
RenderSprites:
|
||||
RenderVoxels:
|
||||
@@ -225,6 +231,8 @@ SCRIN:
|
||||
LimitedAmmo:
|
||||
Ammo: 3
|
||||
PipCount: 3
|
||||
PipType: Ammo
|
||||
PipTypeEmpty: AmmoEmpty
|
||||
AutoTarget:
|
||||
RenderSprites:
|
||||
RenderVoxels:
|
||||
@@ -260,6 +268,8 @@ APACHE:
|
||||
LimitedAmmo:
|
||||
Ammo: 12
|
||||
PipCount: 4
|
||||
PipType: Ammo
|
||||
PipTypeEmpty: AmmoEmpty
|
||||
AutoTarget:
|
||||
WithRotor:
|
||||
Offset: 85,0,384
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
^Building:
|
||||
AppearsOnRadar:
|
||||
SelectionDecorations:
|
||||
Palette: pips
|
||||
Selectable:
|
||||
Priority: 3
|
||||
TargetableBuilding:
|
||||
@@ -96,6 +97,7 @@
|
||||
Gems: 80
|
||||
Beach: 80
|
||||
SelectionDecorations:
|
||||
Palette: pips
|
||||
Selectable:
|
||||
Voice: Infantry
|
||||
TargetableUnit:
|
||||
@@ -167,6 +169,7 @@
|
||||
Beach: 40
|
||||
ROT: 5
|
||||
SelectionDecorations:
|
||||
Palette: pips
|
||||
Selectable:
|
||||
Voice: Vehicle
|
||||
TargetableUnit:
|
||||
@@ -203,6 +206,7 @@
|
||||
TargetTypes: Air
|
||||
GroundedTargetTypes: Ground
|
||||
SelectionDecorations:
|
||||
Palette: pips
|
||||
Selectable:
|
||||
Voice: Heli
|
||||
Helicopter:
|
||||
|
||||
@@ -141,6 +141,7 @@ GAWEAP:
|
||||
ExitCell: 3,3
|
||||
Production:
|
||||
Produces: Vehicle
|
||||
PrimaryBuilding:
|
||||
ProductionBar:
|
||||
WithProductionOverlay@WHITELIGHTS:
|
||||
Sequence: production-lights-white
|
||||
@@ -244,6 +245,7 @@ NAWEAP:
|
||||
ExitCell: 3,3
|
||||
Production:
|
||||
Produces: Vehicle
|
||||
PrimaryBuilding:
|
||||
ProductionBar:
|
||||
WithProductionOverlay@LIGHTS:
|
||||
Sequence: production-lights
|
||||
@@ -623,6 +625,7 @@ GAHPAD:
|
||||
SpawnOffset: 0,-256,0
|
||||
Production:
|
||||
Produces: Air
|
||||
PrimaryBuilding:
|
||||
BelowUnits:
|
||||
Reservable:
|
||||
RepairsUnits:
|
||||
@@ -655,6 +658,7 @@ NAHPAD:
|
||||
SpawnOffset: 0,-256,0
|
||||
Production:
|
||||
Produces: Air
|
||||
PrimaryBuilding:
|
||||
BelowUnits:
|
||||
Reservable:
|
||||
RepairsUnits:
|
||||
|
||||
@@ -17,6 +17,11 @@ World:
|
||||
Filename: cameo.pal
|
||||
AllowModifiers: false
|
||||
ShadowIndex: 242
|
||||
PaletteFromFile@pips:
|
||||
Name: pips
|
||||
Filename: palette.pal
|
||||
AllowModifiers: false
|
||||
ShadowIndex: 4
|
||||
PaletteFromFile@ra:
|
||||
Name: ra
|
||||
Filename: palette.pal
|
||||
|
||||
@@ -79,13 +79,14 @@ clock:
|
||||
Start: 0
|
||||
Length: *
|
||||
|
||||
# TODO:
|
||||
# needs palette.pal
|
||||
pips:
|
||||
medic:
|
||||
Start: 6
|
||||
tag-primary:
|
||||
groups: pipsra #TODO: backfall to RA asset
|
||||
Start: 8
|
||||
Length: 10
|
||||
tag-primary: pipsra #TODO: backfall to RA asset
|
||||
Start: 2
|
||||
pip-empty: pips2
|
||||
Start: 0
|
||||
pip-green: pips2
|
||||
@@ -98,8 +99,10 @@ pips:
|
||||
Start: 4
|
||||
pip-blue: pips2
|
||||
Start: 5
|
||||
pip-ammo: pips2
|
||||
Start: 6
|
||||
pip-ammo: ammopips
|
||||
Start: 0
|
||||
pip-ammoempty: ammopips
|
||||
Start: 1
|
||||
# TODO:
|
||||
pip-empty-building:
|
||||
Start: 0
|
||||
|
||||
Reference in New Issue
Block a user