added ISpawnStartingUnits trait; default impl just spawns an MCV
This commit is contained in:
@@ -233,14 +233,12 @@ namespace OpenRa
|
||||
|
||||
foreach (var client in LobbyInfo.Clients)
|
||||
{
|
||||
int2 sp;
|
||||
if (client.SpawnPoint == 0)
|
||||
sp = ChooseSpawnPoint(available, taken);
|
||||
else
|
||||
sp = world.Map.SpawnPoints.ElementAt(client.SpawnPoint - 1);
|
||||
|
||||
// todo: spawn more than one unit, in most cases!
|
||||
world.CreateActor("mcv", sp, world.players[client.Index]);
|
||||
var sp = (client.SpawnPoint == 0)
|
||||
? ChooseSpawnPoint(available, taken)
|
||||
: world.Map.SpawnPoints.ElementAt(client.SpawnPoint - 1);
|
||||
|
||||
foreach (var ssu in world.players[client.Index].PlayerActor.traits.WithInterface<ISpawnStartingUnits>())
|
||||
ssu.SpawnStartingUnits(world.players[client.Index], sp);
|
||||
}
|
||||
|
||||
Game.viewport.GoToStartLocation( Game.world.LocalPlayer );
|
||||
|
||||
@@ -119,6 +119,7 @@
|
||||
<Compile Include="Sync.cs" />
|
||||
<Compile Include="Traits\Attack\AttackOmni.cs" />
|
||||
<Compile Include="Traits\CustomSellValue.cs" />
|
||||
<Compile Include="Traits\Player\SpawnDefaultUnits.cs" />
|
||||
<Compile Include="Traits\World\BridgeLoadHook.cs" />
|
||||
<Compile Include="Traits\World\ChoosePaletteOnSelect.cs" />
|
||||
<Compile Include="Traits\World\Country.cs" />
|
||||
|
||||
13
OpenRa.Game/Traits/Player/SpawnDefaultUnits.cs
Normal file
13
OpenRa.Game/Traits/Player/SpawnDefaultUnits.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
namespace OpenRa.Traits
|
||||
{
|
||||
class SpawnDefaultUnitsInfo : StatelessTraitInfo<SpawnDefaultUnits> { }
|
||||
|
||||
class SpawnDefaultUnits : ISpawnStartingUnits
|
||||
{
|
||||
public void SpawnStartingUnits(Player p, int2 sp)
|
||||
{
|
||||
p.PlayerActor.World.CreateActor("mcv", sp, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -104,4 +104,5 @@ namespace OpenRa.Traits
|
||||
|
||||
public interface INotifySelection { void SelectionChanged(); }
|
||||
public interface ILoadWorldHook { void WorldLoaded(World w); }
|
||||
public interface ISpawnStartingUnits { void SpawnStartingUnits(Player p, int2 sp); }
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ Player:
|
||||
CancelledAudio: cancel1.aud
|
||||
ClickAudio: button.aud
|
||||
PlaceBuilding:
|
||||
SpawnDefaultUnits:
|
||||
|
||||
World:
|
||||
WaterPaletteRotation:
|
||||
|
||||
@@ -57,6 +57,7 @@ Player:
|
||||
TechLevel: 5
|
||||
GivenAuto: no
|
||||
OneShot: yes
|
||||
SpawnDefaultUnits:
|
||||
|
||||
World:
|
||||
WaterPaletteRotation:
|
||||
|
||||
Reference in New Issue
Block a user