fixed Defense unittype

This commit is contained in:
Chris Forbes
2009-11-17 20:43:59 +13:00
parent 2c05e2d6e0
commit 746ab904e6
4 changed files with 10 additions and 10 deletions

View File

@@ -23,7 +23,7 @@ namespace OpenRa.Game.GameRules
public Cache<string, List<Actor>> GatherBuildings( Player player ) public Cache<string, List<Actor>> GatherBuildings( Player player )
{ {
var ret = new Cache<string, List<Actor>>( x => new List<Actor>() ); var ret = new Cache<string, List<Actor>>( x => new List<Actor>() );
foreach( var b in Game.world.Actors.Where( x => x.Owner == player && Rules.UnitCategory[ x.unitInfo.Name ] == "Building" ) ) foreach( var b in Game.world.Actors.Where( x => x.Owner == player && x.unitInfo is UnitInfo.BuildingInfo ) )
ret[ b.unitInfo.Name ].Add( b ); ret[ b.unitInfo.Name ].Add( b );
return ret; return ret;
} }

View File

@@ -39,7 +39,7 @@ namespace OpenRa.Game
public void Tick() public void Tick()
{ {
var producing = Owner.Producing( "Building" ); var producing = Owner.Producing( Rules.UnitCategory[ Building.Name ] );
if( producing == null || producing.Item != Building.Name || producing.RemainingTime != 0 ) if( producing == null || producing.Item != Building.Name || producing.RemainingTime != 0 )
Game.world.AddFrameEndTask( _ => { Game.controller.orderGenerator = null; } ); Game.world.AddFrameEndTask( _ => { Game.controller.orderGenerator = null; } );
} }

View File

@@ -79,7 +79,7 @@ namespace OpenRa.Game
Game.world.AddFrameEndTask( _ => Game.world.AddFrameEndTask( _ =>
{ {
var building = (UnitInfo.BuildingInfo)Rules.UnitInfo[ order.TargetString ]; var building = (UnitInfo.BuildingInfo)Rules.UnitInfo[ order.TargetString ];
var producing = order.Player.Producing( "Building" ); var producing = order.Player.Producing(Rules.UnitCategory[order.TargetString]);
if( producing == null || producing.Item != order.TargetString || producing.RemainingTime != 0 ) if( producing == null || producing.Item != order.TargetString || producing.RemainingTime != 0 )
return; return;
@@ -110,10 +110,10 @@ namespace OpenRa.Game
() => Game.world.AddFrameEndTask( () => Game.world.AddFrameEndTask(
_ => _ =>
{ {
var isBuilding = group == "Building" || group == "Defense";
if (order.Player == Game.LocalPlayer) if (order.Player == Game.LocalPlayer)
Game.PlaySound(group == "Building" Game.PlaySound( isBuilding ? "conscmp1.aud" : "unitrdy1.aud", false);
? "conscmp1.aud" : "unitrdy1.aud", false); if (!isBuilding)
if (group != "Building" && group != "Defense")
Game.BuildUnit(order.Player, order.TargetString); Game.BuildUnit(order.Player, order.TargetString);
}))); })));
break; break;

View File

@@ -155,6 +155,9 @@ FTUR
GAP GAP
SAM SAM
MSLO MSLO
; SBAG
; BRIK
; FENC
[BuildingTypes] [BuildingTypes]
@@ -175,9 +178,6 @@ BARR
TENT TENT
KENN KENN
FIX FIX
; SBAG
; BRIK
; FENC
FACF FACF
WEAF WEAF
SYRF SYRF
@@ -262,7 +262,7 @@ Description=Construction Yard
Traits=Building, RenderBuilding Traits=Building, RenderBuilding
Dimensions=3,3 Dimensions=3,3
Footprint=xxx xxx xxx Footprint=xxx xxx xxx
Produces=Building Produces=Building,Defense
[PROC] [PROC]
Description=Ore Refinery Description=Ore Refinery
Traits=Building, RenderBuilding, AcceptsOre Traits=Building, RenderBuilding, AcceptsOre