SpawnMapActors trait on world actor is now responsible for spawning trees etc at gamestart time
This commit is contained in:
@@ -120,15 +120,6 @@ namespace OpenRA
|
|||||||
viewport = new Viewport(clientSize, Game.world.Map.Offset, Game.world.Map.Offset + Game.world.Map.Size, renderer);
|
viewport = new Viewport(clientSize, Game.world.Map.Offset, Game.world.Map.Offset + Game.world.Map.Size, renderer);
|
||||||
Timer.Time( "ChromeProv, SeqProv, viewport: {0}" );
|
Timer.Time( "ChromeProv, SeqProv, viewport: {0}" );
|
||||||
|
|
||||||
// todo: delay this
|
|
||||||
skipMakeAnims = true;
|
|
||||||
foreach (var actorReference in world.Map.Actors)
|
|
||||||
world.CreateActor(actorReference.Name, actorReference.Location,
|
|
||||||
world.players.Values.FirstOrDefault(p => p.InternalName == actorReference.Owner)
|
|
||||||
?? world.NeutralPlayer);
|
|
||||||
skipMakeAnims = false;
|
|
||||||
Timer.Time( "map actors: {0}" );
|
|
||||||
|
|
||||||
chrome = new Chrome(renderer, manifest);
|
chrome = new Chrome(renderer, manifest);
|
||||||
Timer.Time( "chrome: {0}" );
|
Timer.Time( "chrome: {0}" );
|
||||||
|
|
||||||
|
|||||||
@@ -258,6 +258,7 @@
|
|||||||
<Compile Include="Traits\TraitsInterfaces.cs" />
|
<Compile Include="Traits\TraitsInterfaces.cs" />
|
||||||
<Compile Include="Traits\Turreted.cs" />
|
<Compile Include="Traits\Turreted.cs" />
|
||||||
<Compile Include="Traits\Unit.cs" />
|
<Compile Include="Traits\Unit.cs" />
|
||||||
|
<Compile Include="Traits\World\SpawnMapActors.cs" />
|
||||||
<Compile Include="Traits\World\UnitInfluence.cs" />
|
<Compile Include="Traits\World\UnitInfluence.cs" />
|
||||||
<Compile Include="Traits\World\WallLoadHook.cs" />
|
<Compile Include="Traits\World\WallLoadHook.cs" />
|
||||||
<Compile Include="Traits\World\WaterPaletteRotation.cs" />
|
<Compile Include="Traits\World\WaterPaletteRotation.cs" />
|
||||||
|
|||||||
24
OpenRA.Game/Traits/World/SpawnMapActors.cs
Normal file
24
OpenRA.Game/Traits/World/SpawnMapActors.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace OpenRA.Traits
|
||||||
|
{
|
||||||
|
class SpawnMapActorsInfo : StatelessTraitInfo<SpawnMapActors> { }
|
||||||
|
|
||||||
|
class SpawnMapActors : IGameStarted
|
||||||
|
{
|
||||||
|
public void GameStarted(World world)
|
||||||
|
{
|
||||||
|
Game.skipMakeAnims = true; // rude hack
|
||||||
|
|
||||||
|
foreach (var actorReference in world.Map.Actors)
|
||||||
|
world.CreateActor(actorReference.Name, actorReference.Location,
|
||||||
|
world.players.Values.FirstOrDefault(p => p.InternalName == actorReference.Owner)
|
||||||
|
?? world.NeutralPlayer);
|
||||||
|
|
||||||
|
Game.skipMakeAnims = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -207,4 +207,5 @@ World:
|
|||||||
Name: Tiberium
|
Name: Tiberium
|
||||||
GrowthInterval: 1
|
GrowthInterval: 1
|
||||||
SpreadInterval: 6
|
SpreadInterval: 6
|
||||||
|
SpawnMapActors:
|
||||||
SpawnDefaultUnits:
|
SpawnDefaultUnits:
|
||||||
@@ -265,6 +265,7 @@ World:
|
|||||||
Templates:templates.ini
|
Templates:templates.ini
|
||||||
Tileset:tileSet.til
|
Tileset:tileSet.til
|
||||||
MapColors:temperat.col
|
MapColors:temperat.col
|
||||||
|
SpawnMapActors:
|
||||||
SpawnDefaultUnits:
|
SpawnDefaultUnits:
|
||||||
|
|
||||||
MGG:
|
MGG:
|
||||||
|
|||||||
Reference in New Issue
Block a user