-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Can now create colonies on suitable bodies that have been geo-surveyed
- Loading branch information
1 parent
7ed220a
commit 84dd836
Showing
14 changed files
with
139 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,8 +41,7 @@ | |
"reveal": "always", | ||
"focus": false, | ||
"panel": "shared" | ||
}, | ||
"problemMatcher": [] | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace Pulsar4X.Datablobs; | ||
|
||
/// <summary> | ||
/// Empty class, used as a tag | ||
/// </summary> | ||
public class ColonizeableDB : BaseDataBlob | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
Pulsar4X/GameEngine/Engine/Orders/Actions/CreateColonyOrder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using System; | ||
using Pulsar4X.Events; | ||
using Pulsar4X.Extensions; | ||
|
||
namespace Pulsar4X.Engine.Orders; | ||
|
||
public class CreateColonyOrder : EntityCommand | ||
{ | ||
public Entity TargetSystemBody { get; private set; } | ||
public Entity Species { get; private set; } | ||
|
||
public override ActionLaneTypes ActionLanes => ActionLaneTypes.InstantOrder; | ||
|
||
public override bool IsBlocking => false; | ||
|
||
public override string Name => "Create Colony"; | ||
|
||
public override string Details => $"Create Colony on {TargetSystemBody.ToString()}"; | ||
|
||
private Entity _entityCommanding; | ||
internal override Entity EntityCommanding => _entityCommanding; | ||
|
||
public static CreateColonyOrder CreateCommand(Entity faction, Entity species, Entity targetBody) | ||
{ | ||
var command = new CreateColonyOrder() | ||
{ | ||
_entityCommanding = faction, | ||
EntityCommandingGuid = faction.Id, | ||
RequestingFactionGuid= faction.Id, | ||
TargetSystemBody = targetBody, | ||
Species = species | ||
}; | ||
|
||
return command; | ||
} | ||
|
||
public override EntityCommand Clone() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override bool IsFinished() | ||
{ | ||
return TargetSystemBody.IsOrHasColony().Item1; | ||
} | ||
|
||
internal override void Execute(DateTime atDateTime) | ||
{ | ||
var colony = ColonyFactory.CreateColony(_entityCommanding, Species, TargetSystemBody); | ||
var colonyName = colony.GetName(RequestingFactionGuid); | ||
EventManager.Instance.Publish( | ||
Event.Create( | ||
EventType.ColonyCreated, | ||
atDateTime, | ||
$"{colonyName} has been created", | ||
RequestingFactionGuid, | ||
_entityCommanding.Manager.ManagerGuid, | ||
colony.Id)); | ||
} | ||
|
||
internal override bool IsValidCommand(Game game) | ||
{ | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -416,6 +416,8 @@ public enum EventType | |
ItsLifeJim, // Easter Egg Event? | ||
|
||
#endregion | ||
|
||
ColonyCreated, | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.