Skip to content

Commit

Permalink
Added the ability to recall/scuttle travelling ships
Browse files Browse the repository at this point in the history
  • Loading branch information
icydee authored and Iain C Docherty committed Feb 15, 2016
1 parent 32c3e50 commit bff9fe5
Show file tree
Hide file tree
Showing 12 changed files with 129 additions and 395 deletions.
361 changes: 11 additions & 350 deletions docs/SpacePort.pod
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,15 @@ See above for these options.
"can_scuttle" : "0",
"can_recall" : "0",
},
"orbiting" : {
"id" : "body-id-goes-here",
"type" : "body",
"name" : "mars",
"empire" : {
"id" : "empire-id-here",
"name" : "Martians"
}
},
"from" : {
"id" : "id-goes-here",
"type" : "body",
Expand Down Expand Up @@ -601,355 +610,6 @@ Show a list of all mining platforms on this asteroid.
}
















Provides a list of incoming ships and ships that are available to send to a specific target. Use with C<send_ship>.

{
"incoming" : [

"id" : "id-goes-here",
"name" : "P13",
"type_human" : "Probe",
"type" : "probe",
"task" : "Travelling",
"speed" : "1200",
"fleet_speed" : "0",
"stealth" : "0",
"hold_size" : "0",
"berth_level" : "1",
"date_started" : "01 31 2010 13:09:05 +0600",
"date_available" : "02 01 2010 10:08:33 +0600",
"date_arrives" : "02 01 2010 10:08:33 +0600",
"from" : {
"id" : "id-goes-here",
"type" : "body",
"name" : "Earth"
},
"to" : {
"id" : "id-goes-here",
"type" : "star",
"name" : "Sol"
}
},
...
],
"available" : [
{
"id" : "id-goes-here",
"name" : "D13",
"type_human" : "Detonator",
"type" : "detonator",
"task" : "Docked",
"speed" : "700",
"fleet_speed" : "0",
"stealth" : "0",
"hold_size" : "0",
"berth_level" : "1",
"estimated_travel_time" : 3600, # in seconds
...
},
...
],
"unavailable" : [
{
"reason" : [1009, "You can't send a detonator to a star."],
"ship" : {
"id" : "id-goes-here",
"name" : "D13",
"type_human" : "Detonator",
"type" : "detonator",
"task" : "Docked",
"speed" : "700",
"fleet_speed" : "0",
"stealth" : "0",
"hold_size" : "0",
"berth_level" : "1",
"date_started" : "01 31 2010 13:09:05 +0600",
"date_available" : "01 31 2010 13:09:05 +0600"
}
},
...
],
"orbiting" : [
{
"id" : "id-goes-here",
"name" : "F13",
"type_human" : "Fighter",
"type" : "fighter",
"task" : "Defend",
"speed" : "2000",
"fleet_speed" : "0",
"stealth" : "0",
"hold_size" : "0",
"berth_level" : "1",
"date_started" : "01 31 2010 13:09:05 +0600",
"date_available" : "02 01 2010 10:08:33 +0600",
"date_arrives" : "02 01 2010 10:08:33 +0600",
"from" : {
"id" : "id-goes-here",
"type" : "body",
"name" : "Earth"
},
"orbiting" : {
"id" : "id-goes-here",
"type" : "body",
"name" : "Mars",
"x" : 4,
"y" : -3,
}

},
...
],
"mining_platforms" : [
{
empire_id => "id-goes-here",
empire_name => "The Peeps From Across The Street"
},
...
],
"fleet_send_limit" : 20,
"status" : { ... }
}

The C<unavailable> block tells you about ships that are docked, but are for some reason not available to be used. The C<orbiting> block will be returned only if the target is body and tells you about fighters that are defending and can be recalled. The C<mining_platforms> block will be returned only if the target is an asteroid that has platforms on it. The value of C<fleet_send_limit> tells you how many ships can be included in a fleet.

=head3 session_id

A session id.

=head3 from_body_id

The unique id of the planet that should send the ship.

=head3 target

A hash reference that can contain one of five items to identify a star or body.

{ "body_name" : "Earth" }

{ "body_id" : "id-goes-here" }

{ "star_name" : "Sol" }

{ "star_id" : "id-goes-here" }

{ "x" : 4, "y" : -3 }

=head4 body_name

A string with the body's name. Case insensitive, but will throw an exception for misspelling.

=head4 body_id

The unique id of the body.

=head4 star_name

A string with the star's name. Case insensitive, but will throw an exception for misspelling.

=head4 star_id

The unique id of the star.

=head4 x | y

A set of x,y coordinates to locate the star or body.


=head2 send_ship ( session_id, ship_id, target )

Sends a ship to a specified body or star. Use with C<get_fleet_for>.

{
"status" : { ... },
"ship" : {
"id" : "id-goes-here",
"name" : "P13",
"type_human" : "Probe",
"type" : "probe",
"task" : "Travelling",
"speed" : "1200",
"fleet_speed" : "0",
"stealth" : "0",
"hold_size" : "0",
"berth_level" : "1",
"date_started" : "01 31 2010 13:09:05 +0600",
"date_available" : "02 01 2010 10:08:33 +0600",
"date_arrives" : "02 01 2010 10:08:33 +0600",
"can_recall" : "0",
"can_scuttle" : "0",
"from" : {
"id" : "id-goes-here",
"type" : "body",
"name" : "Earth"
},
"to" : {
"id" : "id-goes-here",
"type" : "star",
"name" : "Sol"
}
}
}

=head3 session_id

A session id.

=head3 ship_id

The unique id of a ship to send.

=head3 target

A hash reference that can contain one of five items to identify a star or body.

{ "body_name" : "Earth" }

{ "body_id" : "id-goes-here" }

{ "star_name" : "Sol" }

{ "star_id" : "id-goes-here" }

{ "x" : 4, "y" : -3 }

=head4 body_name

A string with the body's name. Case insensitive, but will throw an exception for misspelling.

=head4 body_id

The unique id of the body.

=head4 star_name

A string with the star's name. Case insensitive, but will throw an exception for misspelling.

=head4 star_id

The unique id of the star.

=head4 x | y

A set of x,y coordinates to locate the star or body.


=head2 send_ship_types ( session_id, from_body_id, target, types, arrival )

Sends a quantity of ships, of a specific type (type, speed, combat, stealth) to a target.

Look at B<get_fleet_for> for a summary of what ships can be sent.

Returns the same as B<get_fleet_for> showing how many ships are remaining to be sent.

Throws 1002,1009,1010,1019

=head4 session_id

A session ID.

=head4 from_body_id

The Unique ID of the body that should send the ships

=head4 target

A hash reference that can contain one of five items to identify a star or body.

{ "body_name" : "Earth" }

{ "body_id" : "id-goes-here" }

{ "star_name" : "Sol" }

{ "star_id" : "id-goes-here" }

{ "x" : 4, "y" : -3 }

=head4 body_name

A string with the body's name. Case insensitive, but will throw an exception for misspelling.

=head4 body_id

The unique id of the body.

=head4 star_name

A string with the star's name. Case insensitive, but will throw an exception for misspelling.

=head4 star_id

The unique id of the star.

=head4 x | y

A set of x,y coordinates to locate the star or body.

=head4 types

An array reference that contains the specification of the ships to send and the quantity.

[
{
"type" : "sweeper",
"speed" : 10166,
"stealth" : 10948,
"combat" : 33372,
"quantity" : 100
},
{
"type" : "surveyor",
"speed" : 9030,
"stealth" : 9030,
"combat" : 3220,
"quantity" : 10
}
]

=head4 arrival

A hash reference of the required arrival time.

{
"day" : "23",
"hour" : "12",
"minute" : "01",
"second" : "30"
}
or
{
"earliest" : 1,
}

So long as the sending body has that quantity of ships with those specifications, then the
ships will be sent.

Ships will be set to arrive at the B<arrival> time and date, which can be up to 60 days in
the future. B<day> is the day of the month, either the remainder of the current month, or
the start of next month. e.g. if the current date is 23rd of January, then a B<day> of 23
will refer to today whereas 3 would refer to 3rd of February.

If an arrival time is set which is prior to the earliest arrival time of the slowest ship,
then an exception is raised.

If earliest is set, all other values are ignored and ships are sent at fastest speed possible.
They may still be grouped together by the server into an attack group.

=head2 send_fleet

Send a fleet of ships to a specified target body.
Expand Down Expand Up @@ -1202,7 +862,8 @@ Returns the same response as B<view>

=head2 scuttle_fleet

Destroy ships from a fleet that you no longer need. It must be Docked before you can scuttle it.
Destroy ships from a fleet that you no longer need. You can only scuttle ships
that report the B<can_scuttle> status of '1'.

Accepts either fixed arguments or a hash of named parameters

Expand Down
Loading

0 comments on commit bff9fe5

Please sign in to comment.