MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / parse

Method parse

source/game/StarDungeonGenerator.cpp:89–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87 }
88
89 Maybe<RuleConstPtr> Rule::parse(Json const& rule) {
90 String key = rule.getString(0);
91 if (key == "worldGenMustContainLiquid")
92 return as<Rule>(make_shared<const WorldGenMustContainLiquidRule>());
93 if (key == "worldGenMustNotContainLiquid")
94 return as<Rule>(make_shared<const WorldGenMustNotContainLiquidRule>());
95
96 if (key == "worldGenMustContainSolidForeground")
97 return as<Rule>(make_shared<const WorldGenMustContainSolidRule>(TileLayer::Foreground));
98 if (key == "worldGenMustContainAirForeground")
99 return as<Rule>(make_shared<const WorldGenMustContainAirRule>(TileLayer::Foreground));
100
101 if (key == "worldGenMustContainSolidBackground")
102 return as<Rule>(make_shared<const WorldGenMustContainSolidRule>(TileLayer::Background));
103 if (key == "worldGenMustContainAirBackground")
104 return as<Rule>(make_shared<const WorldGenMustContainAirRule>(TileLayer::Background));
105
106 if (key == "allowOverdrawing")
107 return as<Rule>(make_shared<const AllowOverdrawingRule>());
108 if (key == "ignorePartMaximumRule")
109 return as<Rule>(make_shared<const IgnorePartMaximumRule>());
110 if (key == "maxSpawnCount")
111 return as<Rule>(make_shared<const MaxSpawnCountRule>(rule));
112 if (key == "doNotConnectToPart")
113 return as<Rule>(make_shared<const DoNotConnectToPartRule>(rule));
114 if (key == "doNotCombineWith")
115 return as<Rule>(make_shared<const DoNotCombineWithRule>(rule));
116
117 Logger::error("Unknown dungeon rule: {}", key);
118 return Maybe<RuleConstPtr>();
119 }
120
121 bool Rule::checkTileCanPlace(Vec2I, DungeonGeneratorWriter*) const {
122 return true;

Callers 1

initMethod · 0.45

Calls 12

errorFunction · 0.85
parseFrontBrushFunction · 0.85
parseBackBrushFunction · 0.85
parseObjectBrushFunction · 0.85
parseItemBrushFunction · 0.85
parseSurfaceBrushFunction · 0.85
parseWireBrushFunction · 0.85
getStringMethod · 0.80
getBoolMethod · 0.80
formatFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected