diff --git a/docs/Parliament.pod b/docs/Parliament.pod index 77365727..bd9970a5 100644 --- a/docs/Parliament.pod +++ b/docs/Parliament.pod @@ -838,7 +838,7 @@ If passed, only members of the alliance would be able to set up new colonies on "status" : { ... }, "proposition" : { "id" : "id-goes-here", - "name" : "Members Only Mining Rights", + "name" : "Members Only Colonization", "description" : "Only members of The Federation of Planets should be allowed to colonize planets in the jurisdiction of this station.", "votes_needed" : 7, "votes_yes" : 0, @@ -861,6 +861,35 @@ A session id. The unique id of the parliament. +=head2 propose_neutralize_bhg ( session_id, building_id ) + +If passed, Black Hole Generators will not be able to be used on or from systems in the jurisdiction of this station. + + { + "status" : { ... }, + "proposition" : { + "id" : "id-goes-here", + "name" : "BHG Neutralized", + "description" : "Black Hole Generators will not function in the jurisdiction of this station.", + "votes_needed" : 7, + "votes_yes" : 0, + "votes_no" : 0, + "status" : "Pending", + "date_ends" : "01 31 2010 13:09:05 +0600", + "proposed_by" : { + "id" : "id-goes-here", + "name" : "Klingons", + } + } + } + +=head3 session_id + +A session id. + +=head3 building_id + +The unique id of the parliament. =head2 propose_fire_bfg ( session_id, building_id, body_id, reason ) diff --git a/lib/Lacuna/DB/Result/Laws.pm b/lib/Lacuna/DB/Result/Laws.pm index eff05b7d..13948cf9 100644 --- a/lib/Lacuna/DB/Result/Laws.pm +++ b/lib/Lacuna/DB/Result/Laws.pm @@ -20,6 +20,7 @@ __PACKAGE__->add_columns( ); __PACKAGE__->typecast_map(type => { + BHGNeutralized => 'Lacuna::DB::Result::Laws::BHGNeutralized', Jurisdiction => 'Lacuna::DB::Result::Laws::Jurisdiction', MembersOnlyColonization => 'Lacuna::DB::Result::Laws::MembersOnlyColonization', MembersOnlyMiningRights => 'Lacuna::DB::Result::Laws::MembersOnlyMiningRights', diff --git a/lib/Lacuna/DB/Result/Laws/BHGNeutralized.pm b/lib/Lacuna/DB/Result/Laws/BHGNeutralized.pm new file mode 100644 index 00000000..a78f60eb --- /dev/null +++ b/lib/Lacuna/DB/Result/Laws/BHGNeutralized.pm @@ -0,0 +1,9 @@ +package Lacuna::DB::Result::Laws::BHGNeutralized; + +use Moose; +use utf8; +no warnings qw(uninitialized); +extends 'Lacuna::DB::Result::Laws'; + +no Moose; +__PACKAGE__->meta->make_immutable(inline_constructor => 0); diff --git a/lib/Lacuna/DB/Result/Propositions.pm b/lib/Lacuna/DB/Result/Propositions.pm index 9af37106..60cf2925 100644 --- a/lib/Lacuna/DB/Result/Propositions.pm +++ b/lib/Lacuna/DB/Result/Propositions.pm @@ -25,6 +25,7 @@ __PACKAGE__->add_columns( __PACKAGE__->typecast_map(type => { AbandonStation => 'Lacuna::DB::Result::Propositions::AbandonStation', + BHGNeutralized => 'Lacuna::DB::Result::Propositions::BHGNeutralized', BroadcastOnNetwork19 => 'Lacuna::DB::Result::Propositions::BroadcastOnNetwork19', DemolishModule => 'Lacuna::DB::Result::Propositions::DemolishModule', DowngradeModule => 'Lacuna::DB::Result::Propositions::DowngradeModule', diff --git a/lib/Lacuna/DB/Result/Propositions/BHGNeutralized.pm b/lib/Lacuna/DB/Result/Propositions/BHGNeutralized.pm new file mode 100644 index 00000000..3d8b056d --- /dev/null +++ b/lib/Lacuna/DB/Result/Propositions/BHGNeutralized.pm @@ -0,0 +1,19 @@ +package Lacuna::DB::Result::Propositions::BHGNeutralized; + +use Moose; +use utf8; +no warnings qw(uninitialized); +extends 'Lacuna::DB::Result::Propositions'; + +before pass => sub { + my ($self) = @_; + my $law = Lacuna->db->resultset('Lacuna::DB::Result::Laws')->new({ + name => $self->name, + description => $self->description, + type => 'BHGNeutralized', + station_id => $self->station_id, + })->insert; +}; + +no Moose; +__PACKAGE__->meta->make_immutable(inline_constructor => 0); diff --git a/lib/Lacuna/RPC/Building/Parliament.pm b/lib/Lacuna/RPC/Building/Parliament.pm index 8c1a27c7..a37d6196 100644 --- a/lib/Lacuna/RPC/Building/Parliament.pm +++ b/lib/Lacuna/RPC/Building/Parliament.pm @@ -585,6 +585,31 @@ sub propose_members_only_colonization { }; } +sub propose_neutralize_bhg { + my ($self, $session_id, $building_id) = @_; + my $empire = $self->get_empire_by_session($session_id); + if ($empire->current_session->is_sitter) { + confess [1015, 'Sitters cannot create propositions.']; + } + my $building = $self->get_building($empire, $building_id); + unless ($building->level >= 23) { + confess [1013, 'Parliament must be level 23 to propose to neutralize black hole generators.',23]; + } + my $proposition = Lacuna->db->resultset('Lacuna::DB::Result::Propositions')->new({ + type => 'BHGNeutralized', + name => 'BHG Neutralized', + description => 'All Black Hole Generators will cease to operate within and on planets in the jurisdiction of {Starmap '.$building->body->x.' '.$building->body->y.' '.$building->body->name.'}.', + proposed_by_id => $empire->id, + }); + $proposition->station($building->body); + $proposition->proposed_by($empire); + $proposition->insert; + return { + status => $self->format_status($empire, $building->body), + proposition => $proposition->get_status($empire), + }; +} + sub propose_evict_mining_platform { my ($self, $session_id, $building_id, $platform_id) = @_; my $empire = $self->get_empire_by_session($session_id); diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index 89e866b2..ba94b0b4 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -15,6 +15,7 @@ - Mod: "Stop Excavator Replace Alert" now also stops Excavator Deployed Alert. - Fix: Updated resources.json - Add: BHG can be neutralized in certain areas. + - Add: Space Stations can emit a field to neutralize BHGs. 3.0872: - Fix: Spies need working infrastructure. -- 2.51.2 From 296e9183f969ff55b62c9a53d06e8200e4888f7c Mon Sep 17 00:00:00 2001 From: lemming552 Date: Fri, 16 Nov 2012 21:48:19 -0700 Subject: [PATCH 2/2] Export method. --- lib/Lacuna/RPC/Building/Parliament.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Lacuna/RPC/Building/Parliament.pm b/lib/Lacuna/RPC/Building/Parliament.pm index a37d6196..c91b722c 100644 --- a/lib/Lacuna/RPC/Building/Parliament.pm +++ b/lib/Lacuna/RPC/Building/Parliament.pm @@ -907,7 +907,7 @@ sub view_taxes_collected { -__PACKAGE__->register_rpc_method_names(qw(get_bodies_for_star_in_jurisdiction get_mining_platforms_for_asteroid_in_jurisdiction propose_evict_mining_platform propose_members_only_mining_rights propose_members_only_colonization propose_rename_asteroid propose_rename_uninhabited propose_broadcast_on_network19 get_stars_in_jurisdiction propose_rename_star propose_repeal_law propose_seize_star propose_transfer_station_ownership view_propositions view_laws cast_vote propose_fire_bfg propose_writ propose_elect_new_leader propose_induct_member propose_expel_member propose_taxation view_taxes_collected propose_foreign_aid propose_evict_excavator propose_members_only_excavation)); +__PACKAGE__->register_rpc_method_names(qw(get_bodies_for_star_in_jurisdiction get_mining_platforms_for_asteroid_in_jurisdiction propose_evict_mining_platform propose_members_only_mining_rights propose_members_only_colonization propose_rename_asteroid propose_rename_uninhabited propose_broadcast_on_network19 get_stars_in_jurisdiction propose_rename_star propose_repeal_law propose_seize_star propose_transfer_station_ownership view_propositions view_laws cast_vote propose_fire_bfg propose_writ propose_elect_new_leader propose_induct_member propose_expel_member propose_taxation view_taxes_collected propose_foreign_aid propose_evict_excavator propose_members_only_excavation propose_neutralize_bhg)); no Moose; __PACKAGE__->meta->make_immutable;