Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add building ore requirement data to Types.pm

  • Loading branch information...
commit c1dc4c8aa783117696260baf30486da5aac5f2f8 1 parent 1c7c8ad
fireartist fireartist authored
12 data/LoadBuilding.pm
View
@@ -86,4 +86,16 @@ sub glyph_recipes{
}
return \%recipes;
}
+
+sub building_requires_ores{
+ my($self) = @_;
+ my %requires_ores;
+ my $yaml = $self->{yaml};
+ for my $building ( sort keys %$yaml ){
+ next if !exists $yaml->{$building}{requires_ores};
+ my $requires_ores = $yaml->{$building}{requires_ores};
+ push @{ $requires_ores{$building} }, @$requires_ores;
+ }
+ return \%requires_ores;
+}
1;
15 data/Types.tt2
View
@@ -41,7 +41,8 @@
'meta_type_list',
'building_label',
'building_type_from_label',
- 'building_glyph_recipes'
+ 'building_glyph_recipes',
+ 'building_requires_ores',
];
list_functions = [];
CALL list_functions.import(
@@ -205,6 +206,18 @@ our %EXPORT_TAGS = (
}
}
{
+ my %requires_ores = (
+ [%- FOREACH building_data.building_requires_ores %]
+ [% key %] => [qw([%- FOREACH ore IN value %] [% ore %] [%- END %] )],
+ [%- END %]
+ );
+ sub building_requires_ores{
+ my( $building ) = @_;
+ return if !exists $requires_ores{$building};
+ return wantarray ? @{ $requires_ores{$building} } : $requires_ores{$building}[0];
+ }
+}
+{
my %ships = (
[%~ FOREACH pair IN ship.pairs %]
[% pair.key %] => {
96 data/building.yml
View
@@ -34,6 +34,10 @@ Apple:
orbit:
- 3
phosphorus: ~
+ requires_ores:
+ - gysum
+ - monazite
+ - sulfur
tags:
- food
type: food
@@ -167,6 +171,10 @@ Bean:
orbit:
- 4
phosphorus: ~
+ requires_ores:
+ - gysum
+ - monazite
+ - sulfur
tags:
- food
type: food
@@ -280,6 +288,10 @@ CitadelOfKnope:
- [ beryl, sulfur, monazite, galena ]
CloakingLab:
label: Cloaking Lab
+ requires_ores:
+ - bauxite
+ - chalcopyrite
+ - gold
tags:
- command
- infrastructure
@@ -293,6 +305,10 @@ Corn:
- 2
- 3
phosphorus: ~
+ requires_ores:
+ - gysum
+ - monazite
+ - sulfur
tags:
- food
type: food
@@ -337,6 +353,8 @@ Dairy:
orbit:
- 3
trona: ~
+ requires_ores:
+ - trona
tags:
- food
type: food
@@ -348,6 +366,10 @@ Denton:
- 5
- 6
phosphorus: ~
+ requires_ores:
+ - gysum
+ - monazite
+ - sulfur
tags:
- food
type: food
@@ -425,6 +447,9 @@ Fission:
produces: energy
requires:
university: 6
+ requires_ores:
+ - monazite
+ - uraninite
tags:
- energy
type: energy
@@ -441,11 +466,21 @@ Fusion:
produces: energy
requires:
university: 9
+ requires_ores:
+ - galena
+ - halite
tags:
- energy
type: energy
GasGiantLab:
label: Gas Giant Lab
+ requires_ores:
+ - beryl
+ - chromite
+ - bauxite
+ - goethite
+ - magnetite
+ - rutile
tags:
- command
- infrastructure
@@ -453,6 +488,13 @@ GasGiantLab:
type: command
GasGiantPlatform:
label: Gas Giant Settlement Platform
+ requires_ores:
+ - beryl
+ - chromite
+ - bauxite
+ - goethite
+ - magnetite
+ - rutile
tags:
- command
- infrastructure
@@ -523,6 +565,10 @@ HydroCarbon:
produces: energy
requires:
university: 1
+ requires_ores:
+ - anthracite
+ - kerogen
+ - methane
tags:
- energy
type: energy
@@ -647,6 +693,10 @@ Lapis:
orbit:
- 2
phosphorus: ~
+ requires_ores:
+ - gysum
+ - monazite
+ - sulfur
tags:
- food
type: food
@@ -762,6 +812,9 @@ MissionCommand:
type: command
MunitionsLab:
label: Munitions Lab
+ requires_ores:
+ - monazite
+ - uraninite
tags:
- command
- infrastructure
@@ -807,6 +860,9 @@ OracleOfAnid:
OreRefinery:
label: Ore Refinery
produces: ore
+ requires_ores:
+ - fluorite
+ - sulfur
tags:
- ore
type: ore
@@ -869,6 +925,8 @@ Pie:
type: food
PilotTraining:
label: Pilot Training Facility
+ requires_ores:
+ - gold
tags:
- command
- infrastructure
@@ -907,11 +965,22 @@ Potato:
- 3
- 4
phosphorus: ~
+ requires_ores:
+ - gysum
+ - monazite
+ - sulfur
tags:
- food
type: food
Propulsion:
label: Propulsion System Factory
+ requires_ores:
+ - bauxite
+ - beryl
+ - chromite
+ - goethite
+ - magnetite
+ - rutile
tags:
- command
- infrastructure
@@ -947,6 +1016,14 @@ RockyOutcrop:
- [ trona ]
SAW:
label: Shield Against Weapons
+ requires_ores:
+ - bauxite
+ - chalcopyrite
+ - chromite
+ - gold
+ - magnetite
+ - monazite
+ - rutile
tags:
- command
- defense
@@ -1101,6 +1178,10 @@ TerraformingLab:
- [ methane, zircon, magnetite, beryl ]
TerraformingPlatform:
label: Terraforming Platform
+ requires_ores:
+ - gysum
+ - monazite
+ - sulfur
tags:
- colony
- command
@@ -1178,6 +1259,10 @@ WasteDigester:
WasteEnergy:
label: Waste Energy Plant
produces: energy
+ requires_ores:
+ - beryl
+ - gypsum
+ - zircon
tags:
- energy
- waste
@@ -1200,6 +1285,10 @@ WasteSequestration:
type: storage
WasteTreatment:
label: Waste Treatment Center
+ requires_ores:
+ - halite
+ - sulfur
+ - trona
tags:
- waste
type: waste
@@ -1218,6 +1307,9 @@ WaterPurification:
WaterReclamation:
label: Water Reclamation Facility
produces: water
+ requires_ores:
+ - halite
+ - sulfur
tags:
- water
type: water
@@ -1236,6 +1328,10 @@ Wheat:
- 3
- 4
phosphorus: ~
+ requires_ores:
+ - gysum
+ - monazite
+ - sulfur
tags:
- food
type: food
38 lib/Games/Lacuna/Client/Types.pm
View
@@ -29,12 +29,12 @@ use List::MoreUtils qw(any);
require Exporter;
our @ISA = qw(Exporter);
-our @EXPORT = qw( food_types ore_types ship_types ship_attribute_types building_types building_labels get_tags tag_list meta_building_list meta_type meta_type_list building_label building_type_from_label building_glyph_recipes ship_tags_list ship_tags ship_type_human ship_berth_level is_food_type is_ore_type );
+our @EXPORT = qw( food_types ore_types ship_types ship_attribute_types building_types building_labels get_tags tag_list meta_building_list meta_type meta_type_list building_label building_type_from_label building_glyph_recipes building_requires_ores ship_tags_list ship_tags ship_type_human ship_berth_level is_food_type is_ore_type );
our %EXPORT_TAGS = (
list => [qw( food_types ore_types ship_types ship_attribute_types building_types building_labels )],
resource => [qw( food_types ore_types )],
tag => [qw( get_tags tag_list )],
- meta => [qw( meta_building_list meta_type meta_type_list building_label building_type_from_label building_glyph_recipes )],
+ meta => [qw( meta_building_list meta_type meta_type_list building_label building_type_from_label building_glyph_recipes building_requires_ores )],
ship => [qw( ship_types ship_attribute_types ship_tags_list ship_tags ship_type_human ship_berth_level )],
is => [qw( is_food_type is_ore_type )],
all => [@EXPORT],
@@ -680,6 +680,38 @@ our %EXPORT_TAGS = (
}
}
{
+ my %requires_ores = (
+ Apple => [qw( gysum monazite sulfur )],
+ Bean => [qw( gysum monazite sulfur )],
+ CloakingLab => [qw( bauxite chalcopyrite gold )],
+ Corn => [qw( gysum monazite sulfur )],
+ Dairy => [qw( trona )],
+ Denton => [qw( gysum monazite sulfur )],
+ Fission => [qw( monazite uraninite )],
+ Fusion => [qw( galena halite )],
+ GasGiantLab => [qw( beryl chromite bauxite goethite magnetite rutile )],
+ GasGiantPlatform => [qw( beryl chromite bauxite goethite magnetite rutile )],
+ HydroCarbon => [qw( anthracite kerogen methane )],
+ Lapis => [qw( gysum monazite sulfur )],
+ MunitionsLab => [qw( monazite uraninite )],
+ OreRefinery => [qw( fluorite sulfur )],
+ PilotTraining => [qw( gold )],
+ Potato => [qw( gysum monazite sulfur )],
+ Propulsion => [qw( bauxite beryl chromite goethite magnetite rutile )],
+ SAW => [qw( bauxite chalcopyrite chromite gold magnetite monazite rutile )],
+ TerraformingPlatform => [qw( gysum monazite sulfur )],
+ WasteEnergy => [qw( beryl gypsum zircon )],
+ WasteTreatment => [qw( halite sulfur trona )],
+ WaterReclamation => [qw( halite sulfur )],
+ Wheat => [qw( gysum monazite sulfur )],
+ );
+ sub building_requires_ores{
+ my( $building ) = @_;
+ return if !exists $requires_ores{$building};
+ return wantarray ? @{ $requires_ores{$building} } : $requires_ores{$building}[0];
+ }
+}
+{
my %ships = (
barge => {
type_human => 'Barge',
@@ -1105,6 +1137,8 @@ Games::Lacuna::Client::Types
=item building_glyph_recipes
+=item building_requires_ores
+
=item ship_types
=item ship_attribute_types
Please sign in to comment.
Something went wrong with that request. Please try again.