| 2129 | } |
| 2130 | |
| 2131 | bool WorldEnvironmentCallbacks::placeMod(World* world, Vec2I const& arg1, String const& arg2, String const& arg3, Maybe<int> const& arg4, bool arg5) { |
| 2132 | auto tilePosition = arg1; |
| 2133 | |
| 2134 | PlaceMod placeMod; |
| 2135 | |
| 2136 | auto layerName = arg2; |
| 2137 | if (layerName == "foreground") { |
| 2138 | placeMod.layer = TileLayer::Foreground; |
| 2139 | } else if (layerName == "background") { |
| 2140 | placeMod.layer = TileLayer::Background; |
| 2141 | } else { |
| 2142 | throw StarException(strf("Unsupported tile layer {}", layerName)); |
| 2143 | } |
| 2144 | |
| 2145 | auto modName = arg3; |
| 2146 | auto materialDatabase = Root::singleton().materialDatabase(); |
| 2147 | if (!materialDatabase->modNames().contains(modName)) |
| 2148 | throw StarException(strf("Unknown mod name {}", modName)); |
| 2149 | placeMod.mod = materialDatabase->modId(modName); |
| 2150 | |
| 2151 | if (arg4) |
| 2152 | placeMod.modHueShift = (MaterialHue)*arg4; |
| 2153 | |
| 2154 | bool allowOverlap = arg5; |
| 2155 | |
| 2156 | return world->modifyTile(tilePosition, placeMod, allowOverlap); |
| 2157 | } |
| 2158 | } |
| 2159 | |
| 2160 | } |
nothing calls this directly
no test coverage detected