Merge pull request #4970 from Phrohdoh/LineBuild
Added LineBuildNode trait to filter which structure(s) a LineBuild actor can be attached to. Closes #2248
This commit is contained in:
@@ -40,6 +40,7 @@ NEW:
|
|||||||
Added the BLOXXMAS terrain tiles from the 1.06 patch.
|
Added the BLOXXMAS terrain tiles from the 1.06 patch.
|
||||||
Saboteur can now plant C4 on vehicles.
|
Saboteur can now plant C4 on vehicles.
|
||||||
Added concrete plates and building weathering.
|
Added concrete plates and building weathering.
|
||||||
|
Walls will now extend themselves when placed in line with a turret.
|
||||||
Red Alert:
|
Red Alert:
|
||||||
Engineers are now remapped to team colors.
|
Engineers are now remapped to team colors.
|
||||||
Added some remap to the bottom edge of SAM sites.
|
Added some remap to the bottom edge of SAM sites.
|
||||||
@@ -138,6 +139,7 @@ NEW:
|
|||||||
Maps can define initial cargo for actors by adding "Cargo: actora, actorb, ..." to the actor reference.
|
Maps can define initial cargo for actors by adding "Cargo: actora, actorb, ..." to the actor reference.
|
||||||
Modified Teleport activity to use the best/closest open cell to the target destination for teleports (for ChronoshiftPower this only applies on the return trip).
|
Modified Teleport activity to use the best/closest open cell to the target destination for teleports (for ChronoshiftPower this only applies on the return trip).
|
||||||
Renamed ChronoshiftDeploy trait to PortableChrono.
|
Renamed ChronoshiftDeploy trait to PortableChrono.
|
||||||
|
Added LineBuildNode trait to filter which structure(s) a LineBuild actor can be attached to.
|
||||||
Server:
|
Server:
|
||||||
Message of the day is now shared between all mods and a default motd.txt gets created in the user directory.
|
Message of the day is now shared between all mods and a default motd.txt gets created in the user directory.
|
||||||
Asset Browser:
|
Asset Browser:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#region Copyright & License Information
|
#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
|
* 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
|
* available to you under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation. For more information,
|
* as published by the Free Software Foundation. For more information,
|
||||||
@@ -18,6 +18,9 @@ namespace OpenRA.Mods.RA.Buildings
|
|||||||
{
|
{
|
||||||
[Desc("The maximum allowed length of the line.")]
|
[Desc("The maximum allowed length of the line.")]
|
||||||
public readonly int Range = 5;
|
public readonly int Range = 5;
|
||||||
|
|
||||||
|
[Desc("LineBuildNode 'Types' to attach to.")]
|
||||||
|
public readonly string[] NodeTypes = { "wall" };
|
||||||
}
|
}
|
||||||
|
|
||||||
public class LineBuild {}
|
public class LineBuild {}
|
||||||
|
|||||||
24
OpenRA.Mods.RA/Buildings/LineBuildNode.cs
Normal file
24
OpenRA.Mods.RA/Buildings/LineBuildNode.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* 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,
|
||||||
|
* see COPYING.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using OpenRA.FileFormats;
|
||||||
|
using OpenRA.Traits;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.RA.Buildings
|
||||||
|
{
|
||||||
|
[Desc("LineBuild actors attach to LineBuildNodes.")]
|
||||||
|
public class LineBuildNodeInfo : TraitInfo<LineBuildNode>
|
||||||
|
{
|
||||||
|
[Desc("This actor is of LineBuild 'NodeType'...")]
|
||||||
|
public readonly string[] Types = { "wall" };
|
||||||
|
}
|
||||||
|
|
||||||
|
public class LineBuildNode {}
|
||||||
|
}
|
||||||
@@ -42,7 +42,7 @@ namespace OpenRA.Mods.RA.Buildings
|
|||||||
|
|
||||||
public static IEnumerable<CPos> GetLineBuildCells(World world, CPos location, string name, BuildingInfo bi)
|
public static IEnumerable<CPos> GetLineBuildCells(World world, CPos location, string name, BuildingInfo bi)
|
||||||
{
|
{
|
||||||
int range = Rules.Info[name].Traits.Get<LineBuildInfo>().Range;
|
var lbi = Rules.Info[name].Traits.Get<LineBuildInfo>();
|
||||||
var topLeft = location; // 1x1 assumption!
|
var topLeft = location; // 1x1 assumption!
|
||||||
|
|
||||||
if (world.IsCellBuildable(topLeft, bi))
|
if (world.IsCellBuildable(topLeft, bi))
|
||||||
@@ -54,17 +54,21 @@ namespace OpenRA.Mods.RA.Buildings
|
|||||||
int[] dirs = { 0, 0, 0, 0 };
|
int[] dirs = { 0, 0, 0, 0 };
|
||||||
for (int d = 0; d < 4; d++)
|
for (int d = 0; d < 4; d++)
|
||||||
{
|
{
|
||||||
for (int i = 1; i < range; i++)
|
for (int i = 1; i < lbi.Range; i++)
|
||||||
{
|
{
|
||||||
if (dirs[d] != 0)
|
if (dirs[d] != 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
CPos cell = topLeft + i * vecs[d];
|
var cell = topLeft + i * vecs[d];
|
||||||
if (world.IsCellBuildable(cell, bi))
|
if (world.IsCellBuildable(cell, bi))
|
||||||
continue; // Cell is empty; continue search
|
continue; // Cell is empty; continue search
|
||||||
|
|
||||||
// Cell contains an actor. Is it the type we want?
|
// Cell contains an actor. Is it the type we want?
|
||||||
if (world.ActorsWithTrait<LineBuild>().Any(a => (a.Actor.Info.Name == name && a.Actor.Location.X == cell.X && a.Actor.Location.Y == cell.Y)))
|
if (world.ActorsWithTrait<LineBuildNode>().Any(a =>
|
||||||
|
(
|
||||||
|
a.Actor.Location == cell &&
|
||||||
|
a.Actor.Info.Traits.Get<LineBuildNodeInfo>().Types.Intersect(lbi.NodeTypes).Any()
|
||||||
|
)))
|
||||||
dirs[d] = i; // Cell contains actor of correct type
|
dirs[d] = i; // Cell contains actor of correct type
|
||||||
else
|
else
|
||||||
dirs[d] = -1; // Cell is blocked by another actor type
|
dirs[d] = -1; // Cell is blocked by another actor type
|
||||||
|
|||||||
@@ -490,6 +490,7 @@
|
|||||||
<Compile Include="Orders\BeaconOrderGenerator.cs" />
|
<Compile Include="Orders\BeaconOrderGenerator.cs" />
|
||||||
<Compile Include="Widgets\LogicKeyListenerWidget.cs" />
|
<Compile Include="Widgets\LogicKeyListenerWidget.cs" />
|
||||||
<Compile Include="Widgets\Logic\ControlGroupLogic.cs" />
|
<Compile Include="Widgets\Logic\ControlGroupLogic.cs" />
|
||||||
|
<Compile Include="Buildings\LineBuildNode.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||||
|
|||||||
@@ -447,6 +447,9 @@
|
|||||||
CrushSound: sandbag2.aud
|
CrushSound: sandbag2.aud
|
||||||
LineBuild:
|
LineBuild:
|
||||||
Range: 8
|
Range: 8
|
||||||
|
NodeTypes: wall
|
||||||
|
LineBuildNode:
|
||||||
|
Types: wall
|
||||||
RenderBuildingWall:
|
RenderBuildingWall:
|
||||||
HasMakeAnimation: false
|
HasMakeAnimation: false
|
||||||
Palette: staticterrain
|
Palette: staticterrain
|
||||||
|
|||||||
@@ -726,6 +726,11 @@ SBAG:
|
|||||||
HP: 100
|
HP: 100
|
||||||
Armor:
|
Armor:
|
||||||
Type: Light
|
Type: Light
|
||||||
|
LineBuild:
|
||||||
|
Range: 8
|
||||||
|
NodeTypes: sandbag
|
||||||
|
LineBuildNode:
|
||||||
|
Types: sandbag
|
||||||
|
|
||||||
CYCL:
|
CYCL:
|
||||||
Inherits: ^Wall
|
Inherits: ^Wall
|
||||||
@@ -745,6 +750,11 @@ CYCL:
|
|||||||
HP: 100
|
HP: 100
|
||||||
Armor:
|
Armor:
|
||||||
Type: Light
|
Type: Light
|
||||||
|
LineBuild:
|
||||||
|
Range: 8
|
||||||
|
NodeTypes: chain
|
||||||
|
LineBuildNode:
|
||||||
|
Types: chain
|
||||||
|
|
||||||
BRIK:
|
BRIK:
|
||||||
Inherits: ^Wall
|
Inherits: ^Wall
|
||||||
@@ -769,6 +779,11 @@ BRIK:
|
|||||||
-CrushSound:
|
-CrushSound:
|
||||||
SoundOnDamageTransition:
|
SoundOnDamageTransition:
|
||||||
DestroyedSound: crumble.aud
|
DestroyedSound: crumble.aud
|
||||||
|
LineBuild:
|
||||||
|
Range: 8
|
||||||
|
NodeTypes: concrete
|
||||||
|
LineBuildNode:
|
||||||
|
Types: concrete
|
||||||
|
|
||||||
BARRACKS:
|
BARRACKS:
|
||||||
Tooltip:
|
Tooltip:
|
||||||
|
|||||||
@@ -412,6 +412,9 @@ CONCRETEB:
|
|||||||
CrushClasses: Concretewall
|
CrushClasses: Concretewall
|
||||||
LineBuild:
|
LineBuild:
|
||||||
Range: 8
|
Range: 8
|
||||||
|
NodeTypes: wall, turret
|
||||||
|
LineBuildNode:
|
||||||
|
Types: wall
|
||||||
TargetableBuilding:
|
TargetableBuilding:
|
||||||
TargetTypes: Ground
|
TargetTypes: Ground
|
||||||
RenderBuildingWall:
|
RenderBuildingWall:
|
||||||
@@ -478,6 +481,8 @@ WALL:
|
|||||||
DetectCloaked:
|
DetectCloaked:
|
||||||
Range: 5
|
Range: 5
|
||||||
-WithCrumbleOverlay:
|
-WithCrumbleOverlay:
|
||||||
|
LineBuildNode:
|
||||||
|
Types: turret
|
||||||
|
|
||||||
^ROCKETTOWER:
|
^ROCKETTOWER:
|
||||||
Inherits: ^Building
|
Inherits: ^Building
|
||||||
@@ -527,6 +532,8 @@ WALL:
|
|||||||
DetectCloaked:
|
DetectCloaked:
|
||||||
Range: 6
|
Range: 6
|
||||||
-WithCrumbleOverlay:
|
-WithCrumbleOverlay:
|
||||||
|
LineBuildNode:
|
||||||
|
Types: turret
|
||||||
|
|
||||||
^REPAIR:
|
^REPAIR:
|
||||||
Inherits: ^Building
|
Inherits: ^Building
|
||||||
|
|||||||
@@ -287,6 +287,9 @@
|
|||||||
CrushClasses: wall
|
CrushClasses: wall
|
||||||
LineBuild:
|
LineBuild:
|
||||||
Range: 8
|
Range: 8
|
||||||
|
NodeTypes: wall
|
||||||
|
LineBuildNode:
|
||||||
|
Types: wall
|
||||||
TargetableBuilding:
|
TargetableBuilding:
|
||||||
TargetTypes: Ground, DetonateAttack
|
TargetTypes: Ground, DetonateAttack
|
||||||
RenderBuildingWall:
|
RenderBuildingWall:
|
||||||
|
|||||||
@@ -1355,6 +1355,11 @@ SBAG:
|
|||||||
HP: 300
|
HP: 300
|
||||||
Armor:
|
Armor:
|
||||||
Type: Wood
|
Type: Wood
|
||||||
|
LineBuild:
|
||||||
|
Range: 8
|
||||||
|
NodeTypes: sandbag
|
||||||
|
LineBuildNode:
|
||||||
|
Types: sandbag
|
||||||
|
|
||||||
FENC:
|
FENC:
|
||||||
Inherits: ^Wall
|
Inherits: ^Wall
|
||||||
@@ -1375,6 +1380,11 @@ FENC:
|
|||||||
HP: 300
|
HP: 300
|
||||||
Armor:
|
Armor:
|
||||||
Type: Wood
|
Type: Wood
|
||||||
|
LineBuild:
|
||||||
|
Range: 8
|
||||||
|
NodeTypes: fence
|
||||||
|
LineBuildNode:
|
||||||
|
Types: fence
|
||||||
|
|
||||||
BRIK:
|
BRIK:
|
||||||
Inherits: ^Wall
|
Inherits: ^Wall
|
||||||
@@ -1400,6 +1410,11 @@ BRIK:
|
|||||||
Type: Concrete
|
Type: Concrete
|
||||||
Wall:
|
Wall:
|
||||||
CrushClasses: heavywall
|
CrushClasses: heavywall
|
||||||
|
LineBuild:
|
||||||
|
Range: 8
|
||||||
|
NodeTypes: concrete
|
||||||
|
LineBuildNode:
|
||||||
|
Types: concrete
|
||||||
|
|
||||||
CYCL:
|
CYCL:
|
||||||
Inherits: ^Wall
|
Inherits: ^Wall
|
||||||
|
|||||||
@@ -159,6 +159,9 @@
|
|||||||
CrushClasses: wall
|
CrushClasses: wall
|
||||||
LineBuild:
|
LineBuild:
|
||||||
Range: 8
|
Range: 8
|
||||||
|
NodeTypes: wall
|
||||||
|
LineBuildNode:
|
||||||
|
Types: wall
|
||||||
SelectionDecorations:
|
SelectionDecorations:
|
||||||
Selectable:
|
Selectable:
|
||||||
Priority: 1
|
Priority: 1
|
||||||
|
|||||||
Reference in New Issue
Block a user